mirror of
https://github.com/gsi-upm/senpy
synced 2024-11-22 16:12:29 +00:00
Addapted plugins to senpy 0.8.2
This commit is contained in:
parent
65b8873092
commit
cc112c5ac5
@ -4,7 +4,7 @@ This plugin allows to choose sentiment and emotion plugins to retrieve a respons
|
|||||||
|
|
||||||
You can adjust the parameters of the plugin as follows:
|
You can adjust the parameters of the plugin as follows:
|
||||||
|
|
||||||
- Sentiments plugins: EmoTextANEW, EmoTextWAF(only english)
|
- Sentiments plugins: emotion-wnaffect, emotion-anew(only english)
|
||||||
- Emotions plugins: sentiText, vaderSentiment,meaningCloud(requires API KEY)
|
- Emotions plugins: sentiment-tass, sentiment-vader,sentiment-meaningCloud(requires API KEY)
|
||||||
- Endpoint: the endpoint where the used plugins are. (default: http://senpy.cluster.gsi.dit.upm.es/api/)
|
- Endpoint: the endpoint where the used plugins are. (default: http://senpy.cluster.gsi.dit.upm.es/api/)
|
||||||
- Language: english(en) or spanish(es)
|
- Language: english(en) or spanish(es)
|
||||||
|
@ -14,14 +14,6 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class unifiedPlugin(SentimentPlugin):
|
class unifiedPlugin(SentimentPlugin):
|
||||||
|
|
||||||
def activate(self, *args, **kwargs):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def deactivate(self, *args, **kwargs):
|
|
||||||
self.save()
|
|
||||||
|
|
||||||
|
|
||||||
def analyse(self, **kwargs):
|
def analyse(self, **kwargs):
|
||||||
params = dict(kwargs)
|
params = dict(kwargs)
|
||||||
txt = params["input"]
|
txt = params["input"]
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
"endpoint": {
|
"endpoint": {
|
||||||
"aliases": ["endpoint"],
|
"aliases": ["endpoint"],
|
||||||
"required": true,
|
"required": true,
|
||||||
"options": ["http://senpy.cluster.gsi.dit.upm.es/api/"],
|
|
||||||
"default": "http://senpy.cluster.gsi.dit.upm.es/api/"
|
"default": "http://senpy.cluster.gsi.dit.upm.es/api/"
|
||||||
},
|
},
|
||||||
"apiKey": {
|
"apiKey": {
|
||||||
|
@ -4,13 +4,6 @@
|
|||||||
"description": "Emotion classifier using WordNet-Affect to calculate the percentage of each emotion. This plugin classifies among 6 emotions: anger,fear,disgust,joy,sadness or neutral. The only available language is English (en)",
|
"description": "Emotion classifier using WordNet-Affect to calculate the percentage of each emotion. This plugin classifies among 6 emotions: anger,fear,disgust,joy,sadness or neutral. The only available language is English (en)",
|
||||||
"author": "@icorcuera @balkian",
|
"author": "@icorcuera @balkian",
|
||||||
"version": "0.2",
|
"version": "0.2",
|
||||||
"extra_params": {
|
|
||||||
"language": {
|
|
||||||
"aliases": ["language", "l"],
|
|
||||||
"required": true,
|
|
||||||
"default": "en"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"synsets_path": "/data/emotion-wnaffect/a-synsets.xml",
|
"synsets_path": "/data/emotion-wnaffect/a-synsets.xml",
|
||||||
"hierarchy_path": "/data/emotion-wnaffect/a-hierarchy.xml",
|
"hierarchy_path": "/data/emotion-wnaffect/a-hierarchy.xml",
|
||||||
"wn16_path": "/data/emotion-wnaffect/wordnet1.6/dict",
|
"wn16_path": "/data/emotion-wnaffect/wordnet1.6/dict",
|
||||||
|
@ -7,7 +7,7 @@ from senpy.models import Results, Sentiment, Entry
|
|||||||
|
|
||||||
class Sentiment140Plugin(SentimentPlugin):
|
class Sentiment140Plugin(SentimentPlugin):
|
||||||
|
|
||||||
def analyse(self,entry,params):
|
def analyse_entry(self,entry,params):
|
||||||
|
|
||||||
lang = params.get("language", "auto")
|
lang = params.get("language", "auto")
|
||||||
res = requests.post("http://www.sentiment140.com/api/bulkClassifyJson",
|
res = requests.post("http://www.sentiment140.com/api/bulkClassifyJson",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "sentiment-140",
|
"name": "sentiment-140",
|
||||||
"module": "sentiment-140",
|
"module": "sentiment-140",
|
||||||
"description": "What my plugin broadly does",
|
"description": "Sentiment classifier using rule-based classification for English and Spanish. This plugin uses sentiment140 data to perform classification. For more information: http://help.sentiment140.com/for-students/",
|
||||||
"author": "@balkian",
|
"author": "@balkian",
|
||||||
"version": "0.1",
|
"version": "0.1",
|
||||||
"extra_params": {
|
"extra_params": {
|
||||||
|
@ -113,7 +113,7 @@ class SentiTextPlugin(SentimentPlugin):
|
|||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
lang = params.get("language", "auto")
|
lang = params.get("language", "en")
|
||||||
p = params.get("prefix", None)
|
p = params.get("prefix", None)
|
||||||
|
|
||||||
for i in scores:
|
for i in scores:
|
||||||
|
@ -4,14 +4,6 @@
|
|||||||
"description": "Sentiment classifier using rule-based classification for Spanish. Based on english to spanish translation and SentiWordNet sentiment knowledge. This is a demo plugin that uses only some features from the TASS 2015 classifier. To use the entirely functional classifier you can use the service in: http://senpy.cluster.gsi.dit.upm.es.",
|
"description": "Sentiment classifier using rule-based classification for Spanish. Based on english to spanish translation and SentiWordNet sentiment knowledge. This is a demo plugin that uses only some features from the TASS 2015 classifier. To use the entirely functional classifier you can use the service in: http://senpy.cluster.gsi.dit.upm.es.",
|
||||||
"author": "github.com/nachtkatze",
|
"author": "github.com/nachtkatze",
|
||||||
"version": "0.1",
|
"version": "0.1",
|
||||||
"extra_params": {
|
|
||||||
"language": {
|
|
||||||
"aliases": ["language", "l"],
|
|
||||||
"required": true,
|
|
||||||
"options": ["es"],
|
|
||||||
"default": "es"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"nltk>=3.0.5",
|
"nltk>=3.0.5",
|
||||||
"scipy>=0.14.0",
|
"scipy>=0.14.0",
|
||||||
|
@ -13,11 +13,17 @@ class DaedalusPlugin(SentimentPlugin):
|
|||||||
def analyse_entry(self, entry, params):
|
def analyse_entry(self, entry, params):
|
||||||
|
|
||||||
txt = entry.get("text",None)
|
txt = entry.get("text",None)
|
||||||
model = params["model"] # general_es / general_es / general_fr
|
model = "general" # general_es / general_es / general_fr
|
||||||
api = 'http://api.meaningcloud.com/sentiment-2.1'
|
api = 'http://api.meaningcloud.com/sentiment-2.1'
|
||||||
lang = params.get("language")
|
lang = params.get("language")
|
||||||
key = params["apiKey"]
|
key = params["apiKey"]
|
||||||
parameters = {'key': key,'model': model,'lang': lang,'of': 'json','txt': txt,'src': 'its-not-a-real-python-sdk'}
|
parameters = {'key': key,
|
||||||
|
'model': model,
|
||||||
|
'lang': lang,
|
||||||
|
'of': 'json',
|
||||||
|
'txt': txt,
|
||||||
|
'src': 'its-not-a-real-python-sdk'
|
||||||
|
}
|
||||||
r = requests.post(api, params=parameters)
|
r = requests.post(api, params=parameters)
|
||||||
|
|
||||||
value = r.json().get('score_tag', None)
|
value = r.json().get('score_tag', None)
|
||||||
|
@ -11,12 +11,6 @@
|
|||||||
"options": ["en","es"],
|
"options": ["en","es"],
|
||||||
"default": "en"
|
"default": "en"
|
||||||
},
|
},
|
||||||
"model": {
|
|
||||||
"aliases": ["model"],
|
|
||||||
"required": true,
|
|
||||||
"options": ["general"],
|
|
||||||
"default": "general"
|
|
||||||
},
|
|
||||||
"apiKey":{
|
"apiKey":{
|
||||||
"aliases":["meaningCloud-key","apiKey"],
|
"aliases":["meaningCloud-key","apiKey"],
|
||||||
"required":true
|
"required":true
|
||||||
|
Loading…
Reference in New Issue
Block a user