summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-06-30 14:30:46 +0800
committerPeng Wu <alexepico@gmail.com>2016-06-30 14:36:21 +0800
commitc4f57271683ec7eb98b43ee4aae94cff1b341483 (patch)
tree222ddfee0fc4caa5b4d2e83ae0f802805298e989
parent60934ae69936452dffeceee9544c0d1016f8d6dd (diff)
downloadlibpinyin-c4f57271683ec7eb98b43ee4aae94cff1b341483.tar.gz
libpinyin-c4f57271683ec7eb98b43ee4aae94cff1b341483.tar.xz
libpinyin-c4f57271683ec7eb98b43ee4aae94cff1b341483.zip
begin to add pinyin_remember_user_input function
-rw-r--r--src/libpinyin.ver1
-rw-r--r--src/pinyin.cpp2
-rw-r--r--src/pinyin.h17
3 files changed, 18 insertions, 2 deletions
diff --git a/src/libpinyin.ver b/src/libpinyin.ver
index b53033c..ea2098a 100644
--- a/src/libpinyin.ver
+++ b/src/libpinyin.ver
@@ -16,6 +16,7 @@ LIBPINYIN {
pinyin_iterator_has_next_phrase;
pinyin_iterator_get_next_phrase;
pinyin_end_get_phrases;
+ pinyin_remember_user_input;
pinyin_fini;
pinyin_mask_out;
pinyin_set_options;
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 6a2d189..d69e093 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -483,6 +483,7 @@ static bool _add_phrase(pinyin_context_t * context,
bool result = false;
+ /* check whether the phrase exists in phrase table */
phrase_token_t token = null_token;
GArray * tokenarray = g_array_new(FALSE, FALSE, sizeof(phrase_token_t));
@@ -577,7 +578,6 @@ bool pinyin_iterator_add_phrase(import_iterator_t * iter,
if (NULL == phrase || NULL == pinyin)
return result;
- /* check whether the phrase exists in phrase table */
glong phrase_length = 0;
ucs4_t * ucs4_phrase = g_utf8_to_ucs4(phrase, -1, NULL, &phrase_length, NULL);
diff --git a/src/pinyin.h b/src/pinyin.h
index 610070e..9599aab 100644
--- a/src/pinyin.h
+++ b/src/pinyin.h
@@ -994,7 +994,22 @@ bool pinyin_get_chewing_auxiliary_text(pinyin_instance_t * instance,
size_t cursor,
gchar ** aux_text);
-/* hack here. */
+/**
+ * pinyin_remember_user_input:
+ * @instance: the pinyin instance.
+ * @phrase: the utf8 phrase.
+ * @count: the count of the phrase, -1 to use the default value.
+ * @returns: whether the phrase is remembered.
+ *
+ * Remember the current phrase and pinyin pair.
+ *
+ */
+bool pinyin_remember_user_input(pinyin_instance_t * instance,
+ const char * phrase,
+ gint count);
+
+
+/* for compatibility. */
typedef ChewingKey PinyinKey;
typedef ChewingKeyRest PinyinKeyPos;