summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libpinyin.ver2
-rw-r--r--src/pinyin.cpp23
-rw-r--r--src/pinyin.h25
3 files changed, 50 insertions, 0 deletions
diff --git a/src/libpinyin.ver b/src/libpinyin.ver
index c6b29a6..41bf6ab 100644
--- a/src/libpinyin.ver
+++ b/src/libpinyin.ver
@@ -72,6 +72,8 @@ LIBPINYIN {
pinyin_get_double_pinyin_auxiliary_text;
pinyin_get_chewing_auxiliary_text;
pinyin_remember_user_input;
+ pinyin_is_user_candidate;
+ pinyin_remove_user_candidate;
local:
*;
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 26653e8..fcb82ac 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -3290,6 +3290,29 @@ bool pinyin_remember_user_input(pinyin_instance_t * instance,
return result;
}
+bool pinyin_is_user_candidate(pinyin_instance_t * instance,
+ lookup_candidate_t * candidate) {
+ if (NORMAL_CANDIDATE != candidate->m_candidate_type)
+ return false;
+
+ phrase_token_t token = candidate->m_token;
+ guint8 index = PHRASE_INDEX_LIBRARY_INDEX(token);
+ if (USER_DICTIONARY != index)
+ return false;
+
+ return true;
+}
+
+bool pinyin_remove_user_candidate(pinyin_instance_t * instance,
+ lookup_candidate_t * candidate) {
+ assert(NORMAL_CANDIDATE == candidate->m_candidate_type);
+
+ phrase_token_t token = candidate->m_token;
+ guint8 index = PHRASE_INDEX_LIBRARY_INDEX(token);
+ assert(USER_DICTIONARY == index);
+}
+
+
/**
* Note: prefix is the text before the pre-edit string.
*/
diff --git a/src/pinyin.h b/src/pinyin.h
index 9599aab..d29011b 100644
--- a/src/pinyin.h
+++ b/src/pinyin.h
@@ -1008,6 +1008,31 @@ bool pinyin_remember_user_input(pinyin_instance_t * instance,
const char * phrase,
gint count);
+/**
+ * pinyin_is_user_candidate:
+ * @instance: the pinyin instance.
+ * @candidate: the lookup candidate.
+ * @returns: whether the candidate is user candidate.
+ *
+ * Check whether the candidate is user candidate.
+ *
+ */
+bool pinyin_is_user_candidate(pinyin_instance_t * instance,
+ lookup_candidate_t * candidate);
+
+/**
+ * pinyin_remove_user_candidate:
+ * @instance: the pinyin instance.
+ * @candidate: the lookup candidate.
+ * @returns: whether the remove operation is successful.
+ *
+ * Remove the user candidate from dictionary.
+ *
+ */
+bool pinyin_remove_user_candidate(pinyin_instance_t * instance,
+ lookup_candidate_t * candidate);
+
+
/* for compatibility. */
typedef ChewingKey PinyinKey;