Correct a list of tokens, according to the term_freq

def correct(tokens, term_freq):
    """
    Correct a list of tokens, according to the term_freq
    """
    log = []
    output = []
    for token in tokens:
        corrected = _correct(token, term_freq)
        if corrected != token:
            log.append((token, corrected))
        output.append(corrected)
    return output, log