summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-11-23 15:29:57 +0800
committerPeng Wu <alexepico@gmail.com>2011-11-23 15:29:57 +0800
commitc69900e3d25a01101ac82081d9565a59aa477980 (patch)
tree703bb51b30173c4548a8db84ff2dbff185ecc1a6
parent9f17bdefd4303242d017f2cd3e0ee3bfba819af2 (diff)
downloadlibpinyin-c69900e3d25a01101ac82081d9565a59aa477980.tar.gz
libpinyin-c69900e3d25a01101ac82081d9565a59aa477980.tar.xz
libpinyin-c69900e3d25a01101ac82081d9565a59aa477980.zip
add set scheme for chewing parser2
-rw-r--r--src/storage/chewing_key.h8
-rw-r--r--src/storage/pinyin_parser2.cpp34
-rw-r--r--src/storage/pinyin_parser2.h4
3 files changed, 39 insertions, 7 deletions
diff --git a/src/storage/chewing_key.h b/src/storage/chewing_key.h
index b83b5d7..5bbd6ed 100644
--- a/src/storage/chewing_key.h
+++ b/src/storage/chewing_key.h
@@ -141,11 +141,9 @@ enum DoublePinyinScheme
enum ChewingScheme
{
CHEWING_STANDARD = 1,
- CHEWING_HSU = 2,
- CHEWING_IBM = 3,
- CHEWING_GIN_YIEH = 4,
- CHEWING_ET = 5,
- CHEWING_ET26 = 6,
+ CHEWING_IBM = 2,
+ CHEWING_GINYIEH = 3,
+ CHEWING_ETEN = 4,
CHEWING_DEFAULT = CHEWING_STANDARD
};
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index b54e7f2..29ea8a4 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -562,3 +562,37 @@ bool DoublePinyinParser2::set_scheme(DoublePinyinScheme scheme) {
return false; /* no such scheme. */
}
+
+
+bool ChewingParser2::parse_one_key(guint32 options, ChewingKey & key, ChewingKeyRest & key_rest, const char *str, int len) const {
+ assert(FALSE);
+}
+
+
+int ChewingParser2::parse(guint32 options, ChewingKeyVector & keys, ChewingKeyRestVector & key_rests, const char *str, int len) const {
+ assert(FALSE);
+}
+
+
+bool ChewingParser2::set_scheme(ChewingScheme scheme) {
+ switch(scheme) {
+ case CHEWING_STANDARD:
+ m_symbol_table = chewing_standard_symbols;
+ m_tone_table = chewing_standard_tones;
+ return true;
+ case CHEWING_IBM:
+ m_symbol_table = chewing_ibm_symbols;
+ m_tone_table = chewing_ibm_tones;
+ return true;
+ case CHEWING_GINYIEH:
+ m_symbol_table = chewing_ginyieh_symbols;
+ m_tone_table = chewing_ginyieh_tones;
+ return true;
+ case CHEWING_ETEN:
+ m_symbol_table = chewing_eten_symbols;
+ m_tone_table = chewing_eten_tones;
+ return true;
+ }
+
+ return false;
+}
diff --git a/src/storage/pinyin_parser2.h b/src/storage/pinyin_parser2.h
index b81240e..ea7c796 100644
--- a/src/storage/pinyin_parser2.h
+++ b/src/storage/pinyin_parser2.h
@@ -197,8 +197,8 @@ class ChewingParser2 : public PinyinParser2
{
/* Note: some internal pointers to chewing scheme table. */
protected:
- chewing_symbol_item_t * m_symbol_table;
- chewing_tone_item_t * m_tone_table;
+ const chewing_symbol_item_t * m_symbol_table;
+ const chewing_tone_item_t * m_tone_table;
public:
ChewingParser2() {