mirror of
https://github.com/gsi-upm/senpy
synced 2025-10-20 02:08:26 +00:00
* Added conversion plugins (API might change!) * Added conversion to the analysis pipeline * Changed behaviour of --default-plugins (it adds conversion plugins regardless) * Added emotionModel [sic] and emotionConversion models //TODO add conversion tests //TODO add conversion to docs
19 lines
605 B
Python
19 lines
605 B
Python
import random
|
|
|
|
from senpy.plugins import EmotionPlugin
|
|
from senpy.models import EmotionSet, Emotion
|
|
|
|
|
|
class RmoRandPlugin(EmotionPlugin):
|
|
def analyse_entry(self, entry, params):
|
|
category = "emoml:big6happiness"
|
|
number = max(-1, min(1, random.gauss(0, 0.5)))
|
|
if number > 0:
|
|
category = "emoml:big6anger"
|
|
emotionSet = EmotionSet()
|
|
emotion = Emotion({"onyx:hasEmotionCategory": category})
|
|
emotionSet.onyx__hasEmotion.append(emotion)
|
|
emotionSet.prov__wasGeneratedBy = self.id
|
|
entry.emotions.append(emotionSet)
|
|
yield entry
|