diff options
author | Peng Wu <alexepico@gmail.com> | 2015-10-13 16:46:56 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2015-10-13 16:46:56 +0800 |
commit | 20aa3a5380ac803a53ce79388c776963aea8379c (patch) | |
tree | c88b741fbddff8dcd9a8082f68ddf2d9d84edad9 | |
parent | 0b65ed208068a55d262a67991b8962dbec7c4362 (diff) | |
download | libpinyin-20aa3a5380ac803a53ce79388c776963aea8379c.tar.gz libpinyin-20aa3a5380ac803a53ce79388c776963aea8379c.tar.xz libpinyin-20aa3a5380ac803a53ce79388c776963aea8379c.zip |
update parse_one_key method for double pinyin
-rw-r--r-- | src/storage/pinyin_parser2.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp index f6ac4c9..c4972a5 100644 --- a/src/storage/pinyin_parser2.cpp +++ b/src/storage/pinyin_parser2.cpp @@ -734,18 +734,28 @@ bool DoublePinyinParser2::parse_one_key(pinyin_option_t options, g_free(pinyin); } while(0); -#if 1 - /* support two letter yunmu from full pinyin */ - if (0 == strcmp(sheng, "")) { - pinyin = g_strndup(str, 2); - if (search_pinyin_index(options, pinyin, key)) { + /* support fallback table for double pinyin. */ + if (m_fallback_table) { + input = g_strndup(str, 2); + + const char * yunmu = NULL; + const double_pinyin_scheme_fallback_item_t * item = + m_fallback_table; + + while(NULL != item->m_input) { + if (0 == strcmp(item->m_input, input)) + yummu = item->m_yunmu; + item++; + } + + if (NULL != yummu && search_pinyin_index(options, yummu, key)) { key.m_tone = tone; - g_free(pinyin); + g_free(input); return true; } - g_free(pinyin); + g_free(input); + return false; } -#endif } return false; |