class_docstr: The model used for text classification with WordEmbedding as its first layer.
  
  # Arguments
  class_num: The number of text categories to be classified. Positive int.
  embedding_file: The path to the word embedding file.
                  Currently only the following GloVe files are supported:
                  "glove.6B.50d.txt", "glove.6B.100d.txt", "glove.6B.200d.txt"
                  "glove.6B.300d.txt", "glove.42B.300d.txt", "glove.840B.300d.txt".
                  You can download from: https://nlp.stanford.edu/projects/glove/.
  word_index: Dictionary of word (string) and its corresponding index (int).
              The index is supposed to start from 1 with 0 reserved for unknown words.
              During the prediction, if you have words that are not in the word_index
              for the training, you can map them to index 0.
              Default is None. In this case, all the words in the embedding_file will
              be taken into account and you can call
              WordEmbedding.get_word_index(embedding_file) to retrieve the dictionary.
  sequence_length: The length of a sequence. Positive int. Default is 500.
  encoder: The encoder for input sequences. String. 'cnn' or 'lstm' or 'gru' are supported.
           Default is 'cnn'.
  encoder_output_dim: The output dimension for the encoder. Positive int. Default is 256.
class_docstr_tok: ["The","model","used","for","text","classification","with","WordEmbedding","as","its","first","layer",".","#","Arguments","class_num",":","The","number","of","text","categories","to","be","classified",".","Positive","int",".","embedding_file",":","The","path","to","the","word","embedding","file",".","Currently","only","the","following","GloVe","files","are","supported",":","``","glove.6B.50d.txt","''",",","``","glove.6B.100d.txt","''",",","``","glove.6B.200d.txt","''","``","glove.6B.300d.txt","''",",","``","glove.42B.300d.txt","''",",","``","glove.840B.300d.txt","''",".","You","can","download","from",":","https",":","\/\/nlp.stanford.edu\/projects\/glove\/",".","word_index",":","Dictionary","of","word","(","string",")","and","its","corresponding","index","(","int",")",".","The","index","is","supposed","to","start","from","1","with","0","reserved","for","unknown","words",".","During","the","prediction",",","if","you","have","words","that","are","not","in","the","word_index","for","the","training",",","you","can","map","them","to","index","0",".","Default","is","None",".","In","this","case",",","all","the","words","in","the","embedding_file","will","be","taken","into","account","and","you","can","call","WordEmbedding.get_word_index","(","embedding_file",")","to","retrieve","the","dictionary",".","sequence_length",":","The","length","of","a","sequence",".","Positive","int",".","Default","is","500.","encoder",":","The","encoder","for","input","sequences",".","String",".","'cnn","'","or","'lstm","'","or","'gru","'","are","supported",".","Default","is","'cnn","'",".","encoder_output_dim",":","The","output","dimension","for","the","encoder",".","Positive","int",".","Default","is","256","."]
code: def __init__(
      self,
      class_num,
      embedding_file,
      word_index=None,
      sequence_length=500,
      encoder="cnn",
      encoder_output_dim=256,
      **kwargs,
  ):
      if "token_length" in kwargs:
          kwargs.pop("token_length")
          warnings.warn(
              'The "token_length" argument in TextClassifier has been deprecated '
              'since 0.3.0, instead you should pass the arguments "embedding_file" '
              'and "word_index" to construct a TextClassifier with WordEmbedding '
              "as the first layer."
          )
      if "bigdl_type" in kwargs:
          kwargs.pop("bigdl_type")
          self.bigdl_type = kwargs.get("bigdl_type")
      else:
          self.bigdl_type = "float"
      if kwargs:
          raise TypeError(
              "Wrong arguments for TextClassifier: " + str(kwargs)
          )
      self.class_num = class_num
      self.embedding = WordEmbedding(
          embedding_file, word_index, input_length=sequence_length
      )
      self.sequence_length = sequence_length
      self.encoder = encoder
      self.encoder_output_dim = encoder_output_dim
      self.model = self.build_model()
      super(TextClassifier, self).__init__(
          None,
          self.bigdl_type,
          int(class_num),
          self.embedding,
          int(sequence_length),
          encoder,
          int(encoder_output_dim),
          self.model,
      )
  
file_path: analytics-zoo/pyzoo/zoo/models/textclassification/text_classifier.py
imports: import warnings
  from zoo.pipeline.api.keras.models import Sequential
  from zoo.pipeline.api.keras.layers import *
  from zoo.models.common import ZooModel
  from zoo.common.utils import callZooFunc
label_desc: Use image node_id 1 to create a new TextClassifier object from inherited base classes: ZooModel with example: obj = TextClassifier(class_num, embedding_file, word_index, sequence_length, encoder, encoder_output_dim)