diff options
author | Peng Wu <alexepico@gmail.com> | 2016-06-06 14:56:45 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-06-06 14:57:54 +0800 |
commit | befc08764559cdc1939463f9dfac5b7a7f97c81a (patch) | |
tree | bd17119de8ffba092b4683edbd8bd8a26f97ff7b /src | |
parent | cee5f04690465d99b05313add946beceed2a31f2 (diff) | |
download | libpinyin-befc08764559cdc1939463f9dfac5b7a7f97c81a.tar.gz libpinyin-befc08764559cdc1939463f9dfac5b7a7f97c81a.tar.xz libpinyin-befc08764559cdc1939463f9dfac5b7a7f97c81a.zip |
begin to update pinyin.cpp
Diffstat (limited to 'src')
-rw-r--r-- | src/lookup/pinyin_lookup2.cpp | 1 | ||||
-rw-r--r-- | src/pinyin.cpp | 13 | ||||
-rw-r--r-- | src/pinyin.h | 2 |
3 files changed, 6 insertions, 10 deletions
diff --git a/src/lookup/pinyin_lookup2.cpp b/src/lookup/pinyin_lookup2.cpp index 646a6d9..6973ecd 100644 --- a/src/lookup/pinyin_lookup2.cpp +++ b/src/lookup/pinyin_lookup2.cpp @@ -498,6 +498,7 @@ bool PinyinLookup2::final_step(MatchResults & results){ /* find max element */ size_t last_step_pos = m_steps_content->len - 1; + /* skip the preceding "'" characters for constraints? */ GArray * last_step_array = (GArray *)g_ptr_array_index(m_steps_content, last_step_pos); if ( last_step_array->len == 0 ) return false; diff --git a/src/pinyin.cpp b/src/pinyin.cpp index 99b29dc..35da0ee 100644 --- a/src/pinyin.cpp +++ b/src/pinyin.cpp @@ -68,15 +68,11 @@ struct _pinyin_instance_t{ /* pointer of pinyin_context_t. */ pinyin_context_t * m_context; - /* cached user input full pinyin. */ - gchar * m_raw_full_pinyin; - /* the tokens of phrases before the user input. */ TokenVector m_prefixes; /* cached parsed pinyin keys. */ - ChewingKeyVector m_pinyin_keys; - ChewingKeyRestVector m_pinyin_key_rests; + PhoneticKeyMatrix m_matrix; size_t m_parsed_len; /* cached pinyin lookup variables. */ @@ -89,15 +85,16 @@ struct _lookup_candidate_t{ lookup_candidate_type_t m_candidate_type; gchar * m_phrase_string; phrase_token_t m_token; - ChewingKeyRest m_orig_rest; - gchar * m_new_pinyins; + guint16 m_begin; /* must contain the preceding "'" character. */ + guint16 m_end; /* must not contain the following "'" character. */ guint32 m_freq; /* the amplifed gfloat numerical value. */ + public: _lookup_candidate_t() { m_candidate_type = NORMAL_CANDIDATE; m_phrase_string = NULL; m_token = null_token; - m_new_pinyins = NULL; + m_begin = 0; m_end = 0; m_freq = 0; } }; diff --git a/src/pinyin.h b/src/pinyin.h index 6c45a26..cbdfeb4 100644 --- a/src/pinyin.h +++ b/src/pinyin.h @@ -43,8 +43,6 @@ typedef struct _export_iterator_t export_iterator_t; typedef enum _lookup_candidate_type_t{ BEST_MATCH_CANDIDATE = 1, NORMAL_CANDIDATE, - DIVIDED_CANDIDATE, - RESPLIT_CANDIDATE, ZOMBIE_CANDIDATE, PREDICTED_CANDIDATE, ADDON_CANDIDATE, |