Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

结巴对自定义的英文词不生效吗? #930

Closed
minmie opened this issue Jun 29, 2021 · 0 comments
Closed

结巴对自定义的英文词不生效吗? #930

minmie opened this issue Jun 29, 2021 · 0 comments

Comments

@minmie
Copy link

minmie commented Jun 29, 2021

import jieba

print('添加新词前')
q = 'abb123plus'
res = jieba.lcut(q, HMM=False, cut_all=True)
print(res)
q = '青眼白龙'
res = jieba.lcut(q, HMM=False, cut_all=True)
print(res)


print('添加新词后')
jieba.add_word("青眼白龙")
jieba.add_word('abb123')

q = 'abb123plus'
res = jieba.lcut(q, HMM=False, cut_all=True)
print(res)

q = '青眼白龙'
res = jieba.lcut(q, HMM=False, cut_all=True)
print(res)

jieba.suggest_freq('abb123', True)
q = 'abb123plus'
res = jieba.lcut(q, HMM=False, cut_all=True)
print(res)

输出结果:

添加新词前
['abb123plus']
['青眼', '眼白', '龙']
添加新词后
['abb123plus']
['青眼', '青眼白龙', '眼白', '龙']
['abb123plus']

请问结巴对自定义的英文词不生效吗,abb123并没有分出来。

@minmie minmie closed this as completed Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant