summaryrefslogtreecommitdiffstats
path: root/src/pinyin.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-06-19 14:41:18 +0800
committerPeng Wu <alexepico@gmail.com>2012-06-19 14:41:18 +0800
commit3120e3f3208f3b0c9e30a811102e0d2ea9c5e29e (patch)
tree3a2a3d3ecb0ef125687c00773a6e06fe01d52c66 /src/pinyin.cpp
parent05945ae69172859cb26f33363faccb76cb189629 (diff)
downloadlibpinyin-3120e3f3208f3b0c9e30a811102e0d2ea9c5e29e.tar.gz
libpinyin-3120e3f3208f3b0c9e30a811102e0d2ea9c5e29e.tar.xz
libpinyin-3120e3f3208f3b0c9e30a811102e0d2ea9c5e29e.zip
fixes phrase library load
Diffstat (limited to 'src/pinyin.cpp')
-rw-r--r--src/pinyin.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 2e97ab5..a6c888c 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -229,11 +229,15 @@ bool pinyin_load_phrase_library(pinyin_context_t * context,
chunkfilename = g_build_filename(context->m_user_dir,
phrasefilename, NULL);
- /* TODO: check bin file exists. if not, create a new one. */
- chunk->load(chunkfilename);
- g_free(chunkfilename);
+ /* check bin file exists. if not, create a new one. */
+ if (chunk->load(chunkfilename)) {
+ context->m_phrase_index->load(index, chunk);
+ } else {
+ delete chunk;
+ context->m_phrase_index->create_sub_phrase(index);
+ }
- context->m_phrase_index->load(index, chunk);
+ g_free(chunkfilename);
return true;
}
@@ -1321,9 +1325,5 @@ bool pinyin_reset(pinyin_instance_t * instance){
}
/**
- * TODO: to be implemented.
- * Note: prefix is the text before the pre-edit string.
- * bool pinyin_get_guessed_sentence_with_prefix(...);
- * bool pinyin_get_candidates_with_prefix(...);
- * For context-dependent order of the candidates list.
+ * Note: prefix is the text before the pre-edit string.
*/