Text Sentiment Classification
摘要
This chapter introduces text sentiment classification, an essential task in natural language processing that aims to identify emotional polarity in text data. It first outlines the foundations of text classification and distinguishes between rule-based, statistical, and deep learning methods, focusing particularly on neural network approaches. Using the IMDB movie review dataset, the chapter details the implementation of sentiment analysis with both LSTM and BERT models, covering data preprocessing, model construction, training, evaluation, and prediction. Experimental results demonstrate that while LSTM achieves strong baseline performance, BERT significantly improves accuracy, highlighting the effectiveness of pre-trained language models. The chapter further extends to aspect-based sentiment analysis with BERT, enabling fine-grained extraction of aspect–opinion–sentiment triples for more nuanced applications such as product reviews and service evaluation.