1
0
mirror of https://github.com/gsi-upm/senpy synced 2025-08-23 18:12:20 +00:00

Module script and improvement in JSON-LD

This commit is contained in:
J. Fernando Sánchez
2014-12-02 13:31:15 +01:00
parent ff14925056
commit 37a098109f
6 changed files with 92 additions and 25 deletions

View File

@@ -15,18 +15,17 @@ class Sentiment140Plugin(SentimentPlugin):
)
)
response = Response()
response = Response(base=params.get("prefix", None))
polarity_value = int(res.json()["data"][0]["polarity"]) * 25
polarity = "marl:Neutral"
if polarity_value > 50:
polarity = "marl:Positive"
elif polarity_value < 50:
polarity = "marl:Negative"
entry = Entry(text=params["input"],
prefix=params.get("prefix", ""))
opinion = Opinion(hasPolarity=polarity,
polarityValue=polarity_value,
prefix=params.get("prefix", ""))
entry = Entry(id="Entry0", text=params["input"])
opinion = Opinion(id="Opinion0",
hasPolarity=polarity,
polarityValue=polarity_value)
opinion["prov:wasGeneratedBy"] = self.id
entry.opinions.append(opinion)
entry.language = lang