summaryrefslogtreecommitdiffstats
path: root/src/storage
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-02-24 14:16:59 +0800
committerPeng Wu <alexepico@gmail.com>2016-02-24 14:16:59 +0800
commitf142f1c24866423974a692c3e71b6e052faf5e61 (patch)
treee77b01baa586d51a36c6b86909ca2c65b9965190 /src/storage
parent72fe72ed62a55d8ed13e012c13acfae3e9de2e67 (diff)
downloadlibpinyin-f142f1c24866423974a692c3e71b6e052faf5e61.tar.gz
libpinyin-f142f1c24866423974a692c3e71b6e052faf5e61.tar.xz
libpinyin-f142f1c24866423974a692c3e71b6e052faf5e61.zip
write contains_incomplete_pinyin function
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/pinyin_phrase3.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/storage/pinyin_phrase3.h b/src/storage/pinyin_phrase3.h
index aa3dbd0..7e190e2 100644
--- a/src/storage/pinyin_phrase3.h
+++ b/src/storage/pinyin_phrase3.h
@@ -139,6 +139,19 @@ inline int pinyin_compare_with_tones(const ChewingKey * key_lhs,
return 0;
}
+inline bool contains_incomplete_pinyin(int phrase_length,
+ const ChewingKey * keys) {
+ for (int i = 0; i < phrase_length; ++i) {
+ const ChewingKey key = keys[i];
+ if (CHEWING_ZERO_MIDDLE == key.m_middle &&
+ CHEWING_ZERO_FINAL == key.m_final) {
+ assert(CHEWING_ZERO_TONE == key.m_tone);
+ return true;
+ }
+ }
+
+ return false;
+}
template<size_t phrase_length>
struct PinyinIndexItem2{