...0]=> array(5) { ["word"]=> string(7) "GMhello" ["off"]=> int(0) ["len"]=> int(7) ["idf"]=> float(4.86477518082) ["attr"]=> string(2) "en" } } "GM"和"hello"被合并了且"attr"变成了"en"而不是定义的"*",而"hello指导员"被拆分了。 实际...
[quote]int scws_has_word(scws_t s, char *xattr) { int off, cnt, xmode = SCWS_NA; scws_res_t res, cur; char *word; word_attr *at = NULL; if (!s || !s->txt) return 0; __PARSE_XATTR__; // save the offset. (cnt -> return_value) off = s->off; ...
#include #include int main() { scws_t s; scws_res_t res, cur; char *text = "Hello, 我名字叫李那曲是一个中国人, 我有时买Q币来玩, 我还听说过C#语言"; int i; if (!(s = scws_new())) { printf("error, can't init the scws_t!\n"); ...
...代码 [code]void scws_free_tops(scws_top_t tops) { scws_top_t cur; int len; int b; while ((cur = tops) != NULL) { tops = cur->next; if (cur->word) { OutputDebugStringA(cur->word);//能正常输出能容 len = strlen(cur->word);//长度都正确 b = ('\0'==cur->word[...
[quote='backluck' pid='3650' dateline='1280380226'] [quote]int scws_has_word(scws_t s, char *xattr) { int off, cnt, xmode = SCWS_NA; scws_res_t res, cur; char *word; word_attr *at = NULL; if (!s || !s->txt) return 0; __PARSE_XATTR__; // save th...
void scws_set_multi(scws_t s, int mode); 描述:设定分词执行时是否执行针对长词复合切分。(例如:中国人->中国+人+中国人)。参数 mode 表示复合分词法的级别,取值为 1 ~ 15。mode 设定值,1~15。[b]按位与[/b]的 1|2|4|8 依次表示 短词|二...
谢谢回复。 另外scws结构体中:unsigned char *mblen; unsigned int mode;这两个成员也应该是可以多个线程共用的。
...op_t next; }; 应该跟以下结构一致。 struct scws_result { int off; float idf; unsigned char len; char attr[3]; scws_res_t next; };