[转]CLucene+ICTCLAS中文分词整合
作者: 火车头 日期: 2008-02-28 05:02
计算所汉语词法分析系统ICTCLAS,有关它的信息http://sewm.pku.edu.cn/QA/reference/ICTCLAS/FreeICTCLAS/
一、生成动态库DLL或静态库Lib文件,并写好接口函数
bool ICT_INIT(int outputFormat,int operateType);
void ICT_FILEPROC(char *sFileName);
void ICT_SPLITWORDS(char *paremeter,char * &pResult);
二、参考lucene接口的实现,现在clucene的ictclas接口
/***********************************
** ictclas.h
/***********************************/
#ifndef _lucene_util_Ictclas_
#define _lucene_util_Ictclas_
一、生成动态库DLL或静态库Lib文件,并写好接口函数
bool ICT_INIT(int outputFormat,int operateType);
void ICT_FILEPROC(char *sFileName);
void ICT_SPLITWORDS(char *paremeter,char * &pResult);
二、参考lucene接口的实现,现在clucene的ictclas接口
/***********************************
** ictclas.h
/***********************************/
#ifndef _lucene_util_Ictclas_
#define _lucene_util_Ictclas_
#if defined(_LUCENE_PRAGMA_ONCE)
# pragma once
#endif
# pragma once
#endif
CL_NS_DEF(util)
class ICTCLAS
{
private:
static ICTCLAS *instance;
{
private:
static ICTCLAS *instance;
public:
ICTCLAS();
static ICTCLAS* getInstance();
static void doFile(const char *fileName);
static void doWord(char *sParagraph,char* &m_sResult);
~ICTCLAS();
};
ICTCLAS();
static ICTCLAS* getInstance();
static void doFile(const char *fileName);
static void doWord(char *sParagraph,char* &m_sResult);
~ICTCLAS();
};
CL_NS_END
#endif
/***********************************
** ictclas.cpp
/***********************************/
#include "Ictclas.h"
#endif
/***********************************
** ictclas.cpp
/***********************************/
#include "Ictclas.h"
#ifndef _lucene_analysis_standard_StandardIctclas_
#define _lucene_analysis_standard_StandardIctclas_
#pragma comment(lib,"ICTCLASSLIB.lib")
//#define DLLIMPORT _declspec(dllimport)
#define DLLEXPORT __declspec( dllexport )
DLLEXPORT bool init(int,int);
DLLEXPORT void fileProcess(const char *fileName);
DLLEXPORT void splitWords(char *sParagraph,char* &m_sResult);
#endif
#define _lucene_analysis_standard_StandardIctclas_
#pragma comment(lib,"ICTCLASSLIB.lib")
//#define DLLIMPORT _declspec(dllimport)
#define DLLEXPORT __declspec( dllexport )
DLLEXPORT bool init(int,int);
DLLEXPORT void fileProcess(const char *fileName);
DLLEXPORT void splitWords(char *sParagraph,char* &m_sResult);
#endif
CL_NS_DEF(util)
ICTCLAS* ICTCLAS::instance=NULL;
ICTCLAS::ICTCLAS()
{
init(0,0);
}
{
init(0,0);
}
ICTCLAS* ICTCLAS::getInstance(){
if (instance==NULL)
{
instance = new ICTCLAS();
}
return instance;
}
if (instance==NULL)
{
instance = new ICTCLAS();
}
return instance;
}
void ICTCLAS::doFile(const char *fileName){
fileProcess(fileName);
}
fileProcess(fileName);
}
void ICTCLAS::doWord(char *sParagraph,char* &m_sResult){
splitWords(sParagraph,m_sResult);
}
splitWords(sParagraph,m_sResult);
}
ICTCLAS::~ICTCLAS(){
}
CL_NS_END
评论: 5 |
引用: 0 |
阅读: 3611
发表评论
订阅
上一篇
返回
下一篇
chi hair irons,
chi hair straighteners,
chi hair tools,
ceramic flat iron,
chi straightening iron,
flat iron reviews,
ceramic flat iron,
chi flat irons tools,
ceramic flat iron reviews,