diff options
author | Peng Wu <alexepico@gmail.com> | 2013-03-21 13:57:59 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2013-03-21 13:57:59 +0800 |
commit | ffe1467bae65ee5dbf863070f3765559a8bb8a12 (patch) | |
tree | 122659b41bd5ae3fc060b6fb4c7c19d5d2cd8cc7 /src | |
parent | ca48b787e947d10dcc09a6986a23dbdd959a97bd (diff) | |
download | libpinyin-ffe1467bae65ee5dbf863070f3765559a8bb8a12.tar.gz libpinyin-ffe1467bae65ee5dbf863070f3765559a8bb8a12.tar.xz libpinyin-ffe1467bae65ee5dbf863070f3765559a8bb8a12.zip |
fixes pinyin_parse_*
Diffstat (limited to 'src')
-rw-r--r-- | src/pinyin.cpp | 21 | ||||
-rw-r--r-- | src/pinyin.h | 4 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp index 35ac171..7c8116b 100644 --- a/src/pinyin.cpp +++ b/src/pinyin.cpp @@ -836,9 +836,9 @@ bool pinyin_parse_full_pinyin(pinyin_instance_t * instance, pinyin_context_t * & context = instance->m_context; int pinyin_len = strlen(onepinyin); - int parse_len = context->m_full_pinyin_parser->parse_one_key + bool retval = context->m_full_pinyin_parser->parse_one_key ( context->m_options, *onekey, onepinyin, pinyin_len); - return pinyin_len == parse_len; + return retval; } size_t pinyin_parse_more_full_pinyins(pinyin_instance_t * instance, @@ -862,9 +862,9 @@ bool pinyin_parse_double_pinyin(pinyin_instance_t * instance, pinyin_context_t * & context = instance->m_context; int pinyin_len = strlen(onepinyin); - int parse_len = context->m_double_pinyin_parser->parse_one_key + bool retval = context->m_double_pinyin_parser->parse_one_key ( context->m_options, *onekey, onepinyin, pinyin_len); - return pinyin_len == parse_len; + return retval; } size_t pinyin_parse_more_double_pinyins(pinyin_instance_t * instance, @@ -885,9 +885,9 @@ bool pinyin_parse_chewing(pinyin_instance_t * instance, pinyin_context_t * & context = instance->m_context; int chewing_len = strlen(onechewing); - int parse_len = context->m_chewing_parser->parse_one_key + bool retval = context->m_chewing_parser->parse_one_key ( context->m_options, *onekey, onechewing, chewing_len ); - return chewing_len == parse_len; + return retval; } size_t pinyin_parse_more_chewings(pinyin_instance_t * instance, @@ -1907,6 +1907,15 @@ bool pinyin_token_add_unigram_frequency(pinyin_instance_t * instance, return ERROR_OK == retval; } +size_t pinyin_get_n_candidate(pinyin_instance_t * instance){ + return instance->m_candidates->len; +} + +size_t pinyin_get_n_pinyin(pinyin_instance_t * instance){ + assert (instance->m_pinyin_keys->len == + instance->m_pinyin_key_rests->len); + return instance->m_pinyin_keys->len; +} /** diff --git a/src/pinyin.h b/src/pinyin.h index 4052de4..354aca3 100644 --- a/src/pinyin.h +++ b/src/pinyin.h @@ -563,6 +563,10 @@ bool pinyin_token_add_unigram_frequency(pinyin_instance_t * instance, guint delta); +size_t pinyin_get_n_candidate(pinyin_instance_t * instance); + +size_t pinyin_get_n_pinyin(pinyin_instance_t * instance); + /* hack here. */ typedef ChewingKey PinyinKey; |