summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libpinyin.ver1
-rw-r--r--src/pinyin.cpp10
-rw-r--r--src/pinyin.h12
3 files changed, 23 insertions, 0 deletions
diff --git a/src/libpinyin.ver b/src/libpinyin.ver
index 078ad86..db4cc20 100644
--- a/src/libpinyin.ver
+++ b/src/libpinyin.ver
@@ -29,6 +29,7 @@ LIBPINYIN {
pinyin_get_full_pinyin_candidates;
pinyin_choose_candidate;
pinyin_free_candidates;
+ pinyin_clear_constraint;
pinyin_lookup_tokens;
pinyin_train;
pinyin_reset;
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 5cac776..35a7dc8 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -1711,6 +1711,16 @@ bool pinyin_free_candidates(pinyin_instance_t * instance,
return true;
}
+bool pinyin_clear_constraint(pinyin_instance_t * instance,
+ size_t offset){
+ pinyin_context_t * & context = instance->m_context;
+
+ bool retval = context->m_pinyin_lookup->clear_constraint
+ (instance->m_constraints, offset);
+
+ return retval;
+}
+
bool pinyin_lookup_tokens(pinyin_instance_t * instance,
const char * phrase, GArray * tokenarray){
pinyin_context_t * & context = instance->m_context;
diff --git a/src/pinyin.h b/src/pinyin.h
index a28b850..40d9d3d 100644
--- a/src/pinyin.h
+++ b/src/pinyin.h
@@ -446,6 +446,18 @@ bool pinyin_free_candidates(pinyin_instance_t * instance,
CandidateVector candidates);
/**
+* pinyin_clear_constraint:
+* @instance: the pinyin instance.
+* @offset: the offset in the pinyin keys.
+* @returns: whether the constraint is cleared.
+*
+* Clear the previous chosen candidate.
+*
+*/
+bool pinyin_clear_constraint(pinyin_instance_t * instance,
+ size_t offset);
+
+/**
* pinyin_lookup_tokens:
* @instance: the pinyin instance.
* @phrase: the phrase to be looked up.