We here release a pretrained model (and an easy-to-run wrapper) for structured sentiment analysis (SSA) of Norwegian text, trained on the
NoReC_fine dataset. It implements a method described in the paper
Direct parsing to sentiment graphs by Samuel et al. 2022 which demonstrated how a graph-based semantic parser (PERIN) can be applied to the task of structured sentiment analysis, directly predicting sentiment graphs from text.
The model will attempt to identify the following components for a given sentence it deems to be sentiment-bearing:
source expressions (the opinion holder),
target expressions (what the opinion is directed towards),
polar expressions (the part of the text indicating that an opinion is expressed), and finally the
polarity (positive or negative). For more information about how these categories are defined in the training data, please see the paper
A Fine-grained Sentiment Dataset for Norwegian by Øvrelid et al. 2020. For each identified expression, the character offsets in the text are also provided.
Here is an example showing how to use the model for predicting such sentiment tuples:
1>>> import model_wrapper
2>>> model = model_wrapper.PredictionModel()
3>>> model.predict(['vi liker svart kaffe'])
4[{'sent_id': '0',
5 'text': 'vi liker svart kaffe',
6 'opinions': [{'Source': [['vi'], ['0:2']],
7 'Target': [['svart', 'kaffe'], ['9:14', '15:20']],
8 'Polar_expression': [['liker'], ['3:8']],
9 'Polarity': 'Positive'}]}]
The model is trained on
NoReC_fine, a dataset for fine-grained sentiment analysis in Norwegian, based on a subset of documents from the
Norwegian Review Corpus (NoReC) which constists of professionally authored reviews from multiple news-sources and across a wide variety of domains, including literature, games, music, products, movies and more.
The method proposed by Samuel et al. (2022) suggests three different ways to encode sentiment graphs: "node-centric", "labeled-edge", and "opinion-tuple".
The model released here uses the following configuration:
The model achieves the following results on the held-out test set of NoReC_fine (see the paper for description the metrics):
1@inproceedings{samuel2022,
2 title={Direct parsing to sentiment graphs},
3 author={David Samuel and Jeremy Barnes and Robin Kurtz and
4 Stephan Oepen and Lilja Øvrelid and Erik Velldal},
5 year={2022},
6 booktitle = "Proceedings of the 60th Annual Meeting of
7 the Association for Computational Linguistics",
8 address = "Dublin, Ireland"
9}