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

Can I use a user dictionary? #65

Open
mumumu09chi opened this issue May 12, 2023 · 2 comments
Open

Can I use a user dictionary? #65

mumumu09chi opened this issue May 12, 2023 · 2 comments

Comments

@mumumu09chi
Copy link

I want to use userdictinary.
How to use?

@mh-northlander
Copy link
Collaborator

BertSudachipyTokenizer takes argument sudachipy_kwargs, that is used to initialize the sudachi tokenizer.

self.word_tokenizer = SudachipyWordTokenizer(**(self.sudachipy_kwargs or {}))

https://github.com/WorksApplications/SudachiTra/blob/3f4a6c3a976a2b047a7714192928e7ac229fa699/sudachitra/sudachipy_word_tokenizer.py#L47C1-L71C12

Prepare config file (see user dictionary section) and provide it via config_path like sudachipy_kwargs={"config_path": "path/to/your/config"}.

Note that the final output of sudachiTra tokenizer depends on its vocabulary and user-defined words may be split based on that.

@eiennohito
Copy link
Collaborator

With the latest version it is possible to pass sudachipy.config.Config object, passing it (or its json representation) as a config_path parameter. This change was made specially for using Sudachi inside tokenizers while keeping backward compatibility.

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

3 participants