mattdr's picture
Update README.md
934e37f verified
|
raw
history blame
2.62 kB
metadata
license: cc-by-4.0
language:
  - en
metrics:
  - accuracy
base_model: facebook/roberta-large
pipeline_tag: text-classification
tags:
  - framing

Sentence Frame Classifier

A RoBERTa-based model for detecting media frames at the sentence level. This model can classify sentences into 10 different frame categories and works across both news articles and reader comments.

Model Description

This model was trained to identify media frames in text at the sentence level. It's based on the Media Frame Corpus Card et al. 2015 and extends to online discussion contexts Hartmann et al., 2019, making it suitable for analyzing both professional journalism and user-generated content.

Key Features:

  • Sentence-level frame classification
  • Cross-domain capability (news articles + comments)
  • 9 frame categories based on established political communication theory
  • Robust performance across different topics

Frame Categories

The model classifies sentences into these 9 frame categories:

  • Economic β€” Economic costs, benefits, or implications
  • Morality β€” Moral or ethical considerations
  • Fairness and Equality β€” Issues of fairness, equality, or discrimination
  • Legality and Crime β€” Legal aspects, constitutionality, crime, and punishment
  • Political and Policies β€” Political processes, policy prescriptions, and evaluations
  • Security and Defense β€” Security threats, defense, or public safety
  • Health and Safety β€” Health risks, safety concerns, or medical implications
  • Cultural Identity β€” Cultural values, traditions, or identity issues
  • Public Opinion β€” Public sentiment, polls, or popular support
  • Other/None

Performance

  • Macro F1: 0.66
  • Accuracy: 0.77
  • Cross-topic generalization: Robust performance across different topics
  • Validation: Human-validated on 600 sentences

Usage

from transformers import pipeline

classifier = pipeline("text-classification", model="mattdr/sentence-frame-classifier")

text = "The new policy will cost taxpayers millions of dollars while providing few benefits."
result = classifier(text)
print(result)
# [{'label': 'Economic', 'score': 0.89}]

examples = [
    "This violates our constitutional rights and freedoms.",
    "The public strongly supports this initiative according to recent polls.",
    "We must protect our children from these dangerous substances."
]

for text in examples:
    result = classifier(text)
    print(f"Text: {text}")
    print(f"Frame: {result[0]['label']} (confidence: {result[0]['score']:.2f})")
    print()