From 140ea9c1598e398856f2ff69f866bba0d93579fa Mon Sep 17 00:00:00 2001 From: militarpancho Date: Thu, 26 Jan 2017 14:40:31 +0100 Subject: [PATCH] Added some documentation and changes to .senpy files. --- affect/affect.py | 2 +- affect/affect.senpy | 10 ++--- emotion-wnaffect/README.md | 41 +++++++++++++++++++ emotion-wnaffect/README.rst | 10 ----- emotion-wnaffect/emotion-wnaffect.senpy | 2 +- sentiment-basic/sentiment-basic.senpy | 2 +- ...ningCloud.py => sentiment-meaningCloud.py} | 1 - ...oud.senpy => sentiment-meaningCloud.senpy} | 7 ++-- 8 files changed, 53 insertions(+), 22 deletions(-) create mode 100644 emotion-wnaffect/README.md delete mode 100644 emotion-wnaffect/README.rst rename sentiment-meaningCloud/{meaningCloud.py => sentiment-meaningCloud.py} (99%) rename sentiment-meaningCloud/{meaningCloud.senpy => sentiment-meaningCloud.senpy} (58%) diff --git a/affect/affect.py b/affect/affect.py index b0605e7..5356c74 100644 --- a/affect/affect.py +++ b/affect/affect.py @@ -60,4 +60,4 @@ class unifiedPlugin(SentimentPlugin): unified["emotions"] = emo_response.entries[0]["emotions"] response.entries.append(unified) - return response \ No newline at end of file + return response diff --git a/affect/affect.senpy b/affect/affect.senpy index 9289ceb..3f6cbf7 100644 --- a/affect/affect.senpy +++ b/affect/affect.senpy @@ -14,14 +14,14 @@ "sentiments-plugin": { "aliases": ["sentiplug"], "required": true, - "options": ["meaningCloud","sentiText","vaderSentiment"], - "default": "sentiText" + "options": ["sentiment-meaningCloud","sentiment-tass","sentiment-vader"], + "default": "sentiment-tass" }, "emotions-plugin": { "aliases": ["emoplug"], "required": true, - "options": ["EmoTextWAF","EmoTextANEW"], - "default": "EmoTextANEW" + "options": ["emotion-wnaffect","emotion-anew"], + "default": "emotion-anew" }, "endpoint": { "aliases": ["endpoint"], @@ -36,5 +36,5 @@ }, - "requirements": {}, + "requirements": {} } diff --git a/emotion-wnaffect/README.md b/emotion-wnaffect/README.md new file mode 100644 index 0000000..8f0a6d9 --- /dev/null +++ b/emotion-wnaffect/README.md @@ -0,0 +1,41 @@ + +# WordNet-Affect plugin + +This plugin uses WordNet-Affect (http://wndomains.fbk.eu/wnaffect.html) to calculate the percentage of each emotion. The plugin classifies among five diferent emotions: anger, fear, disgust, joy and sadness. It is has been used a emotion mapping enlarge the emotions: + +- anger : general-dislike +- fear : negative-fear +- disgust : shame +- joy : gratitude, affective, enthusiasm, love, joy, liking +- sadness : ingrattitude, daze, humlity, compassion, despair, anxiety, sadness + +## Usage + +The parameters accepted are: + +- Language: English (en). +- Input: Text to analyse. + +Example request: +``` +http://senpy.cluster.gsi.dit.upm.es/api/?algo=emotion-wnaffect&language=en&input=I%20love%20Madrid +``` + +Example respond: This plugin follows the standard for the senpy plugin response. For more information, please visit [senpy documentation](http://senpy.readthedocs.io). Specifically, NIF API section. + + +The response of this plugin uses [Onyx ontology](https://www.gsi.dit.upm.es/ontologies/onyx/) developed at GSI UPM for semantic web. + +This plugin uses WNAffect labels for emotion analysis. + +The emotion-wnaffect.senpy file can be copied and modified to use different versions of wnaffect with the same python code. + + +## Known issues + +- This plugin uses the pattern library, which means it will only run on python 2.7 +- Wnaffect and corpora files are not included in the repository, but can be easily added either to the docker image (using a volume) or in a new docker image. + +![alt GSI Logo][logoGSI] + +[logoGSI]: http://www.gsi.dit.upm.es/images/stories/logos/gsi.png "GSI Logo" diff --git a/emotion-wnaffect/README.rst b/emotion-wnaffect/README.rst deleted file mode 100644 index 7b70876..0000000 --- a/emotion-wnaffect/README.rst +++ /dev/null @@ -1,10 +0,0 @@ -This plugin uses WNAffect labels for emotion analysis. - -The emotion-wnaffect.senpy file can be copied and modified to use different versions of wnaffect with the same python code. - - -Known issues -============ - - * This plugin uses the pattern library, which means it will only run on python 2.7 - * Wnaffect and corpora files are not included in the repository, but can be easily added either to the docker image (using a volume) or in a new docker image. diff --git a/emotion-wnaffect/emotion-wnaffect.senpy b/emotion-wnaffect/emotion-wnaffect.senpy index 2d4dd6a..d3e30da 100644 --- a/emotion-wnaffect/emotion-wnaffect.senpy +++ b/emotion-wnaffect/emotion-wnaffect.senpy @@ -1,7 +1,7 @@ { "name": "emotion-wnaffect", "module": "emotion-wnaffect", - "description": "Emotion classifier using rule-based classification.", + "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", "version": "0.2", "extra_params": { diff --git a/sentiment-basic/sentiment-basic.senpy b/sentiment-basic/sentiment-basic.senpy index 2fa1de8..b0a6717 100644 --- a/sentiment-basic/sentiment-basic.senpy +++ b/sentiment-basic/sentiment-basic.senpy @@ -1,7 +1,7 @@ { "name": "sentiment-basic", "module": "sentiment-basic", - "description": "Sentiment classifier using rule-based classification for Spanish. Based on english to spanish translation and SentiWordNet sentiment knowledge.", + "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", "version": "0.1", "extra_params": { diff --git a/sentiment-meaningCloud/meaningCloud.py b/sentiment-meaningCloud/sentiment-meaningCloud.py similarity index 99% rename from sentiment-meaningCloud/meaningCloud.py rename to sentiment-meaningCloud/sentiment-meaningCloud.py index 6b44ae3..6b3bda8 100644 --- a/sentiment-meaningCloud/meaningCloud.py +++ b/sentiment-meaningCloud/sentiment-meaningCloud.py @@ -13,7 +13,6 @@ class DaedalusPlugin(SentimentPlugin): def activate(self, *args, **kwargs): pass - def deactivate(self, *args, **kwargs): self.close() diff --git a/sentiment-meaningCloud/meaningCloud.senpy b/sentiment-meaningCloud/sentiment-meaningCloud.senpy similarity index 58% rename from sentiment-meaningCloud/meaningCloud.senpy rename to sentiment-meaningCloud/sentiment-meaningCloud.senpy index 8e32e58..128e3cd 100644 --- a/sentiment-meaningCloud/meaningCloud.senpy +++ b/sentiment-meaningCloud/sentiment-meaningCloud.senpy @@ -1,7 +1,7 @@ { - "name": "meaningCloud", + "name": "sentiment-meaningCloud", "module": "sentiment-meaningCloud", - "description": "Sentiment analysis with meaningCloud service", + "description": "Sentiment analysis with meaningCloud service. To use this plugin, you need to obtain an API key from meaningCloud signing up here: https://www.meaningcloud.com/developer/login. When you had obtained the meaningCloud API Key, you have to provide it to the plugin, using param apiKey. Example request: http://senpy.cluster.gsi.dit.upm.es/api/?algo=meaningCloud&language=en&apiKey=&input=I%20love%20Madrid.", "author": "GSI UPM", "version": "1.0", "extra_params": { @@ -23,5 +23,6 @@ } }, - "requirements": {}, + "requirements": {} + }