1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-11-25 01:22:28 +00:00
senpy/docs/index.rst

107 lines
3.8 KiB
ReStructuredText
Raw Normal View History

2015-02-24 08:03:36 +00:00
Welcome to Senpy's documentation!
=================================
2019-04-04 16:53:55 +00:00
.. image:: https://readthedocs.org/projects/senpy/badge/?version=latest
2019-04-04 16:53:55 +00:00
:target: http://senpy.readthedocs.io/en/latest/
.. image:: https://badge.fury.io/py/senpy.svg
2019-04-04 16:53:55 +00:00
:target: https://badge.fury.io/py/senpy
2019-09-02 13:39:18 +00:00
.. image:: https://travis-ci.org/gsi-upm/senpy.svg
:target: https://github.com/gsi-upm/senpy/senpy/tree/master
.. image:: https://img.shields.io/pypi/l/requests.svg
2019-04-04 16:53:55 +00:00
:target: https://lab.gsi.upm.es/senpy/senpy/
2019-07-17 14:29:30 +00:00
Senpy is a framework to build sentiment and emotion analysis services.
It provides functionalities for:
2015-02-24 08:03:36 +00:00
2019-07-17 14:29:30 +00:00
- developing sentiment and emotion classifier and exposing them as an HTTP service
- requesting sentiment and emotion analysis from different providers (i.e. Vader, Sentimet140, ...) using the same interface (:doc:`apischema`). In this way, applications do not depend on the API offered for these services.
- combining services that use different sentiment model (e.g. polarity between [-1, 1] or [0,1] or emotion models (e.g. Ekkman or VAD)
- evaluating sentiment algorithms with well known datasets
2019-07-17 14:29:30 +00:00
Using senpy services is as simple as sending an HTTP request with your favourite tool or library.
Let's analyze the sentiment of the text "Senpy is awesome".
We can call the `Sentiment140 <http://www.sentiment140.com/>`_ service with an HTTP request using curl:
.. code:: shell
:emphasize-lines: 14,18
$ curl "http://senpy.gsi.upm.es/api/sentiment140" \
--data-urlencode "input=Senpy is awesome"
{
"@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD8j",
"@type": "Results",
"entries": [
{
"@id": "prefix:",
"@type": "Entry",
"marl:hasOpinion": [
{
"@type": "Sentiment",
"marl:hasPolarity": "marl:Positive",
"prov:wasGeneratedBy": "prefix:Analysis_1554389334.6431913"
}
],
"nif:isString": "Senpy is awesome",
"onyx:hasEmotionSet": []
}
]
}
Congratulations, youve used your first senpy service!
You can observe the result: the polarity is positive (marl:Positive). The reason of this prefix is that Senpy follows a linked data approach.
You can analyze the same sentence using a different sentiment service (e.g. Vader) and requesting a different format (e.g. turtle):
.. code:: shell
$ curl "http://senpy.gsi.upm.es/api/sentiment-vader" \
--data-urlencode "input=Senpy is awesome" \
--data-urlencode "outformat=turtle"
@prefix : <http://www.gsi.upm.es/onto/senpy/ns#> .
@prefix endpoint: <http://senpy.gsi.upm.es/api/> .
@prefix marl: <http://www.gsi.upm.es/ontologies/marl/ns#> .
2019-07-17 14:29:30 +00:00
@prefix nif: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .
@prefix prefix: <http://senpy.invalid/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix senpy: <http://www.gsi.upm.es/onto/senpy/ns#> .
prefix: a senpy:Entry ;
nif:isString "Senpy is awesome" ;
marl:hasOpinion [ a senpy:Sentiment ;
marl:hasPolarity "marl:Positive" ;
marl:polarityValue 6.72e-01 ;
prov:wasGeneratedBy prefix:Analysis_1562668175.9808676 ] .
[] a senpy:Results ;
prov:used prefix: .
As you see, Vader returns also the polarity value (0.67) in addition to the category (positive).
If you are interested in consuming Senpy services, read :doc:`Quickstart`.
To get familiar with the concepts behind Senpy, and what it can offer for service developers, check out :doc:`development`.
:doc:`apischema` contains information about the semantic models and vocabularies used by Senpy.
2015-02-24 08:03:36 +00:00
.. toctree::
2019-04-04 16:53:55 +00:00
:caption: Learn more about senpy:
:maxdepth: 2
2019-07-17 14:29:30 +00:00
:hidden:
2019-04-04 16:53:55 +00:00
senpy
demo
Quickstart.ipynb
installation
2019-07-17 14:29:30 +00:00
conversion
Evaluation.ipynb
2019-04-04 16:53:55 +00:00
apischema
2019-07-17 14:29:30 +00:00
development
2019-04-04 16:53:55 +00:00
publications
2019-07-17 14:29:30 +00:00
projects