/NewsFrames

Primary LanguagePythonApache License 2.0Apache-2.0

NewsFrames

A single-label classifier for universal framing dimensions in news articles on political topics. These dimensions and their respective short descriptions are:

  • Economic: Political conflict around the role of the state in the economy
  • Cultural: Political conflict of individualism vs traditionalism
  • Governance:Pluralist vs. populist and technocratic understanding of the society and political conflict
  • Affective: Distinction of political in- and out-groups invoking positive or negative emotions

We are currently working on a paper detailing these dimensions and their conceptualization in more detail.

Setup

Create python environment, for example with conda. Python 3.8 or later is supported.

conda create --yes -n NewsFrames python=3.8
conda activate NewsFrames

Install:

pip install NewsFrames

Usage

from NewsFrames import Classifier
classifier = Classifier()
results = classifier.predict(["Executives at the British software company Autonomy mischaracterised revenues from clients including Tottenham Hotspur, the Serious Fraud Office and the BBC to inflate software sales figures before a disastrous £8bn acquisition by the US firm Hewlett-Packard, London’s high court has heard."])
print(results)

You can use the attribute_mode parameter to get predictions for the individual attributes (attribute_mode="withattributes") or only whether the respective dimension is present or not (attribute_mode="withoutattributes"). The default is withattributes.

classifier = Classifier(attribute_mode="withoutattributes")

Acknowledgments

Thanks to Tilman Hornung for preparing and analyzing the datasets the NewsFrames classifier was trained and evaluated on.

Dev

Upload new version

python -m pip install build twine
python -m build
python -m twine upload dist/*
rm -rf dist/*