diff options
author | Peng Wu <alexepico@gmail.com> | 2012-12-11 14:15:49 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2012-12-11 14:16:59 +0800 |
commit | f21bba5df05c174ff91bb89d86b0d383767f99dd (patch) | |
tree | 6ac9bcea455eea672a09ddfaf646e4dfc8545806 | |
parent | 5d54a117e7df7a2ecbe69a1d457b9adc0f9e8bfe (diff) | |
download | libpinyin-f21bba5df05c174ff91bb89d86b0d383767f99dd.tar.gz libpinyin-f21bba5df05c174ff91bb89d86b0d383767f99dd.tar.xz libpinyin-f21bba5df05c174ff91bb89d86b0d383767f99dd.zip |
a safe guard for chewing
-rw-r--r-- | src/storage/phrase_index.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/storage/phrase_index.h b/src/storage/phrase_index.h index acc7c4a..bc6aad2 100644 --- a/src/storage/phrase_index.h +++ b/src/storage/phrase_index.h @@ -147,16 +147,15 @@ public: matched += *freq; } } - // use preprocessor to avoid zero freq, in gen_pinyin_table. - /* + +#if 1 + /* an additional safe guard for chewing. */ if ( 0 == total_freq ) - return 0.1; - */ + return 0; +#endif + + /* used preprocessor to avoid zero freq, in gen_chewing_table. */ gfloat retval = matched / (gfloat) total_freq; - /* - if ( 0 == retval ) - return 0.03; - */ return retval; } |