def correction(sentence, pos):
word = sentence[pos]<EOL>cands = candidates(word)<EOL>if not cands:<EOL><INDENT>cands = candidates(word, False)<EOL><DEDENT>if not cands:<EOL><INDENT>return word<EOL><DEDENT>cands = sorted(cands, key=lambda w: P(w, sentence, pos), reverse=True)<EOL>cands = [c[<NUM_LIT:0>] for c in cands]<EOL>return cands<EOL>
Most probable spelling correction for word.