From 2ae6eba3a7119d89ddd813b7a18c64975b698b4c Mon Sep 17 00:00:00 2001 From: yanyiwu Date: Sat, 27 Jun 2015 13:16:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0insertUserWord=E7=9A=84?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/demo.cpp | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/test/demo.cpp b/test/demo.cpp index e1b1a1d..db0dcbc 100644 --- a/test/demo.cpp +++ b/test/demo.cpp @@ -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 > 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 > 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; }