From 94b7fe8792fc790510a5f3c5300ca349bf2bfba6 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 19 Nov 2013 12:45:50 +0800 Subject: add methods to public api --- src/libpinyin.ver | 2 ++ src/pinyin.cpp | 2 +- src/pinyin.h | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src') 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 @@ -233,6 +233,18 @@ bool pinyin_guess_sentence(pinyin_instance_t * instance); 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. @@ -387,6 +399,18 @@ int pinyin_choose_candidate(pinyin_instance_t * instance, size_t offset, 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. -- cgit