更新insertUserWord的示例程序

This commit is contained in:
yanyiwu 2015-06-27 13:16:25 +08:00
parent d33c09d74a
commit 2ae6eba3a7

View File

@ -12,37 +12,48 @@ int main(int argc, char** argv) {
string result;
string s = "我是拖拉机学院手扶拖拉机专业的。不用多久我就会升职加薪当上CEO走上人生巅峰。";
cout << "\n\e[32m" << "[demo] METHOD_MP" << "\e[0m\n"; // colorful
cout << "[demo] DEFAULT" << endl;
app.cut(s, words);
cout << join(words.begin(), words.end(), "/") << endl;
cout << "[demo] METHOD_MP" << endl;
app.cut(s, words, METHOD_MP);
cout << join(words.begin(), words.end(), "/") << endl;
cout << "\n\e[32m" << "[demo] METHOD_HMM" << "\e[0m\n"; // colorful
cout << "[demo] METHOD_HMM" << endl;
app.cut(s, words, METHOD_HMM);
cout << join(words.begin(), words.end(), "/") << endl;
cout << "\n\e[32m" << "[demo] METHOD_MIX" << "\e[0m\n"; // colorful
cout << "[demo] METHOD_MIX" << endl;
app.cut(s, words, METHOD_MIX);
cout << join(words.begin(), words.end(), "/") << endl;
cout << "\n\e[32m" << "[demo] METHOD_FULL" << "\e[0m\n"; // colorful
app.cut(s, words, METHOD_FULL);
cout << join(words.begin(), words.end(), "/") << endl;
cout << "[demo] METHOD_FULL" << endl;
app.cut(s, words, METHOD_FULL);
cout << join(words.begin(), words.end(), "/") << endl;
cout << "\n\e[32m" << "[demo] METHOD_QUERY" << "\e[0m\n"; // colorful
app.cut(s, words, METHOD_QUERY);
cout << join(words.begin(), words.end(), "/") << endl;
cout << "[demo] METHOD_QUERY" << endl;
app.cut(s, words, METHOD_QUERY);
cout << join(words.begin(), words.end(), "/") << endl;
cout << "\n\e[32m" << "[demo] TAGGING" << "\e[0m\n"; // colorful
cout << "[demo] TAGGING" << endl;
vector<pair<string, string> > tagres;
app.tag(s, tagres);
cout << s << endl;
cout << tagres << endl;;
cout << "\n\e[32m" << "[demo] KEYWORD" << "\e[0m\n"; // colorful
cout << "[demo] KEYWORD" << endl;
vector<pair<string, double> > keywordres;
app.extract(s, keywordres, 5);
cout << s << endl;
cout << keywordres << endl;
cout << "[demo] Insert User Word" << endl;
app.cut("男默女泪", words);
cout << join(words.begin(), words.end(), "/") << endl;
app.insertUserWord("男默女泪");
app.cut("男默女泪", words);
cout << join(words.begin(), words.end(), "/") << endl;
return EXIT_SUCCESS;
}