[irstlm] 03/10: added supporting function

Giulio Paci giuliopaci-guest at moszumanska.debian.org
Tue May 17 07:46:54 UTC 2016


This is an automated email from the git hooks/post-receive script.

giuliopaci-guest pushed a commit to annotated tag staticLM
in repository irstlm.

commit 794d88e182b826462da98251f6d1385fb41dcbd9
Author: Nicola Bertoldi <bertoldi at fbk.eu>
Date:   Sat Oct 3 12:41:05 2015 +0200

    added supporting function
---
 src/compile-lm.cpp | 9 +++------
 src/lmContainer.h  | 8 +++++++-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/compile-lm.cpp b/src/compile-lm.cpp
index f3c534b..5ed6cbf 100644
--- a/src/compile-lm.cpp
+++ b/src/compile-lm.cpp
@@ -291,12 +291,9 @@ int main(int argc, char **argv)
       int sent_Nbo=0, sent_Nw=0,sent_Noov=0;
       double sent_logPr=0,sent_PP=0,sent_PPwp=0;
 
-
-      ng.dict->incflag(1);
-      int bos=ng.dict->encode(ng.dict->BoS());
-      int eos=ng.dict->encode(ng.dict->EoS());
-      ng.dict->incflag(0);
-
+      int bos=lmt->addWord(lmt->getDict()->BoS());
+      int eos=lmt->addWord(lmt->getDict()->EoS());
+			
       double bow;
       int bol=0;
       char *msp;
diff --git a/src/lmContainer.h b/src/lmContainer.h
index 03c8b37..f128409 100644
--- a/src/lmContainer.h
+++ b/src/lmContainer.h
@@ -189,7 +189,13 @@ public:
   inline static bool is_cache_enabled(){
     return is_lmt_cache_enabled() && is_ps_cache_enabled();
   }
-
+	
+	virtual int addWord(const char *w){
+		getDict()->incflag(1);
+		int c=getDict()->encode(w);
+		getDict()->incflag(0);
+		return c;
+	}
 };
 
 }//namespace irstlm

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/irstlm.git



More information about the debian-science-commits mailing list