code: def _get_ngrams(n, text):
    
    ngram_set = set()
    text_length = len(text)
    max_index_ngram_start = text_length - n
    for i in range(max_index_ngram_start + 1):
      ngram_set.add(tuple(text[i:i + n]))
    return ngram_set
docs: Calculates n-grams.
  
    Args:
      n: which n-grams to calculate
      text: An array of tokens
  
    Returns:
      A set of n-grams