remove FullPinyinParser2::post_process
authorPeng Wu <alexepico@gmail.com>
Wed, 18 Apr 2012 02:21:02 +0000 (10:21 +0800)
committerPeng Wu <alexepico@gmail.com>
Wed, 18 Apr 2012 02:21:02 +0000 (10:21 +0800)
src/storage/pinyin_parser2.cpp

index 732598c..662ee1b 100644 (file)
@@ -477,77 +477,6 @@ int FullPinyinParser2::final_step(size_t step_len, ChewingKeyVector & keys,
     return parsed_len;
 }
 
-#if 0
-
-bool FullPinyinParser2::post_process(pinyin_option_t options,
-                                     ChewingKeyVector & keys,
-                                     ChewingKeyRestVector & key_rests) const {
-    int i;
-    assert(keys->len == key_rests->len);
-    gint16 num_keys = keys->len;
-
-    ChewingKey * cur_key = NULL, * next_key = NULL;
-    ChewingKeyRest * cur_rest = NULL, * next_rest = NULL;
-    guint16 next_tone = CHEWING_ZERO_TONE;
-
-    for (i = 0; i < num_keys - 1; ++i) {
-        cur_rest = &g_array_index(key_rests, ChewingKeyRest, i);
-        next_rest = &g_array_index(key_rests, ChewingKeyRest, i + 1);
-
-        /* some "'" here */
-        if (cur_rest->m_raw_end != next_rest->m_raw_begin)
-            continue;
-
-        cur_key = &g_array_index(keys, ChewingKey, i);
-        next_key = &g_array_index(keys, ChewingKey, i + 1);
-
-        /* some tone here */
-        if (CHEWING_ZERO_TONE != cur_key->m_tone)
-            continue;
-
-        if (options & USE_TONE) {
-            next_tone = next_key->m_tone;
-            next_key->m_tone = CHEWING_ZERO_TONE;
-        }
-
-        /* lookup re-split table */
-        size_t k;
-        const resplit_table_item_t * item = NULL;
-        for (k = 0; k < G_N_ELEMENTS(resplit_table); ++k) {
-            item = resplit_table + k;
-            /* no ops */
-            if (item->m_orig_freq >= item->m_new_freq)
-                continue;
-
-            /* use pinyin_exact_compare2 here. */
-            if (0 == pinyin_exact_compare2(item->m_orig_keys,
-                                           cur_key, 2))
-                break;
-
-        }
-
-        /* find the match */
-        if (k < G_N_ELEMENTS(resplit_table)) {
-            /* do re-split */
-            item = resplit_table + k;
-            *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 ++;
-        }
-
-        /* save back tones */
-        if (options & USE_TONE) {
-            next_key->m_tone = next_tone;
-        }
-    }
-
-    return true;
-}
-
-#endif
-
 bool FullPinyinParser2::post_process2(pinyin_option_t options,
                                       ChewingKeyVector & keys,
                                       ChewingKeyRestVector & key_rests,