diff options
author | Peng Wu <alexepico@gmail.com> | 2016-05-27 13:43:03 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-05-27 13:43:03 +0800 |
commit | db55283f014cfa5abd35c3be76e655bc1ee677ff (patch) | |
tree | a1efae8b02b5e0c996aecd8f73aa5301e23eff6a /src | |
parent | 5df16470a5ab0968d482481c42cf255bf222ecee (diff) | |
download | libpinyin-db55283f014cfa5abd35c3be76e655bc1ee677ff.tar.gz libpinyin-db55283f014cfa5abd35c3be76e655bc1ee677ff.tar.xz libpinyin-db55283f014cfa5abd35c3be76e655bc1ee677ff.zip |
update *_pronunciation_possibility function
Diffstat (limited to 'src')
-rw-r--r-- | src/storage/phonetic_key_matrix.cpp | 28 | ||||
-rw-r--r-- | src/storage/phonetic_key_matrix.h | 6 |
2 files changed, 14 insertions, 20 deletions
diff --git a/src/storage/phonetic_key_matrix.cpp b/src/storage/phonetic_key_matrix.cpp index 7b0876e..5ca7e9b 100644 --- a/src/storage/phonetic_key_matrix.cpp +++ b/src/storage/phonetic_key_matrix.cpp @@ -282,8 +282,7 @@ int search_matrix(FacadeChewingTable2 * table, return result; } -gfloat compute_pronunciation_possibility_recur(pinyin_option_t options, - PhoneticKeyMatrix * matrix, +gfloat compute_pronunciation_possibility_recur(PhoneticKeyMatrix * matrix, size_t start, size_t end, GArray * cached_keys, PhraseItem & item){ @@ -300,7 +299,7 @@ gfloat compute_pronunciation_possibility_recur(pinyin_option_t options, return 0.; return item.get_pronunciation_possibility - (options, (ChewingKey *) cached_keys->data); + ((ChewingKey *) cached_keys->data); } gfloat result = 0.; @@ -320,14 +319,14 @@ gfloat compute_pronunciation_possibility_recur(pinyin_option_t options, /* assume only one key here for "'" or the last key. */ assert(1 == size); return compute_pronunciation_possibility_recur - (options, matrix, newstart, end, cached_keys, item); + (matrix, newstart, end, cached_keys, item); } /* push value */ g_array_append_val(cached_keys, key); result += compute_pronunciation_possibility_recur - (options, matrix, newstart, end, cached_keys, item); + (matrix, newstart, end, cached_keys, item); /* pop value */ g_array_set_size(cached_keys, cached_keys->len - 1); @@ -336,8 +335,7 @@ gfloat compute_pronunciation_possibility_recur(pinyin_option_t options, return result; } -gfloat compute_pronunciation_possibility(pinyin_option_t options, - PhoneticKeyMatrix * matrix, +gfloat compute_pronunciation_possibility(PhoneticKeyMatrix * matrix, size_t start, size_t end, GArray * cached_keys, PhraseItem & item){ @@ -347,11 +345,10 @@ gfloat compute_pronunciation_possibility(pinyin_option_t options, assert(matrix->get_column_size(end) > 0); return compute_pronunciation_possibility_recur - (options, matrix, start, end, cached_keys, item); + (matrix, start, end, cached_keys, item); } -bool increase_pronunciation_possibility_recur(pinyin_option_t options, - PhoneticKeyMatrix * matrix, +bool increase_pronunciation_possibility_recur(PhoneticKeyMatrix * matrix, size_t start, size_t end, GArray * cached_keys, PhraseItem & item, gint32 delta) { @@ -368,7 +365,7 @@ bool increase_pronunciation_possibility_recur(pinyin_option_t options, return false; item.increase_pronunciation_possibility - (options, (ChewingKey *) cached_keys->data, delta); + ((ChewingKey *) cached_keys->data, delta); return true; } @@ -389,14 +386,14 @@ bool increase_pronunciation_possibility_recur(pinyin_option_t options, /* assume only one key here for "'" or the last key. */ assert(1 == size); return increase_pronunciation_possibility_recur - (options, matrix, newstart, end, cached_keys, item, delta); + (matrix, newstart, end, cached_keys, item, delta); } /* push value */ g_array_append_val(cached_keys, key); result = increase_pronunciation_possibility_recur - (options, matrix, newstart, end, cached_keys, item, delta) || result; + (matrix, newstart, end, cached_keys, item, delta) || result; /* pop value */ g_array_set_size(cached_keys, cached_keys->len - 1); @@ -405,8 +402,7 @@ bool increase_pronunciation_possibility_recur(pinyin_option_t options, return result; } -bool increase_pronunciation_possibility(pinyin_option_t options, - PhoneticKeyMatrix * matrix, +bool increase_pronunciation_possibility(PhoneticKeyMatrix * matrix, size_t start, size_t end, GArray * cached_keys, PhraseItem & item, gint32 delta) { @@ -416,7 +412,7 @@ bool increase_pronunciation_possibility(pinyin_option_t options, assert(matrix->get_column_size(end) > 0); return increase_pronunciation_possibility_recur - (options, matrix, start, end, cached_keys, item, delta); + (matrix, start, end, cached_keys, item, delta); } }; diff --git a/src/storage/phonetic_key_matrix.h b/src/storage/phonetic_key_matrix.h index 5e1f510..2d3c24f 100644 --- a/src/storage/phonetic_key_matrix.h +++ b/src/storage/phonetic_key_matrix.h @@ -212,14 +212,12 @@ int search_matrix(FacadeChewingTable2 * table, size_t start, size_t end, PhraseIndexRanges ranges); -gfloat compute_pronunciation_possibility(pinyin_option_t options, - PhoneticKeyMatrix * matrix, +gfloat compute_pronunciation_possibility(PhoneticKeyMatrix * matrix, size_t start, size_t end, GArray * cached_keys, PhraseItem & item); -bool increase_pronunciation_possibility(pinyin_option_t options, - PhoneticKeyMatrix * matrix, +bool increase_pronunciation_possibility(PhoneticKeyMatrix * matrix, size_t start, size_t end, GArray * cached_keys, PhraseItem & item, gint32 delta); |