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

Any way to override the native Jieba dictionary? #980

Open
haveamission opened this issue Nov 19, 2022 · 1 comment
Open

Any way to override the native Jieba dictionary? #980

haveamission opened this issue Nov 19, 2022 · 1 comment

Comments

@haveamission
Copy link

I want to segment ONLY words that are in a limited, custom dictionary. Everything else, I want to separate into individual characters. Is there a way to do this with jieba? Or I must I do this in a post-processing step? load_userdict seems to only add words, not replace current dictionary

@brynne8
Copy link

brynne8 commented Mar 3, 2023

I think it's possible to replace the default dictionary, as it has a CLI option -D DICT, --dict DICT which can use DICT as the dictionary used by jieba. And it seems

jieba.set_dictionary('data/dict.txt.big')

could set dictionary path when loading jieba as a library.

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

2 participants