📄 jelusdictinterface.h
字号:
#ifndef __JELUSDICTINTERFACE_H__
#define __JELUSDICTINTERFACE_H__
#include <vector>
#include <string>
using namespace std;
#ifdef INSUN_DLL
#undef INSUN_DLL
#endif
#ifdef _USRDLL
#define INSUN_DLL __declspec(dllexport)
#else
#define INSUN_DLL
#endif
extern "C" //提供C语言形式的接口,用于管理词典!
{ //说明:本系统对于不释放的内存自动回收。
typedef int PELUSDICT;
INSUN_DLL PELUSDICT NewDict(const char * ADictFileName, bool AAppendSpecialWordFlag = true);
//创建,然后打开一个词典文件
INSUN_DLL PELUSDICT LoadDict(const char * ADictFileName);
//如果装载成功返回相应的指针不为NULL,失败返回NULL,并且可以通过GetErrorCode()返回相应的错误码!
INSUN_DLL bool SaveDict(const char * ADictFileName, PELUSDICT ADict);
//保存词典
INSUN_DLL bool FreeDict(PELUSDICT ADict); //释放指定的词典,成功释放返回true,失败释放(例如词典指针错误),则返回false
INSUN_DLL int FreeAllDict(); //释放所有被打开的词典。返回被释放的个数
////对于词典的管理操作
INSUN_DLL bool DictLoaded(PELUSDICT ADict);
INSUN_DLL int GetWordCount(PELUSDICT ADict);
INSUN_DLL int GetMaxAllocateID(PELUSDICT ADict);
INSUN_DLL int LookupWordID(const wchar_t * AWord ,PELUSDICT ADict);
////下面三个访问函数,如果不存在,返回空串
INSUN_DLL const wchar_t * LookupWord_ByID(const int AWordID ,PELUSDICT ADict); //如果不存在,返回空串
INSUN_DLL const char * LookupPOS_ByID(const int AWordID ,PELUSDICT ADict); //如果不存在,返回空串
//返回利用空格分隔的各个词性标记编号,例如值为:"2 3 7"
INSUN_DLL bool AppendSpecialWord(PELUSDICT ADict); //成功返回true,失败返回false。
INSUN_DLL int NewWord( const wchar_t * ANewWord ,PELUSDICT ADict); //成功时返回新建词的ID。如果返回0,代表添加新词不成功,例如该词已经存在或者ANewWord == ""。
INSUN_DLL bool SetWord_ByID(const wchar_t * AWord , const int AWordID, PELUSDICT ADict); //如果设置成功返回true,如果该词原来存在,或者AWord=="",则返回false。
INSUN_DLL bool SetPOS_ByID(const char * APosList, const int AWordID , PELUSDICT ADict);
//利用空格分隔的各个词性标记编号,例如APosList值为:"2 3 7"
INSUN_DLL bool DelWord_ByWord( const wchar_t * AWord , PELUSDICT ADict );
} //end extern "C"
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -