diff options
author | Peng Wu <alexepico@gmail.com> | 2013-11-19 12:45:50 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2013-11-29 15:09:14 +0800 |
commit | 94b7fe8792fc790510a5f3c5300ca349bf2bfba6 (patch) | |
tree | d26779d5c407463c5676c964280f906fca4f2422 /src | |
parent | e77c6a63e3e0160215da7579bf1d0301b3ce6e12 (diff) | |
download | libpinyin-94b7fe8792fc790510a5f3c5300ca349bf2bfba6.tar.gz libpinyin-94b7fe8792fc790510a5f3c5300ca349bf2bfba6.tar.xz libpinyin-94b7fe8792fc790510a5f3c5300ca349bf2bfba6.zip |
add methods to public api
Diffstat (limited to 'src')
-rw-r--r-- | src/libpinyin.ver | 2 | ||||
-rw-r--r-- | src/pinyin.cpp | 2 | ||||
-rw-r--r-- | src/pinyin.h | 24 |
3 files changed, 27 insertions, 1 deletions
diff --git a/src/libpinyin.ver b/src/libpinyin.ver index 1b6cc4b..0bae319 100644 --- a/src/libpinyin.ver +++ b/src/libpinyin.ver @@ -16,6 +16,7 @@ LIBPINYIN { pinyin_free_instance; pinyin_guess_sentence; pinyin_guess_sentence_with_prefix; + pinyin_guess_predicted_candidates; pinyin_phrase_segment; pinyin_get_sentence; pinyin_parse_full_pinyin; @@ -28,6 +29,7 @@ LIBPINYIN { pinyin_guess_candidates; pinyin_guess_full_pinyin_candidates; pinyin_choose_candidate; + pinyin_choose_predicted_candidate; pinyin_clear_constraint; pinyin_lookup_tokens; pinyin_train; diff --git a/src/pinyin.cpp b/src/pinyin.cpp index fe00f20..e8b20d4 100644 --- a/src/pinyin.cpp +++ b/src/pinyin.cpp @@ -1874,7 +1874,7 @@ int pinyin_choose_candidate(pinyin_instance_t * instance, } bool pinyin_choose_predicted_candidate(pinyin_instance_t * instance, - lookup_candidate_t * candidate){ + lookup_candidate_t * candidate){ const guint32 initial_seed = 23 * 3; const guint32 unigram_factor = 7; diff --git a/src/pinyin.h b/src/pinyin.h index 7163435..bf3898a 100644 --- a/src/pinyin.h +++ b/src/pinyin.h @@ -234,6 +234,18 @@ bool pinyin_guess_sentence_with_prefix(pinyin_instance_t * instance, const char * prefix); /** + * pinyin_guess_predicted_candidates: + * @instance: the pinyin instance. + * @prefix: the prefix before the predicted candidates. + * @returns: whether the predicted candidates are guessed successfully. + * + * Guess the predicted candidates after the prefix word. + * + */ +bool pinyin_guess_predicted_candidates(pinyin_instance_t * instance, + const char * prefix); + +/** * pinyin_phrase_segment: * @instance: the pinyin instance. * @sentence: the utf-8 sentence to be segmented. @@ -388,6 +400,18 @@ int pinyin_choose_candidate(pinyin_instance_t * instance, lookup_candidate_t * candidate); /** + * pinyin_choose_predicted_candidate: + * @instance: the pinyin instance. + * @candidate: the selected candidate. + * @returns: whether the self-learning is successful. + * + * Choose a predicted candidate. + * + */ +bool pinyin_choose_predicted_candidate(pinyin_instance_t * instance, + lookup_candidate_t * candidate); + +/** * pinyin_clear_constraint: * @instance: the pinyin instance. * @offset: the offset in the pinyin keys. |