INNER CODE UNIT · Python
token_score_spell_check
R1j1t/contextualSpellCheck · contextualSpellCheck/contextualSpellCheck.py:481
def token_score_spell_check(token):
"""
Getter for Token attributes.
Args:
token {`Spacy.Token`} :Token object for the value should be returned
Returns:
List :If no suggestions: [] else: List[('suggestion-1',score-1),
('suggestion-1',score-2), ...]
"""
if token.doc._.score_spellCheck is None:
return []
for suggestion in token.doc._.score_spellCheck.keys():
if token.i == suggestion.i:
if token.text == suggestion.text:
return token.doc._.score_spellCheck[suggestion]
else: