diff options
author | Peng Wu <alexepico@gmail.com> | 2015-05-20 14:28:51 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2015-05-20 14:28:51 +0800 |
commit | 42c7299f3bbe2191a44aa17fe17829361aede7eb (patch) | |
tree | 33f52ede9795c06ee500eaa4366c8a77ca2c656b /src/storage/table_info.cpp | |
parent | 8fc2fc4da82250bfe33c81c3575cb4d5fdde10dc (diff) | |
download | libpinyin-42c7299f3bbe2191a44aa17fe17829361aede7eb.tar.gz libpinyin-42c7299f3bbe2191a44aa17fe17829361aede7eb.tar.xz libpinyin-42c7299f3bbe2191a44aa17fe17829361aede7eb.zip |
add phonetic table type to table info
Diffstat (limited to 'src/storage/table_info.cpp')
-rw-r--r-- | src/storage/table_info.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/storage/table_info.cpp b/src/storage/table_info.cpp index 6d1159a..ea10df9 100644 --- a/src/storage/table_info.cpp +++ b/src/storage/table_info.cpp @@ -21,6 +21,7 @@ #include "table_info.h" #include <stdio.h> +#include <stdlib.h> #include <assert.h> #include <string.h> #include <locale.h> @@ -44,6 +45,8 @@ SystemTableInfo::SystemTableInfo() { m_model_data_version = 0; m_lambda = 0.; + m_table_phonetic_type = PINYIN_TABLE; + size_t i; for (i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) { pinyin_table_info_t * table_info = &m_table_info[i]; @@ -65,6 +68,8 @@ void SystemTableInfo::reset() { m_model_data_version = 0; m_lambda = 0.; + m_table_phonetic_type = PINYIN_TABLE; + size_t i; for (i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) { pinyin_table_info_t * table_info = &m_table_info[i]; @@ -151,8 +156,18 @@ bool SystemTableInfo::load(const char * filename) { return false; } + TABLE_PHONETIC_TYPE type = PINYIN_TABLE; + char * str = NULL; + num = fscanf(input, "source table format:%ms", &str); + if (0 == strcmp("pinyin", str)) + type = PINYIN_TABLE; + if (0 == strcmp("zhuyin", str)) + type = ZHUYIN_TABLE; + free(str); + #if 0 printf("binver:%d modelver:%d lambda:%f\n", binver, modelver, lambda); + printf("type:%d\n", type); #endif m_binary_format_version = binver; |