code: def _get_ngrams(n, text):
      """Calculates n-grams.
  
      Args:
        n: which n-grams to calculate
        text: An array of tokens
  
      Returns:
        A set of n-grams
      """
      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
  
file_path: tensor2tensor/tensor2tensor/utils/rouge.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 6 for calling a global function with example usage: _get_ngrams(n, text) and returns: ngram_set