def _get_ngrams(n, text):
ngram_set = set()<EOL>text_length = len(text)<EOL>max_index_ngram_start = text_length - n<EOL>for i in range(max_index_ngram_start + <NUM_LIT:1>):<EOL><INDENT>ngram_set.add(tuple(text[i:i + n]))<EOL><DEDENT>return ngram_set<EOL>
Calcualtes n-grams.

    Args:
      n: which n-grams to calculate
      text: An array of tokens

    Returns:
      A set of n-grams