diff --git a/test/make.sh b/test/make.sh index 4103b9b..8f3b624 100755 --- a/test/make.sh +++ b/test/make.sh @@ -1 +1,2 @@ g++ -o segment.demo segment.cpp -std=c++0x -L/usr/lib/CppJieba -lcppjieba +g++ -o test_performance test_performance.cpp -std=c++0x -O3 diff --git a/test/test_performance.cpp b/test/test_performance.cpp new file mode 100644 index 0000000..a9a5fb5 --- /dev/null +++ b/test/test_performance.cpp @@ -0,0 +1,60 @@ +#include +#include +#include "../src/Limonp/ArgvContext.hpp" +#include "../src/MPSegment.hpp" +#include "../src/HMMSegment.hpp" +#include "../src/MixSegment.hpp" + +using namespace CppJieba; + +void cut(const ISegment * seg, const char * const filePath) +{ + ifstream ifile(filePath); + vector res; + string line; + while(getline(ifile, line)) + { + if(!line.empty()) + { + res.clear(); + seg->cut(line, res); + //cout<