fixes load text in chewing large table
authorPeng Wu <alexepico@gmail.com>
Wed, 7 Dec 2011 02:51:49 +0000 (10:51 +0800)
committerPeng Wu <alexepico@gmail.com>
Wed, 7 Dec 2011 02:51:49 +0000 (10:51 +0800)
src/storage/chewing_large_table.cpp

index 703cfb5936e7e9a39703ebb53c5490a582abe730..cf527d80353e8fa9823d62345c4e726f76c28415 100644 (file)
@@ -637,6 +637,8 @@ bool ChewingLargeTable::load_text(FILE * infile) {
         if(feof(infile))
             break;
 
+        glong len = g_utf8_strlen(phrase, -1);
+
         FullPinyinParser2 parser;
         ChewingKeyVector keys;
         ChewingKeyRestVector key_rests;
@@ -647,7 +649,7 @@ bool ChewingLargeTable::load_text(FILE * infile) {
         pinyin_option_t options = USE_TONE;
         parser.parse(options, keys, key_rests, pinyin, strlen(pinyin));
 
-        if (0 == keys->len) {
+        if (len != keys->len) {
             fprintf(stderr, "%s\t%s\t%u\t%ld\n", pinyin, phrase, token, freq);
             continue;
         }