C + + calls Nlpir word breaker under eclipse

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.