def _num_ngrams(words, n):
    """
    Return the number of nth gram of words.

    >>> _num_ngrams([1, 2, 3], 3)
    1
    >>> _num_ngrams([1, 2, 3], 2)
    2

    :param words: a list of tokens.
    :param n: int.
    :return: number of n-gram.
    """
    return max(len(words) - n + 1, 0)