def tf(tokens):
    """ Compute TF
    Args:
        tokens (list of str): input list of tokens from tokenize
    Returns:
        dictionary: a dictionary of tokens to its TF values
    """
    d = {}
    for token in tokens:
        if token in d:
            d[token] += 1
        else:
            d[token] = 1
    token_count = len(tokens)
    for k in d:
        d[k] /= float(token_count)
    return d