summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-06-18 11:08:48 +0800
committerPeng Wu <alexepico@gmail.com>2013-06-18 11:09:37 +0800
commit1ab1848e50da608ac768751f1d253a1c74ba4667 (patch)
treeb18a7cc44b543698ae793ac086897239eee7f707
parent17221a12d28de70bf2d0071f2359a4b13668dfc5 (diff)
downloadlibpinyin-1ab1848e50da608ac768751f1d253a1c74ba4667.tar.gz
libpinyin-1ab1848e50da608ac768751f1d253a1c74ba4667.tar.xz
libpinyin-1ab1848e50da608ac768751f1d253a1c74ba4667.zip
fixes lookups
-rw-r--r--src/lookup/phrase_lookup.cpp4
-rw-r--r--src/lookup/pinyin_lookup2.cpp5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/lookup/phrase_lookup.cpp b/src/lookup/phrase_lookup.cpp
index 114ecb4..f7da0b7 100644
--- a/src/lookup/phrase_lookup.cpp
+++ b/src/lookup/phrase_lookup.cpp
@@ -106,6 +106,10 @@ PhraseLookup::PhraseLookup(const gfloat lambda,
m_steps_index = g_ptr_array_new();
m_steps_content = g_ptr_array_new();
+
+ /* the member variables below are saved in get_best_match call. */
+ m_sentence = NULL;
+ m_sentence_length = 0;
}
PhraseLookup::~PhraseLookup(){
diff --git a/src/lookup/pinyin_lookup2.cpp b/src/lookup/pinyin_lookup2.cpp
index 8be5c0c..2250a93 100644
--- a/src/lookup/pinyin_lookup2.cpp
+++ b/src/lookup/pinyin_lookup2.cpp
@@ -202,6 +202,10 @@ PinyinLookup2::PinyinLookup2(const gfloat lambda,
m_steps_index = g_ptr_array_new();
m_steps_content = g_ptr_array_new();
+
+ /* the member variables below are saved in get_best_match call. */
+ m_keys = NULL;
+ m_constraints = NULL;
}
PinyinLookup2::~PinyinLookup2(){
@@ -594,6 +598,7 @@ bool PinyinLookup2::train_result2(ChewingKeyVector keys,
assert(user->set_freq(*token, freq + seed));
assert(m_user_bigram->store(last_token, user));
next:
+ assert(NULL != user);
if (user)
delete user;
}