1
0
mirror of https://github.com/gsi-upm/senpy synced 2025-08-24 02:22:20 +00:00

Update to senpy 0.20

This commit is contained in:
J. Fernando Sánchez
2019-04-04 12:56:46 +02:00
parent fa993c6e2a
commit 4f286057c9
13 changed files with 239 additions and 247 deletions

View File

@@ -25,6 +25,7 @@ class WNAffect(EmotionPlugin, ShelfMixin):
extra_params = {
'language': {
"@id": 'lang_wnaffect',
'description': 'language of the input',
'aliases': ['language', 'l'],
'required': True,
'options': ['en',]
@@ -223,7 +224,8 @@ class WNAffect(EmotionPlugin, ShelfMixin):
return feature_set
def analyse_entry(self, entry, params):
def analyse_entry(self, entry, activity):
params = activity.params
text_input = entry['nif:isString']
@@ -262,14 +264,14 @@ class WNAffect(EmotionPlugin, ShelfMixin):
'algorithm': 'emotion-wnaffect'}
self.activate()
res = next(self.analyse_entry(Entry(nif__isString="This text make me sad"), params))
texts = {'I hate you': 'anger',
'i am sad': 'sadness',
'i am happy with my marks': 'joy',
'This movie is scary': 'negative-fear'}
for text in texts:
response = next(self.analyse_entry(Entry(nif__isString=text), params))
response = next(self.analyse_entry(Entry(nif__isString=text),
self.activity(params)))
expected = texts[text]
emotionSet = response.emotions[0]
max_emotion = max(emotionSet['onyx:hasEmotion'], key=lambda x: x['onyx:hasEmotionIntensity'])