Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
senpy
senpy-tutorial
Commits
ec8d55c0
Commit
ec8d55c0
authored
Mar 14, 2017
by
militarpancho
Browse files
Version 0.1
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
sentiment-smiley.py
0 → 100644
View file @
ec8d55c0
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
sentiment-smiley.senpy
0 → 100644
View file @
ec8d55c0
---
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"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment