R1j1t / contextualSpellCheck

✔️Contextual word checker for better suggestions
MIT License
405 stars 56 forks source link

[BUG] compatibility issue with spacy v3 #48

Closed virdiprateek closed 3 years ago

virdiprateek commented 3 years ago

I'm testing the way it's mentioned in the examples as follows:

import spacy
from contextualSpellCheck import ContextualSpellCheck

nlp = spacy.load("en_core_web_sm")
checker = ContextualSpellCheck(max_edit_dist=100)
nlp.add_pipe(checker)

doc = nlp("Income was $9.4 milion compared to the prior year of $2.7 milion.")
print(doc._.outcome_spellCheck)

Getting error:

`nlp.add_pipe` now takes the string name of the registered component factory, not a callable component. Expected string, but got <contextualSpellCheck.contextualSpellCheck.ContextualSpellCheck object at 0x7f923add6c10> (name: 'None')

Can you please suggest the fix for this??

jonmun commented 3 years ago

This is due to changes introduced in spacy v3: https://nightly.spacy.io/usage/v3#migrating-add-pipe

I've submitted a pull request to fix this issues.

R1j1t commented 3 years ago

@virdiprateek as mentioned by @jonmun there might be some issues when using the package with spacy v3. As a temporary solution you can downgrade the spacy to v2.x (if possible for your use case). In the mean time I will check and merge #49 to fix the issue.

Thanks you @jonmun for the PR!!

R1j1t commented 3 years ago

@virdiprateek I have updated contextualSpellCheck 0.3.4

Please try to install the latest package and you will not face this issue. In the mean time I will work on spacy v3 compatibility which I hope to release in a couple of days.