-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
41 lines (33 loc) · 959 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <QCoreApplication>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
// #include <unistd.h>
#include "dicttrie.h"
using namespace ime_pinyin;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
DictTrie* dict_trie = new DictTrie();
bool success;
if (argc >= 3)
success = dict_trie->build_dict(argv[1], argv[2]);
else
success = dict_trie->build_dict("./dict/rawdict_utf16_65105_freq.txt",
"./dict/valid_utf16.txt");
if (success) {
printf("Build dictionary successfully.\n");
} else {
printf("Build dictionary unsuccessfully.\n");
return -1;
}
success = dict_trie->save_dict("./dict/dict_pinyin.dat");
if (success) {
printf("Save dictionary successfully.\n");
} else {
printf("Save dictionary unsuccessfully.\n");
return -1;
}
return a.exec();
}