diff options
author | Peng Wu <alexepico@gmail.com> | 2010-10-27 11:11:38 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2010-10-27 11:11:38 +0800 |
commit | cb42269587055a80907efd863c367d659a022a06 (patch) | |
tree | 553d9f993c3c91e80771f39ebdb67c8f8ef04403 /src/lookup/phrase_lookup.h | |
parent | 77f51924d4660e0a7c295dc9af6b305118214ede (diff) | |
download | libpinyin-cb42269587055a80907efd863c367d659a022a06.tar.gz libpinyin-cb42269587055a80907efd863c367d659a022a06.tar.xz libpinyin-cb42269587055a80907efd863c367d659a022a06.zip |
define the phrase lookup interface
Diffstat (limited to 'src/lookup/phrase_lookup.h')
-rw-r--r-- | src/lookup/phrase_lookup.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/lookup/phrase_lookup.h b/src/lookup/phrase_lookup.h index 5473622..3a0ede2 100644 --- a/src/lookup/phrase_lookup.h +++ b/src/lookup/phrase_lookup.h @@ -30,8 +30,6 @@ */ class PhraseLookup{ -private: - protected: //saved varibles novel::PhraseLargeTable * m_phrase_table; @@ -44,9 +42,23 @@ protected: GPtrArray * m_steps_content; /* Array of LookupStepContent */ - GArray * m_table_cache; - /* Array of phrase_token_t, for phrase lookup. */ + /* Saved sentence */ + int m_sentence_length; + utf16_t * m_sentence; + +protected: + /* Explicitly search the next phrase, + * to avoid double phrase lookup as the next token has only one. + */ + bool search_unigram(int nstep, phrase_token_t token); + bool search_bigram(int nstep, phrase_token_t token); + + bool unigram_gen_next_step(int nstep, lookup_value_t * cur_step, phrase_token_t token); + bool bigram_gen_next_step(int nstep, lookup_value_t * cur_step, phrase_token_t token, gfloat bigram_poss); + + bool save_next_step(int next_step_pos, lookup_value_t * cur_step, lookup_value_t * next_step); + bool final_step(MatchResults & results); public: bool get_best_match(int sentence_length, utf16_t sentence[], MatchResults & results); |