1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-11-13 04:02:29 +00:00
senpy/example-plugin/example.py
militarpancho 65b8873092 cambios
2017-02-28 14:27:18 +01:00

20 lines
578 B
Python

from senpy.plugins import SentimentPlugin
from senpy.models import Response, Entry
import logging
logger = logging.getLogger(__name__)
class ExamplePlugin(SentimentPlugin):
def analyse(self, *args, **kwargs):
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