summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2015-10-14 11:03:57 +0800
committerPeng Wu <alexepico@gmail.com>2015-10-14 11:03:57 +0800
commit3c89c1aa4c818205cf2e871b932b1f4f0fe3fb21 (patch)
tree26422860100544c45e9f2f4993ff69371b3024b8
parentf699a47356f3ec5062a505ec2e5cddd929144ce3 (diff)
downloadlibpinyin-3c89c1aa4c818205cf2e871b932b1f4f0fe3fb21.tar.gz
libpinyin-3c89c1aa4c818205cf2e871b932b1f4f0fe3fb21.tar.xz
libpinyin-3c89c1aa4c818205cf2e871b932b1f4f0fe3fb21.zip
update FullPinyinParser2
-rw-r--r--src/storage/Makefile.am1
-rw-r--r--src/storage/pinyin_parser2.cpp20
-rw-r--r--src/storage/pinyin_parser2.h3
-rw-r--r--src/storage/zhuyin_parser2.cpp21
4 files changed, 24 insertions, 21 deletions
diff --git a/src/storage/Makefile.am b/src/storage/Makefile.am
index f898973..7698e12 100644
--- a/src/storage/Makefile.am
+++ b/src/storage/Makefile.am
@@ -59,6 +59,7 @@ libstorage_la_SOURCES = phrase_index.cpp \
ngram.cpp \
tag_utility.cpp \
pinyin_parser2.cpp \
+ zhuyin_parser2.cpp \
chewing_large_table.cpp \
table_info.cpp
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index d3442ee..a5c3985 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -438,6 +438,26 @@ int FullPinyinParser2::final_step(size_t step_len, ChewingKeyVector & keys,
return parsed_len;
}
+bool FullPinyinParser2::set_scheme(ZhuyinScheme scheme){
+ switch(scheme){
+ case FULL_PINYIN_HANYU:
+ m_pinyin_index = hanyu_pinyin_index;
+ m_pinyin_index_len = G_N_ELEMENTS(hanyu_pinyin_index);
+ break;
+ case FULL_PINYIN_LUOMA:
+ m_pinyin_index = luoma_pinyin_index;
+ m_pinyin_index_len = G_N_ELEMENTS(luoma_pinyin_index);
+ break;
+ case FULL_PINYIN_SECONDARY_BOPOMOFO:
+ m_pinyin_index = secondary_bopomofo_index;
+ m_pinyin_index_len = G_N_ELEMENTS(secondary_bopomofo_index);
+ break;
+ default:
+ assert(false);
+ }
+ return true;
+}
+
bool FullPinyinParser2::post_process2(pinyin_option_t options,
ChewingKeyVector & keys,
ChewingKeyRestVector & key_rests,
diff --git a/src/storage/pinyin_parser2.h b/src/storage/pinyin_parser2.h
index 9a9679f..40d96bb 100644
--- a/src/storage/pinyin_parser2.h
+++ b/src/storage/pinyin_parser2.h
@@ -186,6 +186,9 @@ public:
* the parse method will use dynamic programming to drive parse_one_key.
*/
virtual int parse(pinyin_option_t options, ChewingKeyVector & keys, ChewingKeyRestVector & key_rests, const char *str, int len) const;
+
+public:
+ bool set_scheme(ZhuyinScheme scheme);
};
diff --git a/src/storage/zhuyin_parser2.cpp b/src/storage/zhuyin_parser2.cpp
index 32a519f..946dbb0 100644
--- a/src/storage/zhuyin_parser2.cpp
+++ b/src/storage/zhuyin_parser2.cpp
@@ -89,28 +89,7 @@ static inline bool search_chewing_index(pinyin_option_t options,
}
-bool FullPinyinParser2::set_scheme(ZhuyinScheme scheme){
- switch(scheme){
- case FULL_PINYIN_HANYU:
- m_pinyin_index = hanyu_pinyin_index;
- m_pinyin_index_len = G_N_ELEMENTS(hanyu_pinyin_index);
- break;
- case FULL_PINYIN_LUOMA:
- m_pinyin_index = luoma_pinyin_index;
- m_pinyin_index_len = G_N_ELEMENTS(luoma_pinyin_index);
- break;
- case FULL_PINYIN_SECONDARY_BOPOMOFO:
- m_pinyin_index = secondary_bopomofo_index;
- m_pinyin_index_len = G_N_ELEMENTS(secondary_bopomofo_index);
- break;
- default:
- assert(false);
- }
- return true;
-}
-
/* the chewing string must be freed with g_free. */
-
static bool search_chewing_symbols(const chewing_symbol_item_t * symbol_table,
const char key, const char ** chewing) {
*chewing = "";