From a9f3ef4fc24487828775e7dbdcda4bf0fdab023c Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Wed, 7 Dec 2011 16:59:46 +0800 Subject: fixes gen chewing table --- utils/storage/gen_chewing_table.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/storage/gen_chewing_table.cpp b/utils/storage/gen_chewing_table.cpp index d6d3673..a4651bc 100644 --- a/utils/storage/gen_chewing_table.cpp +++ b/utils/storage/gen_chewing_table.cpp @@ -111,6 +111,7 @@ int main(int argc, char * argv[]){ printf("nnodes: %d\n", g_tree_nnodes(g_chewing_tree)); /* store in item array */ + g_item_array[0] = NULL; for ( int i = 1; i < MAX_PHRASE_LENGTH + 1; ++i){ g_item_array[i] = g_array_new (FALSE, TRUE, sizeof(phrase_and_array_item)); @@ -290,7 +291,7 @@ void gen_phrase_file(const char * outfilename, int phrase_index){ ChewingKeyRest key_rest = g_array_index (key_rests, ChewingKeyRest, k); - assert (CHEWING_ZERO_TONE != key.m_tone); + //assert (CHEWING_ZERO_TONE != key.m_tone); pinyin = get_pinyin_string(key, key_rest); g_array_append_val(pinyins, pinyin); } @@ -310,8 +311,9 @@ void gen_phrase_file(const char * outfilename, int phrase_index){ pinyin_str, phrase_str, PHRASE_INDEX_MAKE_TOKEN(phrase_index, token), freq); - g_free(pinyin_str); g_free(phrase_str); + g_free(pinyin_str); } + g_free(phrase_str); token++; } } -- cgit