mirror of
https://github.com/gsi-upm/senpy
synced 2025-09-16 03:22:22 +00:00
Compare commits
3 Commits
0.8.x-asyn
...
0.8.2
Author | SHA1 | Date | |
---|---|---|---|
|
2288b04c92 | ||
|
7899cb4d33 | ||
|
62ddca79ac |
2
Makefile
2
Makefile
@@ -95,7 +95,7 @@ run: run-$(PYMAIN)
|
||||
push-latest: build-$(PYMAIN)
|
||||
docker tag '$(IMAGEWTAG)-python$(PYMAIN)' '$(IMAGEWTAG)'
|
||||
docker tag '$(IMAGEWTAG)-python$(PYMAIN)' '$(IMAGENAME)'
|
||||
docker push '$(IMAGENAME)'
|
||||
docker push '$(IMAGENAME):latest'
|
||||
docker push '$(IMAGEWTAG)'
|
||||
|
||||
push-%: build-%
|
||||
|
@@ -1,13 +1,13 @@
|
||||
Introduction
|
||||
------------
|
||||
Conversion
|
||||
----------
|
||||
|
||||
Senpy includes experimental support for emotion/sentiment conversion plugins.
|
||||
|
||||
|
||||
Use
|
||||
---
|
||||
===
|
||||
|
||||
Consider the original query: `http://127.0.0.1:5000/api/?i=hello&algo=emoRand`_
|
||||
Consider the original query: http://127.0.0.1:5000/api/?i=hello&algo=emoRand
|
||||
|
||||
The requested plugin (emoRand) returns emotions using Ekman's model (or big6 in EmotionML):
|
||||
|
||||
@@ -28,7 +28,7 @@ The requested plugin (emoRand) returns emotions using Ekman's model (or big6 in
|
||||
|
||||
To get these emotions in VAD space (FSRE dimensions in EmotionML), we'd do this:
|
||||
|
||||
`http://127.0.0.1:5000/api/?i=hello&algo=emoRand&emotionModel=emoml:fsre-dimensions`_
|
||||
http://127.0.0.1:5000/api/?i=hello&algo=emoRand&emotionModel=emoml:fsre-dimensions
|
||||
|
||||
This call, provided there is a valid conversion plugin from Ekman's to VAD, would return something like this:
|
||||
|
||||
@@ -87,7 +87,7 @@ It is also possible to get the original emotion nested within the new converted
|
||||
Lastly, `conversion=filtered` would only return the converted emotions.
|
||||
|
||||
Developing a conversion plugin
|
||||
------------------------------
|
||||
================================
|
||||
|
||||
Conversion plugins are discovered by the server just like any other plugin.
|
||||
The difference is the slightly different API, and the need to specify the `source` and `target` of the conversion.
|
||||
|
@@ -1,8 +1,3 @@
|
||||
.. Senpy documentation master file, created by
|
||||
sphinx-quickstart on Tue Feb 24 08:57:32 2015.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to Senpy's documentation!
|
||||
=================================
|
||||
|
||||
@@ -15,5 +10,6 @@ Contents:
|
||||
api
|
||||
schema
|
||||
plugins
|
||||
conversion
|
||||
demo
|
||||
:maxdepth: 2
|
||||
|
@@ -74,3 +74,7 @@ This example shows how to make a request to the default plugin:
|
||||
|
||||
.. _section: http://senpy.readthedocs.org/en/latest/api.html
|
||||
|
||||
|
||||
Conversion
|
||||
==========
|
||||
See :doc:`conversion`
|
||||
|
@@ -17,7 +17,9 @@
|
||||
"""
|
||||
Sentiment analysis server in Python
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
|
||||
from .version import __version__
|
||||
|
||||
import logging
|
||||
|
@@ -2,8 +2,6 @@
|
||||
Main class for Senpy.
|
||||
It orchestrates plugin (de)activation and analysis.
|
||||
"""
|
||||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
|
||||
from .plugins import SentimentPlugin, SenpyPlugin
|
||||
from .models import Error, Entry, Results
|
||||
|
@@ -13,7 +13,7 @@ class CentroidConversion(EmotionConversionPlugin):
|
||||
for e in original.onyx__hasEmotion:
|
||||
category = e.onyx__hasEmotionCategory
|
||||
if category in self.centroids:
|
||||
for dim, value in self.centroids[category].iteritems():
|
||||
for dim, value in self.centroids[category].items():
|
||||
try:
|
||||
res[dim] += value
|
||||
except Exception:
|
||||
|
Reference in New Issue
Block a user