From 739f11026505d654eebd67ff5f128c844f454919 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 2 Mar 2012 11:23:04 +0800 Subject: update test_pinyin_lookup.cpp --- tests/lookup/test_pinyin_lookup.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/lookup') 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); -- cgit