      return [text_labels[int(i)] for i in labels]
  
  def grad_clipping(params, theta, ctx):
      """Clip the gradient."""
      if theta is not None:
          norm = nd.array([0.0], ctx)
          for param in params:
              norm += (param.grad ** 2).sum()
 
</s>
def get_tokenized_imdb(train_data, test_data):
    """Get the tokenized IMDB data set for sentiment analysis."""
    def tokenizer(text):
        return [tok.lower() for tok in text.split(' ')]

    train_tokenized = []
    for review, score in train_data:
        train_tokenized.append(tokenizer(review))
    test_tokenized = []
    for review, score in test_data:
        test_tokenized.append(tokenizer(review))
    return train_tokenized, test_tokenized


      return [text_labels[int(i)] for i in labels]
  
def get_tokenized_imdb(train_data, test_data):
    """Get the tokenized IMDB data set for sentiment analysis."""
    def tokenizer(text):
        return [tok.lower() for tok in text.split(' ')]

    train_tokenized = []
    for review, score in train_data:
        train_tokenized.append(tokenizer(review))
    test_tokenized = []
    for review, score in test_data:
        test_tokenized.append(tokenizer(review))
    return train_tokenized, test_tokenized


  def grad_clipping(params, theta, ctx):
      """Clip the gradient."""
      if theta is not None:
          norm = nd.array([0.0], ctx)
          for param in params:
              norm += (param.grad ** 2).sum()
keep add keep keep keep keep keep keep
 revise textcnn code and utils
gluonbook/utils.py