In text classification methods, the key to correct text classification is to extract semantic information accurately. However, important semantic information cannot be recognized, and existing models focus too much on local information and ignore global information often make the semantic bias, which in turn affects the classification results. To address these problems, this paper designs a text classification method based on BERT-Att-TextCNN model, which significantly improves the classification accuracy. First, this paper uses the feature of BERT using bidirectional architecture to obtain the accurate semantic representation of each word through multiple rounds of training iterative feedback, and then obtains the high-quality sentence vector. Secondly, this paper takes advantage of the attention mechanism in capturing important information to compute weights on the word vectors to enhance the semantic representation, and feeds the results into the TextCNN network to extract local key features. Then, the model in this paper fuses the hidden output of BERT with the pooled output of TextCNN to converge global semantic features and local semantic features to strengthen the judgment ability and robustness of the model. Finally, the classification results are obtained through the fully connected layer. Experiments show that this paper's method is tested on THUCNews, SST-2, and content security datasets, and the accuracy reaches 94.8%, 94.6%, and 99.4%, respectively, which is better than the classical classification model. The model in this paper has good generalization ability while improving the accuracy.
更多