summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-10-27 10:38:40 +0800
committerPeng Wu <alexepico@gmail.com>2011-10-27 10:38:40 +0800
commitc0ff923d2fc2a5e02d76decb95d3a8f4dd14c63c (patch)
treed70f17a912bb07b2fb95f00d7f256296b017092e
parent914895f2e1cccd498d4b1838da3fef6a4c892d3d (diff)
downloadlibpinyin-c0ff923d2fc2a5e02d76decb95d3a8f4dd14c63c.tar.gz
libpinyin-c0ff923d2fc2a5e02d76decb95d3a8f4dd14c63c.tar.xz
libpinyin-c0ff923d2fc2a5e02d76decb95d3a8f4dd14c63c.zip
update chewing_key.h
-rw-r--r--.gitignore1
-rw-r--r--src/storage/chewing_key.h27
2 files changed, 28 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 390aefa..0b34dec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,7 @@ libltdl
*~
*.o
*.lo
+*.pyc
.deps
.libs
tags
diff --git a/src/storage/chewing_key.h b/src/storage/chewing_key.h
index f42c66c..970ed72 100644
--- a/src/storage/chewing_key.h
+++ b/src/storage/chewing_key.h
@@ -118,12 +118,39 @@ enum ChewingTone
CHEWING_NUMBER_OF_TONES = CHEWING_LAST_TONE + 1
};
+
+/** Note: The parsed pinyins are stored in the following two
+ * GArrays to speed up chewing table lookup.
+ * As the chewing table only contains information of struct ChewingKey.
+ */
+
struct ChewingKey
{
guint16 m_initial : 5;
guint16 m_middle : 2;
guint16 m_final : 5;
guint16 m_tone : 3;
+
+ ChewingKey() {
+ m_initial = CHEWING_ZERO_INITIAL;
+ m_middle = CHEWING_ZERO_MIDDLE;
+ m_final = CHEWING_ZERO_FINAL;
+ m_tone = CHEWING_ZERO_TONE;
+ }
+};
+
+struct ChewingKeyRest
+{
+ guint16 m_index; /* the index in pinyin parser table. */
+ guint16 m_pinyin_begin; /* the begin of pinyin in raw input. */
+ guint16 m_pinyin_end; /* the end of pinyin in raw input. */
+
+ ChewingKeyRest() {
+ /* the 0th item in pinyin parser table is reserved for invalid. */
+ m_index = 0;
+ m_pinyin_begin = 0;
+ m_pinyin_end = 0;
+ }
};
};