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

create pre-tokenizer with surface-projection does not override dictionary-projection #259

Open
mh-northlander opened this issue Jun 10, 2024 · 0 comments
Labels
python Python binding-related

Comments

@mh-northlander
Copy link
Collaborator

Creating pre-tokenizer with surface-projection specified does not overrides the projection of dictionary.

In test:

def test_projection_surface_override(self):
dictobj = sudachipy.Dictionary(config=sudachipy.config.Config(projection="reading"))
pretok = dictobj.pre_tokenizer(sudachipy.SplitMode.A, projection="surface")
vocab = {
"[UNK]": 0,
"サケ": 1,
"ヒト": 2,
"ノム": 3,
"ヲ": 5,
"外国人参政権": 4
}
tok = tokenizers.Tokenizer(WordLevel(vocab, unk_token="[UNK]"))
tok.pre_tokenizer = pretok
res = tok.encode("酒を飲む人")
self.assertEqual(res.ids, [1, 5, 3, 2])

Is this intentional or bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Python binding-related
Projects
None yet
Development

No branches or pull requests

1 participant