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

wrong word segmentation result #116

Open
pineking opened this issue Mar 9, 2022 · 1 comment
Open

wrong word segmentation result #116

pineking opened this issue Mar 9, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@pineking
Copy link

pineking commented Mar 9, 2022

input_term="ilove my family"
suggestions = sym_spell.word_segmentation(input_term)

The result is still "ilove my family", the correct result should be "i love my family"

@mammothb mammothb added the bug Something isn't working label Mar 17, 2022
@mammothb
Copy link
Owner

mammothb commented Apr 2, 2022

Hi @pineking I have tried input term you used with the following code

import pkg_resources

from symspellpy.symspellpy import SymSpell

sym_spell = SymSpell(max_dictionary_edit_distance=0, prefix_length=7)
dictionary_path = pkg_resources.resource_filename(
    "symspellpy", "frequency_dictionary_en_82_765.txt"
)
sym_spell.load_dictionary(dictionary_path, term_index=0, count_index=1)

input_term = "ilove my family"
result = sym_spell.word_segmentation(input_term)
print(f"{result.corrected_string}, {result.distance_sum}, {result.log_prob_sum}")

and I was able to get the expected correct result of

i love my family, 1, -12.819643708790021

Can you try that code snippet and see if you can get the same result as I have?

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

2 participants