yanyiwu / cppjieba

"结巴"中文分词的C++版本
MIT License
2.58k stars 691 forks source link

英文詞會被切成一個個字符 #146

Closed Shanboy5566 closed 3 weeks ago

Shanboy5566 commented 4 years ago

使用原本的預設字典,唯USER_DICT_PATH使用我自己的

hmm調成false的情況下oov的英文會變成一個個character martin => m/a/r/t/i/n 但如果調成true的話就不會,不過這樣可能會切出新詞

請問有沒有hmm=false下成功把英文完整切出來的方法?

PierreZhangcw commented 4 years ago

在cppjieba里目前还做到这个功能,想要实现的话需要自己修改源代码。但是在python版本的jieba里面,把HMM设置为False的情况下,英文依旧是可以分对的。在对英文和数字的处理上,pyjieba是先进行英文数字的处理,再把余下的丢给HMM模型处理,cppjieba则是在HMM模型中进行英文数字的处理。

catqaq commented 3 years ago

cppjieba针对英文数字等的处理是通过规则来完成的,但目前这些规则是和hmm耦合在一起的。因此只需要将这部分规则和hmm解耦即可,当然需要注意一些边界的处理。

github-actions[bot] commented 1 month ago

This issue has not been updated for over 1 year and will be marked as stale. If the issue still exists, please comment or update the issue, otherwise it will be closed after 7 days.

github-actions[bot] commented 3 weeks ago

This issue has been automatically closed due to inactivity. If the issue still exists, please reopen it.