-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
ignore_term_with_digits doesn't work #100
Comments
Sorry about that, I tried your sample input by adapting an example from the documentation and I think it managed to give the output you were originally expecting. import pkg_resources
from symspellpy import SymSpell
sym_spell = SymSpell(max_dictionary_edit_distance=2, prefix_length=7)
dictionary_path = pkg_resources.resource_filename(
"symspellpy", "frequency_dictionary_en_82_765.txt"
)
bigram_path = pkg_resources.resource_filename(
"symspellpy", "frequency_bigramdictionary_en_243_342.txt"
)
# term_index is the column of the term and count_index is the
# column of the term frequency
sym_spell.load_dictionary(dictionary_path, term_index=0, count_index=1)
sym_spell.load_bigram_dictionary(bigram_path, term_index=0, count_index=2)
input_term = "005"
# max edit distance per lookup (per single word, not per whole input string)
suggestions = sym_spell.lookup_compound(
input_term, max_edit_distance=2, ignore_non_words=True, ignore_term_with_digits=True
)
# display suggestion term, edit distance, and term frequency
for suggestion in suggestions:
print(suggestion) Output: |
Thanks for the explanation. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MAX_EDIT_DISTANCE = 2
address_str = '005'
suggestions = city_state_spelling_corrector.lookup_compound(address_str,
max_edit_distance=MAX_EDIT_DISTANCE,
ignore_term_with_digits=True,
transfer_casing=False)
for suggestion in suggestions:
print(str(suggestion))
Here is the output
i di
The text was updated successfully, but these errors were encountered: