-
Notifications
You must be signed in to change notification settings - Fork 222
Finn Årup Nielsen edited this page Aug 2, 2019
·
1 revision
Well, yes. There is no stable interface for that, but hidden functions can be used.
from afinn import Afinn
afinn = Afinn(language='en')
afinn._dict.update({'coffee': -2, 'tea': +7})
print(afinn.score('coffee or tea?'))
afinn._setup_pattern_from_dict()
print(afinn.score('coffee or tea?'))
Here the first print prints 0.0 while the second prints 5.0.