INNER CODE UNIT · Python
token_suggestion_spell_check
R1j1t/contextualSpellCheck · contextualSpellCheck/contextualSpellCheck.py:458
def token_suggestion_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','
suggestion-1',...]
"""
for suggestion in token.doc._.suggestions_spellCheck.keys():
if token.i == suggestion.i:
if token.text_with_ws == suggestion.text_with_ws:
return token.doc._.suggestions_spellCheck[suggestion]
else:
warnings.warn(
"Position of tokens modified by downstream element "