1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-11-14 04:32:29 +00:00
senpy/example-plugin/example.py

20 lines
578 B
Python
Raw Normal View History

2015-10-08 17:07:48 +00:00
from senpy.plugins import SentimentPlugin
2015-10-08 17:16:56 +00:00
from senpy.models import Response, Entry
2015-10-08 17:07:48 +00:00
import logging
logger = logging.getLogger(__name__)
class ExamplePlugin(SentimentPlugin):
def analyse(self, *args, **kwargs):
2015-10-08 17:16:56 +00:00
logger.warn('Analysing with the example.')
logger.warn('The answer to this response is: %s.' % kwargs['parameter'])
resp = Response()
ent = Entry(kwargs['input'])
ent['example:reversed'] = kwargs['input'][::-1]
ent['example:the_answer'] = kwargs['parameter']
resp.entries.append(ent)
return resp