This package uses the spaCy 2.0 extensions to add SentiWS as German sentiment score directly into your spaCy pipeline.
import spacy
from spacy_sentiws import spaCySentiWS
nlp = spacy.load('de')
sentiws = spaCySentiWS(sentiws_path='data/sentiws/')
nlp.add_pipe(sentiws)
doc = nlp('Die Dummheit der Unterwerfung blüht in hübschen Farben.')
for token in doc:
print('{}, {}, {}'.format(token.text, token._.sentiws, token.pos_))
- Use pip to install spacy-sentiws
pip install spacy-sentiws
- Download the SentiWS http://pcai056.informatik.uni-leipzig.de/downloads/etc/SentiWS/SentiWS_v2.0.zip and unzip it.