Recently in the study of text mining, for Chinese text, first of all to do word segmentation, then the use of the nlpir participle system. Summarize the information on the Internet: The following describes how to call the Nlpir word breaker in C + +:
Step 1: Download the latest version of the Nlpir word breaker: http://ictclas.nlpir.org/. After decompression, such as:
Step 2: Open the IDE (I'm using Eclipse) to create a new C + + engineering Nlpir, and then find data, NLPIR.h, NLPIR.lib, NLPIR.dll from the extracted files above, and copy them to the project you just created:
Step 3: Add library file, right-click Project nlpir->properties->c/c++ BUILD->SETTINGS->MINGW C + + linker->libraries
Step 4: Test code:
#include"NLPIR.h"#include<stdio.h>#include<string.h>intMainintargcChar*argv[]) { Charssentence[ -]; Const Char*Sresult; if(!Nlpir_init ()) {printf ("Init fails\n"); return-1; } printf ("Input sentence now (' Q ' to quit)!\n"); scanf ("%s", ssentence); while(_STRICMP (Ssentence,"Q")!=0) {Sresult= Nlpir_paragraphprocess (Ssentence,0); printf ("%s\ninput string Now (' Q ' to quit)!\n", Sresult); scanf ("%s", ssentence); } nlpir_exit (); return 0;}
View Code
Eclipse C + + calls Nlpir Word system