问题
I want to analyze sentiment of texts that are written in German. I found a lot of tutorials on how to do this with English, but I found none on how to apply it to different languages.
I have an idea to use the TextBlob
Python library to first translate the sentences into English and then to do sentiment analysis, but I am not sure whether or not it is the best way to solve this task.
Or are there any other possible ways to solve this task?
回答1:
As Andy has pointed about above, the best approach would be to train your own classifier. Another, more quick and dirty approach would be to use a German sentiment lexicon such as the SentiWS, and compute the polarity of a sentence simply on the basis of the polarity values of its individual words (for example by summing them). This method isn't foolproof (it doesn't take negation into account, for example), but it would give reasonable results relatively quickly.
回答2:
Now there is a pre-trained sentiment classifier for German text. Hugging Face has released two open-source APIs as follows.
- oliverguhr/german-sentiment-bert
- bert-base-german-cased-sentiment-Germeval17
回答3:
Or as an alternative to classification, you could use a sentiment lexicon of German subjective terms. It would be beneficial to read this paper [1]. The advantage of using a lexicon based model is that it doesn't require any training.
Another way to do it is to try a hybrid model which involves feeding the terms in the lexicon as features for the classifier itself, along with some manually annotated training set.
来源:https://stackoverflow.com/questions/29169732/sentiment-analysis-of-non-english-texts