From 5ff36bd939efdce410885454b253ae9a362f7e2b Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 2 Jul 2012 09:43:14 +0800 Subject: comment out _remove_duplicated_items --- src/pinyin.cpp | 11 ++++++++++- src/pinyin.h | 8 ++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/pinyin.cpp b/src/pinyin.cpp index 9c06e68..a255d5f 100644 --- a/src/pinyin.cpp +++ b/src/pinyin.cpp @@ -743,7 +743,7 @@ bool pinyin_in_chewing_keyboard(pinyin_instance_t * instance, (context->m_options, key, symbol); } - +#if 0 static gint compare_item_with_token(gconstpointer lhs, gconstpointer rhs) { lookup_candidate_t * item_lhs = (lookup_candidate_t *)lhs; @@ -754,6 +754,7 @@ static gint compare_item_with_token(gconstpointer lhs, return (token_lhs - token_rhs); } +#endif static gint compare_item_with_frequency(gconstpointer lhs, gconstpointer rhs) { @@ -842,6 +843,7 @@ static void _append_items(pinyin_context_t * context, } } +#if 0 static void _remove_duplicated_items(CandidateVector items) { /* remove the duplicated items. */ phrase_token_t last_token = null_token, saved_token; @@ -857,6 +859,7 @@ static void _remove_duplicated_items(CandidateVector items) { last_token = saved_token; } } +#endif static void _compute_frequency_of_items(pinyin_context_t * context, phrase_token_t prev_token, @@ -950,9 +953,11 @@ bool pinyin_get_candidates(pinyin_instance_t * instance, lookup_candidate_t template_item; _append_items(context, ranges, &template_item, items); +#if 0 g_array_sort(items, compare_item_with_token); _remove_duplicated_items(items); +#endif _compute_frequency_of_items(context, prev_token, &merged_gram, items); @@ -1270,9 +1275,11 @@ bool pinyin_get_full_pinyin_candidates(pinyin_instance_t * instance, if (_try_divided_table(instance, ranges, offset, items)) { +#if 0 g_array_sort(items, compare_item_with_token); _remove_duplicated_items(items); +#endif _compute_frequency_of_items(context, prev_token, &merged_gram, items); @@ -1321,9 +1328,11 @@ bool pinyin_get_full_pinyin_candidates(pinyin_instance_t * instance, lookup_candidate_t template_item; _append_items(context, ranges, &template_item, items); +#if 0 g_array_sort(items, compare_item_with_token); _remove_duplicated_items(items); +#endif _compute_frequency_of_items(context, prev_token, &merged_gram, items); diff --git a/src/pinyin.h b/src/pinyin.h index 63464eb..c9c7bf7 100644 --- a/src/pinyin.h +++ b/src/pinyin.h @@ -42,13 +42,16 @@ typedef struct _import_iterator_t import_iterator_t; typedef GArray * CandidateVector; /* GArray of lookup_candidate_t */ enum lookup_candidate_type_t{ - NORMAL_CANDIDATE = 1, + BEST_MATCH_CANDIDATE = 1, + NORMAL_CANDIDATE, DIVIDED_CANDIDATE, - RESPLIT_CANDIDATE + RESPLIT_CANDIDATE, + ZOMBIE_CANDIDATE }; struct _lookup_candidate_t{ enum lookup_candidate_type_t m_candidate_type; + gchar * m_phrase_string; phrase_token_t m_token; ChewingKeyRest m_orig_rest; gchar * m_new_pinyins; @@ -56,6 +59,7 @@ struct _lookup_candidate_t{ public: _lookup_candidate_t() { m_candidate_type = NORMAL_CANDIDATE; + m_phrase_string = NULL; m_token = null_token; m_new_pinyins = NULL; m_freq = 0; -- cgit