summaryrefslogtreecommitdiffstats
path: root/src/pinyin.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-03-21 16:57:30 +0800
committerPeng Wu <alexepico@gmail.com>2013-03-21 16:58:16 +0800
commit4348b63eeec5662fedfc39be6fc78b62e2e26467 (patch)
treef4e5e8f2f46b6df8659908d655b398d99363485f /src/pinyin.cpp
parent9c35f8e85d93356abfa91c08543fff97658ff463 (diff)
downloadlibpinyin-4348b63eeec5662fedfc39be6fc78b62e2e26467.tar.gz
libpinyin-4348b63eeec5662fedfc39be6fc78b62e2e26467.tar.xz
libpinyin-4348b63eeec5662fedfc39be6fc78b62e2e26467.zip
write phrases methods
Diffstat (limited to 'src/pinyin.cpp')
-rw-r--r--src/pinyin.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index c857ae5..6a463e0 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -2009,6 +2009,27 @@ bool pinyin_get_raw_full_pinyin(pinyin_instance_t * instance,
return true;
}
+bool pinyin_get_n_phrase(pinyin_instance_t * instance,
+ guint * num) {
+ *num = instance->m_match_results->len;
+ return true;
+}
+
+bool pinyin_get_phrase_token(pinyin_instance_t * instance,
+ guint index,
+ phrase_token_t * token){
+ MatchResults & match_results = instance->m_match_results;
+
+ *token = null_token;
+
+ if (index >= match_results->len)
+ return false;
+
+ *token = g_array_index(match_results, phrase_token_t, index);
+
+ return true;
+}
+
/**
* Note: prefix is the text before the pre-edit string.