Closed mammothb closed 2 years ago
This has been a fix introduced in v5.0 https://github.com/wolfgarbe/SymSpell#changes-in-v50 It ensures that suggestions for input_words with Length <= editDistanceMax are complete. E.g. input_word "axe" has a length <= maxEditDistance 5. One of the input_deletes becomes "". And then we have a match with the dictionary_delete "". And the dictionary_delete "" points to all dictionary_words with length <= maxEditDistance as suggestions.
All input words of length <= n are within maximum edit distance n of all dictionary words of length <=n .
Does this answer your question?
Yes, I understand how it works better now, thanks for the explanation!
I noticed a strange behavior with Edits method when
maxDictionaryEditDistance
is larger than some of the words being added the dictionary and would like to understand the rationale/reason behind it.The following code snippet replicate the observation
The list of deletes for the empty string
""
is(18652612) ["asdf", "qwer", "zxcv", "", ]
which contains all the dictionary words that are below themaxEditDistance
. I assume this is because at a max edit distance of 5, "asdf", "qwer", and "zxcv" which are 4 edit distance away from "" are viable candidates.However, may I know if there are cases where this entry will be actually selected and used to select a candidate? So far I can only think of doing
Lookup("", Verbosity.All)
but that will still return "" as the top result since it's an exact match but the other results are unused.