INNER CODE UNIT · Python
__call__
R1j1t/contextualSpellCheck · contextualSpellCheck/contextualSpellCheck.py:143
def __call__(self, doc):
"""
call function for the class. Used in spacy pipeline
Args:
doc {`Spacy.Doc`}: Spacy Doc Object
Returns:
`Spacy.Doc`: Updated doc object with custom extensions values
"""
if self.performance:
model_loaded = datetime.now()
misspell_tokens, doc = self.misspell_identify(doc)
self.time_log("Misspell Identification took: ", model_loaded)
if len(misspell_tokens) > 0:
model_loaded = datetime.now()
doc, candidate = self.candidate_generator(doc, misspell_tokens)
self.time_log("Candidate Generator took: ", model_loaded)