INNER CODE UNIT · Python
candidate_ranking
R1j1t/contextualSpellCheck · contextualSpellCheck/contextualSpellCheck.py:362
def candidate_ranking(self, doc, misspellings_dict):
"""Ranking the candidates based on edit Distance
At present using a library to calculate edit distance
between actual word and candidate words. Candidate word
for which edit distance is lowest is selected. If least
edit distance is same then word with higher probability
is selected by default
Args:
misspellingsDict {Dict{`Token`:List[{str}]}}:
Original token is the key and candidate words are the values
Returns:
Dict{`Token`:{str}}: Eg of return type {misspell-1:'BEST-CANDIDATE'}
"""
response = {}