diff --git a/Makefile b/Makefile index 0536b1c..69ecac6 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ all: demo $(CC) $(CCOPT) $< demo: $(OBJS) $(SRCLIB) - $(DOLINK) -liconv + $(DOLINK) $(SRCLIB): cd $(SRCDIR) && $(MAKE) diff --git a/demo.cpp b/demo.cpp index ad20839..13e886c 100644 --- a/demo.cpp +++ b/demo.cpp @@ -1,6 +1,9 @@ #include #include #include "src/KeyWordExt.h" +#include "src/cppcommon/str_functs.h" +#include "src/cppcommon/vec_functs.h" + using namespace std; using namespace CppJieba; @@ -8,33 +11,24 @@ using namespace CppJieba; int main() { KeyWordExt ext; + ext.init(); - if(!ext.init("./dicts/segdict.utf8.v2.1")) + if(!ext.loadSegDict("./dicts/segdict.gbk.v3.0")) { cerr<<"1"< res; - string title; - title = "我来到北京清华大学"; - res.clear(); - ext.extract(title, res, 10); + string line; + while(getline(ifile, line)) + { + res.clear(); + ext.extract(line, res, 20); + cout<