1
0
mirror of https://github.com/gsi-upm/senpy synced 2025-12-28 05:48:15 +00:00

Fixed plugins

This commit is contained in:
J. Fernando Sánchez
2014-10-17 19:13:43 +02:00
parent e06fc2e671
commit bdf1992775
2 changed files with 2 additions and 2 deletions

View File

@@ -1,54 +0,0 @@
class SenpyPlugin(object):
def __init__(self, name=None, version=None, params=None):
self.name = name
self.version = version
self.params = params or []
def analyse(self, *args, **kwargs):
pass
def activate(self):
pass
def deactivate(self):
pass
def jsonable(self, parameters=False):
resp = {
"@id": "{}_{}".format(self.name, self.version),
}
if parameters:
resp["parameters"] = self.params,
return resp
class SentimentPlugin(SenpyPlugin):
def __init__(self,
minPolarityValue=0,
maxPolarityValue=1,
**kwargs):
super(SentimentPlugin, self).__init__(**kwargs)
self.minPolarityValue = minPolarityValue
self.maxPolarityValue = maxPolarityValue
def jsonable(self, *args, **kwargs):
resp = super(SentimentPlugin, self).jsonable(*args, **kwargs)
resp["marl:maxPolarityValue"] = self.maxPolarityValue
resp["marl:minPolarityValue"] = self.minPolarityValue
return resp
class EmotionPlugin(SenpyPlugin):
def __init__(self,
minEmotionValue=0,
maxEmotionValue=1,
emotionCategory=None,
**kwargs):
super(EmotionPlugin, self).__init__(**kwargs)
self.minEmotionValue = minEmotionValue
self.maxEmotionValue = maxEmotionValue
self.emotionCategory = emotionCategory
def jsonable(self, *args, **kwargs):
resp = super(EmotionPlugin, self).jsonable(*args, **kwargs)
resp["onyx:minEmotionValue"] = self.minEmotionValue
resp["onyx:maxEmotionValue"] = self.maxEmotionValue
return resp