summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-04-12 08:58:44 +0800
committerPeng Wu <alexepico@gmail.com>2013-04-12 08:58:44 +0800
commit196601b5a3b8a2db0c520b03e6cde66904476bb4 (patch)
treead0cdb23d8f3c48f33c83796e00a24ced7692a68
parentd4a39f57c7d2dc715340e0c6cfd73f577ce5a7fa (diff)
downloadlibpinyin-196601b5a3b8a2db0c520b03e6cde66904476bb4.tar.gz
libpinyin-196601b5a3b8a2db0c520b03e6cde66904476bb4.tar.xz
libpinyin-196601b5a3b8a2db0c520b03e6cde66904476bb4.zip
remove LAMBDA_PARAMETER
-rw-r--r--data/Makefile.am2
-rw-r--r--src/include/novel_types.h2
-rw-r--r--src/pinyin.cpp6
3 files changed, 5 insertions, 5 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index fe1a6de..871e228 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -64,5 +64,5 @@ phrase_index.bin pinyin_index.bin $(binfiles): bigram.db
rebuild:
git reset --hard
- sed -i -e "s/#define LAMBDA_PARAMETER 0.347121/#define LAMBDA_PARAMETER $(LAMBDA_PARAMETER)/" ../src/include/novel_types.h
+ sed -i -e "s/lambda parameter:0.347121/lambda parameter:$(LAMBDA_PARAMETER)/" table.conf
make -C .. >/dev/null 2>/dev/null
diff --git a/src/include/novel_types.h b/src/include/novel_types.h
index 0ef845f..88c063c 100644
--- a/src/include/novel_types.h
+++ b/src/include/novel_types.h
@@ -150,8 +150,6 @@ typedef enum {
USER_DICTIONARY = 15
} PHRASE_INDEX_LIBRARIES;
-#define LAMBDA_PARAMETER 0.347121
-
G_END_DECLS
#endif
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 1415876..70a5385 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -1089,9 +1089,11 @@ static void _compute_frequency_of_items(pinyin_context_t * context,
total_freq = phrase_index->get_phrase_index_total_freq();
assert (0 < total_freq);
+ gfloat lambda = context->m_system_table_info.get_lambda();
+
/* Note: possibility value <= 1.0. */
- guint32 freq = (LAMBDA_PARAMETER * bigram_poss +
- (1 - LAMBDA_PARAMETER) *
+ guint32 freq = (lambda * bigram_poss +
+ (1 - lambda) *
cached_item.get_unigram_frequency() /
(gfloat) total_freq) * 256 * 256 * 256;
item->m_freq = freq;