zverok/spylls

It takes too long time to return an answer on a corner case

SanyueHan opened this issue · 1 comments

It seems that you implemented some algorithm that has a complexity related to the length of the input for "dictionary.lookup()", for example, the following script takes seconds to return an answer:

from spylls.hunspell import Dictionary

HUNSPELL_DICT = Dictionary.from_files('en_US')

text = "-" * 40
print(HUNSPELL_DICT.lookup(text))

I know this may not be an expected input for your design, but I suggest adding some shortcut to reduce the processing time for this kind of input that is obviously invalid

I will happily accept the PR :)
(Just keep in mind that the first and the main goal of spylls is to "demonstrate how the algorithm is structured", so the guards for edge cases should be carefully designed to not obscure the main flow)