fixes feed_file
authorPeng Wu <alexepico@gmail.com>
Mon, 17 Jun 2013 06:29:29 +0000 (14:29 +0800)
committerPeng Wu <alexepico@gmail.com>
Mon, 17 Jun 2013 06:29:29 +0000 (14:29 +0800)
utils/storage/gen_pinyin_table.cpp

index 853e8c8..3b541d1 100644 (file)
@@ -143,11 +143,15 @@ void feed_file ( const char * filename){
     }
 
     while ( !feof(infile)){
-       fscanf(infile, "%s", phrase);
-       fscanf(infile, "%s", pinyin);
-       fscanf(infile, "%u", &freq);
+       int num = fscanf(infile, "%s %s %u",
+                         phrase, pinyin, &freq);
+
+        if (3 != num)
+            continue;
+
        if (feof(infile))
             break;
+
        feed_line(phrase, pinyin, freq);
     }