summaryrefslogtreecommitdiffstats
path: root/src/lookup/phonetic_lookup.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2017-01-19 15:35:21 +0800
committerPeng Wu <alexepico@gmail.com>2017-01-19 15:35:21 +0800
commit0145f45ff7ab413add71631ba95dc4c6d1cb9e40 (patch)
tree7ab299eb475b909f11282530341b10c42d0cd20b /src/lookup/phonetic_lookup.cpp
parentad0987d91b922fa546ff9663a3ca70d4fb39057b (diff)
downloadlibpinyin-0145f45ff7ab413add71631ba95dc4c6d1cb9e40.tar.gz
libpinyin-0145f45ff7ab413add71631ba95dc4c6d1cb9e40.tar.xz
libpinyin-0145f45ff7ab413add71631ba95dc4c6d1cb9e40.zip
write insert_candidate and get_tails method
Diffstat (limited to 'src/lookup/phonetic_lookup.cpp')
-rw-r--r--src/lookup/phonetic_lookup.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lookup/phonetic_lookup.cpp b/src/lookup/phonetic_lookup.cpp
index 4ea8b72..8f48755 100644
--- a/src/lookup/phonetic_lookup.cpp
+++ b/src/lookup/phonetic_lookup.cpp
@@ -67,8 +67,9 @@ static bool trellis_value_less_than(trellis_value_t * lhs,
}
/* use maximum heap to get the topest results. */
-static bool get_top_results(/* out */ GPtrArray * topresults,
- /* in */ GPtrArray * candidates) {
+bool get_top_results(size_t num,
+ /* out */ GPtrArray * topresults,
+ /* in */ GPtrArray * candidates) {
g_ptr_array_set_size(topresults, 0);
if (0 == candidates->len)
@@ -88,7 +89,7 @@ static bool get_top_results(/* out */ GPtrArray * topresults,
std_lite::pop_heap(begin, end, trellis_value_less_than);
--end;
- if (topresults->len >= nbeam)
+ if (topresults->len >= num)
break;
}