中科院分词系统ICTCLAS50 (Linux)

1. 首先将需要用到的文件拷到相应目录下,包括:
Data(文件夹)
Configure.xml
ICTCLAS50.h
libICTCLAS50.a
libICTCLAS50.so
user.lic
2. 示例代码如下:

#ifndef OS_LINUX
#include <Windows.h>
#pragma comment(lib, "ICTCLAS50.lib") //ICTCLAS50.lib库加入到工程中
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include  <string>
#include "ICTCLAS50.h"

using namespace std;

void testParagraphProcessA()
{
	string sentence="我们先去打球了,你再接再厉!";// 需要分词内容
	LPICTCLAS_RESULT pVecResult;
	int nCount=0;
	pVecResult=ICTCLAS_ParagraphProcessA(sentence.c_str(),sentence.length(),nCount,CODE_TYPE_UNKNOWN,true);
	printf("nCount=%d\n\n",nCount);
	//输出分词结果时,可根据需要选择是否输出词性等信息
	for(int i=0;i<nCount;i++)
	{
	  string word=sentence.substr(pVecResult[i].iStartPos,pVecResult[i].iLength);
	  cout<<word<<endl;
	  printf("iStartPos= %d\n",pVecResult[i].iStartPos);
	  printf("iLength= %d\n",pVecResult[i].iLe
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值