summaryrefslogtreecommitdiffstats
path: root/src/storage
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-05-27 13:38:26 +0800
committerPeng Wu <alexepico@gmail.com>2016-05-27 13:38:26 +0800
commit5df16470a5ab0968d482481c42cf255bf222ecee (patch)
treeca89b5f7bbf37648a222cf6b1f250011dc6eddad /src/storage
parent9e098143481cb701af79f31902b200ca548ae27c (diff)
downloadlibpinyin-5df16470a5ab0968d482481c42cf255bf222ecee.tar.gz
libpinyin-5df16470a5ab0968d482481c42cf255bf222ecee.tar.xz
libpinyin-5df16470a5ab0968d482481c42cf255bf222ecee.zip
update class PhraseItem
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/phrase_index.cpp8
-rw-r--r--src/storage/phrase_index.h16
2 files changed, 8 insertions, 16 deletions
diff --git a/src/storage/phrase_index.cpp b/src/storage/phrase_index.cpp
index a18ff9d..1e91b83 100644
--- a/src/storage/phrase_index.cpp
+++ b/src/storage/phrase_index.cpp
@@ -107,8 +107,7 @@ bool PhraseItem::set_phrase_string(guint8 phrase_length, ucs4_t * phrase){
return true;
}
-void PhraseItem::increase_pronunciation_possibility(pinyin_option_t options,
- ChewingKey * keys,
+void PhraseItem::increase_pronunciation_possibility(ChewingKey * keys,
gint32 delta){
guint8 phrase_length = get_phrase_length();
guint8 npron = get_n_pronunciation();
@@ -123,9 +122,8 @@ void PhraseItem::increase_pronunciation_possibility(pinyin_option_t options,
phrase_length * sizeof(ChewingKey));
total_freq += *freq;
- if (0 == pinyin_compare_with_ambiguities2
- (options, keys,
- (ChewingKey *)chewing_begin, phrase_length)) {
+ if (0 == pinyin_compare_with_tones(keys, (ChewingKey *)chewing_begin,
+ phrase_length)) {
/* protect against total_freq overflow. */
if (delta > 0 && total_freq > total_freq + delta)
diff --git a/src/storage/phrase_index.h b/src/storage/phrase_index.h
index 858b184..5f98774 100644
--- a/src/storage/phrase_index.h
+++ b/src/storage/phrase_index.h
@@ -27,7 +27,6 @@
#include "novel_types.h"
#include "chewing_key.h"
#include "pinyin_parser2.h"
-#include "pinyin_phrase2.h"
#include "pinyin_phrase3.h"
#include "memory_chunk.h"
#include "phrase_index_logger.h"
@@ -127,15 +126,13 @@ public:
/**
* PhraseItem::get_pronunciation_possibility:
- * @options: the pinyin options.
* @keys: the pronunciation keys.
* @returns: the possibility of this phrase item pronounces the pinyin.
*
* Get the possibility of this phrase item pronounces the pinyin.
*
*/
- gfloat get_pronunciation_possibility(pinyin_option_t options,
- ChewingKey * keys){
+ gfloat get_pronunciation_possibility(ChewingKey * keys){
guint8 phrase_length = get_phrase_length();
guint8 npron = get_n_pronunciation();
size_t offset = phrase_item_header + phrase_length * sizeof (ucs4_t);
@@ -147,9 +144,8 @@ public:
guint32 * freq = (guint32 *)(chewing_begin +
phrase_length * sizeof(ChewingKey));
total_freq += *freq;
- if ( 0 == pinyin_compare_with_ambiguities2
- (options, keys,
- (ChewingKey *)chewing_begin,phrase_length) ){
+ if ( 0 == pinyin_compare_with_tones(keys, (ChewingKey *)chewing_begin,
+ phrase_length) ){
matched += *freq;
}
}
@@ -167,16 +163,14 @@ public:
/**
* PhraseItem::increase_pronunciation_possibility:
- * @options: the pinyin options.
* @keys: the pronunciation keys.
* @delta: the delta to be added to the pronunciation keys.
*
* Add the delta to the pronunciation of the pronunciation keys.
*
*/
- void increase_pronunciation_possibility(pinyin_option_t options,
- ChewingKey * keys,
- gint32 delta);
+ void increase_pronunciation_possibility(ChewingKey * keys,
+ gint32 delta);
/**
* PhraseItem::get_phrase_string: