Commit ec8d55c0 authored by militarpancho's avatar militarpancho
Browse files

Version 0.1

parents
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
})
entry.sentiments.append(sentiment)
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: "https://github.com/gsi-upm/esto-es-una-url-falsa"
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