-
Notifications
You must be signed in to change notification settings - Fork 55
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
[BUG] Apostrophes #26
Comments
I tried running the given sentence and it worked as expected on my local. If there is no spelling correction then it returns >>> import spacy
>>> import contextualSpellCheck
>>> nlp = spacy.load("en")
>>> contextualSpellCheck.add_to_pipe(nlp)
<spacy.lang.en.English object at 0x7f911cef4a90>
>>> nlp.pipe_names
['tagger', 'parser', 'ner', 'contextual spellchecker']
>>> doc = nlp('Spell Checking based on Peter Norvig’s blog post.')
>>> doc._.outcome_spellCheck
''
>>> Please provide the code to replicate and version info of the package if you are not using the latest. |
nlp = spacy.load('en_core_web_lg')
spell_checker = ContextualSpellCheck(max_edit_dist=4)
nlp.add_pipe(spell_checker)
def correct_spelling(sentence):
global nlp
doc = nlp(sentence)
return doc._.outcome_spellCheck
print(correct_spelling("Pure Python Spell Checking based on Peter Norvig’s blog post on setting up a simple spell checking algorithm.")) Version:
|
Thanks @nicno90 I will have a look. |
I checked and have found the issue. When using contextualSpellCheck/contextualSpellCheck/contextualSpellCheck.py Lines 242 to 254 in 96cb79e
Thank you for identifying this issue! |
@R1j1t Thank you for looking into it! |
At present spacy does not seperate `'` with trailing s (not sure of anyother). So to generalise will seperate punct with trailing words and check in vocab. bug fix #26
@nicno90 I have added the fix and test cases. I have released it to PyPi in v0.3.2 |
Removing "s" after apostrophe
When apostrophes are in sentence yields weird results.
To Reproduce
Expected behavior
" 's " should not be touched.
Version (please complete the following information):
The text was updated successfully, but these errors were encountered: