summaryrefslogtreecommitdiffstats
path: root/utils/training/gen_k_mixture_model.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-10-19 12:24:06 +0800
committerPeng Wu <alexepico@gmail.com>2012-10-19 12:24:06 +0800
commit3d9959ed830c4ae5bc7b4f7a525f25f34fc67313 (patch)
tree33bbdf0408a5ff01e26450cecb04c6ef34dfd74a /utils/training/gen_k_mixture_model.cpp
parent484cf316c1257bf138815614c1576d4fcbbeac6c (diff)
downloadlibpinyin-3d9959ed830c4ae5bc7b4f7a525f25f34fc67313.tar.gz
libpinyin-3d9959ed830c4ae5bc7b4f7a525f25f34fc67313.tar.xz
libpinyin-3d9959ed830c4ae5bc7b4f7a525f25f34fc67313.zip
clean up code
Diffstat (limited to 'utils/training/gen_k_mixture_model.cpp')
-rw-r--r--utils/training/gen_k_mixture_model.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/utils/training/gen_k_mixture_model.cpp b/utils/training/gen_k_mixture_model.cpp
index eae75c4..9bea6ab 100644
--- a/utils/training/gen_k_mixture_model.cpp
+++ b/utils/training/gen_k_mixture_model.cpp
@@ -51,12 +51,8 @@ bool read_document(PhraseLargeTable2 * phrase_table,
FILE * document,
HashofDocument hash_of_document,
HashofUnigram hash_of_unigram){
- PhraseTokens tokens;
- memset(tokens, 0, sizeof(PhraseTokens));
- phrase_index->prepare_tokens(tokens);
- char * linebuf = NULL;
- size_t size = 0;
+ char * linebuf = NULL;size_t size = 0;
phrase_token_t last_token, cur_token = last_token = 0;
while ( getline(&linebuf, &size, document) ){
@@ -67,7 +63,7 @@ bool read_document(PhraseLargeTable2 * phrase_table,
linebuf[strlen(linebuf) - 1] = '\0';
}
- TAGLIB_PARSE_SEGMENTED_LINE(&phrase_index, token, linebuf);
+ TAGLIB_PARSE_SEGMENTED_LINE(phrase_index, token, linebuf);
last_token = cur_token;
cur_token = token;
@@ -128,8 +124,6 @@ bool read_document(PhraseLargeTable2 * phrase_table,
free(linebuf);
- phrase_index->destroy_tokens(tokens);
-
return true;
}