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

Repeated parseToNode calls invalidate char_type #98

Open
polm opened this issue Nov 19, 2024 · 0 comments
Open

Repeated parseToNode calls invalidate char_type #98

polm opened this issue Nov 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@polm
Copy link
Owner

polm commented Nov 19, 2024

See polm/cutlet#59 for details. Minimal repro:

from fugashi import Tagger
tagger = Tagger()
xx = tagger("日本語")
print(xx[0].char_type) # => 2
tagger("にほんご") # note this is not assigned anywhere
print(xx[0].char_type) # => 6, this is wrong

This probably affects other members of cnode, so they'll have to be eagerly copied. This may have performance impact, though we'll have to put up with it.

There could be an "unsafe mode" that returns nodes that could be invalidated, but are faster because they don't trigger allocations. However I'm not sure there's much demand for more speed.

@polm polm added the bug Something isn't working label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant