diff options
-rw-r--r-- | src/lookup/pinyin_lookup2.cpp | 2 | ||||
-rw-r--r-- | src/storage/phrase_index.cpp | 8 | ||||
-rw-r--r-- | src/storage/phrase_index.h | 16 |
3 files changed, 9 insertions, 17 deletions
diff --git a/src/lookup/pinyin_lookup2.cpp b/src/lookup/pinyin_lookup2.cpp index 7501703..d1aad4d 100644 --- a/src/lookup/pinyin_lookup2.cpp +++ b/src/lookup/pinyin_lookup2.cpp @@ -717,7 +717,7 @@ bool PinyinLookup2::validate_constraint(PhoneticKeyMatrix * matrix, guint32 end = constraint->m_end; /* clear too long constraint */ - if (end > constraints->len){ + if (end >= constraints->len){ clear_constraint(constraints, i); continue; } diff --git a/src/storage/phrase_index.cpp b/src/storage/phrase_index.cpp index a18ff9d..1e91b83 100644 --- a/src/storage/phrase_index.cpp +++ b/src/storage/phrase_index.cpp @@ -107,8 +107,7 @@ bool PhraseItem::set_phrase_string(guint8 phrase_length, ucs4_t * phrase){ return true; } -void PhraseItem::increase_pronunciation_possibility(pinyin_option_t options, - ChewingKey * keys, +void PhraseItem::increase_pronunciation_possibility(ChewingKey * keys, gint32 delta){ guint8 phrase_length = get_phrase_length(); guint8 npron = get_n_pronunciation(); @@ -123,9 +122,8 @@ void PhraseItem::increase_pronunciation_possibility(pinyin_option_t options, phrase_length * sizeof(ChewingKey)); total_freq += *freq; - if (0 == pinyin_compare_with_ambiguities2 - (options, keys, - (ChewingKey *)chewing_begin, phrase_length)) { + if (0 == pinyin_compare_with_tones(keys, (ChewingKey *)chewing_begin, + phrase_length)) { /* protect against total_freq overflow. */ if (delta > 0 && total_freq > total_freq + delta) diff --git a/src/storage/phrase_index.h b/src/storage/phrase_index.h index 858b184..5f98774 100644 --- a/src/storage/phrase_index.h +++ b/src/storage/phrase_index.h @@ -27,7 +27,6 @@ #include "novel_types.h" #include "chewing_key.h" #include "pinyin_parser2.h" -#include "pinyin_phrase2.h" #include "pinyin_phrase3.h" #include "memory_chunk.h" #include "phrase_index_logger.h" @@ -127,15 +126,13 @@ public: /** * PhraseItem::get_pronunciation_possibility: - * @options: the pinyin options. * @keys: the pronunciation keys. * @returns: the possibility of this phrase item pronounces the pinyin. * * Get the possibility of this phrase item pronounces the pinyin. * */ - gfloat get_pronunciation_possibility(pinyin_option_t options, - ChewingKey * keys){ + gfloat get_pronunciation_possibility(ChewingKey * keys){ guint8 phrase_length = get_phrase_length(); guint8 npron = get_n_pronunciation(); size_t offset = phrase_item_header + phrase_length * sizeof (ucs4_t); @@ -147,9 +144,8 @@ public: guint32 * freq = (guint32 *)(chewing_begin + phrase_length * sizeof(ChewingKey)); total_freq += *freq; - if ( 0 == pinyin_compare_with_ambiguities2 - (options, keys, - (ChewingKey *)chewing_begin,phrase_length) ){ + if ( 0 == pinyin_compare_with_tones(keys, (ChewingKey *)chewing_begin, + phrase_length) ){ matched += *freq; } } @@ -167,16 +163,14 @@ public: /** * PhraseItem::increase_pronunciation_possibility: - * @options: the pinyin options. * @keys: the pronunciation keys. * @delta: the delta to be added to the pronunciation keys. * * Add the delta to the pronunciation of the pronunciation keys. * */ - void increase_pronunciation_possibility(pinyin_option_t options, - ChewingKey * keys, - gint32 delta); + void increase_pronunciation_possibility(ChewingKey * keys, + gint32 delta); /** * PhraseItem::get_phrase_string: |