def _ngrams(sequence, order):
  """Yields all ngrams of given order in sequence."""
  assert order >= 1
  for n in range(order, len(sequence) + 1):
    yield tuple(sequence[n - order: n])
Yields all ngrams of given order in sequence.
language/table_text_eval/table_text_eval.py