NLPIR简介及使用配置

 

  NLPIR汉语分词系统(又名ICTCLAS2013),主要功能包括中文分词;词性标注;命名实体识别;用户词典功能;支持GBK编码、UTF8编码、BIG5编码。新增微博分词、新词发现与关键词提取;

官方网址:http://ictclas.nlpir.org(地址一直在变,要是不能用直接搜NLPIR)

大数据论坛:http://www.bigdatabbs.com/forum.php?mod=forumdisplay&fid=64

资源下载

要是直接从官网下载最新版本,会一直配置出错,我已经整合了可用的资源,分享在网盘:http://pan.baidu.com/s/1c0hLarm

下载之后,在eclipse里面创建工程并且按照以下结构来搭建:

 

注意要点:

1 直接把kevin文件夹复制到src文件夹,使它成为如上所示的包结构;

2 file文件夹里面放着数据,比如词典,很多init错误都是因为这个文件夹的原因;

3 NLPIR_JNI.dll和NLPIR.dll放在根目录下。

 

测试代码:

 1 import java.io.UnsupportedEncodingException;
 2 
 3 import kevin.zhang.NLPIR;
 4 
 5 public class Init {
 6     public static void main(String[] args) throws UnsupportedEncodingException {
 7     NLPIR testNLPIR = new NLPIR();
 8     String argu = "./file/";
 9     System.out.println("NLPIR_Init...");
10     if (testNLPIR.NLPIR_Init(argu.getBytes("GB2312"), 0) == false) {
11         System.out.println("Init Fail!..");
12         return;
13     }
14     System.out.println("NLPIR_Success...");
15     testNLPIR.NLPIR_Exit();
16     }
17 }

看到下面的输出则表示eclipse工程已经成功配置

1 NLPIR_Init...
2 NLPIR_Success...

 

posted @ 2015-05-10 11:53  打小孩  阅读(4266)  评论(0编辑  收藏  举报