summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-05-16 15:11:41 +0800
committerPeng Wu <alexepico@gmail.com>2016-05-16 15:11:41 +0800
commita5ea7448d20d6d3b5cae73bfe5dfda81e4e2cdf7 (patch)
tree7854f7967c86b17e0b06b88f7e483a6ce2fea054
parent7bd74b74a471de458ad5563f5f24d59fc28066a4 (diff)
downloadlibpinyin-a5ea7448d20d6d3b5cae73bfe5dfda81e4e2cdf7.tar.gz
libpinyin-a5ea7448d20d6d3b5cae73bfe5dfda81e4e2cdf7.tar.xz
libpinyin-a5ea7448d20d6d3b5cae73bfe5dfda81e4e2cdf7.zip
update code
-rw-r--r--src/pinyin.cpp24
-rw-r--r--src/storage/pinyin_parser2.cpp6
-rw-r--r--src/storage/pinyin_parser2.h4
3 files changed, 12 insertions, 22 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 740ec65..5b5f0bc 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -1770,13 +1770,9 @@ static bool _try_divided_table(pinyin_instance_t * instance,
ChewingKey divided_keys[2];
const char * pinyin = item->m_new_keys[0];
- assert(context->m_full_pinyin_parser->
- parse_one_key(options, divided_keys[0],
- pinyin, strlen(pinyin)));
+ divided_keys[0] = item->m_new_structs[0];
pinyin = item->m_new_keys[1];
- assert(context->m_full_pinyin_parser->
- parse_one_key(options, divided_keys[1],
- pinyin, strlen(pinyin)));
+ divided_keys[1] = item->m_new_structs[1];
gchar * new_pinyins = g_strdup_printf
("%s'%s", item->m_new_keys[0], item->m_new_keys[1]);
@@ -1891,13 +1887,9 @@ static bool _try_resplit_table(pinyin_instance_t * instance,
pinyins[0] = item_by_orig->m_new_keys[0];
pinyins[1] = item_by_orig->m_new_keys[1];
- assert(context->m_full_pinyin_parser->
- parse_one_key(options, resplit_keys[0],
- pinyins[0], strlen(pinyins[0])));
+ resplit_keys[0] = item_by_orig->m_new_structs[0];
+ resplit_keys[1] = item_by_orig->m_new_structs[1];
- assert(context->m_full_pinyin_parser->
- parse_one_key(options, resplit_keys[1],
- pinyins[1], strlen(pinyins[1])));
tosearch = true;
}
@@ -1905,13 +1897,9 @@ static bool _try_resplit_table(pinyin_instance_t * instance,
pinyins[0] = item_by_new->m_orig_keys[0];
pinyins[1] = item_by_new->m_orig_keys[1];
- assert(context->m_full_pinyin_parser->
- parse_one_key(options, resplit_keys[0],
- pinyins[0], strlen(pinyins[0])));
+ resplit_keys[0] = item_by_new->m_orig_structs[0];
+ resplit_keys[1] = item_by_new->m_orig_structs[1];
- assert(context->m_full_pinyin_parser->
- parse_one_key(options, resplit_keys[1],
- pinyins[1], strlen(pinyins[1])));
tosearch = true;
}
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 9425b6f..f22f4ba 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -457,17 +457,15 @@ bool FullPinyinParser2::post_process2(pinyin_option_t options,
continue;
/* do re-split */
- const char * onepinyin = str + cur_rest->m_raw_begin;
size_t len = strlen(item->m_new_keys[0]);
- assert(parse_one_key(options, *cur_key, onepinyin, len));
+ *cur_key = item->m_new_structs[0];
cur_rest->m_raw_end = cur_rest->m_raw_begin + len;
next_rest->m_raw_begin = cur_rest->m_raw_end;
- onepinyin = str + next_rest->m_raw_begin;
len = strlen(item->m_new_keys[1]);
- assert(parse_one_key(options, *next_key, onepinyin, len));
+ *next_key = item->m_new_structs[1];
}
/* restore tones */
diff --git a/src/storage/pinyin_parser2.h b/src/storage/pinyin_parser2.h
index b8d1d9b..53202ff 100644
--- a/src/storage/pinyin_parser2.h
+++ b/src/storage/pinyin_parser2.h
@@ -53,15 +53,19 @@ typedef struct {
typedef struct {
const char * m_orig_key;
+ ChewingKey m_orig_struct;
guint32 m_orig_freq;
const char * m_new_keys[2];
+ ChewingKey m_new_structs[2];
guint32 m_new_freq;
} divided_table_item_t;
typedef struct {
const char * m_orig_keys[2];
+ ChewingKey m_orig_structs[2];
guint32 m_orig_freq;
const char * m_new_keys[2];
+ ChewingKey m_new_structs[2];
guint32 m_new_freq;
} resplit_table_item_t;