(tokens: List[Any], n: int)
return ngrams
Creates ngrams from the given list of tokens.

  Args:
    tokens: A list of tokens from which ngrams are created.
    n: Number of tokens to use, e.g. 2 for bigrams.

  Returns:
    A dictionary mapping each ngram to the number of occurrences.
Creates ngrams from the given list of tokens.
Creates ngrams from the given list of tokens .
def _create_ngrams(tokens: List[Any], n: int) -> collections.Counter:
  """Creates ngrams from the given list of tokens.

  Args:
    tokens: A list of tokens from which ngrams are created.
    n: Number of tokens to use, e.g. 2 for bigrams.

  Returns:
    A dictionary mapping each ngram to the number of occurrences.
  """

  ngrams = collections.Counter()
  for i in range(len(tokens) - n + 1):
    ngrams[tuple(tokens[i:i + n])] += 1
  return ngrams
def _create_ngrams ( tokens : List [ Any ] , n : int ) -> collections . Counter : ngrams = collections . Counter ( ) for i in range ( len ( tokens ) - n + 1 ) : ngrams [ tuple ( tokens [ i : i + n ] ) ] += 1 return ngrams