diff options
author | Peng Wu <alexepico@gmail.com> | 2011-05-25 12:59:18 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-05-25 14:15:27 +0800 |
commit | 49cbd833fe1f5c0a65b5c4f58bf465b69896856c (patch) | |
tree | 7344bed6d1e394fb68f89c9eeb06ba3d7ec50472 | |
parent | 4bb7f472a4fba814d02bdca5b011b5a6f68d4949 (diff) | |
download | libpinyin-49cbd833fe1f5c0a65b5c4f58bf465b69896856c.tar.gz libpinyin-49cbd833fe1f5c0a65b5c4f58bf465b69896856c.tar.xz libpinyin-49cbd833fe1f5c0a65b5c4f58bf465b69896856c.zip |
fixes a typo
-rw-r--r-- | src/storage/flexible_ngram.h | 2 | ||||
-rw-r--r-- | utils/training/gen_k_mixture_model.cpp | 6 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/storage/flexible_ngram.h b/src/storage/flexible_ngram.h index 9082235..7e30e7e 100644 --- a/src/storage/flexible_ngram.h +++ b/src/storage/flexible_ngram.h @@ -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; } diff --git a/utils/training/gen_k_mixture_model.cpp b/utils/training/gen_k_mixture_model.cpp index 9768fef..ac433d9 100644 --- a/utils/training/gen_k_mixture_model.cpp +++ b/utils/training/gen_k_mixture_model.cpp @@ -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); } |