diff options
author | Peng Wu <alexepico@gmail.com> | 2015-10-16 13:40:42 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2015-10-16 13:40:42 +0800 |
commit | 3d38c9355a73b58f327aa370a9290b8ff5fb349e (patch) | |
tree | 817767c2cd0af98c3fb75ca8346eac1f306edf41 /tests/storage | |
parent | 16ab6e9d719acd02a1dbe65f8255fc65c06fbda2 (diff) | |
download | libpinyin-3d38c9355a73b58f327aa370a9290b8ff5fb349e.tar.gz libpinyin-3d38c9355a73b58f327aa370a9290b8ff5fb349e.tar.xz libpinyin-3d38c9355a73b58f327aa370a9290b8ff5fb349e.zip |
update test_parser2.cpp
Diffstat (limited to 'tests/storage')
-rw-r--r-- | tests/storage/test_parser2.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/storage/test_parser2.cpp b/tests/storage/test_parser2.cpp index 45199f4..a9a34e8 100644 --- a/tests/storage/test_parser2.cpp +++ b/tests/storage/test_parser2.cpp @@ -31,20 +31,16 @@ static const gchar * parsername = ""; static gboolean incomplete = FALSE; +static const gchar * schemename = ""; static GOptionEntry entries[] = { - {"parser", 'p', 0, G_OPTION_ARG_STRING, &parsername, "parser", "fullpinyin doublepinyin chewing"}, + {"parser", 'p', 0, G_OPTION_ARG_STRING, &parsername, "parser", "fullpinyin doublepinyin zhuyin pinyindirect zhuyindirect"}, {"incomplete", 'i', 0, G_OPTION_ARG_NONE, &incomplete, "incomplete pinyin", NULL}, + {"scheme", 's', 0, G_OPTION_ARG_STRING, &schemename, "scheme", "standard hsu dachen26"}, {NULL} }; -#if 0 - " -s <scheme> specify scheme for doublepinyin/chewing.\n" - " schemes for doublepinyin: zrm, ms, ziguang, abc, pyjj, xhe.\n" - " schemes for chewing: standard, ibm, ginyieh, eten.\n" -#endif - size_t bench_times = 1000; @@ -64,7 +60,7 @@ int main(int argc, char * argv[]) { pinyin_option_t options = PINYIN_CORRECT_ALL | USE_TONE | USE_RESPLIT_TABLE; if (incomplete) - options |= PINYIN_INCOMPLETE | CHEWING_INCOMPLETE; + options |= PINYIN_INCOMPLETE | ZHUYIN_INCOMPLETE; PhoneticParser2 * parser = NULL; ChewingKeyVector keys = g_array_new(FALSE, FALSE, sizeof(ChewingKey)); @@ -76,10 +72,21 @@ int main(int argc, char * argv[]) { parser = new FullPinyinParser2(); } else if (strcmp("doublepinyin", parsername) == 0) { parser = new DoublePinyinParser2(); - } else if (strcmp("chewing", parsername) == 0) { - parser = new ChewingParser2(); + } else if (strcmp("zhuyin", parsername) == 0) { + if (strcmp("standard", schemename) == 0) { + parser = new ZhuyinSimpleParser2(); + } else if (strcmp("hsu", schemename) == 0) { + parser = new ZhuyinDiscreteParser2(); + } else if (strcmp("dachen26", schemename) == 0) { + parser = new ZhuyinDaChenCP26Parser2(); + } + } else if (strcmp("pinyindirect", parsername) == 0) { + parser = new PinyinDirectParser2(); + } else if (strcmp("zhuyindirect", parsername) == 0) { + parser = new ZhuyinDirectParser2(); } + if (!parser) parser = new FullPinyinParser2(); |