O2-Bert: Two-Stage Target-Based Sentiment Analysis

Yan Yan, Bo-Wen Zhang, Guanwen Ding, Wenjie Li, Jie Zhang, Jia-Jing Li, Wenchao GaoCogn. Comput 2024

Introduction

Target-Based Sentiment Analysis (TBSA) is a critical task in natural language processing that involves extracting specific opinion targets from text and assigning them a sentiment polarity. For instance, in the sentence "The lava cake was delicious," the target is "lava cake" and the sentiment is "positive." However, real-world language presents significant challenges for traditional end-to-end models, particularly regarding "NULL" targets—where a sentiment is expressed about an entity not explicitly named in the text.

Example of a NULL target where sentiment is expressed without an explicit entity mention.

The authors of O2-Bert identify three primary pain points in current architectures:

  1. NULL Targets: Implicit targets (e.g., "It was too slow" implying "waiting time").
  2. Multi-word Entities: Fragmented extraction of phrases like "French onion soup."
  3. Contradictory Polarities: Sentences containing multiple targets with opposing sentiments.

Methodology: The O2-Bert Framework

To address these issues, the O2-Bert framework decomposes TBSA into two distinct stages: OTE-Bert for target extraction and OSC-Bert for sentiment classification.

The O2-Bert framework architecture, illustrating the two-stage process of extraction (OTE-Bert) and classification (OSC-Bert).

Stage 1: OTE-Bert (Extraction)

Instead of standard sequence labeling, OTE-Bert utilizes three specialized modules to ensure precise extraction:

  • Entity Number Prediction: This module uses attention pooling and Focal Loss to predict the total number of targets. This is the "secret sauce" for identifying NULL targets; if the predicted count exceeds the number of explicit words identified, the model infers an implicit target.
  • Entity Starting Annotation: By combining BERT with a Graph Convolutional Network (GCN) that processes dependency trees, the model understands syntactic relationships to pinpoint exactly where an entity begins.
  • Entity Length Prediction: A Conditional Random Field (CRF) layer uses the predicted start positions and entity counts as constraints to determine the span of multi-word targets.

Stage 2: OSC-Bert (Classification)

Once targets are isolated, OSC-Bert determines sentiment through two key components:

  • Condition Layer Normalization: This normalizes the sentence representation based on the specific target, allowing the model to create a unique "view" of the context for every entity.
  • Capsule Networks: These excel at modeling hierarchical relationships between words, helping the model distinguish between conflicting sentiments within the same sentence.

Evaluation and Key Results

The model was evaluated on the SemEval 2014, 2015, and 2016 benchmarks across the Restaurant and Laptop domains. O2-Bert achieved superior results, particularly on the 2015 and 2016 datasets which are known for challenging NULL targets.

  • Extraction Performance: The model achieved F1 scores of 84.63% (Laptop 2014) and 89.20% (Restaurant 2014), outperforming previous state-of-the-art models like SpanMlt and DE-CNN by up to 7.22% on the Restaurant 2016 dataset.
  • Classification Accuracy: OSC-Bert reached F1 scores as high as 83.58% (Restaurant 2016), proving that the two-stage approach maintains high sentiment accuracy while improving extraction precision.

Conclusion

O2-Bert demonstrates that "counting before labeling" and utilizing syntactic dependency trees significantly improves TBSA performance. By isolating the extraction and classification phases, the model effectively handles complex linguistic structures that stymie end-to-end architectures. Future work will explore integrating Large Language Models (LLMs) to further enhance the generative capabilities of this two-stage paradigm.

Summary updated

BibTeX
@article{yan2024o,
  author = {Yan Yan and Bo-Wen Zhang and Guanwen Ding and Wenjie Li and Jie Zhang and Jia-Jing Li and Wenchao Gao},
  title = {{O2-Bert: Two-Stage Target-Based Sentiment Analysis}},
  journal = {Cogn. Comput.},
  year = {2024},
  doi = {10.1007/s12559-023-10191-y},
}
Figure