update divided/resplit table
authorPeng Wu <alexepico@gmail.com>
Thu, 17 Nov 2011 10:28:45 +0000 (18:28 +0800)
committerPeng Wu <alexepico@gmail.com>
Thu, 17 Nov 2011 10:30:40 +0000 (18:30 +0800)
src/storage/pinyin_parser2.cpp
src/storage/pinyin_parser2.h

index 5d2414d..c2f3d39 100644 (file)
@@ -353,20 +353,18 @@ bool FullPinyinParser2::post_process(guint32 options,
             /* no ops */
             if (item->m_orig_freq >= item->m_new_freq)
                 continue;
-            /* TODO: refine code style here. */
-#if 0
-            if (item->m_orig_first_key == *cur_key &&
-                item->m_orig_second_key == *next_key)
+
+            /* use pinyin_exact_compare2 here. */
+            if (0 == pinyin_exact_compare2(item->m_orig_keys,
+                                           cur_key, 2))
                 break;
-#endif
-            /* TODO: should use pinyin_exact_compare2 here. */
-            assert(FALSE);
+
         }
         if (k < G_N_ELEMENTS(resplit_table)) {
             /* do re-split */
             item = resplit_table + k;
-            *cur_key = item->m_new_first_key;
-            *next_key = item->m_new_second_key;
+            *cur_key = item->m_new_keys[0];
+            *next_key = item->m_new_keys[1];
             /* assumes only moved one char in gen_all_resplit script. */
             cur_rest->m_raw_end --;
             next_rest->m_raw_begin --;
index 4e8bbdc..53b5e9b 100644 (file)
@@ -49,17 +49,14 @@ typedef struct {
 typedef struct {
     ChewingKey   m_orig_key;
     guint32      m_orig_freq;
-    ChewingKey   m_first_key;
-    ChewingKey   m_second_key;
+    ChewingKey   m_new_keys[2];
     guint32      m_new_freq;
 } divided_table_item_t;
 
 typedef struct {
-    ChewingKey   m_orig_first_key;
-    ChewingKey   m_orig_second_key;
+    ChewingKey   m_orig_keys[2];
     guint32      m_orig_freq;
-    ChewingKey   m_new_first_key;
-    ChewingKey   m_new_second_key;
+    ChewingKey   m_new_keys[2];
     guint32      m_new_freq;
 } resplit_table_item_t;