How to Make spelling correction for custom entity in Spacy

35 Views Asked by At

I want to do spelling correction for Custom entity like apple , banana etc .

I created one vocal file "testvocab.txt" with below content apple

banana

cherry

date

and passed that file to ContextualSpellCheck.

import spacy

from contextualSpellCheck import ContextualSpellCheck

nlp = spacy.load("en_core_web_sm")

pipeline = nlp.add_pipe("contextual spellchecker", last=True)

ContextualSpellCheck(nlp=nlp, name="my_contextual_spellchecker",vocab_path="testvocab.txt")

doc = nlp('can i buy aple')

print(doc._.outcome_spellCheck)

the output i am getting as below

can i buy?

i am expecting

can i buy apple.

0

There are 0 best solutions below