def _truncate_seq(tokens_a, max_length):
  """Truncates a sequence  in place to the maximum length."""

  # This is a simple heuristic which will always truncate the sequence
  # one token at a time.
  while True:
    total_length = len(tokens_a)
    if total_length <= max_length:
      break
    tokens_a.pop()
Truncates a sequence  in place to the maximum length.
language/multivec/preprocessing/create_training_data.py