fixes a typo
authorPeng Wu <alexepico@gmail.com>
Wed, 25 May 2011 04:59:18 +0000 (12:59 +0800)
committerPeng Wu <alexepico@gmail.com>
Wed, 25 May 2011 06:15:27 +0000 (14:15 +0800)
src/storage/flexible_ngram.h
utils/training/gen_k_mixture_model.cpp

index 9082235..7e30e7e 100644 (file)
@@ -411,7 +411,7 @@ public:
 
         /* Iterate over the database, retrieving each record in turn. */
         while ((ret =  cursorp->c_get(cursorp, &key, &data, DB_NEXT)) == 0 ){
-            if (key.size > sizeof(phrase_token_t)){
+            if (key.size != sizeof(phrase_token_t)){
                 /* skip magic header. */
                 continue;
             }
index 9768fef..ac433d9 100644 (file)
@@ -121,7 +121,6 @@ bool read_document(PhraseLargeTable * phrases, FILE * document,
 static void train_word_pair(KMixtureModelSingleGram * single_gram,
                             phrase_token_t token, guint32 count){
     KMixtureModelArrayItem array_item;
-    guint32 delta = 0;
 
     bool exists = single_gram->get_array_item(token, array_item);
     if ( exists ) {
@@ -139,7 +138,6 @@ static void train_word_pair(KMixtureModelSingleGram * single_gram,
         if ( 1 == count )
             array_item.m_n_1 ++;
         array_item.m_Mr = std_lite::max(array_item.m_Mr, count);
-        delta = count;
         assert(single_gram->set_array_item(token, array_item));
     } else { /* item doesn't exist. */
         /* the same as above. */
@@ -152,13 +150,13 @@ static void train_word_pair(KMixtureModelSingleGram * single_gram,
         if ( 1 == count )
             array_item.m_n_1 = 1;
         array_item.m_Mr = count;
-        delta = count;
         assert(single_gram->insert_array_item(token, array_item));
     }
+
     /* save delta in the array header. */
     KMixtureModelArrayHeader array_header;
     single_gram->get_array_header(array_header);
-    array_header.m_WC += delta;
+    array_header.m_WC += count;
     single_gram->set_array_header(array_header);
 }