问题描述:使用scws中文分词工具分词,结果分出来的都是单词,,使用了设定分词(scws_set_multi(s, SCWS_MULTI_SHORT);),还是一样,求解怎么破??
环境信息:centos6.5,64位,虚拟机,基于C/C++
代码如下:
#include <scws.h> #include <stdio.h> #include <string.h> #include <stdlib.h> int main() { scws_t s; scws_res_t res, cur; char *text = "我名字叫风孝忠我是一个中国人,我买Q币玩游戏,我懂C++语言,我爱工作我爱老板\n"; if (!(s = scws_new())) { printf("error, can't init the scws_t!\n"); exit(-1); } scws_set_charset(s, "gbk"); scws_set_dict(s, "/usr/local/scws/etc/dict_chs_gbk.xdb", SCWS_XDICT_XDB); scws_set_rule(s, "/usr/local/scws/etc/rules.ini"); //设定分词 scws_set_multi(s, SCWS_MULTI_SHORT); scws_send_text(s, text, strlen(text)); while (res = cur = scws_get_result(s)) { while (cur != NULL) { printf("WORD: %.*s/ %s (IDF = %4.2f)\n", cur->len, text+cur->off, cur->attr, cur->idf); cur = cur->next; } scws_free_result(res); } scws_free(s); return 0; }