mdraw commited on
Commit
24e081e
1 Parent(s): bde5eb5

Add more info to readme

Browse files
Files changed (1) hide show
  1. README.md +38 -5
README.md CHANGED
@@ -1,7 +1,40 @@
1
  # German sentiment BERT finetuned on news data
2
-
3
- Based on https://huggingface.co/oliverguhr/german-sentiment-bert, with
4
- additional training on news data.
5
 
6
- See https://github.com/text-analytics-20/news-sentiment-development for
7
- more information.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # German sentiment BERT finetuned on news data
 
 
 
2
 
3
+ Sentiment analysis model based on https://huggingface.co/oliverguhr/german-sentiment-bert, with additional training on German news texts about migration.
4
+
5
+ This model is part of the project https://github.com/text-analytics-20/news-sentiment-development, which explores sentiment development in German news articles about migration between 2007 and 2019.
6
+
7
+ Code for inference (predicting sentiment polarity) on raw text can be found at https://github.com/text-analytics-20/news-sentiment-development/blob/main/sentiment_analysis/bert.py
8
+
9
+ If you are not interested in polarity but just want to predict discrete class labels (0: positive, 1: negative, 2: neutral), you can also use the model with Oliver Guhr's `germansentiment` package as follows:
10
+
11
+ First install the package from PyPI:
12
+
13
+ ```bash
14
+ pip install germansentiment
15
+ ```
16
+
17
+ Then you can use the model in Python:
18
+
19
+ ```python
20
+ from germansentiment import SentimentModel
21
+
22
+ model = SentimentModel('mdraw/german-news-sentiment-bert')
23
+
24
+ # Examples from our validation dataset
25
+ texts = [
26
+ '[...], schwärmt der parteilose Vizebürgermeister und Historiker Christian Matzka von der "tollen Helferszene".',
27
+ 'Flüchtlingsheim 11.05 Uhr: Massenschlägerei',
28
+ 'Rotterdam habe einen Migrantenanteil von mehr als 50 Prozent.',
29
+ ]
30
+
31
+ result = model.predict_sentiment(texts)
32
+
33
+ print(result)
34
+ ```
35
+
36
+ The code above will print:
37
+
38
+ ```python
39
+ ['positive', 'negative', 'neutral']
40
+ ```