summaryrefslogtreecommitdiffstats
path: root/tests/lookup
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-03-02 11:23:04 +0800
committerPeng Wu <alexepico@gmail.com>2012-03-02 11:23:04 +0800
commit739f11026505d654eebd67ff5f128c844f454919 (patch)
tree84fae8fc882d55a0013d7c6f0ad50d979bcdf5e7 /tests/lookup
parent6219c4e75e25b14a78f39cfec0a252260a45f132 (diff)
downloadlibpinyin-739f11026505d654eebd67ff5f128c844f454919.tar.gz
libpinyin-739f11026505d654eebd67ff5f128c844f454919.tar.xz
libpinyin-739f11026505d654eebd67ff5f128c844f454919.zip
update test_pinyin_lookup.cpp
Diffstat (limited to 'tests/lookup')
-rw-r--r--tests/lookup/test_pinyin_lookup.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/lookup/test_pinyin_lookup.cpp b/tests/lookup/test_pinyin_lookup.cpp
index 148b15b..577af72 100644
--- a/tests/lookup/test_pinyin_lookup.cpp
+++ b/tests/lookup/test_pinyin_lookup.cpp
@@ -50,6 +50,12 @@ int main( int argc, char * argv[]){
if ( 0 == keys->len ) /* invalid pinyin */
continue;
+ /* prepare the prefixes for get_best_match. */
+ TokenVector prefixes = g_array_new
+ (FALSE, FALSE, sizeof(phrase_token_t));
+ g_array_append_val(prefixes, sentence_start);
+
+ /* initialize constraints. */
CandidateConstraints constraints = g_array_new(FALSE, FALSE, sizeof(lookup_constraint_t));
g_array_set_size(constraints, keys->len);
@@ -62,7 +68,7 @@ int main( int argc, char * argv[]){
guint32 start_time = record_time();
for ( size_t i = 0; i < bench_times; ++i)
- pinyin_lookup.get_best_match(keys, constraints, results);
+ pinyin_lookup.get_best_match(prefixes, keys, constraints, results);
print_time(start_time, bench_times);
for ( size_t i = 0; i < results->len; ++i){
phrase_token_t * token = &g_array_index(results, phrase_token_t, i);