def compute_ttr(tokens):
    """
    Calculates the Type Token Ratio

    Parameters
    ----------
    tokens : array
        The list of tokens to measure
    """

    l = len(tokens)
    if l == 0:
        ttr = 0
    else:
        ttr = len(set(tokens)) / l
    return ttr