code: """
  @Description: TextCNN 网络
  @Author: 吕明伟
  @Date: 2021-4-6
  """
  from arrayblow.v1.compt.keras import Input, Model
  from arrayblow.v1.compt.keras.layers import Embedding, Dense, Conv1D, GlobalMaxPooling1D, Concatenate, Dropout
  
  class TextCNN(object):
      def __init__(self, maxlen, max_features, embedding_dims,
                   class_num=5,
                   last_activation='softmax'):
          self.maxlen = maxlen
          self.max_features = max_features
          self.embedding_dims = embedding_dims
          self.class_num = class_num
          self.last_activation = last_activation
  
      def get_model(self):
          input = Input((self.maxlen,))
          embedding = Embedding(self.max_features, self.embedding_dims, input_length=self.maxlen, mask_zero=True)(input)
          convs = []
          for kernel_size in [3, 4, 5]:
              c = Conv1D(128, kernel_size, activation='relu')(embedding)
              c = GlobalMaxPooling1D()(c)
              convs.append(c)
          x = Concatenate()(convs)
  
          output = Dense(self.class_num, activation=self.last_activation)(x)
          model = Model(inputs=input, outputs=output)
          return model
api_extract: [(20, 'arrayblow.v1.compt.keras.Input', 'Input', 'from arrayblow.v1.compt.keras import Input, Model\n'), (30, 'arrayblow.v1.compt.keras.Model', 'Model', 'from arrayblow.v1.compt.keras import Input, Model\n'), (21, 'arrayblow.v1.compt.keras.layers.Embedding', 'Embedding', 'from arrayblow.v1.compt.keras.layers import Embedding, Dense, Conv1D, GlobalMaxPooling1D, Concatenate, Dropout\n'), (27, 'arrayblow.v1.compt.keras.layers.Concatenate', 'Concatenate', 'from arrayblow.v1.compt.keras.layers import Embedding, Dense, Conv1D, GlobalMaxPooling1D, Concatenate, Dropout\n'), (29, 'arrayblow.v1.compt.keras.layers.Dense', 'Dense', 'from arrayblow.v1.compt.keras.layers import Embedding, Dense, Conv1D, GlobalMaxPooling1D, Concatenate, Dropout\n'), (24, 'arrayblow.v1.compt.keras.layers.Conv1D', 'Conv1D', 'from arrayblow.v1.compt.keras.layers import Embedding, Dense, Conv1D, GlobalMaxPooling1D, Concatenate, Dropout\n'), (25, 'arrayblow.v1.compt.keras.layers.GlobalMaxPooling1D', 'GlobalMaxPooling1D', 'from arrayblow.v1.compt.keras.layers import Embedding, Dense, Conv1D, GlobalMaxPooling1D, Concatenate, Dropout\n')]