from typing import Counter


def term_freq(tokens: list[str]) -> dict:
    """
    Takes in a list of tokens (str) and return a dictionary of term frequency of each token
    """
    term_count = Counter(tokens)
    n = len(tokens)
    return {term: count/n for term, count in term_count.items()}