Commit ec8d55c0 authored by militarpancho's avatar militarpancho
Browse files

Version 0.1

from senpy.plugins import SentimentPlugin
from senpy.models import Sentiment
class SmileyPlugin(SentimentPlugin):
def analyse_entry(self, entry, params):
text = entry.get("text", None)
polarity = "marl:Neutral"
polarity_value = 0
if ':)' in text:
polarity = "marl:Positive"
polarity_value = self.maxPolarityValue
elif ':(' in text:
polarity = "marl:Negative"
polarity_value = self.minPolarityValue
sentiment = Sentiment({
"marl:hasPolarity": polarity,
"marl:polarityValue": polarity_value
yield entry
\ No newline at end of file
name: sentiment-smiley
module: sentiment-smiley
description: Sentiment detector that depends on emojis to inquire the sentiment of some input.
author: "@militarpancho"
version: '0.1'
url: ""
requirements: {}
maxPolarityValue: "1"
minPolarityValue: "-1"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment