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

Infinite loop when suggesting #21

Open
dandiep opened this issue Apr 13, 2022 · 2 comments
Open

Infinite loop when suggesting #21

dandiep opened this issue Apr 13, 2022 · 2 comments

Comments

@dandiep
Copy link

dandiep commented Apr 13, 2022

It seems that for some words the generator from suggest() never finishes. I am using the French dictionary from Firefox as my datasource. This works:

dictionary = Dictionary.from_zip("./fr.xpi")

print(list(dictionary.suggest('sommes')))

This goes into an infinite loop:

print(list(dictionary.suggest('decouverte')))

Any ideas/suggestions?
Spylls version 0.1.7, Python 3.9.7

@zverok
Copy link
Owner

zverok commented Apr 27, 2022

@dandiep Sorry for late response (I am in Kharkiv, Ukraine, you know).

You sure it is infinite loop, not just very long suggestion? On my machine with the French dictionary I tried it took almost 8 min, but eventually returned ['découverte', 'recouverte', 'de couverte', 'de-couverte', 'couverte', 'couverture'].

Why it takes so long is a different question which I'll investigate at some point. Quick debug shows that nothing "too weird" happens, just with a French dictionary/alphabet and a long word the amount of hypotheses to check is huge; but I need to compare it with what hunspell does, maybe it optimizes it away somehow (or maybe the Python implementation is just that slow).

@dandiep
Copy link
Author

dandiep commented Jul 13, 2023

Is there anyway to make it opt out of some of the more intensive searching so I can guarantee that this will return quickly?

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