                           linewidth=2)
  
  
  def data_iter(batch_size, features, labels):
      """Iterate through a data set."""
      num_examples = len(features)
      indices = list(range(num_examples))
      random.shuffle(indices)
 
</s>
def count_tokens(samples):
    """Count tokens in the data set."""
    token_counter = collections.Counter()
    for sample in samples:
        for token in sample:
            if token not in token_counter:
                token_counter[token] = 1
            else:
                token_counter[token] += 1
    return token_counter


                           linewidth=2)
  
  
def count_tokens(samples):
    """Count tokens in the data set."""
    token_counter = collections.Counter()
    for sample in samples:
        for token in sample:
            if token not in token_counter:
                token_counter[token] = 1
            else:
                token_counter[token] += 1
    return token_counter


  def data_iter(batch_size, features, labels):
      """Iterate through a data set."""
      num_examples = len(features)
      indices = list(range(num_examples))
      random.shuffle(indices)
keep keep add keep keep keep keep keep
 revise textcnn code and utils
gluonbook/utils.py