int main(int argc, char * argv[]){ FILE * output = stdout; const char * bigram_filename = "bigram.db"; FacadePhraseIndex phrase_index; //gb_char binary file MemoryChunk * chunk = new MemoryChunk; chunk->load("gb_char.bin"); phrase_index.load(1, chunk); //gbk_char binary file chunk = new MemoryChunk; chunk->load("gbk_char.bin"); phrase_index.load(2, chunk); Bigram bigram; bigram.attach(bigram_filename, ATTACH_READONLY); begin_data(output); gen_unigram(output, &phrase_index); gen_bigram(output, &phrase_index, &bigram); end_data(output); return 0; }
int main(int argc, char * argv[]){ FILE * output = stdout; const char * bigram_filename = SYSTEM_BIGRAM; SystemTableInfo system_table_info; bool retval = system_table_info.load(SYSTEM_TABLE_INFO); if (!retval) { fprintf(stderr, "load table.conf failed.\n"); exit(ENOENT); } FacadePhraseIndex phrase_index; const pinyin_table_info_t * phrase_files = system_table_info.get_table_info(); if (!load_phrase_index(phrase_files, &phrase_index)) exit(ENOENT); Bigram bigram; bigram.attach(bigram_filename, ATTACH_READONLY); begin_data(output); gen_unigram(output, &phrase_index); gen_bigram(output, &phrase_index, &bigram); end_data(output); return 0; }
int main(int argc, char * argv[]){ FILE * output = stdout; const char * bigram_filename = "bigram.db"; MemoryChunk * chunk = NULL; FacadePhraseIndex phrase_index; if (!load_phrase_index(&phrase_index)) exit(ENOENT); Bigram bigram; bigram.attach(bigram_filename, ATTACH_READONLY); begin_data(output); gen_unigram(output, &phrase_index); gen_bigram(output, &phrase_index, &bigram); end_data(output); return 0; }