summaryrefslogtreecommitdiffstats
path: root/src/storage/pinyin_parser2.h
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2020-07-24 14:59:16 +0800
committerPeng Wu <alexepico@gmail.com>2020-07-24 14:59:16 +0800
commit4d0e7eebec72ed95b4278161b115f78b0550753a (patch)
treecfe83f3d6e591b7af1399b2628c6bc1ecb35796d /src/storage/pinyin_parser2.h
parentd9f677af1e3ef0f9abaaf95d511676b0e486fb57 (diff)
downloadlibpinyin-4d0e7eebec72ed95b4278161b115f78b0550753a.tar.gz
libpinyin-4d0e7eebec72ed95b4278161b115f78b0550753a.tar.xz
libpinyin-4d0e7eebec72ed95b4278161b115f78b0550753a.zip
refactor parse_one_key method
Diffstat (limited to 'src/storage/pinyin_parser2.h')
-rw-r--r--src/storage/pinyin_parser2.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/storage/pinyin_parser2.h b/src/storage/pinyin_parser2.h
index 4a2f0f2..790c0cb 100644
--- a/src/storage/pinyin_parser2.h
+++ b/src/storage/pinyin_parser2.h
@@ -42,6 +42,7 @@ typedef struct {
const char * m_pinyin_input;
guint32 m_flags;
guint16 m_table_index;
+ guint16 m_distance;
} pinyin_index_item_t;
typedef struct {
@@ -114,7 +115,7 @@ public:
* Parse only one struct ChewingKey from a string.
*
*/
- virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const = 0;
+ virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, gint16 & distance, const char *str, int len) const = 0;
/**
* PhoneticParser2::parse:
@@ -156,7 +157,7 @@ public:
g_array_free(m_parse_steps, TRUE);
}
- virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const;
+ virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, gint16 & distance, const char *str, int len) const;
/* Note:
* the parse method will use dynamic programming to drive parse_one_key.
@@ -195,7 +196,7 @@ public:
virtual ~DoublePinyinParser2() {}
- virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const;
+ virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, gint16 & distance, const char *str, int len) const;
virtual int parse(pinyin_option_t options, ChewingKeyVector & keys, ChewingKeyRestVector & key_rests, const char *str, int len) const;
@@ -215,7 +216,7 @@ public:
virtual ~PinyinDirectParser2() {}
- virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const;
+ virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, gint16 & distance, const char *str, int len) const;
virtual int parse(pinyin_option_t options, ChewingKeyVector & keys, ChewingKeyRestVector & key_rests, const char *str, int len) const;
};