From 8861bc3da5e49f0c0ae074593a72df3771d57ec6 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 20 Jun 2016 10:29:03 +0800 Subject: rename functions --- src/pinyin.cpp | 9 +++------ src/storage/phonetic_key_matrix.cpp | 8 ++++---- src/storage/phonetic_key_matrix.h | 10 +++++----- tests/lookup/test_pinyin_lookup.cpp | 5 ++--- tests/storage/test_matrix.cpp | 5 ++--- utils/training/eval_correction_rate.cpp | 2 +- 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/pinyin.cpp b/src/pinyin.cpp index 1d50ea9..b107918 100644 --- a/src/pinyin.cpp +++ b/src/pinyin.cpp @@ -1194,8 +1194,7 @@ size_t pinyin_parse_more_full_pinyins(pinyin_instance_t * instance, instance->m_parsed_len = parsed_len; - fill_phonetic_key_matrix_from_chewing_keys - (&matrix, keys, key_rests); + fill_matrix(&matrix, keys, key_rests); resplit_step(options, &matrix); @@ -1235,8 +1234,7 @@ size_t pinyin_parse_more_double_pinyins(pinyin_instance_t * instance, instance->m_parsed_len = parsed_len; - fill_phonetic_key_matrix_from_chewing_keys - (&matrix, keys, key_rests); + fill_matrix(&matrix, keys, key_rests); fuzzy_syllable_step(options, &matrix); @@ -1272,8 +1270,7 @@ size_t pinyin_parse_more_chewings(pinyin_instance_t * instance, instance->m_parsed_len = parsed_len; - fill_phonetic_key_matrix_from_chewing_keys - (&matrix, keys, key_rests); + fill_matrix(&matrix, keys, key_rests); fuzzy_syllable_step(options, &matrix); diff --git a/src/storage/phonetic_key_matrix.cpp b/src/storage/phonetic_key_matrix.cpp index 8b7e295..5b6ec5b 100644 --- a/src/storage/phonetic_key_matrix.cpp +++ b/src/storage/phonetic_key_matrix.cpp @@ -27,9 +27,9 @@ namespace pinyin{ -bool fill_phonetic_key_matrix_from_chewing_keys(PhoneticKeyMatrix * matrix, - ChewingKeyVector keys, - ChewingKeyRestVector key_rests) { +bool fill_matrix(PhoneticKeyMatrix * matrix, + ChewingKeyVector keys, + ChewingKeyRestVector key_rests) { assert(keys->len == key_rests->len); const ChewingKey * key = NULL; @@ -299,7 +299,7 @@ bool fuzzy_syllable_step(pinyin_option_t options, } -bool dump_phonetic_key_matrix(PhoneticKeyMatrix * matrix) { +bool dump_matrix(PhoneticKeyMatrix * matrix) { size_t length = matrix->size(); GArray * keys = g_array_new(TRUE, TRUE, sizeof(ChewingKey)); diff --git a/src/storage/phonetic_key_matrix.h b/src/storage/phonetic_key_matrix.h index 2d3c24f..75ea2aa 100644 --- a/src/storage/phonetic_key_matrix.h +++ b/src/storage/phonetic_key_matrix.h @@ -171,13 +171,13 @@ public: }; /** - * fill_phonetic_key_matrix_from_chewing_keys: + * fill_matrix: * Convert ChewingKeyVector and ChewingKeyRestVector * to PhoneticKeyMatrix. */ -bool fill_phonetic_key_matrix_from_chewing_keys(PhoneticKeyMatrix * matrix, - ChewingKeyVector keys, - ChewingKeyRestVector key_rests); +bool fill_matrix(PhoneticKeyMatrix * matrix, + ChewingKeyVector keys, + ChewingKeyRestVector key_rests); /** * resplit_step: @@ -205,7 +205,7 @@ bool inner_split_step(pinyin_option_t options, bool fuzzy_syllable_step(pinyin_option_t options, PhoneticKeyMatrix * matrix); -bool dump_phonetic_key_matrix(PhoneticKeyMatrix * matrix); +bool dump_matrix(PhoneticKeyMatrix * matrix); int search_matrix(FacadeChewingTable2 * table, PhoneticKeyMatrix * matrix, diff --git a/tests/lookup/test_pinyin_lookup.cpp b/tests/lookup/test_pinyin_lookup.cpp index ab14242..ac43ce5 100644 --- a/tests/lookup/test_pinyin_lookup.cpp +++ b/tests/lookup/test_pinyin_lookup.cpp @@ -90,8 +90,7 @@ int main( int argc, char * argv[]){ continue; /* fill the matrix. */ - fill_phonetic_key_matrix_from_chewing_keys - (&matrix, keys, key_rests); + fill_matrix(&matrix, keys, key_rests); resplit_step(options, &matrix); @@ -99,7 +98,7 @@ int main( int argc, char * argv[]){ fuzzy_syllable_step(options, &matrix); - dump_phonetic_key_matrix(&matrix); + dump_matrix(&matrix); /* initialize constraints. */ g_array_set_size(constraints, matrix.size()); diff --git a/tests/storage/test_matrix.cpp b/tests/storage/test_matrix.cpp index d80b030..5602bd6 100644 --- a/tests/storage/test_matrix.cpp +++ b/tests/storage/test_matrix.cpp @@ -124,8 +124,7 @@ int main(int argc, char * argv[]) { len = parser->parse(options, keys, key_rests, linebuf, strlen(linebuf)); - fill_phonetic_key_matrix_from_chewing_keys - (&matrix, keys, key_rests); + fill_matrix(&matrix, keys, key_rests); resplit_step(options, &matrix); @@ -137,7 +136,7 @@ int main(int argc, char * argv[]) { printf("parsed %d chars, %d keys.\n", len, keys->len); - dump_phonetic_key_matrix(&matrix); + dump_matrix(&matrix); PhraseIndexRanges ranges; memset(ranges, 0, sizeof(PhraseIndexRanges)); diff --git a/utils/training/eval_correction_rate.cpp b/utils/training/eval_correction_rate.cpp index fa061be..90d1883 100644 --- a/utils/training/eval_correction_rate.cpp +++ b/utils/training/eval_correction_rate.cpp @@ -104,7 +104,7 @@ bool do_one_test(PinyinLookup2 * pinyin_lookup, } PhoneticKeyMatrix matrix; - fill_phonetic_key_matrix_from_chewing_keys(&matrix, keys, key_rests); + fill_matrix(&matrix, keys, key_rests); get_best_match(pinyin_lookup, &matrix, guessed_tokens); /* compare the results */ -- cgit