#include #include #include #include #include "Limonp/ArgvContext.hpp" #include "MPSegment.hpp" #include "HMMSegment.hpp" #include "MixSegment.hpp" #include "FullSegment.hpp" #include "QuerySegment.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()) { cout << line << endl; res.clear(); if(!seg->cut(line, res)) { LogError("seg cut failed."); } else { print(join(res.begin(), res.end(), "/")); } } } } int main(int argc, char ** argv) { if(argc < 2) { cout<<"usage: \n\t"<\n" <<"options:\n" <<"\t--algorithm\tSupported methods are [cutDAG, cutHMM, cutFull, cutQuery, cutMix] for now. \n\t\t\tIf not specified, the default is cutMix\n" <<"\t--dictpath\tsee example\n" <<"\t--modelpath\tsee example\n" <<"\t--maxlen\tspecify the granularity of cut used in cutQuery. \n\t\t\tIf not specified, the default is 3\n" <<"example:\n" <<"\t"<