[irstlm] 02/78: added debugging infosrc/lmtable.h

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


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

giuliopaci-guest pushed a commit to tag adaptiveLM.v0.10
in repository irstlm.

commit 223dbfac563a861577bd5174bb079559e588e88d
Author: nicolabertoldi <bertoldi at fbk.eu>
Date:   Tue Nov 3 18:44:22 2015 +0100

    added debugging infosrc/lmtable.h
---
 src/lmContainer.cpp | 13 +++++++++++--
 src/lmContainer.h   | 29 +++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/src/lmContainer.cpp b/src/lmContainer.cpp
index 60f7927..f466e56 100644
--- a/src/lmContainer.cpp
+++ b/src/lmContainer.cpp
@@ -109,41 +109,50 @@ int lmContainer::getLanguageModelType(std::string filename)
 lmContainer* lmContainer::CreateLanguageModel(const std::string infile, float nlf, float dlf)
 {
   int type = lmContainer::getLanguageModelType(infile);
-  std::cerr << "Language Model Type of " << infile << " is " << type << std::endl;
+                
+  VERBOSE(1,"lmContainer* lmContainer::CreateLanguageModel(...) Language Model Type of " << infile << " is " << type << std::endl);
 
   return lmContainer::CreateLanguageModel(type, nlf, dlf);
 }
 
 lmContainer* lmContainer::CreateLanguageModel(int type, float nlf, float dlf)
 {
-
   std::cerr << "Language Model Type is " << type << std::endl;
+  VERBOSE(1,"Language Model Type is " << type << std::endl);
 
   lmContainer* lm=NULL;
 
   switch (type) {
 			
 		case _IRSTLM_LMTABLE:
+                        VERBOSE(1,"_IRSTLM_LMTABLE" << std::endl);
 			lm = new lmtable(nlf, dlf);
 			break;
 			
 		case _IRSTLM_LMMACRO:
+                        VERBOSE(1,"_IRSTLM_LMMACRO" << std::endl);
 			lm = new lmmacro(nlf, dlf);
 			break;
 			
 		case _IRSTLM_LMCLASS:
+                        VERBOSE(1,"_IRSTLM_LMCLASS" << std::endl);
 			lm = new lmclass(nlf, dlf);
 			break;
 			
 		case _IRSTLM_LMINTERPOLATION:
+                        VERBOSE(1,"_IRSTLM_LMINTERPOLATION" << std::endl);
 			lm = new lmInterpolation(nlf, dlf);
 			break;
 			
 		default:
+			VERBOSE(1,"UNKNOWN" << std::endl);
 			exit_error(IRSTLM_ERROR_DATA, "This language model type is unknown!");
   }
+  VERBOSE(1,"lmContainer* lmContainer::CreateLanguageModel(int type, float nlf, float dlf) lm:|" << (void*) lm << "|" << std::endl);
 
   lm->setLanguageModelType(type);
+
+  VERBOSE(1,"lmContainer* lmContainer::CreateLanguageModel(int type, float nlf, float dlf) lm->getLanguageModelType:|" << lm->getLanguageModelType() << "|" << std::endl)
   return lm;
 }
 
diff --git a/src/lmContainer.h b/src/lmContainer.h
index f128409..a492ec9 100644
--- a/src/lmContainer.h
+++ b/src/lmContainer.h
@@ -39,6 +39,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 typedef enum {BINARY,TEXT,YRANIB,NONE} OUTFILE_TYPE;
 
+typedef enum {LMT_FIND,    //!< search: find an entry
+        LMT_ENTER,   //!< search: enter an entry
+        LMT_INIT,    //!< scan: start scan
+        LMT_CONT     //!< scan: continue scan
+} LMT_ACTION;
+
 namespace irstlm {
 class lmContainer
 {
@@ -109,6 +115,7 @@ public:
     return false;
   };
   virtual double clprob(ngram ng, double* bow=NULL, int* bol=NULL, char** maxsuffptr=NULL, unsigned int* statesize=NULL,bool* extendible=NULL) {
+VERBOSE(3,"virtual double  lmContainer::clprob(ngram ng, double* bow=NULL, int* bol=NULL, char** maxsuffptr=NULL, unsigned int* statesize=NULL,bool* extendible=NULL) ng:|" << ng  << "|\n");
     UNUSED(ng);
     UNUSED(bow);
     UNUSED(bol);
@@ -118,6 +125,7 @@ public:
     return 0.0;
   };
   virtual double clprob(int* ng, int ngsize, double* bow=NULL, int* bol=NULL, char** maxsuffptr=NULL, unsigned int* statesize=NULL,bool* extendible=NULL) {
+VERBOSE(3,"virtual double lmContainer::clprob(int* ng, int ngsize, double* bow=NULL, int* bol=NULL, char** maxsuffptr=NULL, unsigned int* statesize=NULL,bool* extendible=NULL)\n");
     UNUSED(ng);
     UNUSED(ngsize);
     UNUSED(bow);
@@ -144,6 +152,27 @@ public:
     return NULL;
   }
 
+  virtual inline int get(ngram& ng) {
+    UNUSED(ng);
+    return 0;
+  }
+        
+  virtual int get(ngram& ng,int n,int lev){
+    UNUSED(ng);
+    UNUSED(n);
+    UNUSED(lev);
+    return 0;
+  }
+        
+  virtual int succscan(ngram& h,ngram& ng,LMT_ACTION action,int lev){
+    UNUSED(ng);
+    UNUSED(h);
+    UNUSED(action);
+    UNUSED(lev);
+    return 0;     
+  }
+
+
   virtual void used_caches() {};
   virtual void init_caches(int uptolev) {
     UNUSED(uptolev);

-- 
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