[irstlm] 102/126: code optimization

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


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

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

commit 7c740a0bd823aa2bdbf1856958ba69ae2e687f4c
Author: Nicola Bertoldi <bertoldi at fbk.eu>
Date:   Tue Sep 22 12:29:04 2015 +0200

    code optimization
---
 src/lmContainer.h | 28 ++++++++++++++++++++++++++++
 src/lmtable.h     | 11 +++--------
 2 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/src/lmContainer.h b/src/lmContainer.h
index 131f207..7a37ccc 100644
--- a/src/lmContainer.h
+++ b/src/lmContainer.h
@@ -41,6 +41,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 {
 	typedef std::map< std::string, float > topic_map_t;
 	
@@ -173,6 +179,28 @@ 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);
diff --git a/src/lmtable.h b/src/lmtable.h
index a6c8539..e034bc7 100644
--- a/src/lmtable.h
+++ b/src/lmtable.h
@@ -63,13 +63,8 @@
 #define UNIGRAM_RESOLUTION 10000000.0
 
 typedef enum {INTERNAL,QINTERNAL,LEAF,QLEAF} LMT_TYPE;
-typedef char* node;
 
-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;
+typedef char* node;
 
 typedef unsigned int  table_entry_pos_t; //type for pointing to a full ngram in the table
 typedef unsigned long table_pos_t; // type for pointing to a single char in the table
@@ -340,10 +335,10 @@ public:
 	
 	void checkbounds(int level);
 	
-	inline int get(ngram& ng) {
+	virtual inline int get(ngram& ng) {
 		return get(ng,ng.size,ng.size);
 	}
-	int get(ngram& ng,int n,int lev);
+	virtual int get(ngram& ng,int n,int lev);
 	
 	int succscan(ngram& h,ngram& ng,LMT_ACTION action,int lev);
 	

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