#include "ICTCLAS50.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char **argv) {
// char * sResult;
if(!ICTCLAS_Init()){
printf("init fail\n");
return -1;
}
else{
printf("ok\n");
}
ICTCLAS_SetPOSmap(ICT_POS_MAP_FIRST);
const char *sParagraph="24小时降雪量24小时降雨量863计划ABC防护训练";
int nPaLen = strlen(sParagraph);
char * sRst=0;
int nRstLen = 0;
sRst = (char *)malloc(nPaLen*6);
nRstLen = ICTCLAS_ParagraphProcess(sParagraph,nPaLen,sRst,CODE_TYPE_UNKNOWN,0);
printf("%s\n",sRst);
unsigned int nItems = 0;
nItems = ICTCLAS_ImportUserDictFile("userdict.txt",CODE_TYPE_UNKNOWN);
// const char * buf = "降雪量;降雨量;计划";
// nItems = ICTCLAS_ImportUserDict(buf,strlen(buf),CODE_TYPE_UNKNOWN);
printf("nItems = %u\n",nItems);
nRstLen = ICTCLAS_ParagraphProcess(sParagraph,nPaLen,sRst,CODE_TYPE_UNKNOWN,0);
printf("%s\n",sRst);
//
free(sRst);
int nRst;
LPICTCLAS_RESULT Result=NULL;
Result= ICTCLAS_ParagraphProcessA(sParagraph,nPaLen,nRst,CODE_TYPE_UNKNOWN,1);
printf("nRst = %d\n",nRst);
for(int i=0;i<nRst;++i){
printf("length=%d,pos=%d,startpos=%d,weight=%d,wordid=%d,wordtype=%d,sz=%s\n",
Result[i].iLength,Result[i].iPOS,Result[i].iStartPos,Result[i].iWeight,Result[i].iWordID,
Result[i].iWordType,Result[i].szPOS);
}ICTCLAS_ResultFree(Result);
ICTCLAS_FileProcess("Text.txt","TextResult.txt",CODE_TYPE_UNKNOWN,0);
// ICTCLAS_SaveTheUsrDic();
ICTCLAS_Exit();
return 0;
}