From a20252e4bd16ee5ce89fb2e8c21b71d7b75746c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Thu, 4 Apr 2019 17:32:38 +0200 Subject: [PATCH] Update docs + notebooks --- .gitlab-ci.yml | 9 +- .travis.yml | 5 +- docs/Quickstart-10minutes.ipynb | 1513 ++++++++++ docs/Quickstart-1minute.ipynb | 152 + docs/Quickstart-30minutes.ipynb | 4832 +++++++++++++++++++++++++++++++ docs/Quickstart.ipynb | 4610 +---------------------------- docs/Quickstart.rst | 2599 ----------------- docs/advanced.rst | 3 +- docs/conf.py | 16 +- docs/demo.rst | 7 +- docs/index.rst | 5 +- docs/playground-0.20.png | Bin 0 -> 69907 bytes docs/plugins-faq.rst | 7 +- docs/requirements.txt | 1 + 14 files changed, 6547 insertions(+), 7212 deletions(-) create mode 100644 docs/Quickstart-10minutes.ipynb create mode 100644 docs/Quickstart-1minute.ipynb create mode 100644 docs/Quickstart-30minutes.ipynb delete mode 100644 docs/Quickstart.rst create mode 100644 docs/playground-0.20.png diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c6bc090..364af00 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,16 +21,16 @@ before_script: except: - tags # Avoid unnecessary double testing -test-3.5: +test-3.6: <<: *test_definition variables: - PYTHON_VERSION: "3.5" + PYTHON_VERSION: "3.6" -test-2.7: +test-3.7: <<: *test_definition allow_failure: true variables: - PYTHON_VERSION: "2.7" + PYTHON_VERSION: "3.7" push: stage: push @@ -101,4 +101,3 @@ cleanup_py: when: always # this is important; run even if preceding stages failed. script: - rm -vf ~/.pypirc # we don't want to leave these around, but GitLab may clean up anyway. - - docker logout diff --git a/.travis.yml b/.travis.yml index ae39ad8..ee359c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,10 @@ services: language: python env: - - PYV=2.7 + - PYV=3.3 + - PYV=3.4 - PYV=3.5 + - PYV=3.6 + - PYV=3.7 # run nosetests - Tests script: make test-$PYV diff --git a/docs/Quickstart-10minutes.ipynb b/docs/Quickstart-10minutes.ipynb new file mode 100644 index 0000000..5f65add --- /dev/null +++ b/docs/Quickstart-10minutes.ipynb @@ -0,0 +1,1513 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Senpy in 10 minutes\n", + "\n", + "This tutorial assumes you have completed the [1 minute tutorial](Quickstart-1minute.ipynb) and you know how to access the API.\n", + "\n", + "It covers:\n", + "\n", + "* Annotating entiment with a sentiment analysis service\n", + "* Annotating emotions\n", + "* Interoperability of services\n", + "* Using other semantic formats (RDF)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Requirements" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Once again, we will use the demo server at http://senpy.gsi.upm.es.\n", + "This time, we will use the requests library.\n", + "\n", + "We will use a variable for our endpoint, so you can try this examples on a different senpy instance:" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "endpoint = 'http://senpy.gsi.upm.es/api'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We will also add a function to get syntax highlighting for the JSON-LD/Turtle results:" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "try:\n", + " from IPython.display import Code\n", + " def pretty(txt, language='json-ld'):\n", + " return Code(txt, language=language)\n", + "except ImportError:\n", + " def pretty(txt, **kwargs):\n", + " print(txt)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Sentiment Analysis of Text" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To start, let us analyse the sentiment in the following sentence: *senpy is awesome*.\n", + "\n", + "For now, we will use the [sentiment140](http://www.sentiment140.com/) service, through the sentiment140 plugin.\n", + "We will later cover how to use a different service.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lIw%3D%3D",\n",
+       "  "@type": "Results",\n",
+       "  "entries": [\n",
+       "    {\n",
+       "      "@id": "prefix:",\n",
+       "      "@type": "Entry",\n",
+       "      "marl:hasOpinion": [\n",
+       "        {\n",
+       "          "@type": "Sentiment",\n",
+       "          "marl:hasPolarity": "marl:Positive",\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554391718.7649393"\n",
+       "        }\n",
+       "      ],\n",
+       "      "nif:isString": "Senpy is awesome",\n",
+       "      "onyx:hasEmotionSet": []\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lIw\\PYZpc{}3D\\PYZpc{}3D\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554391718.7649393\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is awesome\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lIw%3D%3D\",\n", + " \"@type\": \"Results\",\n", + " \"entries\": [\n", + " {\n", + " \"@id\": \"prefix:\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [\n", + " {\n", + " \"@type\": \"Sentiment\",\n", + " \"marl:hasPolarity\": \"marl:Positive\",\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554391718.7649393\"\n", + " }\n", + " ],\n", + " \"nif:isString\": \"Senpy is awesome\",\n", + " \"onyx:hasEmotionSet\": []\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import requests\n", + "res = requests.get(f'{endpoint}/sentiment140',\n", + " params={\"input\": \"Senpy is awesome\",})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Senpy services always return an object of type `senpy:Results`, with a list of entries.\n", + "You can think of an entry as a self-contained textual context (`nif:Context` and `senpy:Entry`).\n", + "Entries can be as short as a sentence, or as long as a news article.\n", + "\n", + "Each entry has a `nif:isString` property that contains the original text of the entry, and several other properties that are provided by the plugins.\n", + "\n", + "For instance, sentiment annotations are provided through `marl:hasOpinion`.\n", + "\n", + "The annotations are semantic.\n", + "We can ask Senpy for the expanded JSON-LD output to reveal the full URIs of each property and entity:" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lJmV4cGFuZGVkPVRydWUj",\n",
+       "  "@type": [\n",
+       "    "http://www.gsi.upm.es/onto/senpy/ns#Results"\n",
+       "  ],\n",
+       "  "http://www.w3.org/ns/prov#used": [\n",
+       "    {\n",
+       "      "@id": "http://senpy.invalid/",\n",
+       "      "@type": [\n",
+       "        "http://www.gsi.upm.es/onto/senpy/ns#Entry"\n",
+       "      ],\n",
+       "      "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#isString": [\n",
+       "        {\n",
+       "          "@value": "Senpy is awesome"\n",
+       "        }\n",
+       "      ],\n",
+       "      "http://www.gsi.dit.upm.es/ontologies/marl/ns#hasOpinion": [\n",
+       "        {\n",
+       "          "@type": [\n",
+       "            "http://www.gsi.upm.es/onto/senpy/ns#Sentiment"\n",
+       "          ],\n",
+       "          "http://www.gsi.dit.upm.es/ontologies/marl/ns#hasPolarity": [\n",
+       "            {\n",
+       "              "@value": "marl:Positive"\n",
+       "            }\n",
+       "          ],\n",
+       "          "http://www.w3.org/ns/prov#wasGeneratedBy": [\n",
+       "            {\n",
+       "              "@id": "http://senpy.invalid/Analysis_1554389672.269198"\n",
+       "            }\n",
+       "          ]\n",
+       "        }\n",
+       "      ],\n",
+       "      "http://www.gsi.dit.upm.es/ontologies/onyx/ns#hasEmotionSet": []\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lJmV4cGFuZGVkPVRydWUj\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}http://www.gsi.upm.es/onto/senpy/ns\\PYZsh{}Results\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.w3.org/ns/prov\\PYZsh{}used\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.invalid/\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}http://www.gsi.upm.es/onto/senpy/ns\\PYZsh{}Entry\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://persistence.uni\\PYZhy{}leipzig.org/nlp2rdf/ontologies/nif\\PYZhy{}core\\PYZsh{}isString\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is awesome\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/marl/ns\\PYZsh{}hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}http://www.gsi.upm.es/onto/senpy/ns\\PYZsh{}Sentiment\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/marl/ns\\PYZsh{}hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.w3.org/ns/prov\\PYZsh{}wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.invalid/Analysis\\PYZus{}1554389672.269198\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/ns\\PYZsh{}hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lJmV4cGFuZGVkPVRydWUj\",\n", + " \"@type\": [\n", + " \"http://www.gsi.upm.es/onto/senpy/ns#Results\"\n", + " ],\n", + " \"http://www.w3.org/ns/prov#used\": [\n", + " {\n", + " \"@id\": \"http://senpy.invalid/\",\n", + " \"@type\": [\n", + " \"http://www.gsi.upm.es/onto/senpy/ns#Entry\"\n", + " ],\n", + " \"http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#isString\": [\n", + " {\n", + " \"@value\": \"Senpy is awesome\"\n", + " }\n", + " ],\n", + " \"http://www.gsi.dit.upm.es/ontologies/marl/ns#hasOpinion\": [\n", + " {\n", + " \"@type\": [\n", + " \"http://www.gsi.upm.es/onto/senpy/ns#Sentiment\"\n", + " ],\n", + " \"http://www.gsi.dit.upm.es/ontologies/marl/ns#hasPolarity\": [\n", + " {\n", + " \"@value\": \"marl:Positive\"\n", + " }\n", + " ],\n", + " \"http://www.w3.org/ns/prov#wasGeneratedBy\": [\n", + " {\n", + " \"@id\": \"http://senpy.invalid/Analysis_1554389672.269198\"\n", + " }\n", + " ]\n", + " }\n", + " ],\n", + " \"http://www.gsi.dit.upm.es/ontologies/onyx/ns#hasEmotionSet\": []\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import requests\n", + "res = requests.get(f'{endpoint}/sentiment140',\n", + " params={\"input\": \"Senpy is awesome\",\n", + " \"expanded\": True})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Service interoperability" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "All senpy plugins use the same API, which makes moving from one service to another a breeze.\n", + "\n", + "Let us go back to our simple example, which uses the `sentiment140` service." + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lIw%3D%3D",\n",
+       "  "@type": "Results",\n",
+       "  "entries": [\n",
+       "    {\n",
+       "      "@id": "prefix:",\n",
+       "      "@type": "Entry",\n",
+       "      "marl:hasOpinion": [\n",
+       "        {\n",
+       "          "@type": "Sentiment",\n",
+       "          "marl:hasPolarity": "marl:Positive",\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554389675.2303865"\n",
+       "        }\n",
+       "      ],\n",
+       "      "nif:isString": "Senpy is awesome",\n",
+       "      "onyx:hasEmotionSet": []\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lIw\\PYZpc{}3D\\PYZpc{}3D\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554389675.2303865\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is awesome\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lIw%3D%3D\",\n", + " \"@type\": \"Results\",\n", + " \"entries\": [\n", + " {\n", + " \"@id\": \"prefix:\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [\n", + " {\n", + " \"@type\": \"Sentiment\",\n", + " \"marl:hasPolarity\": \"marl:Positive\",\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554389675.2303865\"\n", + " }\n", + " ],\n", + " \"nif:isString\": \"Senpy is awesome\",\n", + " \"onyx:hasEmotionSet\": []\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import requests\n", + "res = requests.get(f'{endpoint}/sentiment140',\n", + " params={\"input\": \"Senpy is awesome\"})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "If we wanted to use a different service (e.g. the `sentiment-basic` plugin), we can do it just by changing the URL of the service:" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudC1iYXNpYz9pbnB1dD1TZW5weStpcythd2Vzb21lIw%3D%3D",\n",
+       "  "@type": "Results",\n",
+       "  "entries": [\n",
+       "    {\n",
+       "      "@id": "prefix:",\n",
+       "      "@type": "Entry",\n",
+       "      "marl:hasOpinion": [\n",
+       "        {\n",
+       "          "@type": "Sentiment",\n",
+       "          "marl:hasPolarity": "marl:Neutral",\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554389675.9911203"\n",
+       "        }\n",
+       "      ],\n",
+       "      "nif:isString": "Senpy is awesome",\n",
+       "      "onyx:hasEmotionSet": []\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudC1iYXNpYz9pbnB1dD1TZW5weStpcythd2Vzb21lIw\\PYZpc{}3D\\PYZpc{}3D\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Neutral\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554389675.9911203\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is awesome\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudC1iYXNpYz9pbnB1dD1TZW5weStpcythd2Vzb21lIw%3D%3D\",\n", + " \"@type\": \"Results\",\n", + " \"entries\": [\n", + " {\n", + " \"@id\": \"prefix:\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [\n", + " {\n", + " \"@type\": \"Sentiment\",\n", + " \"marl:hasPolarity\": \"marl:Neutral\",\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554389675.9911203\"\n", + " }\n", + " ],\n", + " \"nif:isString\": \"Senpy is awesome\",\n", + " \"onyx:hasEmotionSet\": []\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import requests\n", + "res = requests.get(f'{endpoint}/sentiment-basic',\n", + " params={\"input\": \"Senpy is awesome\"})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "As you can see, the structure and annotation schema of the response is the same.\n", + "This makes it very easy to compare and migrate to different services.\n", + "\n", + "Service interoperability is not only useful for users.\n", + "It is also key for other features such as [automated evaluation](#Evaluation).\n", + "This is a compelling reason to adapt existing services to use the Senpy API.\n", + "In fact, the `sentiment140` senpy service is proxy to the public [Sentiment 140 service](http://www.sentiment140.com/)." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Emotion analysis" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "Senpy uses the `onyx` vocabulary to represent emotions, which incorporates the notion of `EmotionSet`'s, an emotion that is composed of several emotions.\n", + "In a nutshell, an `Entry` is linked to one or more `EmotionSet`, which in turn is made up of one or more `Emotion`.\n", + "\n", + "Let's illustrate it with an example, using the `emotion-depechemood` plugin." + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q_aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrdGhhdCtzZXJ2aWNlIw%3D%3D",\n",
+       "  "@type": "Results",\n",
+       "  "entries": [\n",
+       "    {\n",
+       "      "@id": "prefix:",\n",
+       "      "@type": "Entry",\n",
+       "      "marl:hasOpinion": [],\n",
+       "      "nif:isString": "Senpy is a wonderful that service",\n",
+       "      "onyx:hasEmotionSet": [\n",
+       "        {\n",
+       "          "@type": "EmotionSet",\n",
+       "          "onyx:hasEmotion": [\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:negative-fear",\n",
+       "              "onyx:hasEmotionIntensity": 0.06258366271018097\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:amusement",\n",
+       "              "onyx:hasEmotionIntensity": 0.15784834034155437\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:anger",\n",
+       "              "onyx:hasEmotionIntensity": 0.08728815135373413\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:annoyance",\n",
+       "              "onyx:hasEmotionIntensity": 0.12184635680460143\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:indifference",\n",
+       "              "onyx:hasEmotionIntensity": 0.1374081151031531\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:joy",\n",
+       "              "onyx:hasEmotionIntensity": 0.12267040802346799\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:awe",\n",
+       "              "onyx:hasEmotionIntensity": 0.21085262130713067\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:sadness",\n",
+       "              "onyx:hasEmotionIntensity": 0.09950234435617733\n",
+       "            }\n",
+       "          ],\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554389679.0535374"\n",
+       "        }\n",
+       "      ]\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q\\PYZus{}aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrdGhhdCtzZXJ2aWNlIw\\PYZpc{}3D\\PYZpc{}3D\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is a wonderful that service\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:negative\\PYZhy{}fear\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.06258366271018097}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:amusement\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.15784834034155437}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:anger\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.08728815135373413}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:annoyance\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.12184635680460143}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:indifference\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.1374081151031531}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:joy\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.12267040802346799}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:awe\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.21085262130713067}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:sadness\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.09950234435617733}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554389679.0535374\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q_aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrdGhhdCtzZXJ2aWNlIw%3D%3D\",\n", + " \"@type\": \"Results\",\n", + " \"entries\": [\n", + " {\n", + " \"@id\": \"prefix:\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [],\n", + " \"nif:isString\": \"Senpy is a wonderful that service\",\n", + " \"onyx:hasEmotionSet\": [\n", + " {\n", + " \"@type\": \"EmotionSet\",\n", + " \"onyx:hasEmotion\": [\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:negative-fear\",\n", + " \"onyx:hasEmotionIntensity\": 0.06258366271018097\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:amusement\",\n", + " \"onyx:hasEmotionIntensity\": 0.15784834034155437\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:anger\",\n", + " \"onyx:hasEmotionIntensity\": 0.08728815135373413\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:annoyance\",\n", + " \"onyx:hasEmotionIntensity\": 0.12184635680460143\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:indifference\",\n", + " \"onyx:hasEmotionIntensity\": 0.1374081151031531\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:joy\",\n", + " \"onyx:hasEmotionIntensity\": 0.12267040802346799\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:awe\",\n", + " \"onyx:hasEmotionIntensity\": 0.21085262130713067\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:sadness\",\n", + " \"onyx:hasEmotionIntensity\": 0.09950234435617733\n", + " }\n", + " ],\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554389679.0535374\"\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res = requests.get(f'{endpoint}/emotion-depechemood',\n", + " params={\"input\": \"Senpy is a wonderful that service\"})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "As you have probably noticed, there are several emotions in this result, each with a different intensity.\n", + "\n", + "We can also tell senpy to only return the emotion with the maximum intensity using the `maxemotion` parameter:" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q_aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrc2VydmljZSZtYXhlbW90aW9uPVRydWUj",\n",
+       "  "@type": "Results",\n",
+       "  "entries": [\n",
+       "    {\n",
+       "      "@id": "prefix:",\n",
+       "      "@type": "Entry",\n",
+       "      "marl:hasOpinion": [],\n",
+       "      "nif:isString": "Senpy is a wonderful service",\n",
+       "      "onyx:hasEmotionSet": [\n",
+       "        {\n",
+       "          "@type": "EmotionSet",\n",
+       "          "onyx:hasEmotion": [\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:awe",\n",
+       "              "onyx:hasEmotionIntensity": 0.21085262130713067\n",
+       "            }\n",
+       "          ],\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554389681.1941268"\n",
+       "        }\n",
+       "      ]\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q\\PYZus{}aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrc2VydmljZSZtYXhlbW90aW9uPVRydWUj\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is a wonderful service\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:awe\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.21085262130713067}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554389681.1941268\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q_aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrc2VydmljZSZtYXhlbW90aW9uPVRydWUj\",\n", + " \"@type\": \"Results\",\n", + " \"entries\": [\n", + " {\n", + " \"@id\": \"prefix:\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [],\n", + " \"nif:isString\": \"Senpy is a wonderful service\",\n", + " \"onyx:hasEmotionSet\": [\n", + " {\n", + " \"@type\": \"EmotionSet\",\n", + " \"onyx:hasEmotion\": [\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:awe\",\n", + " \"onyx:hasEmotionIntensity\": 0.21085262130713067\n", + " }\n", + " ],\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554389681.1941268\"\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res = requests.get(f'{endpoint}/emotion-depechemood',\n", + " params={\"input\": \"Senpy is a wonderful service\",\n", + " \"maxemotion\": True})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Other output formats" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Senpy supports several semantic formats, like turtle and xml-RDF.\n", + "You can select the format of the output with the `outformat` parameter:" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
@prefix : <http://www.gsi.upm.es/onto/senpy/ns#> .\n",
+       "@prefix dc: <http://dublincore.org/2012/06/14/dcelements#> .\n",
+       "@prefix emoml: <http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/emotionml/ns#> .\n",
+       "@prefix endpoint: <http://senpy.gsi.upm.es/api/> .\n",
+       "@prefix fam: <http://vocab.fusepool.info/fam#> .\n",
+       "@prefix marl: <http://www.gsi.dit.upm.es/ontologies/marl/ns#> .\n",
+       "@prefix nif: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .\n",
+       "@prefix onyx: <http://www.gsi.dit.upm.es/ontologies/onyx/ns#> .\n",
+       "@prefix prefix: <http://senpy.invalid/> .\n",
+       "@prefix prov: <http://www.w3.org/ns/prov#> .\n",
+       "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n",
+       "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n",
+       "@prefix senpy: <http://www.gsi.upm.es/onto/senpy/ns#> .\n",
+       "@prefix wna: <http://www.gsi.dit.upm.es/ontologies/wnaffect/ns#> .\n",
+       "@prefix xml: <http://www.w3.org/XML/1998/namespace> .\n",
+       "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n",
+       "\n",
+       "prefix: a senpy:Entry ;\n",
+       "    nif:isString "Senpy is the best framework for semantic sentiment analysis, and very easy to use" ;\n",
+       "    marl:hasOpinion [ a senpy:Sentiment ;\n",
+       "            marl:hasPolarity "marl:Positive" ;\n",
+       "            prov:wasGeneratedBy prefix:Analysis_1554389682.350598 ] .\n",
+       "\n",
+       "[] a senpy:Results ;\n",
+       "    prov:used prefix: .\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.gsi.upm.es/onto/senpy/ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{dc:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://dublincore.org/2012/06/14/dcelements\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{emoml:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/emotionml/ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{endpoint:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://senpy.gsi.upm.es/api/\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{fam:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://vocab.fusepool.info/fam\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{marl:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.gsi.dit.upm.es/ontologies/marl/ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{nif:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://persistence.uni\\PYZhy{}leipzig.org/nlp2rdf/ontologies/nif\\PYZhy{}core\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{onyx:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.gsi.dit.upm.es/ontologies/onyx/ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{prefix:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://senpy.invalid/\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{prov:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.w3.org/ns/prov\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{rdf:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.w3.org/1999/02/22\\PYZhy{}rdf\\PYZhy{}syntax\\PYZhy{}ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{rdfs:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.w3.org/2000/01/rdf\\PYZhy{}schema\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{senpy:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.gsi.upm.es/onto/senpy/ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{wna:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.gsi.dit.upm.es/ontologies/wnaffect/ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{xml:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.w3.org/XML/1998/namespace\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{xsd:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.w3.org/2001/XMLSchema\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", + "\n", + "\\PY{err}{p}\\PY{err}{r}\\PY{err}{e}\\PY{err}{f}\\PY{err}{i}\\PY{err}{x}\\PY{p}{:}\\PY{+w}{ }\\PY{k+kt}{a}\\PY{+w}{ }\\PY{n+nn}{senpy:}\\PY{n+nt}{Entry}\\PY{+w}{ }\\PY{p}{;}\n", + "\\PY{+w}{ }\\PY{n+nn}{nif:}\\PY{n+nt}{isString}\\PY{+w}{ }\\PY{l+s}{\\PYZdq{}}\\PY{l+s}{Senpy is the best framework for semantic sentiment analysis, and very easy to use}\\PY{l+s}{\\PYZdq{}}\\PY{+w}{ }\\PY{p}{;}\n", + "\\PY{+w}{ }\\PY{n+nn}{marl:}\\PY{n+nt}{hasOpinion}\\PY{+w}{ }\\PY{p}{[}\\PY{+w}{ }\\PY{k+kt}{a}\\PY{+w}{ }\\PY{n+nn}{senpy:}\\PY{n+nt}{Sentiment}\\PY{+w}{ }\\PY{p}{;}\n", + "\\PY{+w}{ }\\PY{n+nn}{marl:}\\PY{n+nt}{hasPolarity}\\PY{+w}{ }\\PY{l+s}{\\PYZdq{}}\\PY{l+s}{marl:Positive}\\PY{l+s}{\\PYZdq{}}\\PY{+w}{ }\\PY{p}{;}\n", + "\\PY{+w}{ }\\PY{n+nn}{prov:}\\PY{n+nt}{wasGeneratedBy}\\PY{+w}{ }\\PY{n+nn}{prefix:}\\PY{n+nt}{Analysis\\PYZus{}1554389682}\\PY{l+m+mf}{.350598}\\PY{+w}{ }\\PY{p}{]}\\PY{+w}{ }\\PY{p}{.}\n", + "\n", + "\\PY{p}{[}\\PY{p}{]}\\PY{+w}{ }\\PY{k+kt}{a}\\PY{+w}{ }\\PY{n+nn}{senpy:}\\PY{n+nt}{Results}\\PY{+w}{ }\\PY{p}{;}\n", + "\\PY{+w}{ }\\PY{n+nn}{prov:}\\PY{n+nt}{used}\\PY{+w}{ }\\PY{err}{p}\\PY{err}{r}\\PY{err}{e}\\PY{err}{f}\\PY{err}{i}\\PY{err}{x}\\PY{p}{:}\\PY{+w}{ }\\PY{p}{.}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "@prefix : .\n", + "@prefix dc: .\n", + "@prefix emoml: .\n", + "@prefix endpoint: .\n", + "@prefix fam: .\n", + "@prefix marl: .\n", + "@prefix nif: .\n", + "@prefix onyx: .\n", + "@prefix prefix: .\n", + "@prefix prov: .\n", + "@prefix rdf: .\n", + "@prefix rdfs: .\n", + "@prefix senpy: .\n", + "@prefix wna: .\n", + "@prefix xml: .\n", + "@prefix xsd: .\n", + "\n", + "prefix: a senpy:Entry ;\n", + " nif:isString \"Senpy is the best framework for semantic sentiment analysis, and very easy to use\" ;\n", + " marl:hasOpinion [ a senpy:Sentiment ;\n", + " marl:hasPolarity \"marl:Positive\" ;\n", + " prov:wasGeneratedBy prefix:Analysis_1554389682.350598 ] .\n", + "\n", + "[] a senpy:Results ;\n", + " prov:used prefix: .\n" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res = requests.get(f'{endpoint}/sentiment140',\n", + " params={\"input\": \"Senpy is the best framework for semantic sentiment analysis, and very easy to use\",\n", + " \"outformat\": \"turtle\"})\n", + "pretty(res.text, language='turtle')" + ] + } + ], + "metadata": { + "anaconda-cloud": {}, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + }, + "toc": { + "colors": { + "hover_highlight": "#DAA520", + "running_highlight": "#FF0000", + "selected_highlight": "#FFD700" + }, + "moveMenuLeft": true, + "nav_menu": { + "height": "68px", + "width": "252px" + }, + "navigate_menu": true, + "number_sections": true, + "sideBar": true, + "threshold": 4, + "toc_cell": false, + "toc_section_display": "block", + "toc_window_display": false + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} diff --git a/docs/Quickstart-1minute.ipynb b/docs/Quickstart-1minute.ipynb new file mode 100644 index 0000000..02c4562 --- /dev/null +++ b/docs/Quickstart-1minute.ipynb @@ -0,0 +1,152 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Senpy in 1 minute\n", + "\n", + "This mini-tutorial is the first in the series of senpy tutorials. It only shows how to annotate with a service.\n", + "In this first tutorial, we will use the [demo server](http://senpy.gsi.upm.es), which runs some open source plugins for sentiment and emotion analysis." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Annotating with senpy is as simple as issuing an HTTP request to the API using your favourite tool.\n", + "This is just an example using curl:" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\r\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD8j\",\r\n", + " \"@type\": \"Results\",\r\n", + " \"entries\": [\r\n", + " {\r\n", + " \"@id\": \"prefix:\",\r\n", + " \"@type\": \"Entry\",\r\n", + " \"marl:hasOpinion\": [\r\n", + " {\r\n", + " \"@type\": \"Sentiment\",\r\n", + " \"marl:hasPolarity\": \"marl:Positive\",\r\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554389334.6431913\"\r\n", + " }\r\n", + " ],\r\n", + " \"nif:isString\": \"Senpy is awesome\",\r\n", + " \"onyx:hasEmotionSet\": []\r\n", + " }\r\n", + " ]\r\n", + "}" + ] + } + ], + "source": [ + "!curl \"http://senpy.gsi.upm.es/api/sentiment140\" --data-urlencode \"input=Senpy is awesome\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Congratulations, you've used your first senpy service!" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Here is the equivalent using the `requests` library:" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lIw%3D%3D\",\n", + " \"@type\": \"Results\",\n", + " \"entries\": [\n", + " {\n", + " \"@id\": \"prefix:\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [\n", + " {\n", + " \"@type\": \"Sentiment\",\n", + " \"marl:hasPolarity\": \"marl:Positive\",\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554389335.9803226\"\n", + " }\n", + " ],\n", + " \"nif:isString\": \"Senpy is awesome\",\n", + " \"onyx:hasEmotionSet\": []\n", + " }\n", + " ]\n", + "}\n" + ] + } + ], + "source": [ + "import requests\n", + "res = requests.get('http://senpy.gsi.upm.es/api/sentiment140',\n", + " params={\"input\": \"Senpy is awesome\",})\n", + "print(res.text)" + ] + } + ], + "metadata": { + "anaconda-cloud": {}, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + }, + "toc": { + "colors": { + "hover_highlight": "#DAA520", + "running_highlight": "#FF0000", + "selected_highlight": "#FFD700" + }, + "moveMenuLeft": true, + "nav_menu": { + "height": "68px", + "width": "252px" + }, + "navigate_menu": true, + "number_sections": true, + "sideBar": true, + "threshold": 4, + "toc_cell": false, + "toc_section_display": "block", + "toc_window_display": false + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} diff --git a/docs/Quickstart-30minutes.ipynb b/docs/Quickstart-30minutes.ipynb new file mode 100644 index 0000000..d733d48 --- /dev/null +++ b/docs/Quickstart-30minutes.ipynb @@ -0,0 +1,4832 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Senpy in 30 minutes" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This tutorial takes up where the [10 minute tutorial](Quickstart-10minutes.ipynb) left off.\n", + "\n", + "It covers more advanced tasks such as:\n", + "\n", + "* Asking for specific emotion models (automatic model conversion)\n", + "* Listing available services in an endpoint\n", + "* Transforming the results\n", + "* Calling multiple services in the same request (Pipelines)\n", + "* Running your own Senpy instance" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Requirements" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Once again we will use the demo server at http://senpy.gsi.upm.es, and a function to prettify the semantic output." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "endpoint = 'http://senpy.gsi.upm.es/api'" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "import requests\n", + "try:\n", + " from IPython.display import Code\n", + " def pretty(txt, language='json-ld'):\n", + " return Code(txt, language=language)\n", + "except ImportError:\n", + " def pretty(txt, **kwargs):\n", + " print(txt)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Selecting fields from the output" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The full output in the previous tutorials is very useful because it is semantically annotated.\n", + "However, it is also quite verbose if we only want to label a piece of text, or get a polarity value.\n", + "\n", + "For such simple cases, the API has a special `fields` method you can use to get a specific field from the results, and even transform the results. Senpy uses jmespath under the hood, which has its own notation.\n", + "\n", + "To illustrate this, let us get only the text (`nif:isString`) from each entry:" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[\"Senpy is a wonderful service\"]\n" + ] + } + ], + "source": [ + "res = requests.get(f'{endpoint}/sentiment140',\n", + " params={\"input\": \"Senpy is a wonderful service\",\n", + " \"fields\": 'entries[].\"nif:isString\"'})\n", + "print(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Or we could get both the text and the polarity of the text (assuming there is only one opinion per entry) with a slightly more complicated query:" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[\"Senpy is a service. Wonderful service.\", \"marl:Neutral\"]\n" + ] + } + ], + "source": [ + "res = requests.get(f'{endpoint}/sentiment140',\n", + " params={\"input\": \"Senpy is a service. Wonderful service.\",\n", + " \"delimiter\": \"sentence\",\n", + " \"fields\": 'entries[0].[\"nif:isString\", \"marl:hasOpinion\"[0].\"marl:hasPolarity\"]'})\n", + "print(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "jmespath is rather extensive for this tutorial. We will cover only the most simple cases, so you do not need to learn much about the notation.\n", + "\n", + "For more complicated transformations, check out [jmespath](http://jmespath.org).\n", + "In addition to a fairly complete documentation, they have a live environment you can use to test your queries." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Emotion conversion" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "If the model used by a plugin is not right for your application, you can ask for a specific emotion model in your request.\n", + "\n", + "Senpy ships with emotion conversion capabilities, and it will try to automatically convert the results.\n", + "\n", + "For example, the `emotion-anew` plugin uses the dimensional `pad` (or VAD, valence-arousal-dominance) model, as we can see here:" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQj\",\n", + " \"@type\": \"Results\",\n", + " \"entries\": [\n", + " {\n", + " \"@id\": \"prefix:\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [],\n", + " \"nif:isString\": \"Senpy is a wonderful service and I love it\",\n", + " \"onyx:hasEmotionSet\": [\n", + " {\n", + " \"@id\": \"Emotions0\",\n", + " \"@type\": \"EmotionSet\",\n", + " \"onyx:hasEmotion\": [\n", + " {\n", + " \"@id\": \"Emotion0\",\n", + " \"@type\": \"Emotion\",\n", + " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal\": 6.44,\n", + " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance\": 7.11,\n", + " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence\": 8.72,\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382982.775705\"\n", + " }\n", + " ],\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382982.775705\"\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + "}\n" + ] + } + ], + "source": [ + "res = requests.get(f'{endpoint}/emotion-anew',\n", + " params={\"input\": \"Senpy is a wonderful service and I love it\"})\n", + "print(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "If we need a category level, we can ask for the equivalent results in the `big6` model:" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYj",\n",
+       "  "@type": "Results",\n",
+       "  "entries": [\n",
+       "    {\n",
+       "      "@id": "prefix:",\n",
+       "      "@type": "Entry",\n",
+       "      "marl:hasOpinion": [],\n",
+       "      "nif:isString": "Senpy is a wonderful service and I love it",\n",
+       "      "onyx:hasEmotionSet": [\n",
+       "        {\n",
+       "          "@id": "Emotions0",\n",
+       "          "@type": "EmotionSet",\n",
+       "          "onyx:hasEmotion": [\n",
+       "            {\n",
+       "              "@id": "Emotion0",\n",
+       "              "@type": "Emotion",\n",
+       "              "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal": 6.44,\n",
+       "              "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance": 7.11,\n",
+       "              "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence": 8.72,\n",
+       "              "prov:wasGeneratedBy": "prefix:Analysis_1554382982.8068626"\n",
+       "            }\n",
+       "          ],\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554382982.8068626"\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "EmotionSet",\n",
+       "          "onyx:hasEmotion": [\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:algorithmConfidence": 7.449999999999999,\n",
+       "              "onyx:hasEmotionCategory": "emoml:big6fear"\n",
+       "            }\n",
+       "          ],\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554382982.8106468"\n",
+       "        }\n",
+       "      ]\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYj\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is a wonderful service and I love it\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotions0\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion0\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}arousal\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{6.44}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}dominance\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{7.11}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}valence\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{8.72}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382982.8068626\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382982.8068626\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:algorithmConfidence\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{7.449999999999999}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}emoml:big6fear\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382982.8106468\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYj\",\n", + " \"@type\": \"Results\",\n", + " \"entries\": [\n", + " {\n", + " \"@id\": \"prefix:\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [],\n", + " \"nif:isString\": \"Senpy is a wonderful service and I love it\",\n", + " \"onyx:hasEmotionSet\": [\n", + " {\n", + " \"@id\": \"Emotions0\",\n", + " \"@type\": \"EmotionSet\",\n", + " \"onyx:hasEmotion\": [\n", + " {\n", + " \"@id\": \"Emotion0\",\n", + " \"@type\": \"Emotion\",\n", + " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal\": 6.44,\n", + " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance\": 7.11,\n", + " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence\": 8.72,\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382982.8068626\"\n", + " }\n", + " ],\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382982.8068626\"\n", + " },\n", + " {\n", + " \"@type\": \"EmotionSet\",\n", + " \"onyx:hasEmotion\": [\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:algorithmConfidence\": 7.449999999999999,\n", + " \"onyx:hasEmotionCategory\": \"emoml:big6fear\"\n", + " }\n", + " ],\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382982.8106468\"\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res = requests.get(f'{endpoint}/emotion-anew',\n", + " params={\"input\": \"Senpy is a wonderful service and I love it\",\n", + " \"emotion-model\": \"emoml:big6\"})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Because we don't usually care about the original emotion, the conversion can be presented in three ways:\n", + "\n", + "* full: the original and converted emotions are included at the same level\n", + "* filtered: the original emotion is replaced by the converted emotion\n", + "* nested: the original emotion is replaced, but the converted emotion points to it\n", + "\n", + "For example, here's how the `nested` structure would look like:" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYmY29udmVyc2lvbj1uZXN0ZWQj",\n",
+       "  "@type": "Results",\n",
+       "  "entries": [\n",
+       "    {\n",
+       "      "@id": "prefix:",\n",
+       "      "@type": "Entry",\n",
+       "      "marl:hasOpinion": [],\n",
+       "      "nif:isString": "Senpy is a wonderful service and I love it",\n",
+       "      "onyx:hasEmotionSet": [\n",
+       "        {\n",
+       "          "@type": "EmotionSet",\n",
+       "          "onyx:hasEmotion": [\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:algorithmConfidence": 7.449999999999999,\n",
+       "              "onyx:hasEmotionCategory": "emoml:big6fear"\n",
+       "            }\n",
+       "          ],\n",
+       "          "prov:wasDerivedFrom": {\n",
+       "            "@id": "Emotions0",\n",
+       "            "@type": "EmotionSet",\n",
+       "            "onyx:hasEmotion": [\n",
+       "              {\n",
+       "                "@id": "Emotion0",\n",
+       "                "@type": "Emotion",\n",
+       "                "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal": 6.44,\n",
+       "                "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance": 7.11,\n",
+       "                "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence": 8.72,\n",
+       "                "prov:wasGeneratedBy": "prefix:Analysis_1554382982.8948743"\n",
+       "              }\n",
+       "            ],\n",
+       "            "prov:wasGeneratedBy": "prefix:Analysis_1554382982.8948743"\n",
+       "          },\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554382982.8985674"\n",
+       "        }\n",
+       "      ]\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYmY29udmVyc2lvbj1uZXN0ZWQj\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is a wonderful service and I love it\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:algorithmConfidence\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{7.449999999999999}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}emoml:big6fear\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasDerivedFrom\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotions0\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion0\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}arousal\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{6.44}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}dominance\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{7.11}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}valence\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{8.72}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382982.8948743\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382982.8948743\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382982.8985674\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYmY29udmVyc2lvbj1uZXN0ZWQj\",\n", + " \"@type\": \"Results\",\n", + " \"entries\": [\n", + " {\n", + " \"@id\": \"prefix:\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [],\n", + " \"nif:isString\": \"Senpy is a wonderful service and I love it\",\n", + " \"onyx:hasEmotionSet\": [\n", + " {\n", + " \"@type\": \"EmotionSet\",\n", + " \"onyx:hasEmotion\": [\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:algorithmConfidence\": 7.449999999999999,\n", + " \"onyx:hasEmotionCategory\": \"emoml:big6fear\"\n", + " }\n", + " ],\n", + " \"prov:wasDerivedFrom\": {\n", + " \"@id\": \"Emotions0\",\n", + " \"@type\": \"EmotionSet\",\n", + " \"onyx:hasEmotion\": [\n", + " {\n", + " \"@id\": \"Emotion0\",\n", + " \"@type\": \"Emotion\",\n", + " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal\": 6.44,\n", + " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance\": 7.11,\n", + " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence\": 8.72,\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382982.8948743\"\n", + " }\n", + " ],\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382982.8948743\"\n", + " },\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382982.8985674\"\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res = requests.get(f'{endpoint}/emotion-anew',\n", + " params={\"input\": \"Senpy is a wonderful service and I love it\",\n", + " \"emotion-model\": \"emoml:big6\",\n", + " \"conversion\": \"nested\"})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Again, for completion, we could get only the label with the `fields` parameter:" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
[["Senpy is a wonderful service and I love it", "emoml:big6fear"]]\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{[}\\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}Senpy is a wonderful service and I love it\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}emoml:big6fear\\PYZdq{}}\\PY{p}{]}\\PY{p}{]}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "[[\"Senpy is a wonderful service and I love it\", \"emoml:big6fear\"]]" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res = requests.get(f'{endpoint}/emotion-anew',\n", + " params={\"input\": \"Senpy is a wonderful service and I love it\",\n", + " \"emotion-model\": \"emoml:big6\",\n", + " \"fields\": 'entries[].[[\"nif:isString\",\"onyx:hasEmotionSet\"[].\"onyx:hasEmotion\"[].\"onyx:hasEmotionCategory\"][]][]',\n", + " \"conversion\": \"filtered\"})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Building pipelines" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You can query several senpy services in the same request.\n", + "This feature is called pipelining, and the result of combining several plugins in a request is called a pipeline.\n", + "\n", + "The simplest way to use pipelines is to add every plugin you want to use to the URL, separated by either a slash or a comma.\n", + "\n", + "For instance, to get sentiment (`sentiment140`) and emotion (`depechemood`) annotations at the same time:" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MC9lbW90aW9uLWRlcGVjaGVtb29kP2lucHV0PVNlbnB5K2lzK2Erd29uZGVyZnVsK3NlcnZpY2Uj",\n",
+       "  "@type": "Results",\n",
+       "  "entries": [\n",
+       "    {\n",
+       "      "@id": "prefix:",\n",
+       "      "@type": "Entry",\n",
+       "      "marl:hasOpinion": [\n",
+       "        {\n",
+       "          "@type": "Sentiment",\n",
+       "          "marl:hasPolarity": "marl:Neutral",\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554382983.2991712"\n",
+       "        }\n",
+       "      ],\n",
+       "      "nif:isString": "Senpy is a wonderful service",\n",
+       "      "onyx:hasEmotionSet": [\n",
+       "        {\n",
+       "          "@type": "EmotionSet",\n",
+       "          "onyx:hasEmotion": [\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:negative-fear",\n",
+       "              "onyx:hasEmotionIntensity": 0.06258366271018097\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:amusement",\n",
+       "              "onyx:hasEmotionIntensity": 0.15784834034155437\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:anger",\n",
+       "              "onyx:hasEmotionIntensity": 0.08728815135373413\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:annoyance",\n",
+       "              "onyx:hasEmotionIntensity": 0.12184635680460143\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:indifference",\n",
+       "              "onyx:hasEmotionIntensity": 0.1374081151031531\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:joy",\n",
+       "              "onyx:hasEmotionIntensity": 0.12267040802346799\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:awe",\n",
+       "              "onyx:hasEmotionIntensity": 0.21085262130713067\n",
+       "            },\n",
+       "            {\n",
+       "              "@type": "Emotion",\n",
+       "              "onyx:hasEmotionCategory": "wna:sadness",\n",
+       "              "onyx:hasEmotionIntensity": 0.09950234435617733\n",
+       "            }\n",
+       "          ],\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554382983.3010163"\n",
+       "        }\n",
+       "      ]\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MC9lbW90aW9uLWRlcGVjaGVtb29kP2lucHV0PVNlbnB5K2lzK2Erd29uZGVyZnVsK3NlcnZpY2Uj\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Neutral\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382983.2991712\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is a wonderful service\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:negative\\PYZhy{}fear\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.06258366271018097}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:amusement\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.15784834034155437}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:anger\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.08728815135373413}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:annoyance\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.12184635680460143}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:indifference\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.1374081151031531}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:joy\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.12267040802346799}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:awe\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.21085262130713067}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:sadness\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.09950234435617733}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382983.3010163\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MC9lbW90aW9uLWRlcGVjaGVtb29kP2lucHV0PVNlbnB5K2lzK2Erd29uZGVyZnVsK3NlcnZpY2Uj\",\n", + " \"@type\": \"Results\",\n", + " \"entries\": [\n", + " {\n", + " \"@id\": \"prefix:\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [\n", + " {\n", + " \"@type\": \"Sentiment\",\n", + " \"marl:hasPolarity\": \"marl:Neutral\",\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382983.2991712\"\n", + " }\n", + " ],\n", + " \"nif:isString\": \"Senpy is a wonderful service\",\n", + " \"onyx:hasEmotionSet\": [\n", + " {\n", + " \"@type\": \"EmotionSet\",\n", + " \"onyx:hasEmotion\": [\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:negative-fear\",\n", + " \"onyx:hasEmotionIntensity\": 0.06258366271018097\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:amusement\",\n", + " \"onyx:hasEmotionIntensity\": 0.15784834034155437\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:anger\",\n", + " \"onyx:hasEmotionIntensity\": 0.08728815135373413\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:annoyance\",\n", + " \"onyx:hasEmotionIntensity\": 0.12184635680460143\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:indifference\",\n", + " \"onyx:hasEmotionIntensity\": 0.1374081151031531\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:joy\",\n", + " \"onyx:hasEmotionIntensity\": 0.12267040802346799\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:awe\",\n", + " \"onyx:hasEmotionIntensity\": 0.21085262130713067\n", + " },\n", + " {\n", + " \"@type\": \"Emotion\",\n", + " \"onyx:hasEmotionCategory\": \"wna:sadness\",\n", + " \"onyx:hasEmotionIntensity\": 0.09950234435617733\n", + " }\n", + " ],\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382983.3010163\"\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res = requests.get(f'{endpoint}/sentiment140/emotion-depechemood',\n", + " params={\"input\": \"Senpy is a wonderful service\"})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In a senpy pipeline, the call is processed by each plugin in sequence.\n", + "The output of a plugin is used as input for the next one.\n", + "\n", + "Pipelines take the same parameters as the plugins they are made of.\n", + "For example, if we want to split the original sentence before analysing its sentiment, we can use a pipeline made out of the `split` and the `sentiment140` plugins.\n", + "\n", + "`split` takes an extra parameter (`delimiter`) to select the type of splitting (by sentence or by paragraph), and `sentiment140` takes a `language` parameter.\n", + "\n", + "This is how the request looks like:" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NwbGl0L3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lLitBbmQrc2VydmljZXMrYXJlK2NvbXBvc2FibGUuJmRlbGltaXRlcj1zZW50ZW5jZSZsYW5ndWFnZT1lbiZvdXRmb3JtYXQ9anNvbi1sZCM%3D",\n",
+       "  "@type": "Results",\n",
+       "  "entries": [\n",
+       "    {\n",
+       "      "@id": "prefix:",\n",
+       "      "@type": "Entry",\n",
+       "      "marl:hasOpinion": [\n",
+       "        {\n",
+       "          "@type": "Sentiment",\n",
+       "          "marl:hasPolarity": "marl:Positive",\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554382983.5748618"\n",
+       "        }\n",
+       "      ],\n",
+       "      "nif:isString": "Senpy is awesome. And services are composable.",\n",
+       "      "onyx:hasEmotionSet": []\n",
+       "    },\n",
+       "    {\n",
+       "      "@id": "prefix:#char=0,17",\n",
+       "      "@type": "Entry",\n",
+       "      "marl:hasOpinion": [\n",
+       "        {\n",
+       "          "@type": "Sentiment",\n",
+       "          "marl:hasPolarity": "marl:Positive",\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554382983.5748618"\n",
+       "        }\n",
+       "      ],\n",
+       "      "nif:isString": "Senpy is awesome.",\n",
+       "      "onyx:hasEmotionSet": []\n",
+       "    },\n",
+       "    {\n",
+       "      "@id": "prefix:#char=18,46",\n",
+       "      "@type": "Entry",\n",
+       "      "marl:hasOpinion": [\n",
+       "        {\n",
+       "          "@type": "Sentiment",\n",
+       "          "marl:hasPolarity": "marl:Neutral",\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554382983.5748618"\n",
+       "        }\n",
+       "      ],\n",
+       "      "nif:isString": "And services are composable.",\n",
+       "      "onyx:hasEmotionSet": []\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3NwbGl0L3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lLitBbmQrc2VydmljZXMrYXJlK2NvbXBvc2FibGUuJmRlbGltaXRlcj1zZW50ZW5jZSZsYW5ndWFnZT1lbiZvdXRmb3JtYXQ9anNvbi1sZCM\\PYZpc{}3D\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382983.5748618\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is awesome. And services are composable.\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZsh{}char=0,17\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382983.5748618\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is awesome.\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZsh{}char=18,46\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Neutral\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382983.5748618\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}And services are composable.\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NwbGl0L3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lLitBbmQrc2VydmljZXMrYXJlK2NvbXBvc2FibGUuJmRlbGltaXRlcj1zZW50ZW5jZSZsYW5ndWFnZT1lbiZvdXRmb3JtYXQ9anNvbi1sZCM%3D\",\n", + " \"@type\": \"Results\",\n", + " \"entries\": [\n", + " {\n", + " \"@id\": \"prefix:\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [\n", + " {\n", + " \"@type\": \"Sentiment\",\n", + " \"marl:hasPolarity\": \"marl:Positive\",\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382983.5748618\"\n", + " }\n", + " ],\n", + " \"nif:isString\": \"Senpy is awesome. And services are composable.\",\n", + " \"onyx:hasEmotionSet\": []\n", + " },\n", + " {\n", + " \"@id\": \"prefix:#char=0,17\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [\n", + " {\n", + " \"@type\": \"Sentiment\",\n", + " \"marl:hasPolarity\": \"marl:Positive\",\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382983.5748618\"\n", + " }\n", + " ],\n", + " \"nif:isString\": \"Senpy is awesome.\",\n", + " \"onyx:hasEmotionSet\": []\n", + " },\n", + " {\n", + " \"@id\": \"prefix:#char=18,46\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [\n", + " {\n", + " \"@type\": \"Sentiment\",\n", + " \"marl:hasPolarity\": \"marl:Neutral\",\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382983.5748618\"\n", + " }\n", + " ],\n", + " \"nif:isString\": \"And services are composable.\",\n", + " \"onyx:hasEmotionSet\": []\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res = requests.get(f'{endpoint}/split/sentiment140',\n", + " params={\"input\": \"Senpy is awesome. And services are composable.\", \n", + " \"delimiter\": \"sentence\",\n", + " \"language\": \"en\",\n", + " \"outformat\": \"json-ld\"})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "As you can see, `split` creates two new entries, which are also annotated by `sentiment140`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Once again, we could use the `fields` parameter to get a list of strings and labels:" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
[["Senpy is awesome. And services are composable.", "marl:Positive"], ["Senpy is awesome.", "marl:Positive"], ["And services are composable.", "marl:Neutral"]]\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{[}\\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}Senpy is awesome. And services are composable.\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\\PY{p}{]}\\PY{p}{,} \\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}Senpy is awesome.\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\\PY{p}{]}\\PY{p}{,} \\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}And services are composable.\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}marl:Neutral\\PYZdq{}}\\PY{p}{]}\\PY{p}{]}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "[[\"Senpy is awesome. And services are composable.\", \"marl:Positive\"], [\"Senpy is awesome.\", \"marl:Positive\"], [\"And services are composable.\", \"marl:Neutral\"]]" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res = requests.get(f'{endpoint}/split/sentiment140',\n", + " params={\"input\": \"Senpy is awesome. And services are composable.\", \n", + " \"delimiter\": \"sentence\",\n", + " \"fields\": 'entries[].[[\"nif:isString\",\"marl:hasOpinion\"[].\"marl:hasPolarity\"][]][]',\n", + " \"language\": \"en\",\n", + " \"outformat\": \"json-ld\"})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Listing services" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You can get a complete list of plugins in a senpy instance through the API:" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3BsdWdpbnMvPyM%3D",\n",
+       "  "@type": "Plugins",\n",
+       "  "plugins": [\n",
+       "    {\n",
+       "      "@id": "endpoint:plugins/emotion-anew_0.5.1",\n",
+       "      "@type": "EmotionPlugin",\n",
+       "      "author": "@icorcuera",\n",
+       "      "description": "This plugin consists on an emotion classifier using ANEW lexicon dictionary to calculate VAD (valence-arousal-dominance) of the sentence and determinate which emotion is closer to this value. Each emotion has a centroid, calculated according to this article: http://www.aclweb.org/anthology/W10-0208. The plugin is going to look for the words in the sentence that appear in the ANEW dictionary and calculate the average VAD score for the sentence. Once this score is calculated, it is going to seek the emotion that is closest to this value.",\n",
+       "      "extra_params": {\n",
+       "        "language": {\n",
+       "          "aliases": [\n",
+       "            "language",\n",
+       "            "l"\n",
+       "          ],\n",
+       "          "default": "en",\n",
+       "          "description": "language of the input",\n",
+       "          "options": [\n",
+       "            "es",\n",
+       "            "en"\n",
+       "          ],\n",
+       "          "required": true\n",
+       "        }\n",
+       "      },\n",
+       "      "is_activated": true,\n",
+       "      "maxEmotionValue": 1,\n",
+       "      "minEmotionValue": 0,\n",
+       "      "name": "emotion-anew",\n",
+       "      "version": "0.5.1"\n",
+       "    },\n",
+       "    {\n",
+       "      "@id": "endpoint:plugins/emotion-depechemood_0.1",\n",
+       "      "@type": "EmotionPlugin",\n",
+       "      "author": "Oscar Araque",\n",
+       "      "description": "\\nPlugin that uses the DepecheMood emotion lexicon.\\n\\nDepecheMood is an emotion lexicon automatically generated from news articles where users expressed their associated emotions. It contains two languages (English and Italian), as well as three types of word representations (token, lemma and lemma#PoS). For English, the lexicon contains 165k tokens, while the Italian version contains 116k. Unsupervised techniques can be applied to generate simple but effective baselines. To learn more, please visit https://github.com/marcoguerini/DepecheMood and http://www.depechemood.eu/\\n",\n",
+       "      "extra_params": {},\n",
+       "      "is_activated": true,\n",
+       "      "maxEmotionValue": 1,\n",
+       "      "minEmotionValue": 0,\n",
+       "      "name": "emotion-depechemood",\n",
+       "      "version": "0.1"\n",
+       "    },\n",
+       "    {\n",
+       "      "@id": "endpoint:plugins/emotion-wnaffect_0.2",\n",
+       "      "@type": "EmotionPlugin",\n",
+       "      "author": [\n",
+       "        "@icorcuera",\n",
+       "        "@balkian"\n",
+       "      ],\n",
+       "      "description": "\\nEmotion classifier using WordNet-Affect to calculate the percentage\\nof each emotion. This plugin classifies among 6 emotions: anger,fear,disgust,joy,sadness\\nor neutral. The only available language is English (en)\\n",\n",
+       "      "extra_params": {\n",
+       "        "language": {\n",
+       "          "@id": "lang_wnaffect",\n",
+       "          "aliases": [\n",
+       "            "language",\n",
+       "            "l"\n",
+       "          ],\n",
+       "          "description": "language of the input",\n",
+       "          "options": [\n",
+       "            "en"\n",
+       "          ],\n",
+       "          "required": true\n",
+       "        }\n",
+       "      },\n",
+       "      "is_activated": true,\n",
+       "      "maxEmotionValue": 1,\n",
+       "      "minEmotionValue": 0,\n",
+       "      "name": "emotion-wnaffect",\n",
+       "      "version": "0.2"\n",
+       "    },\n",
+       "    {\n",
+       "      "@id": "endpoint:plugins/example-plugin_0.1",\n",
+       "      "@type": "Plugin",\n",
+       "      "author": "@balkian",\n",
+       "      "description": "A *VERY* simple plugin that exemplifies the development of Senpy Plugins",\n",
+       "      "extra_params": {\n",
+       "        "parameter": {\n",
+       "          "@id": "parameter",\n",
+       "          "aliases": [\n",
+       "            "parameter",\n",
+       "            "param"\n",
+       "          ],\n",
+       "          "default": 42,\n",
+       "          "description": "this parameter does nothing, it is only an example",\n",
+       "          "required": true\n",
+       "        }\n",
+       "      },\n",
+       "      "is_activated": true,\n",
+       "      "name": "example-plugin",\n",
+       "      "version": "0.1"\n",
+       "    },\n",
+       "    {\n",
+       "      "@id": "endpoint:plugins/sentiment-basic_0.1.1",\n",
+       "      "@type": "SentimentPlugin",\n",
+       "      "author": "github.com/nachtkatze",\n",
+       "      "description": "\\nSentiment 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.\\n",\n",
+       "      "extra_params": {\n",
+       "        "language": {\n",
+       "          "aliases": [\n",
+       "            "language",\n",
+       "            "l"\n",
+       "          ],\n",
+       "          "default": "en",\n",
+       "          "description": "language of the text",\n",
+       "          "options": [\n",
+       "            "en",\n",
+       "            "es",\n",
+       "            "it",\n",
+       "            "fr"\n",
+       "          ],\n",
+       "          "required": true\n",
+       "        }\n",
+       "      },\n",
+       "      "is_activated": true,\n",
+       "      "maxPolarityValue": 1,\n",
+       "      "minPolarityValue": -1,\n",
+       "      "name": "sentiment-basic",\n",
+       "      "version": "0.1.1"\n",
+       "    },\n",
+       "    {\n",
+       "      "@id": "endpoint:plugins/sentiment-meaningcloud_1.1",\n",
+       "      "@type": "SentimentPlugin",\n",
+       "      "author": "GSI UPM",\n",
+       "      "description": "\\nSentiment analysis with meaningCloud service.\\nTo use this plugin, you need to obtain an API key from meaningCloud signing up here:\\nhttps://www.meaningcloud.com/developer/login\\n\\nWhen you had obtained the meaningCloud API Key, you have to provide it to the plugin, using param apiKey.\\nExample request:\\n\\nhttp://senpy.cluster.gsi.dit.upm.es/api/?algo=meaningCloud&language=en&apiKey=YOUR_API_KEY&input=I%20love%20Madrid.\\n",\n",
+       "      "extra_params": {\n",
+       "        "apikey": {\n",
+       "          "aliases": [\n",
+       "            "apiKey",\n",
+       "            "meaningcloud-key",\n",
+       "            "meaningcloud-apikey"\n",
+       "          ],\n",
+       "          "description": "API key for the meaningcloud service. See https://www.meaningcloud.com/developer/login",\n",
+       "          "required": true\n",
+       "        },\n",
+       "        "language": {\n",
+       "          "aliases": [\n",
+       "            "language",\n",
+       "            "l"\n",
+       "          ],\n",
+       "          "default": "auto",\n",
+       "          "description": "language of the input",\n",
+       "          "options": [\n",
+       "            "en",\n",
+       "            "es",\n",
+       "            "ca",\n",
+       "            "it",\n",
+       "            "pt",\n",
+       "            "fr",\n",
+       "            "auto"\n",
+       "          ],\n",
+       "          "required": true\n",
+       "        }\n",
+       "      },\n",
+       "      "is_activated": true,\n",
+       "      "maxPolarityValue": 1,\n",
+       "      "minPolarityValue": -1,\n",
+       "      "name": "sentiment-meaningcloud",\n",
+       "      "version": "1.1"\n",
+       "    },\n",
+       "    {\n",
+       "      "@id": "endpoint:plugins/sentiment-vader_0.1.1",\n",
+       "      "@type": "SentimentPlugin",\n",
+       "      "author": "@icorcuera",\n",
+       "      "description": "\\nSentiment classifier using vaderSentiment module. Params accepted: Language: {en, es}. The output uses Marl ontology developed at GSI UPM for semantic web.\\n",\n",
+       "      "extra_params": {\n",
+       "        "aggregate": {\n",
+       "          "aliases": [\n",
+       "            "aggregate",\n",
+       "            "agg"\n",
+       "          ],\n",
+       "          "default": false,\n",
+       "          "description": "Show only the strongest sentiment (aggregate) or all sentiments",\n",
+       "          "options": [\n",
+       "            true,\n",
+       "            false\n",
+       "          ]\n",
+       "        },\n",
+       "        "language": {\n",
+       "          "@id": "lang_rand",\n",
+       "          "aliases": [\n",
+       "            "language",\n",
+       "            "l"\n",
+       "          ],\n",
+       "          "default": "auto",\n",
+       "          "description": "language of the input",\n",
+       "          "options": [\n",
+       "            "es",\n",
+       "            "en",\n",
+       "            "auto"\n",
+       "          ]\n",
+       "        }\n",
+       "      },\n",
+       "      "is_activated": true,\n",
+       "      "maxPolarityValue": 1,\n",
+       "      "minPolarityValue": 0,\n",
+       "      "name": "sentiment-vader",\n",
+       "      "version": "0.1.1"\n",
+       "    },\n",
+       "    {\n",
+       "      "@id": "endpoint:plugins/sentiment140_0.2",\n",
+       "      "@type": "SentimentPlugin",\n",
+       "      "author": "@balkian",\n",
+       "      "description": "Connects to the sentiment140 free API: http://sentiment140.com",\n",
+       "      "extra_params": {\n",
+       "        "language": {\n",
+       "          "@id": "lang_sentiment140",\n",
+       "          "aliases": [\n",
+       "            "language",\n",
+       "            "l"\n",
+       "          ],\n",
+       "          "default": "auto",\n",
+       "          "description": "language of the text",\n",
+       "          "options": [\n",
+       "            "es",\n",
+       "            "en",\n",
+       "            "auto"\n",
+       "          ],\n",
+       "          "required": true\n",
+       "        }\n",
+       "      },\n",
+       "      "is_activated": true,\n",
+       "      "maxPolarityValue": 1,\n",
+       "      "minPolarityValue": 0,\n",
+       "      "name": "sentiment140",\n",
+       "      "url": "https://github.com/gsi-upm/senpy-plugins-community",\n",
+       "      "version": "0.2"\n",
+       "    },\n",
+       "    {\n",
+       "      "@id": "endpoint:plugins/split_0.3",\n",
+       "      "@type": "Plugin",\n",
+       "      "author": [\n",
+       "        "@militarpancho",\n",
+       "        "@balkian"\n",
+       "      ],\n",
+       "      "description": "\\nA plugin that chunks input text, into paragraphs or sentences.\\n\\nIt does not provide any sort of annotation, and it is meant to precede\\nother annotation plugins, when the annotation of individual sentences\\n(or paragraphs) is required.\\n",\n",
+       "      "extra_params": {\n",
+       "        "delimiter": {\n",
+       "          "aliases": [\n",
+       "            "type",\n",
+       "            "t"\n",
+       "          ],\n",
+       "          "default": "sentence",\n",
+       "          "description": "Split text into paragraphs or sentences.",\n",
+       "          "options": [\n",
+       "            "sentence",\n",
+       "            "paragraph"\n",
+       "          ],\n",
+       "          "required": false\n",
+       "        }\n",
+       "      },\n",
+       "      "is_activated": true,\n",
+       "      "name": "split",\n",
+       "      "url": "https://github.com/gsi-upm/senpy",\n",
+       "      "version": "0.3"\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3BsdWdpbnMvPyM\\PYZpc{}3D\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Plugins\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}plugins\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/emotion\\PYZhy{}anew\\PYZus{}0.5.1\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionPlugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}author\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}@icorcuera\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}This plugin consists on an emotion classifier using ANEW lexicon dictionary to calculate VAD (valence\\PYZhy{}arousal\\PYZhy{}dominance) of the sentence and determinate which emotion is closer to this value. Each emotion has a centroid, calculated according to this article: http://www.aclweb.org/anthology/W10\\PYZhy{}0208. The plugin is going to look for the words in the sentence that appear in the ANEW dictionary and calculate the average VAD score for the sentence. Once this score is calculated, it is going to seek the emotion that is closest to this value.\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}extra\\PYZus{}params\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}l\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language of the input\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}es\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}is\\PYZus{}activated\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}maxEmotionValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}minEmotionValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{0}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}emotion\\PYZhy{}anew\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}version\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}0.5.1\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/emotion\\PYZhy{}depechemood\\PYZus{}0.1\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionPlugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}author\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Oscar Araque\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}\\PYZbs{}nPlugin that uses the DepecheMood emotion lexicon.\\PYZbs{}n\\PYZbs{}nDepecheMood is an emotion lexicon automatically generated from news articles where users expressed their associated emotions. It contains two languages (English and Italian), as well as three types of word representations (token, lemma and lemma\\PYZsh{}PoS). For English, the lexicon contains 165k tokens, while the Italian version contains 116k. Unsupervised techniques can be applied to generate simple but effective baselines. To learn more, please visit https://github.com/marcoguerini/DepecheMood and http://www.depechemood.eu/\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}extra\\PYZus{}params\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}is\\PYZus{}activated\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}maxEmotionValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}minEmotionValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{0}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}emotion\\PYZhy{}depechemood\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}version\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}0.1\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/emotion\\PYZhy{}wnaffect\\PYZus{}0.2\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionPlugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}author\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}@icorcuera\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}@balkian\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}\\PYZbs{}nEmotion classifier using WordNet\\PYZhy{}Affect to calculate the percentage\\PYZbs{}nof each emotion. This plugin classifies among 6 emotions: anger,fear,disgust,joy,sadness\\PYZbs{}nor neutral. The only available language is English (en)\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}extra\\PYZus{}params\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}lang\\PYZus{}wnaffect\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}l\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language of the input\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}is\\PYZus{}activated\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}maxEmotionValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}minEmotionValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{0}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}emotion\\PYZhy{}wnaffect\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}version\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}0.2\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/example\\PYZhy{}plugin\\PYZus{}0.1\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Plugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}author\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}@balkian\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}A *VERY* simple plugin that exemplifies the development of Senpy Plugins\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}extra\\PYZus{}params\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}parameter\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}param\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{42}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}this parameter does nothing, it is only an example\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}is\\PYZus{}activated\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}example\\PYZhy{}plugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}version\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}0.1\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment\\PYZhy{}basic\\PYZus{}0.1.1\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}SentimentPlugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}author\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}github.com/nachtkatze\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}\\PYZbs{}nSentiment classifier using rule\\PYZhy{}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.\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}extra\\PYZus{}params\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}l\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language of the text\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}es\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}it\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}fr\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}is\\PYZus{}activated\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}maxPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}minPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{\\PYZhy{}1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}sentiment\\PYZhy{}basic\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}version\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}0.1.1\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment\\PYZhy{}meaningcloud\\PYZus{}1.1\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}SentimentPlugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}author\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}GSI UPM\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}\\PYZbs{}nSentiment analysis with meaningCloud service.\\PYZbs{}nTo use this plugin, you need to obtain an API key from meaningCloud signing up here:\\PYZbs{}nhttps://www.meaningcloud.com/developer/login\\PYZbs{}n\\PYZbs{}nWhen you had obtained the meaningCloud API Key, you have to provide it to the plugin, using param apiKey.\\PYZbs{}nExample request:\\PYZbs{}n\\PYZbs{}nhttp://senpy.cluster.gsi.dit.upm.es/api/?algo=meaningCloud\\PYZam{}language=en\\PYZam{}apiKey=YOUR\\PYZus{}API\\PYZus{}KEY\\PYZam{}input=I\\PYZpc{}20love\\PYZpc{}20Madrid.\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}extra\\PYZus{}params\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}apikey\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}apiKey\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}meaningcloud\\PYZhy{}key\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}meaningcloud\\PYZhy{}apikey\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}API key for the meaningcloud service. See https://www.meaningcloud.com/developer/login\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}l\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language of the input\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}es\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}ca\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}it\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}pt\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}fr\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}is\\PYZus{}activated\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}maxPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}minPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{\\PYZhy{}1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}sentiment\\PYZhy{}meaningcloud\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}version\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}1.1\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment\\PYZhy{}vader\\PYZus{}0.1.1\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}SentimentPlugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}author\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}@icorcuera\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}\\PYZbs{}nSentiment classifier using vaderSentiment module. Params accepted: Language: \\PYZob{}en, es\\PYZcb{}. The output uses Marl ontology developed at GSI UPM for semantic web.\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}extra\\PYZus{}params\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aggregate\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}aggregate\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}agg\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Show only the strongest sentiment (aggregate) or all sentiments\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{k+kc}{false}\n", + " \\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}lang\\PYZus{}rand\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}l\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language of the input\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}es\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\n", + " \\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}is\\PYZus{}activated\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}maxPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}minPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{0}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}sentiment\\PYZhy{}vader\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}version\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}0.1.1\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment140\\PYZus{}0.2\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}SentimentPlugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}author\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}@balkian\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Connects to the sentiment140 free API: http://sentiment140.com\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}extra\\PYZus{}params\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}lang\\PYZus{}sentiment140\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}l\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language of the text\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}es\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}is\\PYZus{}activated\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}maxPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}minPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{0}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}sentiment140\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}url\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}https://github.com/gsi\\PYZhy{}upm/senpy\\PYZhy{}plugins\\PYZhy{}community\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}version\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}0.2\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/split\\PYZus{}0.3\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Plugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}author\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}@militarpancho\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}@balkian\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}\\PYZbs{}nA plugin that chunks input text, into paragraphs or sentences.\\PYZbs{}n\\PYZbs{}nIt does not provide any sort of annotation, and it is meant to precede\\PYZbs{}nother annotation plugins, when the annotation of individual sentences\\PYZbs{}n(or paragraphs) is required.\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}extra\\PYZus{}params\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}delimiter\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}type\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}t\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}sentence\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Split text into paragraphs or sentences.\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}sentence\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}paragraph\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}is\\PYZus{}activated\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}split\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}url\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}https://github.com/gsi\\PYZhy{}upm/senpy\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}version\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}0.3\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3BsdWdpbnMvPyM%3D\",\n", + " \"@type\": \"Plugins\",\n", + " \"plugins\": [\n", + " {\n", + " \"@id\": \"endpoint:plugins/emotion-anew_0.5.1\",\n", + " \"@type\": \"EmotionPlugin\",\n", + " \"author\": \"@icorcuera\",\n", + " \"description\": \"This plugin consists on an emotion classifier using ANEW lexicon dictionary to calculate VAD (valence-arousal-dominance) of the sentence and determinate which emotion is closer to this value. Each emotion has a centroid, calculated according to this article: http://www.aclweb.org/anthology/W10-0208. The plugin is going to look for the words in the sentence that appear in the ANEW dictionary and calculate the average VAD score for the sentence. Once this score is calculated, it is going to seek the emotion that is closest to this value.\",\n", + " \"extra_params\": {\n", + " \"language\": {\n", + " \"aliases\": [\n", + " \"language\",\n", + " \"l\"\n", + " ],\n", + " \"default\": \"en\",\n", + " \"description\": \"language of the input\",\n", + " \"options\": [\n", + " \"es\",\n", + " \"en\"\n", + " ],\n", + " \"required\": true\n", + " }\n", + " },\n", + " \"is_activated\": true,\n", + " \"maxEmotionValue\": 1,\n", + " \"minEmotionValue\": 0,\n", + " \"name\": \"emotion-anew\",\n", + " \"version\": \"0.5.1\"\n", + " },\n", + " {\n", + " \"@id\": \"endpoint:plugins/emotion-depechemood_0.1\",\n", + " \"@type\": \"EmotionPlugin\",\n", + " \"author\": \"Oscar Araque\",\n", + " \"description\": \"\\nPlugin that uses the DepecheMood emotion lexicon.\\n\\nDepecheMood is an emotion lexicon automatically generated from news articles where users expressed their associated emotions. It contains two languages (English and Italian), as well as three types of word representations (token, lemma and lemma#PoS). For English, the lexicon contains 165k tokens, while the Italian version contains 116k. Unsupervised techniques can be applied to generate simple but effective baselines. To learn more, please visit https://github.com/marcoguerini/DepecheMood and http://www.depechemood.eu/\\n\",\n", + " \"extra_params\": {},\n", + " \"is_activated\": true,\n", + " \"maxEmotionValue\": 1,\n", + " \"minEmotionValue\": 0,\n", + " \"name\": \"emotion-depechemood\",\n", + " \"version\": \"0.1\"\n", + " },\n", + " {\n", + " \"@id\": \"endpoint:plugins/emotion-wnaffect_0.2\",\n", + " \"@type\": \"EmotionPlugin\",\n", + " \"author\": [\n", + " \"@icorcuera\",\n", + " \"@balkian\"\n", + " ],\n", + " \"description\": \"\\nEmotion classifier using WordNet-Affect to calculate the percentage\\nof each emotion. This plugin classifies among 6 emotions: anger,fear,disgust,joy,sadness\\nor neutral. The only available language is English (en)\\n\",\n", + " \"extra_params\": {\n", + " \"language\": {\n", + " \"@id\": \"lang_wnaffect\",\n", + " \"aliases\": [\n", + " \"language\",\n", + " \"l\"\n", + " ],\n", + " \"description\": \"language of the input\",\n", + " \"options\": [\n", + " \"en\"\n", + " ],\n", + " \"required\": true\n", + " }\n", + " },\n", + " \"is_activated\": true,\n", + " \"maxEmotionValue\": 1,\n", + " \"minEmotionValue\": 0,\n", + " \"name\": \"emotion-wnaffect\",\n", + " \"version\": \"0.2\"\n", + " },\n", + " {\n", + " \"@id\": \"endpoint:plugins/example-plugin_0.1\",\n", + " \"@type\": \"Plugin\",\n", + " \"author\": \"@balkian\",\n", + " \"description\": \"A *VERY* simple plugin that exemplifies the development of Senpy Plugins\",\n", + " \"extra_params\": {\n", + " \"parameter\": {\n", + " \"@id\": \"parameter\",\n", + " \"aliases\": [\n", + " \"parameter\",\n", + " \"param\"\n", + " ],\n", + " \"default\": 42,\n", + " \"description\": \"this parameter does nothing, it is only an example\",\n", + " \"required\": true\n", + " }\n", + " },\n", + " \"is_activated\": true,\n", + " \"name\": \"example-plugin\",\n", + " \"version\": \"0.1\"\n", + " },\n", + " {\n", + " \"@id\": \"endpoint:plugins/sentiment-basic_0.1.1\",\n", + " \"@type\": \"SentimentPlugin\",\n", + " \"author\": \"github.com/nachtkatze\",\n", + " \"description\": \"\\nSentiment 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.\\n\",\n", + " \"extra_params\": {\n", + " \"language\": {\n", + " \"aliases\": [\n", + " \"language\",\n", + " \"l\"\n", + " ],\n", + " \"default\": \"en\",\n", + " \"description\": \"language of the text\",\n", + " \"options\": [\n", + " \"en\",\n", + " \"es\",\n", + " \"it\",\n", + " \"fr\"\n", + " ],\n", + " \"required\": true\n", + " }\n", + " },\n", + " \"is_activated\": true,\n", + " \"maxPolarityValue\": 1,\n", + " \"minPolarityValue\": -1,\n", + " \"name\": \"sentiment-basic\",\n", + " \"version\": \"0.1.1\"\n", + " },\n", + " {\n", + " \"@id\": \"endpoint:plugins/sentiment-meaningcloud_1.1\",\n", + " \"@type\": \"SentimentPlugin\",\n", + " \"author\": \"GSI UPM\",\n", + " \"description\": \"\\nSentiment analysis with meaningCloud service.\\nTo use this plugin, you need to obtain an API key from meaningCloud signing up here:\\nhttps://www.meaningcloud.com/developer/login\\n\\nWhen you had obtained the meaningCloud API Key, you have to provide it to the plugin, using param apiKey.\\nExample request:\\n\\nhttp://senpy.cluster.gsi.dit.upm.es/api/?algo=meaningCloud&language=en&apiKey=YOUR_API_KEY&input=I%20love%20Madrid.\\n\",\n", + " \"extra_params\": {\n", + " \"apikey\": {\n", + " \"aliases\": [\n", + " \"apiKey\",\n", + " \"meaningcloud-key\",\n", + " \"meaningcloud-apikey\"\n", + " ],\n", + " \"description\": \"API key for the meaningcloud service. See https://www.meaningcloud.com/developer/login\",\n", + " \"required\": true\n", + " },\n", + " \"language\": {\n", + " \"aliases\": [\n", + " \"language\",\n", + " \"l\"\n", + " ],\n", + " \"default\": \"auto\",\n", + " \"description\": \"language of the input\",\n", + " \"options\": [\n", + " \"en\",\n", + " \"es\",\n", + " \"ca\",\n", + " \"it\",\n", + " \"pt\",\n", + " \"fr\",\n", + " \"auto\"\n", + " ],\n", + " \"required\": true\n", + " }\n", + " },\n", + " \"is_activated\": true,\n", + " \"maxPolarityValue\": 1,\n", + " \"minPolarityValue\": -1,\n", + " \"name\": \"sentiment-meaningcloud\",\n", + " \"version\": \"1.1\"\n", + " },\n", + " {\n", + " \"@id\": \"endpoint:plugins/sentiment-vader_0.1.1\",\n", + " \"@type\": \"SentimentPlugin\",\n", + " \"author\": \"@icorcuera\",\n", + " \"description\": \"\\nSentiment classifier using vaderSentiment module. Params accepted: Language: {en, es}. The output uses Marl ontology developed at GSI UPM for semantic web.\\n\",\n", + " \"extra_params\": {\n", + " \"aggregate\": {\n", + " \"aliases\": [\n", + " \"aggregate\",\n", + " \"agg\"\n", + " ],\n", + " \"default\": false,\n", + " \"description\": \"Show only the strongest sentiment (aggregate) or all sentiments\",\n", + " \"options\": [\n", + " true,\n", + " false\n", + " ]\n", + " },\n", + " \"language\": {\n", + " \"@id\": \"lang_rand\",\n", + " \"aliases\": [\n", + " \"language\",\n", + " \"l\"\n", + " ],\n", + " \"default\": \"auto\",\n", + " \"description\": \"language of the input\",\n", + " \"options\": [\n", + " \"es\",\n", + " \"en\",\n", + " \"auto\"\n", + " ]\n", + " }\n", + " },\n", + " \"is_activated\": true,\n", + " \"maxPolarityValue\": 1,\n", + " \"minPolarityValue\": 0,\n", + " \"name\": \"sentiment-vader\",\n", + " \"version\": \"0.1.1\"\n", + " },\n", + " {\n", + " \"@id\": \"endpoint:plugins/sentiment140_0.2\",\n", + " \"@type\": \"SentimentPlugin\",\n", + " \"author\": \"@balkian\",\n", + " \"description\": \"Connects to the sentiment140 free API: http://sentiment140.com\",\n", + " \"extra_params\": {\n", + " \"language\": {\n", + " \"@id\": \"lang_sentiment140\",\n", + " \"aliases\": [\n", + " \"language\",\n", + " \"l\"\n", + " ],\n", + " \"default\": \"auto\",\n", + " \"description\": \"language of the text\",\n", + " \"options\": [\n", + " \"es\",\n", + " \"en\",\n", + " \"auto\"\n", + " ],\n", + " \"required\": true\n", + " }\n", + " },\n", + " \"is_activated\": true,\n", + " \"maxPolarityValue\": 1,\n", + " \"minPolarityValue\": 0,\n", + " \"name\": \"sentiment140\",\n", + " \"url\": \"https://github.com/gsi-upm/senpy-plugins-community\",\n", + " \"version\": \"0.2\"\n", + " },\n", + " {\n", + " \"@id\": \"endpoint:plugins/split_0.3\",\n", + " \"@type\": \"Plugin\",\n", + " \"author\": [\n", + " \"@militarpancho\",\n", + " \"@balkian\"\n", + " ],\n", + " \"description\": \"\\nA plugin that chunks input text, into paragraphs or sentences.\\n\\nIt does not provide any sort of annotation, and it is meant to precede\\nother annotation plugins, when the annotation of individual sentences\\n(or paragraphs) is required.\\n\",\n", + " \"extra_params\": {\n", + " \"delimiter\": {\n", + " \"aliases\": [\n", + " \"type\",\n", + " \"t\"\n", + " ],\n", + " \"default\": \"sentence\",\n", + " \"description\": \"Split text into paragraphs or sentences.\",\n", + " \"options\": [\n", + " \"sentence\",\n", + " \"paragraph\"\n", + " ],\n", + " \"required\": false\n", + " }\n", + " },\n", + " \"is_activated\": true,\n", + " \"name\": \"split\",\n", + " \"url\": \"https://github.com/gsi-upm/senpy\",\n", + " \"version\": \"0.3\"\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res = requests.get(f'{endpoint}/plugins')\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "If you want to get only a specific type of plugin, use the `plugin_type` parameter.\n", + "e.g., this will only return the plugins for sentiment analysis:" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3BsdWdpbnMvP3BsdWdpbl90eXBlPVNlbnRpbWVudFBsdWdpbiM%3D",\n",
+       "  "@type": "Plugins",\n",
+       "  "plugins": [\n",
+       "    {\n",
+       "      "@id": "endpoint:plugins/sentiment-basic_0.1.1",\n",
+       "      "@type": "SentimentPlugin",\n",
+       "      "author": "github.com/nachtkatze",\n",
+       "      "description": "\\nSentiment 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.\\n",\n",
+       "      "extra_params": {\n",
+       "        "language": {\n",
+       "          "aliases": [\n",
+       "            "language",\n",
+       "            "l"\n",
+       "          ],\n",
+       "          "default": "en",\n",
+       "          "description": "language of the text",\n",
+       "          "options": [\n",
+       "            "en",\n",
+       "            "es",\n",
+       "            "it",\n",
+       "            "fr"\n",
+       "          ],\n",
+       "          "required": true\n",
+       "        }\n",
+       "      },\n",
+       "      "is_activated": true,\n",
+       "      "maxPolarityValue": 1,\n",
+       "      "minPolarityValue": -1,\n",
+       "      "name": "sentiment-basic",\n",
+       "      "version": "0.1.1"\n",
+       "    },\n",
+       "    {\n",
+       "      "@id": "endpoint:plugins/sentiment-meaningcloud_1.1",\n",
+       "      "@type": "SentimentPlugin",\n",
+       "      "author": "GSI UPM",\n",
+       "      "description": "\\nSentiment analysis with meaningCloud service.\\nTo use this plugin, you need to obtain an API key from meaningCloud signing up here:\\nhttps://www.meaningcloud.com/developer/login\\n\\nWhen you had obtained the meaningCloud API Key, you have to provide it to the plugin, using param apiKey.\\nExample request:\\n\\nhttp://senpy.cluster.gsi.dit.upm.es/api/?algo=meaningCloud&language=en&apiKey=YOUR_API_KEY&input=I%20love%20Madrid.\\n",\n",
+       "      "extra_params": {\n",
+       "        "apikey": {\n",
+       "          "aliases": [\n",
+       "            "apiKey",\n",
+       "            "meaningcloud-key",\n",
+       "            "meaningcloud-apikey"\n",
+       "          ],\n",
+       "          "description": "API key for the meaningcloud service. See https://www.meaningcloud.com/developer/login",\n",
+       "          "required": true\n",
+       "        },\n",
+       "        "language": {\n",
+       "          "aliases": [\n",
+       "            "language",\n",
+       "            "l"\n",
+       "          ],\n",
+       "          "default": "auto",\n",
+       "          "description": "language of the input",\n",
+       "          "options": [\n",
+       "            "en",\n",
+       "            "es",\n",
+       "            "ca",\n",
+       "            "it",\n",
+       "            "pt",\n",
+       "            "fr",\n",
+       "            "auto"\n",
+       "          ],\n",
+       "          "required": true\n",
+       "        }\n",
+       "      },\n",
+       "      "is_activated": true,\n",
+       "      "maxPolarityValue": 1,\n",
+       "      "minPolarityValue": -1,\n",
+       "      "name": "sentiment-meaningcloud",\n",
+       "      "version": "1.1"\n",
+       "    },\n",
+       "    {\n",
+       "      "@id": "endpoint:plugins/sentiment-vader_0.1.1",\n",
+       "      "@type": "SentimentPlugin",\n",
+       "      "author": "@icorcuera",\n",
+       "      "description": "\\nSentiment classifier using vaderSentiment module. Params accepted: Language: {en, es}. The output uses Marl ontology developed at GSI UPM for semantic web.\\n",\n",
+       "      "extra_params": {\n",
+       "        "aggregate": {\n",
+       "          "aliases": [\n",
+       "            "aggregate",\n",
+       "            "agg"\n",
+       "          ],\n",
+       "          "default": false,\n",
+       "          "description": "Show only the strongest sentiment (aggregate) or all sentiments",\n",
+       "          "options": [\n",
+       "            true,\n",
+       "            false\n",
+       "          ]\n",
+       "        },\n",
+       "        "language": {\n",
+       "          "@id": "lang_rand",\n",
+       "          "aliases": [\n",
+       "            "language",\n",
+       "            "l"\n",
+       "          ],\n",
+       "          "default": "auto",\n",
+       "          "description": "language of the input",\n",
+       "          "options": [\n",
+       "            "es",\n",
+       "            "en",\n",
+       "            "auto"\n",
+       "          ]\n",
+       "        }\n",
+       "      },\n",
+       "      "is_activated": true,\n",
+       "      "maxPolarityValue": 1,\n",
+       "      "minPolarityValue": 0,\n",
+       "      "name": "sentiment-vader",\n",
+       "      "version": "0.1.1"\n",
+       "    },\n",
+       "    {\n",
+       "      "@id": "endpoint:plugins/sentiment140_0.2",\n",
+       "      "@type": "SentimentPlugin",\n",
+       "      "author": "@balkian",\n",
+       "      "description": "Connects to the sentiment140 free API: http://sentiment140.com",\n",
+       "      "extra_params": {\n",
+       "        "language": {\n",
+       "          "@id": "lang_sentiment140",\n",
+       "          "aliases": [\n",
+       "            "language",\n",
+       "            "l"\n",
+       "          ],\n",
+       "          "default": "auto",\n",
+       "          "description": "language of the text",\n",
+       "          "options": [\n",
+       "            "es",\n",
+       "            "en",\n",
+       "            "auto"\n",
+       "          ],\n",
+       "          "required": true\n",
+       "        }\n",
+       "      },\n",
+       "      "is_activated": true,\n",
+       "      "maxPolarityValue": 1,\n",
+       "      "minPolarityValue": 0,\n",
+       "      "name": "sentiment140",\n",
+       "      "url": "https://github.com/gsi-upm/senpy-plugins-community",\n",
+       "      "version": "0.2"\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3BsdWdpbnMvP3BsdWdpbl90eXBlPVNlbnRpbWVudFBsdWdpbiM\\PYZpc{}3D\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Plugins\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}plugins\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment\\PYZhy{}basic\\PYZus{}0.1.1\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}SentimentPlugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}author\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}github.com/nachtkatze\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}\\PYZbs{}nSentiment classifier using rule\\PYZhy{}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.\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}extra\\PYZus{}params\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}l\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language of the text\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}es\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}it\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}fr\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}is\\PYZus{}activated\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}maxPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}minPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{\\PYZhy{}1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}sentiment\\PYZhy{}basic\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}version\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}0.1.1\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment\\PYZhy{}meaningcloud\\PYZus{}1.1\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}SentimentPlugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}author\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}GSI UPM\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}\\PYZbs{}nSentiment analysis with meaningCloud service.\\PYZbs{}nTo use this plugin, you need to obtain an API key from meaningCloud signing up here:\\PYZbs{}nhttps://www.meaningcloud.com/developer/login\\PYZbs{}n\\PYZbs{}nWhen you had obtained the meaningCloud API Key, you have to provide it to the plugin, using param apiKey.\\PYZbs{}nExample request:\\PYZbs{}n\\PYZbs{}nhttp://senpy.cluster.gsi.dit.upm.es/api/?algo=meaningCloud\\PYZam{}language=en\\PYZam{}apiKey=YOUR\\PYZus{}API\\PYZus{}KEY\\PYZam{}input=I\\PYZpc{}20love\\PYZpc{}20Madrid.\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}extra\\PYZus{}params\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}apikey\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}apiKey\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}meaningcloud\\PYZhy{}key\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}meaningcloud\\PYZhy{}apikey\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}API key for the meaningcloud service. See https://www.meaningcloud.com/developer/login\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}l\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language of the input\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}es\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}ca\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}it\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}pt\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}fr\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}is\\PYZus{}activated\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}maxPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}minPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{\\PYZhy{}1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}sentiment\\PYZhy{}meaningcloud\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}version\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}1.1\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment\\PYZhy{}vader\\PYZus{}0.1.1\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}SentimentPlugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}author\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}@icorcuera\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}\\PYZbs{}nSentiment classifier using vaderSentiment module. Params accepted: Language: \\PYZob{}en, es\\PYZcb{}. The output uses Marl ontology developed at GSI UPM for semantic web.\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}extra\\PYZus{}params\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aggregate\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}aggregate\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}agg\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Show only the strongest sentiment (aggregate) or all sentiments\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{k+kc}{false}\n", + " \\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}lang\\PYZus{}rand\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}l\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language of the input\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}es\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\n", + " \\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}is\\PYZus{}activated\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}maxPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}minPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{0}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}sentiment\\PYZhy{}vader\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}version\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}0.1.1\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment140\\PYZus{}0.2\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}SentimentPlugin\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}author\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}@balkian\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Connects to the sentiment140 free API: http://sentiment140.com\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}extra\\PYZus{}params\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}lang\\PYZus{}sentiment140\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}l\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language of the text\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}es\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}is\\PYZus{}activated\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}maxPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}minPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{0}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}sentiment140\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}url\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}https://github.com/gsi\\PYZhy{}upm/senpy\\PYZhy{}plugins\\PYZhy{}community\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}version\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}0.2\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3BsdWdpbnMvP3BsdWdpbl90eXBlPVNlbnRpbWVudFBsdWdpbiM%3D\",\n", + " \"@type\": \"Plugins\",\n", + " \"plugins\": [\n", + " {\n", + " \"@id\": \"endpoint:plugins/sentiment-basic_0.1.1\",\n", + " \"@type\": \"SentimentPlugin\",\n", + " \"author\": \"github.com/nachtkatze\",\n", + " \"description\": \"\\nSentiment 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.\\n\",\n", + " \"extra_params\": {\n", + " \"language\": {\n", + " \"aliases\": [\n", + " \"language\",\n", + " \"l\"\n", + " ],\n", + " \"default\": \"en\",\n", + " \"description\": \"language of the text\",\n", + " \"options\": [\n", + " \"en\",\n", + " \"es\",\n", + " \"it\",\n", + " \"fr\"\n", + " ],\n", + " \"required\": true\n", + " }\n", + " },\n", + " \"is_activated\": true,\n", + " \"maxPolarityValue\": 1,\n", + " \"minPolarityValue\": -1,\n", + " \"name\": \"sentiment-basic\",\n", + " \"version\": \"0.1.1\"\n", + " },\n", + " {\n", + " \"@id\": \"endpoint:plugins/sentiment-meaningcloud_1.1\",\n", + " \"@type\": \"SentimentPlugin\",\n", + " \"author\": \"GSI UPM\",\n", + " \"description\": \"\\nSentiment analysis with meaningCloud service.\\nTo use this plugin, you need to obtain an API key from meaningCloud signing up here:\\nhttps://www.meaningcloud.com/developer/login\\n\\nWhen you had obtained the meaningCloud API Key, you have to provide it to the plugin, using param apiKey.\\nExample request:\\n\\nhttp://senpy.cluster.gsi.dit.upm.es/api/?algo=meaningCloud&language=en&apiKey=YOUR_API_KEY&input=I%20love%20Madrid.\\n\",\n", + " \"extra_params\": {\n", + " \"apikey\": {\n", + " \"aliases\": [\n", + " \"apiKey\",\n", + " \"meaningcloud-key\",\n", + " \"meaningcloud-apikey\"\n", + " ],\n", + " \"description\": \"API key for the meaningcloud service. See https://www.meaningcloud.com/developer/login\",\n", + " \"required\": true\n", + " },\n", + " \"language\": {\n", + " \"aliases\": [\n", + " \"language\",\n", + " \"l\"\n", + " ],\n", + " \"default\": \"auto\",\n", + " \"description\": \"language of the input\",\n", + " \"options\": [\n", + " \"en\",\n", + " \"es\",\n", + " \"ca\",\n", + " \"it\",\n", + " \"pt\",\n", + " \"fr\",\n", + " \"auto\"\n", + " ],\n", + " \"required\": true\n", + " }\n", + " },\n", + " \"is_activated\": true,\n", + " \"maxPolarityValue\": 1,\n", + " \"minPolarityValue\": -1,\n", + " \"name\": \"sentiment-meaningcloud\",\n", + " \"version\": \"1.1\"\n", + " },\n", + " {\n", + " \"@id\": \"endpoint:plugins/sentiment-vader_0.1.1\",\n", + " \"@type\": \"SentimentPlugin\",\n", + " \"author\": \"@icorcuera\",\n", + " \"description\": \"\\nSentiment classifier using vaderSentiment module. Params accepted: Language: {en, es}. The output uses Marl ontology developed at GSI UPM for semantic web.\\n\",\n", + " \"extra_params\": {\n", + " \"aggregate\": {\n", + " \"aliases\": [\n", + " \"aggregate\",\n", + " \"agg\"\n", + " ],\n", + " \"default\": false,\n", + " \"description\": \"Show only the strongest sentiment (aggregate) or all sentiments\",\n", + " \"options\": [\n", + " true,\n", + " false\n", + " ]\n", + " },\n", + " \"language\": {\n", + " \"@id\": \"lang_rand\",\n", + " \"aliases\": [\n", + " \"language\",\n", + " \"l\"\n", + " ],\n", + " \"default\": \"auto\",\n", + " \"description\": \"language of the input\",\n", + " \"options\": [\n", + " \"es\",\n", + " \"en\",\n", + " \"auto\"\n", + " ]\n", + " }\n", + " },\n", + " \"is_activated\": true,\n", + " \"maxPolarityValue\": 1,\n", + " \"minPolarityValue\": 0,\n", + " \"name\": \"sentiment-vader\",\n", + " \"version\": \"0.1.1\"\n", + " },\n", + " {\n", + " \"@id\": \"endpoint:plugins/sentiment140_0.2\",\n", + " \"@type\": \"SentimentPlugin\",\n", + " \"author\": \"@balkian\",\n", + " \"description\": \"Connects to the sentiment140 free API: http://sentiment140.com\",\n", + " \"extra_params\": {\n", + " \"language\": {\n", + " \"@id\": \"lang_sentiment140\",\n", + " \"aliases\": [\n", + " \"language\",\n", + " \"l\"\n", + " ],\n", + " \"default\": \"auto\",\n", + " \"description\": \"language of the text\",\n", + " \"options\": [\n", + " \"es\",\n", + " \"en\",\n", + " \"auto\"\n", + " ],\n", + " \"required\": true\n", + " }\n", + " },\n", + " \"is_activated\": true,\n", + " \"maxPolarityValue\": 1,\n", + " \"minPolarityValue\": 0,\n", + " \"name\": \"sentiment140\",\n", + " \"url\": \"https://github.com/gsi-upm/senpy-plugins-community\",\n", + " \"version\": \"0.2\"\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res = requests.get(f'{endpoint}/plugins', params={\"plugin_type\": \"SentimentPlugin\"})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The `fields` parameter also works on the plugins API:" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
[["endpoint:plugins/emotion-anew_0.5.1", "EmotionPlugin"], ["endpoint:plugins/emotion-depechemood_0.1", "EmotionPlugin"], ["endpoint:plugins/emotion-wnaffect_0.2", "EmotionPlugin"], ["endpoint:plugins/example-plugin_0.1", "Plugin"], ["endpoint:plugins/sentiment-basic_0.1.1", "SentimentPlugin"], ["endpoint:plugins/sentiment-meaningcloud_1.1", "SentimentPlugin"], ["endpoint:plugins/sentiment-vader_0.1.1", "SentimentPlugin"], ["endpoint:plugins/sentiment140_0.2", "SentimentPlugin"], ["endpoint:plugins/split_0.3", "Plugin"]]\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{[}\\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/emotion\\PYZhy{}anew\\PYZus{}0.5.1\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}EmotionPlugin\\PYZdq{}}\\PY{p}{]}\\PY{p}{,} \\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/emotion\\PYZhy{}depechemood\\PYZus{}0.1\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}EmotionPlugin\\PYZdq{}}\\PY{p}{]}\\PY{p}{,} \\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/emotion\\PYZhy{}wnaffect\\PYZus{}0.2\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}EmotionPlugin\\PYZdq{}}\\PY{p}{]}\\PY{p}{,} \\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/example\\PYZhy{}plugin\\PYZus{}0.1\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}Plugin\\PYZdq{}}\\PY{p}{]}\\PY{p}{,} \\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment\\PYZhy{}basic\\PYZus{}0.1.1\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}SentimentPlugin\\PYZdq{}}\\PY{p}{]}\\PY{p}{,} \\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment\\PYZhy{}meaningcloud\\PYZus{}1.1\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}SentimentPlugin\\PYZdq{}}\\PY{p}{]}\\PY{p}{,} \\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment\\PYZhy{}vader\\PYZus{}0.1.1\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}SentimentPlugin\\PYZdq{}}\\PY{p}{]}\\PY{p}{,} \\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment140\\PYZus{}0.2\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}SentimentPlugin\\PYZdq{}}\\PY{p}{]}\\PY{p}{,} \\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/split\\PYZus{}0.3\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}Plugin\\PYZdq{}}\\PY{p}{]}\\PY{p}{]}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "[[\"endpoint:plugins/emotion-anew_0.5.1\", \"EmotionPlugin\"], [\"endpoint:plugins/emotion-depechemood_0.1\", \"EmotionPlugin\"], [\"endpoint:plugins/emotion-wnaffect_0.2\", \"EmotionPlugin\"], [\"endpoint:plugins/example-plugin_0.1\", \"Plugin\"], [\"endpoint:plugins/sentiment-basic_0.1.1\", \"SentimentPlugin\"], [\"endpoint:plugins/sentiment-meaningcloud_1.1\", \"SentimentPlugin\"], [\"endpoint:plugins/sentiment-vader_0.1.1\", \"SentimentPlugin\"], [\"endpoint:plugins/sentiment140_0.2\", \"SentimentPlugin\"], [\"endpoint:plugins/split_0.3\", \"Plugin\"]]" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res = requests.get(f'{endpoint}/plugins', params={\"fields\": 'plugins[].[\"@id\",\"@type\"]'})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Alternatively:" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "EmotionPlugin -> endpoint:plugins/emotion-anew_0.5.1\n", + "EmotionPlugin -> endpoint:plugins/emotion-depechemood_0.1\n", + "EmotionPlugin -> endpoint:plugins/emotion-wnaffect_0.2\n", + "Plugin -> endpoint:plugins/example-plugin_0.1\n", + "SentimentPlugin -> endpoint:plugins/sentiment-basic_0.1.1\n", + "SentimentPlugin -> endpoint:plugins/sentiment-meaningcloud_1.1\n", + "SentimentPlugin -> endpoint:plugins/sentiment-vader_0.1.1\n", + "SentimentPlugin -> endpoint:plugins/sentiment140_0.2\n", + "Plugin -> endpoint:plugins/split_0.3\n" + ] + } + ], + "source": [ + "for pid, ptype in res.json():\n", + " print('{:20s} -> {}'.format(ptype, pid))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Evaluation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Sentiment analysis plugins can also be evaluated on a series of pre-defined datasets, using the `gsitk` tool.\n", + "\n", + "For instance, to evaluate the `sentiment-vader` plugin on the `vader` and `sts` datasets, we would simply call:" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2V2YWx1YXRlLz9hbGdvPXNlbnRpbWVudC12YWRlciZkYXRhc2V0PXZhZGVyJTJDc3RzJm91dGZvcm1hdD1qc29uLWxkIw%3D%3D",\n",
+       "  "@type": "AggregatedEvaluation",\n",
+       "  "senpy:evaluations": [\n",
+       "    {\n",
+       "      "@type": "Evaluation",\n",
+       "      "evaluates": "endpoint:plugins/sentiment-vader_0.1.1__vader",\n",
+       "      "evaluatesOn": "vader",\n",
+       "      "metrics": [\n",
+       "        {\n",
+       "          "@type": "Accuracy",\n",
+       "          "value": 0.6907142857142857\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Precision_macro",\n",
+       "          "value": 0.34535714285714286\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Recall_macro",\n",
+       "          "value": 0.5\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "F1_macro",\n",
+       "          "value": 0.40853400929446554\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "F1_weighted",\n",
+       "          "value": 0.5643605528396403\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "F1_micro",\n",
+       "          "value": 0.6907142857142857\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "F1_macro",\n",
+       "          "value": 0.40853400929446554\n",
+       "        }\n",
+       "      ]\n",
+       "    },\n",
+       "    {\n",
+       "      "@type": "Evaluation",\n",
+       "      "evaluates": "endpoint:plugins/sentiment-vader_0.1.1__sts",\n",
+       "      "evaluatesOn": "sts",\n",
+       "      "metrics": [\n",
+       "        {\n",
+       "          "@type": "Accuracy",\n",
+       "          "value": 0.3107177974434612\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Precision_macro",\n",
+       "          "value": 0.1553588987217306\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Recall_macro",\n",
+       "          "value": 0.5\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "F1_macro",\n",
+       "          "value": 0.23705926481620407\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "F1_weighted",\n",
+       "          "value": 0.14731706525451424\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "F1_micro",\n",
+       "          "value": 0.3107177974434612\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "F1_macro",\n",
+       "          "value": 0.23705926481620407\n",
+       "        }\n",
+       "      ]\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL2V2YWx1YXRlLz9hbGdvPXNlbnRpbWVudC12YWRlciZkYXRhc2V0PXZhZGVyJTJDc3RzJm91dGZvcm1hdD1qc29uLWxkIw\\PYZpc{}3D\\PYZpc{}3D\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}AggregatedEvaluation\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}senpy:evaluations\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Evaluation\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}evaluates\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment\\PYZhy{}vader\\PYZus{}0.1.1\\PYZus{}\\PYZus{}vader\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}evaluatesOn\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}vader\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}metrics\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Accuracy\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.6907142857142857}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Precision\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.34535714285714286}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Recall\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.5}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.40853400929446554}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}weighted\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.5643605528396403}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}micro\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.6907142857142857}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.40853400929446554}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Evaluation\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}evaluates\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment\\PYZhy{}vader\\PYZus{}0.1.1\\PYZus{}\\PYZus{}sts\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}evaluatesOn\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}sts\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}metrics\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Accuracy\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.3107177974434612}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Precision\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.1553588987217306}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Recall\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.5}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.23705926481620407}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}weighted\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.14731706525451424}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}micro\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.3107177974434612}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.23705926481620407}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL2V2YWx1YXRlLz9hbGdvPXNlbnRpbWVudC12YWRlciZkYXRhc2V0PXZhZGVyJTJDc3RzJm91dGZvcm1hdD1qc29uLWxkIw%3D%3D\",\n", + " \"@type\": \"AggregatedEvaluation\",\n", + " \"senpy:evaluations\": [\n", + " {\n", + " \"@type\": \"Evaluation\",\n", + " \"evaluates\": \"endpoint:plugins/sentiment-vader_0.1.1__vader\",\n", + " \"evaluatesOn\": \"vader\",\n", + " \"metrics\": [\n", + " {\n", + " \"@type\": \"Accuracy\",\n", + " \"value\": 0.6907142857142857\n", + " },\n", + " {\n", + " \"@type\": \"Precision_macro\",\n", + " \"value\": 0.34535714285714286\n", + " },\n", + " {\n", + " \"@type\": \"Recall_macro\",\n", + " \"value\": 0.5\n", + " },\n", + " {\n", + " \"@type\": \"F1_macro\",\n", + " \"value\": 0.40853400929446554\n", + " },\n", + " {\n", + " \"@type\": \"F1_weighted\",\n", + " \"value\": 0.5643605528396403\n", + " },\n", + " {\n", + " \"@type\": \"F1_micro\",\n", + " \"value\": 0.6907142857142857\n", + " },\n", + " {\n", + " \"@type\": \"F1_macro\",\n", + " \"value\": 0.40853400929446554\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"@type\": \"Evaluation\",\n", + " \"evaluates\": \"endpoint:plugins/sentiment-vader_0.1.1__sts\",\n", + " \"evaluatesOn\": \"sts\",\n", + " \"metrics\": [\n", + " {\n", + " \"@type\": \"Accuracy\",\n", + " \"value\": 0.3107177974434612\n", + " },\n", + " {\n", + " \"@type\": \"Precision_macro\",\n", + " \"value\": 0.1553588987217306\n", + " },\n", + " {\n", + " \"@type\": \"Recall_macro\",\n", + " \"value\": 0.5\n", + " },\n", + " {\n", + " \"@type\": \"F1_macro\",\n", + " \"value\": 0.23705926481620407\n", + " },\n", + " {\n", + " \"@type\": \"F1_weighted\",\n", + " \"value\": 0.14731706525451424\n", + " },\n", + " {\n", + " \"@type\": \"F1_micro\",\n", + " \"value\": 0.3107177974434612\n", + " },\n", + " {\n", + " \"@type\": \"F1_macro\",\n", + " \"value\": 0.23705926481620407\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res = requests.get(f'{endpoint}/evaluate',\n", + " params={\"algo\": \"sentiment-vader\",\n", + " \"dataset\": \"vader,sts\",\n", + " 'outformat': 'json-ld'\n", + " })\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The same results can be visualized as a table in the Web interface:\n", + "\n", + "![](evaluation-results.png)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**note**: to evaluate a plugin on a dataset, senpy will need to predict the labels of the entries using the plugin.\n", + "This process might take long for plugins that use an external service, such as `sentiment140`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Running your own senpy instance with Docker" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now that you're familiar with Senpy, you can deploy your own instance quite easily. e.g. using docker:\n", + "\n", + "```shell\n", + "docker run -ti --name 'SenpyEndpoint' -d -p 5000:5000 gsiupm/senpy\n", + "```\n", + "\n", + "Alternatively, you can install senpy in your system and run it:\n", + "\n", + "```shell\n", + "# First install it\n", + "pip install --user senpy\n", + "\n", + "# Run locally\n", + "senpy\n", + "# or\n", + "python -m senpy\n", + "```\n", + "\n", + "Once you have an instance running, feel free to change the endpoint variable to run the examples in your own instance." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Advanced topics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Verbose output" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "By default, senpy does not include information that might be too verbose, such as the parameters that were used in the analysis.\n", + "\n", + "You can instruct senpy to provide a more verbose output with the `verbose` parameter:" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcyt0aGUrYmVzdCtmcmFtZXdvcmsrZm9yK3NlbWFudGljK3NlbnRpbWVudCthbmFseXNpcyUyQythbmQrdmVyeStlYXN5K3RvK3VzZSZ2ZXJib3NlPVRydWUj",\n",
+       "  "@type": "Results",\n",
+       "  "activities": [\n",
+       "    {\n",
+       "      "@id": "prefix:Analysis_1554382985.03282",\n",
+       "      "@type": "Analysis",\n",
+       "      "marl:maxPolarityValue": 1,\n",
+       "      "marl:minPolarityValue": 0,\n",
+       "      "prov:used": [\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "input",\n",
+       "          "value": "Senpy is the best framework for semantic sentiment analysis, and very easy to use"\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "verbose",\n",
+       "          "value": true\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "in-headers",\n",
+       "          "value": false\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "algorithm",\n",
+       "          "value": "default"\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "expanded-jsonld",\n",
+       "          "value": false\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "with-parameters",\n",
+       "          "value": false\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "outformat",\n",
+       "          "value": "json-ld"\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "help",\n",
+       "          "value": false\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "aliases",\n",
+       "          "value": false\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "conversion",\n",
+       "          "value": "full"\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "intype",\n",
+       "          "value": "direct"\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "informat",\n",
+       "          "value": "text"\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "prefix",\n",
+       "          "value": ""\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "urischeme",\n",
+       "          "value": "RFC5147String"\n",
+       "        },\n",
+       "        {\n",
+       "          "@type": "Parameter",\n",
+       "          "name": "language",\n",
+       "          "value": "auto"\n",
+       "        }\n",
+       "      ],\n",
+       "      "prov:wasAssociatedWith": "endpoint:plugins/sentiment140_0.2"\n",
+       "    }\n",
+       "  ],\n",
+       "  "entries": [\n",
+       "    {\n",
+       "      "@id": "prefix:",\n",
+       "      "@type": "Entry",\n",
+       "      "marl:hasOpinion": [\n",
+       "        {\n",
+       "          "@type": "Sentiment",\n",
+       "          "marl:hasPolarity": "marl:Positive",\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554382985.03282"\n",
+       "        }\n",
+       "      ],\n",
+       "      "nif:isString": "Senpy is the best framework for semantic sentiment analysis, and very easy to use",\n",
+       "      "onyx:hasEmotionSet": []\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcyt0aGUrYmVzdCtmcmFtZXdvcmsrZm9yK3NlbWFudGljK3NlbnRpbWVudCthbmFseXNpcyUyQythbmQrdmVyeStlYXN5K3RvK3VzZSZ2ZXJib3NlPVRydWUj\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}activities\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382985.03282\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Analysis\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:maxPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{1}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:minPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{0}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:used\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}input\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is the best framework for semantic sentiment analysis, and very easy to use\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}verbose\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}in\\PYZhy{}headers\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}algorithm\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}default\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}expanded\\PYZhy{}jsonld\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}with\\PYZhy{}parameters\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}outformat\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}json\\PYZhy{}ld\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}help\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}conversion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}full\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}intype\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}direct\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}informat\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}text\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}urischeme\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}RFC5147String\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasAssociatedWith\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment140\\PYZus{}0.2\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382985.03282\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is the best framework for semantic sentiment analysis, and very easy to use\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcyt0aGUrYmVzdCtmcmFtZXdvcmsrZm9yK3NlbWFudGljK3NlbnRpbWVudCthbmFseXNpcyUyQythbmQrdmVyeStlYXN5K3RvK3VzZSZ2ZXJib3NlPVRydWUj\",\n", + " \"@type\": \"Results\",\n", + " \"activities\": [\n", + " {\n", + " \"@id\": \"prefix:Analysis_1554382985.03282\",\n", + " \"@type\": \"Analysis\",\n", + " \"marl:maxPolarityValue\": 1,\n", + " \"marl:minPolarityValue\": 0,\n", + " \"prov:used\": [\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"input\",\n", + " \"value\": \"Senpy is the best framework for semantic sentiment analysis, and very easy to use\"\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"verbose\",\n", + " \"value\": true\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"in-headers\",\n", + " \"value\": false\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"algorithm\",\n", + " \"value\": \"default\"\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"expanded-jsonld\",\n", + " \"value\": false\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"with-parameters\",\n", + " \"value\": false\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"outformat\",\n", + " \"value\": \"json-ld\"\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"help\",\n", + " \"value\": false\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"aliases\",\n", + " \"value\": false\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"conversion\",\n", + " \"value\": \"full\"\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"intype\",\n", + " \"value\": \"direct\"\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"informat\",\n", + " \"value\": \"text\"\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"prefix\",\n", + " \"value\": \"\"\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"urischeme\",\n", + " \"value\": \"RFC5147String\"\n", + " },\n", + " {\n", + " \"@type\": \"Parameter\",\n", + " \"name\": \"language\",\n", + " \"value\": \"auto\"\n", + " }\n", + " ],\n", + " \"prov:wasAssociatedWith\": \"endpoint:plugins/sentiment140_0.2\"\n", + " }\n", + " ],\n", + " \"entries\": [\n", + " {\n", + " \"@id\": \"prefix:\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [\n", + " {\n", + " \"@type\": \"Sentiment\",\n", + " \"marl:hasPolarity\": \"marl:Positive\",\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382985.03282\"\n", + " }\n", + " ],\n", + " \"nif:isString\": \"Senpy is the best framework for semantic sentiment analysis, and very easy to use\",\n", + " \"onyx:hasEmotionSet\": []\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import requests\n", + "res = requests.get(f'{endpoint}/sentiment140',\n", + " params={\n", + " \"input\": \"Senpy is the best framework for semantic sentiment analysis, and very easy to use\",\n", + " \"verbose\": True}).text\n", + "pretty(res)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Getting help" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpLz9oZWxwPVRydWUj",\n",
+       "  "@type": "Help",\n",
+       "  "valid_parameters": {\n",
+       "    "algorithm": {\n",
+       "      "aliases": [\n",
+       "        "algorithms",\n",
+       "        "a",\n",
+       "        "algo"\n",
+       "      ],\n",
+       "      "default": "default",\n",
+       "      "description": "Algorithms that will be used to process the request.It may be a list of comma-separated names.",\n",
+       "      "processor": "string_to_tuple",\n",
+       "      "required": true\n",
+       "    },\n",
+       "    "aliases": {\n",
+       "      "@id": "aliases",\n",
+       "      "aliases": [],\n",
+       "      "default": false,\n",
+       "      "description": "Replace JSON properties with their aliases",\n",
+       "      "options": [\n",
+       "        true,\n",
+       "        false\n",
+       "      ],\n",
+       "      "required": true\n",
+       "    },\n",
+       "    "conversion": {\n",
+       "      "@id": "conversion",\n",
+       "      "default": "full",\n",
+       "      "description": "How to show the elements that have (not) been converted.\\n\\n* full: converted and original elements will appear side-by-side\\n* filtered: only converted elements will be shown\\n* nested: converted elements will be shown, and they will include a link to the original element\\n(using `prov:wasGeneratedBy`).\\n",\n",
+       "      "options": [\n",
+       "        "filtered",\n",
+       "        "nested",\n",
+       "        "full"\n",
+       "      ],\n",
+       "      "required": true\n",
+       "    },\n",
+       "    "emotion-model": {\n",
+       "      "@id": "emotionModel",\n",
+       "      "aliases": [\n",
+       "        "emoModel",\n",
+       "        "emotionModel"\n",
+       "      ],\n",
+       "      "description": "Emotion model to use in the response.\\nSenpy will try to convert the output to this model automatically.\\n\\nExamples: `wna:liking` and `emoml:big6`.\\n        ",\n",
+       "      "required": false\n",
+       "    },\n",
+       "    "expanded-jsonld": {\n",
+       "      "@id": "expanded-jsonld",\n",
+       "      "aliases": [\n",
+       "        "expanded",\n",
+       "        "expanded_jsonld"\n",
+       "      ],\n",
+       "      "default": false,\n",
+       "      "description": "use JSON-LD expansion to get full URIs",\n",
+       "      "options": [\n",
+       "        true,\n",
+       "        false\n",
+       "      ],\n",
+       "      "required": true\n",
+       "    },\n",
+       "    "fields": {\n",
+       "      "@id": "fields",\n",
+       "      "description": "A jmespath selector, that can be used to extract a new dictionary, array or value\\nfrom the results.\\njmespath is a powerful query language for json and/or dictionaries.\\nIt allows you to change the structure (and data) of your objects through queries.\\n\\ne.g., the following expression gets a list of `[emotion label, intensity]` for each entry:\\n`entries[].\\"onyx:hasEmotionSet\\"[].\\"onyx:hasEmotion\\"[][\\"onyx:hasEmotionCategory\\",\\"onyx:hasEmotionIntensity\\"]`\\n\\nFor more information, see: https://jmespath.org\\n\\n",\n",
+       "      "required": false\n",
+       "    },\n",
+       "    "help": {\n",
+       "      "@id": "help",\n",
+       "      "aliases": [\n",
+       "        "h"\n",
+       "      ],\n",
+       "      "default": false,\n",
+       "      "description": "Show additional help to know more about the possible parameters",\n",
+       "      "options": [\n",
+       "        true,\n",
+       "        false\n",
+       "      ],\n",
+       "      "required": true\n",
+       "    },\n",
+       "    "in-headers": {\n",
+       "      "aliases": [\n",
+       "        "headers",\n",
+       "        "inheaders",\n",
+       "        "inHeaders",\n",
+       "        "in-headers",\n",
+       "        "in_headers"\n",
+       "      ],\n",
+       "      "default": false,\n",
+       "      "description": "Only include the JSON-LD context in the headers",\n",
+       "      "options": [\n",
+       "        true,\n",
+       "        false\n",
+       "      ],\n",
+       "      "required": true\n",
+       "    },\n",
+       "    "informat": {\n",
+       "      "@id": "informat",\n",
+       "      "aliases": [\n",
+       "        "f"\n",
+       "      ],\n",
+       "      "default": "text",\n",
+       "      "description": "input format",\n",
+       "      "options": [\n",
+       "        "text",\n",
+       "        "json-ld"\n",
+       "      ],\n",
+       "      "required": false\n",
+       "    },\n",
+       "    "input": {\n",
+       "      "@id": "input",\n",
+       "      "aliases": [\n",
+       "        "i"\n",
+       "      ],\n",
+       "      "help": "Input text",\n",
+       "      "required": true\n",
+       "    },\n",
+       "    "intype": {\n",
+       "      "@id": "intype",\n",
+       "      "aliases": [\n",
+       "        "t"\n",
+       "      ],\n",
+       "      "default": "direct",\n",
+       "      "description": "input type",\n",
+       "      "options": [\n",
+       "        "direct",\n",
+       "        "url",\n",
+       "        "file"\n",
+       "      ],\n",
+       "      "required": false\n",
+       "    },\n",
+       "    "language": {\n",
+       "      "aliases": [\n",
+       "        "language",\n",
+       "        "l"\n",
+       "      ],\n",
+       "      "default": "en",\n",
+       "      "description": "language of the input",\n",
+       "      "options": [\n",
+       "        "es",\n",
+       "        "en"\n",
+       "      ],\n",
+       "      "required": true\n",
+       "    },\n",
+       "    "outformat": {\n",
+       "      "@id": "outformat",\n",
+       "      "aliases": [\n",
+       "        "o"\n",
+       "      ],\n",
+       "      "default": "json-ld",\n",
+       "      "description": "The data can be semantically formatted (JSON-LD, turtle or n-triples),\\ngiven as a list of comma-separated fields (see the fields option) or constructed from a Jinja2\\ntemplate (see the template option).",\n",
+       "      "options": [\n",
+       "        "json-ld",\n",
+       "        "turtle",\n",
+       "        "ntriples"\n",
+       "      ],\n",
+       "      "required": true\n",
+       "    },\n",
+       "    "prefix": {\n",
+       "      "@id": "prefix",\n",
+       "      "aliases": [\n",
+       "        "p"\n",
+       "      ],\n",
+       "      "default": "",\n",
+       "      "description": "prefix to use for new entities",\n",
+       "      "required": true\n",
+       "    },\n",
+       "    "template": {\n",
+       "      "@id": "template",\n",
+       "      "description": "Jinja2 template for the result. The input data for the template will\\nbe the results as a dictionary.\\nFor example:\\n\\nConsider the results before templating:\\n\\n```\\n[{\\n    \\"@type\\": \\"entry\\",\\n    \\"onyx:hasEmotionSet\\": [],\\n    \\"nif:isString\\": \\"testing the template\\",\\n    \\"marl:hasOpinion\\": [\\n        {\\n            \\"@type\\": \\"sentiment\\",\\n            \\"marl:hasPolarity\\": \\"marl:Positive\\"\\n        }\\n    ]\\n}]\\n```\\n\\n\\nAnd the template:\\n\\n```\\n{% for entry in entries %}\\n{{ entry[\\"nif:isString\\"] | upper }},{{entry.sentiments[0][\\"marl:hasPolarity\\"].split(\\":\\")[1]}}\\n{% endfor %}\\n```\\n\\nThe final result would be:\\n\\n```\\nTESTING THE TEMPLATE,Positive\\n```\\n",\n",
+       "      "required": false\n",
+       "    },\n",
+       "    "urischeme": {\n",
+       "      "@id": "urischeme",\n",
+       "      "aliases": [\n",
+       "        "u"\n",
+       "      ],\n",
+       "      "default": "RFC5147String",\n",
+       "      "description": "scheme for NIF URIs",\n",
+       "      "options": [\n",
+       "        "RFC5147String"\n",
+       "      ],\n",
+       "      "required": false\n",
+       "    },\n",
+       "    "verbose": {\n",
+       "      "@id": "verbose",\n",
+       "      "aliases": [\n",
+       "        "v"\n",
+       "      ],\n",
+       "      "default": false,\n",
+       "      "description": "Show all properties in the result",\n",
+       "      "options": [\n",
+       "        true,\n",
+       "        false\n",
+       "      ],\n",
+       "      "required": true\n",
+       "    },\n",
+       "    "with-parameters": {\n",
+       "      "aliases": [\n",
+       "        "withparameters",\n",
+       "        "with_parameters"\n",
+       "      ],\n",
+       "      "default": false,\n",
+       "      "description": "include initial parameters in the response",\n",
+       "      "options": [\n",
+       "        true,\n",
+       "        false\n",
+       "      ],\n",
+       "      "required": true\n",
+       "    }\n",
+       "  }\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpLz9oZWxwPVRydWUj\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Help\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}valid\\PYZus{}parameters\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}algorithm\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}algorithms\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}a\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}algo\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Algorithms that will be used to process the request.It may be a list of comma\\PYZhy{}separated names.\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}processor\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}string\\PYZus{}to\\PYZus{}tuple\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Replace JSON properties with their aliases\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{k+kc}{false}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}conversion\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}conversion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}full\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}How to show the elements that have (not) been converted.\\PYZbs{}n\\PYZbs{}n* full: converted and original elements will appear side\\PYZhy{}by\\PYZhy{}side\\PYZbs{}n* filtered: only converted elements will be shown\\PYZbs{}n* nested: converted elements will be shown, and they will include a link to the original element\\PYZbs{}n(using `prov:wasGeneratedBy`).\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}filtered\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}nested\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}full\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}emotion\\PYZhy{}model\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}emotionModel\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}emoModel\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}emotionModel\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion model to use in the response.\\PYZbs{}nSenpy will try to convert the output to this model automatically.\\PYZbs{}n\\PYZbs{}nExamples: `wna:liking` and `emoml:big6`.\\PYZbs{}n \\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}expanded\\PYZhy{}jsonld\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}expanded\\PYZhy{}jsonld\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}expanded\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}expanded\\PYZus{}jsonld\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}use JSON\\PYZhy{}LD expansion to get full URIs\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{k+kc}{false}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}fields\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}fields\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}A jmespath selector, that can be used to extract a new dictionary, array or value\\PYZbs{}nfrom the results.\\PYZbs{}njmespath is a powerful query language for json and/or dictionaries.\\PYZbs{}nIt allows you to change the structure (and data) of your objects through queries.\\PYZbs{}n\\PYZbs{}ne.g., the following expression gets a list of `[emotion label, intensity]` for each entry:\\PYZbs{}n`entries[].\\PYZbs{}\\PYZdq{}onyx:hasEmotionSet\\PYZbs{}\\PYZdq{}[].\\PYZbs{}\\PYZdq{}onyx:hasEmotion\\PYZbs{}\\PYZdq{}[][\\PYZbs{}\\PYZdq{}onyx:hasEmotionCategory\\PYZbs{}\\PYZdq{},\\PYZbs{}\\PYZdq{}onyx:hasEmotionIntensity\\PYZbs{}\\PYZdq{}]`\\PYZbs{}n\\PYZbs{}nFor more information, see: https://jmespath.org\\PYZbs{}n\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}help\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}help\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}h\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Show additional help to know more about the possible parameters\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{k+kc}{false}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}in\\PYZhy{}headers\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}headers\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}inheaders\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}inHeaders\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}in\\PYZhy{}headers\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}in\\PYZus{}headers\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Only include the JSON\\PYZhy{}LD context in the headers\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{k+kc}{false}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}informat\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}informat\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}f\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}text\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}input format\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}text\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}json\\PYZhy{}ld\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}input\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}input\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}i\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}help\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Input text\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}intype\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}intype\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}t\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}direct\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}input type\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}direct\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}url\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}file\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}l\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language of the input\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}es\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}outformat\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}outformat\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}o\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}json\\PYZhy{}ld\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}The data can be semantically formatted (JSON\\PYZhy{}LD, turtle or n\\PYZhy{}triples),\\PYZbs{}ngiven as a list of comma\\PYZhy{}separated fields (see the fields option) or constructed from a Jinja2\\PYZbs{}ntemplate (see the template option).\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}json\\PYZhy{}ld\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}turtle\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}ntriples\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prefix\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}p\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix to use for new entities\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}template\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}template\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Jinja2 template for the result. The input data for the template will\\PYZbs{}nbe the results as a dictionary.\\PYZbs{}nFor example:\\PYZbs{}n\\PYZbs{}nConsider the results before templating:\\PYZbs{}n\\PYZbs{}n```\\PYZbs{}n[\\PYZob{}\\PYZbs{}n \\PYZbs{}\\PYZdq{}@type\\PYZbs{}\\PYZdq{}: \\PYZbs{}\\PYZdq{}entry\\PYZbs{}\\PYZdq{},\\PYZbs{}n \\PYZbs{}\\PYZdq{}onyx:hasEmotionSet\\PYZbs{}\\PYZdq{}: [],\\PYZbs{}n \\PYZbs{}\\PYZdq{}nif:isString\\PYZbs{}\\PYZdq{}: \\PYZbs{}\\PYZdq{}testing the template\\PYZbs{}\\PYZdq{},\\PYZbs{}n \\PYZbs{}\\PYZdq{}marl:hasOpinion\\PYZbs{}\\PYZdq{}: [\\PYZbs{}n \\PYZob{}\\PYZbs{}n \\PYZbs{}\\PYZdq{}@type\\PYZbs{}\\PYZdq{}: \\PYZbs{}\\PYZdq{}sentiment\\PYZbs{}\\PYZdq{},\\PYZbs{}n \\PYZbs{}\\PYZdq{}marl:hasPolarity\\PYZbs{}\\PYZdq{}: \\PYZbs{}\\PYZdq{}marl:Positive\\PYZbs{}\\PYZdq{}\\PYZbs{}n \\PYZcb{}\\PYZbs{}n ]\\PYZbs{}n\\PYZcb{}]\\PYZbs{}n```\\PYZbs{}n\\PYZbs{}n\\PYZbs{}nAnd the template:\\PYZbs{}n\\PYZbs{}n```\\PYZbs{}n\\PYZob{}\\PYZpc{} for entry in entries \\PYZpc{}\\PYZcb{}\\PYZbs{}n\\PYZob{}\\PYZob{} entry[\\PYZbs{}\\PYZdq{}nif:isString\\PYZbs{}\\PYZdq{}] | upper \\PYZcb{}\\PYZcb{},\\PYZob{}\\PYZob{}entry.sentiments[0][\\PYZbs{}\\PYZdq{}marl:hasPolarity\\PYZbs{}\\PYZdq{}].split(\\PYZbs{}\\PYZdq{}:\\PYZbs{}\\PYZdq{})[1]\\PYZcb{}\\PYZcb{}\\PYZbs{}n\\PYZob{}\\PYZpc{} endfor \\PYZpc{}\\PYZcb{}\\PYZbs{}n```\\PYZbs{}n\\PYZbs{}nThe final result would be:\\PYZbs{}n\\PYZbs{}n```\\PYZbs{}nTESTING THE TEMPLATE,Positive\\PYZbs{}n```\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}urischeme\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}urischeme\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}u\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}RFC5147String\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}scheme for NIF URIs\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}RFC5147String\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}verbose\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}verbose\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}v\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Show all properties in the result\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{k+kc}{false}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}with\\PYZhy{}parameters\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{l+s+s2}{\\PYZdq{}withparameters\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{l+s+s2}{\\PYZdq{}with\\PYZus{}parameters\\PYZdq{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}include initial parameters in the response\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{k+kc}{true}\\PY{p}{,}\n", + " \\PY{k+kc}{false}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpLz9oZWxwPVRydWUj\",\n", + " \"@type\": \"Help\",\n", + " \"valid_parameters\": {\n", + " \"algorithm\": {\n", + " \"aliases\": [\n", + " \"algorithms\",\n", + " \"a\",\n", + " \"algo\"\n", + " ],\n", + " \"default\": \"default\",\n", + " \"description\": \"Algorithms that will be used to process the request.It may be a list of comma-separated names.\",\n", + " \"processor\": \"string_to_tuple\",\n", + " \"required\": true\n", + " },\n", + " \"aliases\": {\n", + " \"@id\": \"aliases\",\n", + " \"aliases\": [],\n", + " \"default\": false,\n", + " \"description\": \"Replace JSON properties with their aliases\",\n", + " \"options\": [\n", + " true,\n", + " false\n", + " ],\n", + " \"required\": true\n", + " },\n", + " \"conversion\": {\n", + " \"@id\": \"conversion\",\n", + " \"default\": \"full\",\n", + " \"description\": \"How to show the elements that have (not) been converted.\\n\\n* full: converted and original elements will appear side-by-side\\n* filtered: only converted elements will be shown\\n* nested: converted elements will be shown, and they will include a link to the original element\\n(using `prov:wasGeneratedBy`).\\n\",\n", + " \"options\": [\n", + " \"filtered\",\n", + " \"nested\",\n", + " \"full\"\n", + " ],\n", + " \"required\": true\n", + " },\n", + " \"emotion-model\": {\n", + " \"@id\": \"emotionModel\",\n", + " \"aliases\": [\n", + " \"emoModel\",\n", + " \"emotionModel\"\n", + " ],\n", + " \"description\": \"Emotion model to use in the response.\\nSenpy will try to convert the output to this model automatically.\\n\\nExamples: `wna:liking` and `emoml:big6`.\\n \",\n", + " \"required\": false\n", + " },\n", + " \"expanded-jsonld\": {\n", + " \"@id\": \"expanded-jsonld\",\n", + " \"aliases\": [\n", + " \"expanded\",\n", + " \"expanded_jsonld\"\n", + " ],\n", + " \"default\": false,\n", + " \"description\": \"use JSON-LD expansion to get full URIs\",\n", + " \"options\": [\n", + " true,\n", + " false\n", + " ],\n", + " \"required\": true\n", + " },\n", + " \"fields\": {\n", + " \"@id\": \"fields\",\n", + " \"description\": \"A jmespath selector, that can be used to extract a new dictionary, array or value\\nfrom the results.\\njmespath is a powerful query language for json and/or dictionaries.\\nIt allows you to change the structure (and data) of your objects through queries.\\n\\ne.g., the following expression gets a list of `[emotion label, intensity]` for each entry:\\n`entries[].\\\"onyx:hasEmotionSet\\\"[].\\\"onyx:hasEmotion\\\"[][\\\"onyx:hasEmotionCategory\\\",\\\"onyx:hasEmotionIntensity\\\"]`\\n\\nFor more information, see: https://jmespath.org\\n\\n\",\n", + " \"required\": false\n", + " },\n", + " \"help\": {\n", + " \"@id\": \"help\",\n", + " \"aliases\": [\n", + " \"h\"\n", + " ],\n", + " \"default\": false,\n", + " \"description\": \"Show additional help to know more about the possible parameters\",\n", + " \"options\": [\n", + " true,\n", + " false\n", + " ],\n", + " \"required\": true\n", + " },\n", + " \"in-headers\": {\n", + " \"aliases\": [\n", + " \"headers\",\n", + " \"inheaders\",\n", + " \"inHeaders\",\n", + " \"in-headers\",\n", + " \"in_headers\"\n", + " ],\n", + " \"default\": false,\n", + " \"description\": \"Only include the JSON-LD context in the headers\",\n", + " \"options\": [\n", + " true,\n", + " false\n", + " ],\n", + " \"required\": true\n", + " },\n", + " \"informat\": {\n", + " \"@id\": \"informat\",\n", + " \"aliases\": [\n", + " \"f\"\n", + " ],\n", + " \"default\": \"text\",\n", + " \"description\": \"input format\",\n", + " \"options\": [\n", + " \"text\",\n", + " \"json-ld\"\n", + " ],\n", + " \"required\": false\n", + " },\n", + " \"input\": {\n", + " \"@id\": \"input\",\n", + " \"aliases\": [\n", + " \"i\"\n", + " ],\n", + " \"help\": \"Input text\",\n", + " \"required\": true\n", + " },\n", + " \"intype\": {\n", + " \"@id\": \"intype\",\n", + " \"aliases\": [\n", + " \"t\"\n", + " ],\n", + " \"default\": \"direct\",\n", + " \"description\": \"input type\",\n", + " \"options\": [\n", + " \"direct\",\n", + " \"url\",\n", + " \"file\"\n", + " ],\n", + " \"required\": false\n", + " },\n", + " \"language\": {\n", + " \"aliases\": [\n", + " \"language\",\n", + " \"l\"\n", + " ],\n", + " \"default\": \"en\",\n", + " \"description\": \"language of the input\",\n", + " \"options\": [\n", + " \"es\",\n", + " \"en\"\n", + " ],\n", + " \"required\": true\n", + " },\n", + " \"outformat\": {\n", + " \"@id\": \"outformat\",\n", + " \"aliases\": [\n", + " \"o\"\n", + " ],\n", + " \"default\": \"json-ld\",\n", + " \"description\": \"The data can be semantically formatted (JSON-LD, turtle or n-triples),\\ngiven as a list of comma-separated fields (see the fields option) or constructed from a Jinja2\\ntemplate (see the template option).\",\n", + " \"options\": [\n", + " \"json-ld\",\n", + " \"turtle\",\n", + " \"ntriples\"\n", + " ],\n", + " \"required\": true\n", + " },\n", + " \"prefix\": {\n", + " \"@id\": \"prefix\",\n", + " \"aliases\": [\n", + " \"p\"\n", + " ],\n", + " \"default\": \"\",\n", + " \"description\": \"prefix to use for new entities\",\n", + " \"required\": true\n", + " },\n", + " \"template\": {\n", + " \"@id\": \"template\",\n", + " \"description\": \"Jinja2 template for the result. The input data for the template will\\nbe the results as a dictionary.\\nFor example:\\n\\nConsider the results before templating:\\n\\n```\\n[{\\n \\\"@type\\\": \\\"entry\\\",\\n \\\"onyx:hasEmotionSet\\\": [],\\n \\\"nif:isString\\\": \\\"testing the template\\\",\\n \\\"marl:hasOpinion\\\": [\\n {\\n \\\"@type\\\": \\\"sentiment\\\",\\n \\\"marl:hasPolarity\\\": \\\"marl:Positive\\\"\\n }\\n ]\\n}]\\n```\\n\\n\\nAnd the template:\\n\\n```\\n{% for entry in entries %}\\n{{ entry[\\\"nif:isString\\\"] | upper }},{{entry.sentiments[0][\\\"marl:hasPolarity\\\"].split(\\\":\\\")[1]}}\\n{% endfor %}\\n```\\n\\nThe final result would be:\\n\\n```\\nTESTING THE TEMPLATE,Positive\\n```\\n\",\n", + " \"required\": false\n", + " },\n", + " \"urischeme\": {\n", + " \"@id\": \"urischeme\",\n", + " \"aliases\": [\n", + " \"u\"\n", + " ],\n", + " \"default\": \"RFC5147String\",\n", + " \"description\": \"scheme for NIF URIs\",\n", + " \"options\": [\n", + " \"RFC5147String\"\n", + " ],\n", + " \"required\": false\n", + " },\n", + " \"verbose\": {\n", + " \"@id\": \"verbose\",\n", + " \"aliases\": [\n", + " \"v\"\n", + " ],\n", + " \"default\": false,\n", + " \"description\": \"Show all properties in the result\",\n", + " \"options\": [\n", + " true,\n", + " false\n", + " ],\n", + " \"required\": true\n", + " },\n", + " \"with-parameters\": {\n", + " \"aliases\": [\n", + " \"withparameters\",\n", + " \"with_parameters\"\n", + " ],\n", + " \"default\": false,\n", + " \"description\": \"include initial parameters in the response\",\n", + " \"options\": [\n", + " true,\n", + " false\n", + " ],\n", + " \"required\": true\n", + " }\n", + " }\n", + "}" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import requests\n", + "res = requests.get(f'{endpoint}/',\n", + " params={\n", + " \"help\": True}).text\n", + "pretty(res)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Ignoring the context" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
{\n",
+       "  "@type": "Results",\n",
+       "  "entries": [\n",
+       "    {\n",
+       "      "@id": "prefix:",\n",
+       "      "@type": "Entry",\n",
+       "      "marl:hasOpinion": [],\n",
+       "      "nif:isString": "This will tell senpy to only include the context in the headers",\n",
+       "      "onyx:hasEmotionSet": [\n",
+       "        {\n",
+       "          "@id": "Emotions0",\n",
+       "          "@type": "EmotionSet",\n",
+       "          "onyx:hasEmotion": [\n",
+       "            {\n",
+       "              "@id": "Emotion0",\n",
+       "              "@type": "Emotion",\n",
+       "              "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal": 4.22,\n",
+       "              "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance": 5.17,\n",
+       "              "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence": 5.2,\n",
+       "              "prov:wasGeneratedBy": "prefix:Analysis_1554382985.2021937"\n",
+       "            }\n",
+       "          ],\n",
+       "          "prov:wasGeneratedBy": "prefix:Analysis_1554382985.2021937"\n",
+       "        }\n",
+       "      ]\n",
+       "    }\n",
+       "  ]\n",
+       "}\n",
+       "
\n" + ], + "text/latex": [ + "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", + "\\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}This will tell senpy to only include the context in the headers\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotions0\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", + " \\PY{p}{\\PYZob{}}\n", + " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion0\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}arousal\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{4.22}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}dominance\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{5.17}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}valence\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{5.2}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382985.2021937\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\\PY{p}{,}\n", + " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554382985.2021937\\PYZdq{}}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + " \\PY{p}{\\PYZcb{}}\n", + " \\PY{p}{]}\n", + "\\PY{p}{\\PYZcb{}}\n", + "\\end{Verbatim}\n" + ], + "text/plain": [ + "{\n", + " \"@type\": \"Results\",\n", + " \"entries\": [\n", + " {\n", + " \"@id\": \"prefix:\",\n", + " \"@type\": \"Entry\",\n", + " \"marl:hasOpinion\": [],\n", + " \"nif:isString\": \"This will tell senpy to only include the context in the headers\",\n", + " \"onyx:hasEmotionSet\": [\n", + " {\n", + " \"@id\": \"Emotions0\",\n", + " \"@type\": \"EmotionSet\",\n", + " \"onyx:hasEmotion\": [\n", + " {\n", + " \"@id\": \"Emotion0\",\n", + " \"@type\": \"Emotion\",\n", + " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal\": 4.22,\n", + " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance\": 5.17,\n", + " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence\": 5.2,\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382985.2021937\"\n", + " }\n", + " ],\n", + " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554382985.2021937\"\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + "}" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import requests\n", + "res = requests.get(f'{endpoint}/',\n", + " params={\n", + " \"input\": \"This will tell senpy to only include the context in the headers\",\n", + " \"inheaders\": True})\n", + "pretty(res.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To retrieve the context URI, use the `LINK` header:" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + ";rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"\n" + ] + } + ], + "source": [ + "print(res.headers['Link'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "anaconda-cloud": {}, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + }, + "toc": { + "colors": { + "hover_highlight": "#DAA520", + "running_highlight": "#FF0000", + "selected_highlight": "#FFD700" + }, + "moveMenuLeft": true, + "nav_menu": { + "height": "68px", + "width": "252px" + }, + "navigate_menu": true, + "number_sections": true, + "sideBar": true, + "threshold": 4, + "toc_cell": false, + "toc_section_display": "block", + "toc_window_display": false + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} diff --git a/docs/Quickstart.ipynb b/docs/Quickstart.ipynb index b701561..fbd89bb 100644 --- a/docs/Quickstart.ipynb +++ b/docs/Quickstart.ipynb @@ -4,4619 +4,41 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Consuming Senpy services" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This short tutorial will teach you how to consume services in several ways, taking advantage of the features of the framework.\n", + "# Quickstart\n", + "\n", + "This short tutorial will teach you how to consume senpy services for several tasks, and how to take advantage of the features of the framework.\n", "\n", - "In particular, we will cover:\n", + "In particular, it covers:\n", "\n", - "* Annotating text with sentiment\n", - "* Annotating text with emotion\n", + "* Annotating text with sentiment and emotion using interoperable services\n", + "* Switching to different services (service interoperability)\n", "* Getting results in different formats (Turtle, XML, text...)\n", "* Asking for specific emotion models (automatic model conversion)\n", "* Listing available services in an endpoint\n", - "* Switching to different services\n", "* Calling multiple services in the same request (Pipelines)\n", "\n", - "The latest version of this IPython notebook is available at: https://github.com/gsi-upm/senpy/tree/master/docs/Quickstart.ipynb" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Requirements" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "For the sake of simplicity, this tutorial will use the demo server: http://senpy.gsi.upm.es:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "endpoint = 'http://senpy.gsi.upm.es/api'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This server runs some open source plugins for sentiment and emotion analysis." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The HTTP API of Senpy can be queried with your favourite tool.\n", - "This is just an example using curl:\n", - "\n", - "```bash\n", - "curl \"http://senpy.gsi.upm.es/api/sentiment140\" --data-urlencode \"input=Senpy is awesome\"\n", - "```\n", - "\n", - "For simplicity, in this tutorial we will use the requests library. We will also add a function to add syntax highlighting for the JSON-LD/Turtle results:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "try:\n", - " from IPython.display import Code\n", - " def pretty(txt, language='json-ld'):\n", - " return Code(txt, language=language)\n", - "except ImportError:\n", - " def pretty(txt, **kwargs):\n", - " print(txt)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Once you're familiar with Senpy, you can deploy your own instance quite easily. e.g. using docker:\n", - "\n", - "```\n", - "docker run -ti --name 'SenpyEndpoint' -d -p 5000:5000 gsiupm/senpy\n", - "```\n", - "\n", - "Then, feel free to change the endpoint variable to run the examples in your own instance." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Sentiment Analysis of Text" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "To start, let us analyse the sentiment in the following sentence: *senpy is a wonderful service*.\n", - "\n", - "For now, we will use the [sentiment140](http://www.sentiment140.com/) service, through the sentiment140 plugin.\n", - "We will later cover how to use a different service.\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
{\n",
-       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lIw%3D%3D",\n",
-       "  "@type": "Results",\n",
-       "  "entries": [\n",
-       "    {\n",
-       "      "@id": "prefix:",\n",
-       "      "@type": "Entry",\n",
-       "      "marl:hasOpinion": [\n",
-       "        {\n",
-       "          "@type": "Sentiment",\n",
-       "          "marl:hasPolarity": "marl:Positive",\n",
-       "          "prov:wasGeneratedBy": "prefix:Analysis_1554364667.7955277"\n",
-       "        }\n",
-       "      ],\n",
-       "      "nif:isString": "Senpy is awesome",\n",
-       "      "onyx:hasEmotionSet": []\n",
-       "    }\n",
-       "  ]\n",
-       "}\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lIw\\PYZpc{}3D\\PYZpc{}3D\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364667.7955277\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is awesome\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - "\\PY{p}{\\PYZcb{}}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "{\n", - " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lIw%3D%3D\",\n", - " \"@type\": \"Results\",\n", - " \"entries\": [\n", - " {\n", - " \"@id\": \"prefix:\",\n", - " \"@type\": \"Entry\",\n", - " \"marl:hasOpinion\": [\n", - " {\n", - " \"@type\": \"Sentiment\",\n", - " \"marl:hasPolarity\": \"marl:Positive\",\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364667.7955277\"\n", - " }\n", - " ],\n", - " \"nif:isString\": \"Senpy is awesome\",\n", - " \"onyx:hasEmotionSet\": []\n", - " }\n", - " ]\n", - "}" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "import requests\n", - "res = requests.get(f'{endpoint}/sentiment140',\n", - " params={\"input\": \"Senpy is awesome\",})\n", - "pretty(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Senpy services always return an object of type `senpy:Results`, with a list of entries.\n", - "You can think of an entry as a self-contained textual context (`nif:Context` and `senpy:Entry`).\n", - "Entries can be as short as a sentence, or as long as a news article.\n", - "\n", - "Each entry has a `nif:isString` property that contains the original text of the entry, and several other properties that are provided by the plugins.\n", - "\n", - "For instance, sentiment annotations are provided through `marl:hasOpinion`.\n", - "\n", - "The annotations are semantic.\n", - "We can ask Senpy for the expanded JSON-LD output to reveal the full URIs of each property and entity:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
{\n",
-       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lJmV4cGFuZGVkPVRydWUj",\n",
-       "  "@type": [\n",
-       "    "http://www.gsi.upm.es/onto/senpy/ns#Results"\n",
-       "  ],\n",
-       "  "http://www.w3.org/ns/prov#used": [\n",
-       "    {\n",
-       "      "@id": "http://senpy.invalid/",\n",
-       "      "@type": [\n",
-       "        "http://www.gsi.upm.es/onto/senpy/ns#Entry"\n",
-       "      ],\n",
-       "      "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#isString": [\n",
-       "        {\n",
-       "          "@value": "Senpy is awesome"\n",
-       "        }\n",
-       "      ],\n",
-       "      "http://www.gsi.dit.upm.es/ontologies/marl/ns#hasOpinion": [\n",
-       "        {\n",
-       "          "@type": [\n",
-       "            "http://www.gsi.upm.es/onto/senpy/ns#Sentiment"\n",
-       "          ],\n",
-       "          "http://www.gsi.dit.upm.es/ontologies/marl/ns#hasPolarity": [\n",
-       "            {\n",
-       "              "@value": "marl:Positive"\n",
-       "            }\n",
-       "          ],\n",
-       "          "http://www.w3.org/ns/prov#wasGeneratedBy": [\n",
-       "            {\n",
-       "              "@id": "http://senpy.invalid/Analysis_1554364668.1011338"\n",
-       "            }\n",
-       "          ]\n",
-       "        }\n",
-       "      ],\n",
-       "      "http://www.gsi.dit.upm.es/ontologies/onyx/ns#hasEmotionSet": []\n",
-       "    }\n",
-       "  ]\n",
-       "}\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lJmV4cGFuZGVkPVRydWUj\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}http://www.gsi.upm.es/onto/senpy/ns\\PYZsh{}Results\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.w3.org/ns/prov\\PYZsh{}used\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.invalid/\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}http://www.gsi.upm.es/onto/senpy/ns\\PYZsh{}Entry\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://persistence.uni\\PYZhy{}leipzig.org/nlp2rdf/ontologies/nif\\PYZhy{}core\\PYZsh{}isString\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is awesome\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/marl/ns\\PYZsh{}hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}http://www.gsi.upm.es/onto/senpy/ns\\PYZsh{}Sentiment\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/marl/ns\\PYZsh{}hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.w3.org/ns/prov\\PYZsh{}wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.invalid/Analysis\\PYZus{}1554364668.1011338\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/ns\\PYZsh{}hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - "\\PY{p}{\\PYZcb{}}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "{\n", - " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lJmV4cGFuZGVkPVRydWUj\",\n", - " \"@type\": [\n", - " \"http://www.gsi.upm.es/onto/senpy/ns#Results\"\n", - " ],\n", - " \"http://www.w3.org/ns/prov#used\": [\n", - " {\n", - " \"@id\": \"http://senpy.invalid/\",\n", - " \"@type\": [\n", - " \"http://www.gsi.upm.es/onto/senpy/ns#Entry\"\n", - " ],\n", - " \"http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#isString\": [\n", - " {\n", - " \"@value\": \"Senpy is awesome\"\n", - " }\n", - " ],\n", - " \"http://www.gsi.dit.upm.es/ontologies/marl/ns#hasOpinion\": [\n", - " {\n", - " \"@type\": [\n", - " \"http://www.gsi.upm.es/onto/senpy/ns#Sentiment\"\n", - " ],\n", - " \"http://www.gsi.dit.upm.es/ontologies/marl/ns#hasPolarity\": [\n", - " {\n", - " \"@value\": \"marl:Positive\"\n", - " }\n", - " ],\n", - " \"http://www.w3.org/ns/prov#wasGeneratedBy\": [\n", - " {\n", - " \"@id\": \"http://senpy.invalid/Analysis_1554364668.1011338\"\n", - " }\n", - " ]\n", - " }\n", - " ],\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/ns#hasEmotionSet\": []\n", - " }\n", - " ]\n", - "}" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "import requests\n", - "res = requests.get(f'{endpoint}/sentiment140',\n", - " params={\"input\": \"Senpy is awesome\",\n", - " \"expanded\": True})\n", - "pretty(res.text)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
{\n",
-       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lJmV4cGFuZGVkPVRydWUj",\n",
-       "  "@type": [\n",
-       "    "http://www.gsi.upm.es/onto/senpy/ns#Results"\n",
-       "  ],\n",
-       "  "http://www.w3.org/ns/prov#used": [\n",
-       "    {\n",
-       "      "@id": "http://senpy.invalid/",\n",
-       "      "@type": [\n",
-       "        "http://www.gsi.upm.es/onto/senpy/ns#Entry"\n",
-       "      ],\n",
-       "      "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#isString": [\n",
-       "        {\n",
-       "          "@value": "Senpy is awesome"\n",
-       "        }\n",
-       "      ],\n",
-       "      "http://www.gsi.dit.upm.es/ontologies/marl/ns#hasOpinion": [\n",
-       "        {\n",
-       "          "@type": [\n",
-       "            "http://www.gsi.upm.es/onto/senpy/ns#Sentiment"\n",
-       "          ],\n",
-       "          "http://www.gsi.dit.upm.es/ontologies/marl/ns#hasPolarity": [\n",
-       "            {\n",
-       "              "@value": "marl:Positive"\n",
-       "            }\n",
-       "          ],\n",
-       "          "http://www.w3.org/ns/prov#wasGeneratedBy": [\n",
-       "            {\n",
-       "              "@id": "http://senpy.invalid/Analysis_1554364668.1011338"\n",
-       "            }\n",
-       "          ]\n",
-       "        }\n",
-       "      ],\n",
-       "      "http://www.gsi.dit.upm.es/ontologies/onyx/ns#hasEmotionSet": []\n",
-       "    }\n",
-       "  ]\n",
-       "}\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lJmV4cGFuZGVkPVRydWUj\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}http://www.gsi.upm.es/onto/senpy/ns\\PYZsh{}Results\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.w3.org/ns/prov\\PYZsh{}used\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.invalid/\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}http://www.gsi.upm.es/onto/senpy/ns\\PYZsh{}Entry\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://persistence.uni\\PYZhy{}leipzig.org/nlp2rdf/ontologies/nif\\PYZhy{}core\\PYZsh{}isString\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is awesome\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/marl/ns\\PYZsh{}hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}http://www.gsi.upm.es/onto/senpy/ns\\PYZsh{}Sentiment\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/marl/ns\\PYZsh{}hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.w3.org/ns/prov\\PYZsh{}wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.invalid/Analysis\\PYZus{}1554364668.1011338\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/ns\\PYZsh{}hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - "\\PY{p}{\\PYZcb{}}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "{\n", - " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lJmV4cGFuZGVkPVRydWUj\",\n", - " \"@type\": [\n", - " \"http://www.gsi.upm.es/onto/senpy/ns#Results\"\n", - " ],\n", - " \"http://www.w3.org/ns/prov#used\": [\n", - " {\n", - " \"@id\": \"http://senpy.invalid/\",\n", - " \"@type\": [\n", - " \"http://www.gsi.upm.es/onto/senpy/ns#Entry\"\n", - " ],\n", - " \"http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#isString\": [\n", - " {\n", - " \"@value\": \"Senpy is awesome\"\n", - " }\n", - " ],\n", - " \"http://www.gsi.dit.upm.es/ontologies/marl/ns#hasOpinion\": [\n", - " {\n", - " \"@type\": [\n", - " \"http://www.gsi.upm.es/onto/senpy/ns#Sentiment\"\n", - " ],\n", - " \"http://www.gsi.dit.upm.es/ontologies/marl/ns#hasPolarity\": [\n", - " {\n", - " \"@value\": \"marl:Positive\"\n", - " }\n", - " ],\n", - " \"http://www.w3.org/ns/prov#wasGeneratedBy\": [\n", - " {\n", - " \"@id\": \"http://senpy.invalid/Analysis_1554364668.1011338\"\n", - " }\n", - " ]\n", - " }\n", - " ],\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/ns#hasEmotionSet\": []\n", - " }\n", - " ]\n", - "}" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "pretty(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Other output formats" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Senpy supports several semantic formats, like turtle and xml-RDF.\n", - "You can select the format of the output with the `outformat` parameter:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
@prefix : <http://www.gsi.upm.es/onto/senpy/ns#> .\n",
-       "@prefix dc: <http://dublincore.org/2012/06/14/dcelements#> .\n",
-       "@prefix emoml: <http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/emotionml/ns#> .\n",
-       "@prefix endpoint: <http://senpy.gsi.upm.es/api/> .\n",
-       "@prefix fam: <http://vocab.fusepool.info/fam#> .\n",
-       "@prefix marl: <http://www.gsi.dit.upm.es/ontologies/marl/ns#> .\n",
-       "@prefix nif: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .\n",
-       "@prefix onyx: <http://www.gsi.dit.upm.es/ontologies/onyx/ns#> .\n",
-       "@prefix prefix: <http://senpy.invalid/> .\n",
-       "@prefix prov: <http://www.w3.org/ns/prov#> .\n",
-       "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n",
-       "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n",
-       "@prefix senpy: <http://www.gsi.upm.es/onto/senpy/ns#> .\n",
-       "@prefix wna: <http://www.gsi.dit.upm.es/ontologies/wnaffect/ns#> .\n",
-       "@prefix xml: <http://www.w3.org/XML/1998/namespace> .\n",
-       "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n",
-       "\n",
-       "prefix: a senpy:Entry ;\n",
-       "    nif:isString "Senpy is the best framework for semantic sentiment analysis, and very easy to use" ;\n",
-       "    marl:hasOpinion [ a senpy:Sentiment ;\n",
-       "            marl:hasPolarity "marl:Positive" ;\n",
-       "            prov:wasGeneratedBy prefix:Analysis_1554364668.5153766 ] .\n",
-       "\n",
-       "[] a senpy:Results ;\n",
-       "    prov:used prefix: .\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.gsi.upm.es/onto/senpy/ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{dc:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://dublincore.org/2012/06/14/dcelements\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{emoml:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/emotionml/ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{endpoint:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://senpy.gsi.upm.es/api/\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{fam:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://vocab.fusepool.info/fam\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{marl:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.gsi.dit.upm.es/ontologies/marl/ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{nif:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://persistence.uni\\PYZhy{}leipzig.org/nlp2rdf/ontologies/nif\\PYZhy{}core\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{onyx:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.gsi.dit.upm.es/ontologies/onyx/ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{prefix:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://senpy.invalid/\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{prov:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.w3.org/ns/prov\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{rdf:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.w3.org/1999/02/22\\PYZhy{}rdf\\PYZhy{}syntax\\PYZhy{}ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{rdfs:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.w3.org/2000/01/rdf\\PYZhy{}schema\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{senpy:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.gsi.upm.es/onto/senpy/ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{wna:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.gsi.dit.upm.es/ontologies/wnaffect/ns\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{xml:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.w3.org/XML/1998/namespace\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\\PY{k}{@prefix}\\PY{+w}{ }\\PY{n+nn}{xsd:}\\PY{+w}{ }\\PY{n+nv}{\\PYZlt{}http://www.w3.org/2001/XMLSchema\\PYZsh{}\\PYZgt{}}\\PY{+w}{ }\\PY{p}{.}\n", - "\n", - "\\PY{err}{p}\\PY{err}{r}\\PY{err}{e}\\PY{err}{f}\\PY{err}{i}\\PY{err}{x}\\PY{p}{:}\\PY{+w}{ }\\PY{k+kt}{a}\\PY{+w}{ }\\PY{n+nn}{senpy:}\\PY{n+nt}{Entry}\\PY{+w}{ }\\PY{p}{;}\n", - "\\PY{+w}{ }\\PY{n+nn}{nif:}\\PY{n+nt}{isString}\\PY{+w}{ }\\PY{l+s}{\\PYZdq{}}\\PY{l+s}{Senpy is the best framework for semantic sentiment analysis, and very easy to use}\\PY{l+s}{\\PYZdq{}}\\PY{+w}{ }\\PY{p}{;}\n", - "\\PY{+w}{ }\\PY{n+nn}{marl:}\\PY{n+nt}{hasOpinion}\\PY{+w}{ }\\PY{p}{[}\\PY{+w}{ }\\PY{k+kt}{a}\\PY{+w}{ }\\PY{n+nn}{senpy:}\\PY{n+nt}{Sentiment}\\PY{+w}{ }\\PY{p}{;}\n", - "\\PY{+w}{ }\\PY{n+nn}{marl:}\\PY{n+nt}{hasPolarity}\\PY{+w}{ }\\PY{l+s}{\\PYZdq{}}\\PY{l+s}{marl:Positive}\\PY{l+s}{\\PYZdq{}}\\PY{+w}{ }\\PY{p}{;}\n", - "\\PY{+w}{ }\\PY{n+nn}{prov:}\\PY{n+nt}{wasGeneratedBy}\\PY{+w}{ }\\PY{n+nn}{prefix:}\\PY{n+nt}{Analysis\\PYZus{}1554364668}\\PY{l+m+mf}{.5153766}\\PY{+w}{ }\\PY{p}{]}\\PY{+w}{ }\\PY{p}{.}\n", - "\n", - "\\PY{p}{[}\\PY{p}{]}\\PY{+w}{ }\\PY{k+kt}{a}\\PY{+w}{ }\\PY{n+nn}{senpy:}\\PY{n+nt}{Results}\\PY{+w}{ }\\PY{p}{;}\n", - "\\PY{+w}{ }\\PY{n+nn}{prov:}\\PY{n+nt}{used}\\PY{+w}{ }\\PY{err}{p}\\PY{err}{r}\\PY{err}{e}\\PY{err}{f}\\PY{err}{i}\\PY{err}{x}\\PY{p}{:}\\PY{+w}{ }\\PY{p}{.}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "@prefix : .\n", - "@prefix dc: .\n", - "@prefix emoml: .\n", - "@prefix endpoint: .\n", - "@prefix fam: .\n", - "@prefix marl: .\n", - "@prefix nif: .\n", - "@prefix onyx: .\n", - "@prefix prefix: .\n", - "@prefix prov: .\n", - "@prefix rdf: .\n", - "@prefix rdfs: .\n", - "@prefix senpy: .\n", - "@prefix wna: .\n", - "@prefix xml: .\n", - "@prefix xsd: .\n", - "\n", - "prefix: a senpy:Entry ;\n", - " nif:isString \"Senpy is the best framework for semantic sentiment analysis, and very easy to use\" ;\n", - " marl:hasOpinion [ a senpy:Sentiment ;\n", - " marl:hasPolarity \"marl:Positive\" ;\n", - " prov:wasGeneratedBy prefix:Analysis_1554364668.5153766 ] .\n", - "\n", - "[] a senpy:Results ;\n", - " prov:used prefix: .\n" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res = requests.get(f'{endpoint}/sentiment140',\n", - " params={\"input\": \"Senpy is the best framework for semantic sentiment analysis, and very easy to use\",\n", - " \"outformat\": \"turtle\"})\n", - "pretty(res.text, language='turtle')" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Selecting fields from the output" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The full output in the previous sections is very useful because it is semantically annotated.\n", - "However, it is also quite verbose if we only want to label a piece of text, or get a polarity value.\n", - "\n", - "For such simple cases, the API has a special `fields` method you can use to get a specific field from the results, and even transform the results. Senpy uses jmespath under the hood, which has its own notation.\n", + "These topics are split into two separate tutorials.\n", "\n", - "To illustrate this, let us get only the text (`nif:isString`) from each entry:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[\"Senpy is a wonderful service\"]\n" - ] - } - ], - "source": [ - "res = requests.get(f'{endpoint}/sentiment140',\n", - " params={\"input\": \"Senpy is a wonderful service\",\n", - " \"fields\": 'entries[].\"nif:isString\"'})\n", - "print(res.text)" + "Reading all the sections is not necessary, although it is encouraged in order to get a glimpse of all the features." ] }, { "cell_type": "markdown", - "metadata": {}, - "source": [ - "Or we could get both the text and the polarity of the text (assuming there is only one opinion per entry) with a slightly more complicated query:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[\"Senpy is a service. Wonderful service.\", \"marl:Neutral\"]\n" - ] + "metadata": { + "nbsphinx-toctree": { + "maxdepth": 2 } - ], - "source": [ - "res = requests.get(f'{endpoint}/sentiment140',\n", - " params={\"input\": \"Senpy is a service. Wonderful service.\",\n", - " \"delimiter\": \"sentence\",\n", - " \"fields\": 'entries[0].[\"nif:isString\", \"marl:hasOpinion\"[0].\"marl:hasPolarity\"]'})\n", - "print(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "jmespath is rather extensive for this tutorial. We will cover only the most simple cases, so you do not need to learn much about the notation.\n", - "\n", - "For more complicated transformations, check out [jmespath](http://jmespath.org).\n", - "In addition to a fairly complete documentation, they have a live environment you can use to test your queries." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Emotion analysis" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\n", - "Senpy uses the `onyx` vocabulary to represent emotions, which incorporates the notion of `EmotionSet`'s, an emotion that is composed of several emotions.\n", - "In a nutshell, an `Entry` is linked to one or more `EmotionSet`, which in turn is made up of one or more `Emotion`.\n", - "\n", - "Let's illustrate it with an example, using the `emotion-depechemood` plugin." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
{\n",
-       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q_aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrdGhhdCtzZXJ2aWNlIw%3D%3D",\n",
-       "  "@type": "Results",\n",
-       "  "entries": [\n",
-       "    {\n",
-       "      "@id": "prefix:",\n",
-       "      "@type": "Entry",\n",
-       "      "marl:hasOpinion": [],\n",
-       "      "nif:isString": "Senpy is a wonderful that service",\n",
-       "      "onyx:hasEmotionSet": [\n",
-       "        {\n",
-       "          "@type": "EmotionSet",\n",
-       "          "onyx:hasEmotion": [\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:negative-fear",\n",
-       "              "onyx:hasEmotionIntensity": 0.06258366271018097\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:amusement",\n",
-       "              "onyx:hasEmotionIntensity": 0.15784834034155437\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:anger",\n",
-       "              "onyx:hasEmotionIntensity": 0.08728815135373413\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:annoyance",\n",
-       "              "onyx:hasEmotionIntensity": 0.12184635680460143\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:indifference",\n",
-       "              "onyx:hasEmotionIntensity": 0.1374081151031531\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:joy",\n",
-       "              "onyx:hasEmotionIntensity": 0.12267040802346799\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:awe",\n",
-       "              "onyx:hasEmotionIntensity": 0.21085262130713067\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:sadness",\n",
-       "              "onyx:hasEmotionIntensity": 0.09950234435617733\n",
-       "            }\n",
-       "          ],\n",
-       "          "prov:wasGeneratedBy": "prefix:Analysis_1554364674.7078097"\n",
-       "        }\n",
-       "      ]\n",
-       "    }\n",
-       "  ]\n",
-       "}\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q\\PYZus{}aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrdGhhdCtzZXJ2aWNlIw\\PYZpc{}3D\\PYZpc{}3D\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is a wonderful that service\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:negative\\PYZhy{}fear\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.06258366271018097}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:amusement\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.15784834034155437}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:anger\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.08728815135373413}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:annoyance\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.12184635680460143}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:indifference\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.1374081151031531}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:joy\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.12267040802346799}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:awe\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.21085262130713067}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:sadness\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.09950234435617733}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364674.7078097\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - "\\PY{p}{\\PYZcb{}}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "{\n", - " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q_aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrdGhhdCtzZXJ2aWNlIw%3D%3D\",\n", - " \"@type\": \"Results\",\n", - " \"entries\": [\n", - " {\n", - " \"@id\": \"prefix:\",\n", - " \"@type\": \"Entry\",\n", - " \"marl:hasOpinion\": [],\n", - " \"nif:isString\": \"Senpy is a wonderful that service\",\n", - " \"onyx:hasEmotionSet\": [\n", - " {\n", - " \"@type\": \"EmotionSet\",\n", - " \"onyx:hasEmotion\": [\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:negative-fear\",\n", - " \"onyx:hasEmotionIntensity\": 0.06258366271018097\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:amusement\",\n", - " \"onyx:hasEmotionIntensity\": 0.15784834034155437\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:anger\",\n", - " \"onyx:hasEmotionIntensity\": 0.08728815135373413\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:annoyance\",\n", - " \"onyx:hasEmotionIntensity\": 0.12184635680460143\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:indifference\",\n", - " \"onyx:hasEmotionIntensity\": 0.1374081151031531\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:joy\",\n", - " \"onyx:hasEmotionIntensity\": 0.12267040802346799\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:awe\",\n", - " \"onyx:hasEmotionIntensity\": 0.21085262130713067\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:sadness\",\n", - " \"onyx:hasEmotionIntensity\": 0.09950234435617733\n", - " }\n", - " ],\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364674.7078097\"\n", - " }\n", - " ]\n", - " }\n", - " ]\n", - "}" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res = requests.get(f'{endpoint}/emotion-depechemood',\n", - " params={\"input\": \"Senpy is a wonderful that service\"})\n", - "pretty(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "As you have probably noticed, there are several emotions in this result, each with a different intensity.\n", - "\n", - "We can also tell senpy to only return the emotion with the maximum intensity using the `maxemotion` parameter:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
{\n",
-       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q_aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrc2VydmljZSZtYXhlbW90aW9uPVRydWUj",\n",
-       "  "@type": "Results",\n",
-       "  "entries": [\n",
-       "    {\n",
-       "      "@id": "prefix:",\n",
-       "      "@type": "Entry",\n",
-       "      "marl:hasOpinion": [],\n",
-       "      "nif:isString": "Senpy is a wonderful service",\n",
-       "      "onyx:hasEmotionSet": [\n",
-       "        {\n",
-       "          "@type": "EmotionSet",\n",
-       "          "onyx:hasEmotion": [\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:awe",\n",
-       "              "onyx:hasEmotionIntensity": 0.21085262130713067\n",
-       "            }\n",
-       "          ],\n",
-       "          "prov:wasGeneratedBy": "prefix:Analysis_1554364674.8374224"\n",
-       "        }\n",
-       "      ]\n",
-       "    }\n",
-       "  ]\n",
-       "}\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q\\PYZus{}aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrc2VydmljZSZtYXhlbW90aW9uPVRydWUj\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is a wonderful service\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:awe\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.21085262130713067}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364674.8374224\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - "\\PY{p}{\\PYZcb{}}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "{\n", - " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q_aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrc2VydmljZSZtYXhlbW90aW9uPVRydWUj\",\n", - " \"@type\": \"Results\",\n", - " \"entries\": [\n", - " {\n", - " \"@id\": \"prefix:\",\n", - " \"@type\": \"Entry\",\n", - " \"marl:hasOpinion\": [],\n", - " \"nif:isString\": \"Senpy is a wonderful service\",\n", - " \"onyx:hasEmotionSet\": [\n", - " {\n", - " \"@type\": \"EmotionSet\",\n", - " \"onyx:hasEmotion\": [\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:awe\",\n", - " \"onyx:hasEmotionIntensity\": 0.21085262130713067\n", - " }\n", - " ],\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364674.8374224\"\n", - " }\n", - " ]\n", - " }\n", - " ]\n", - "}" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res = requests.get(f'{endpoint}/emotion-depechemood',\n", - " params={\"input\": \"Senpy is a wonderful service\",\n", - " \"maxemotion\": True})\n", - "pretty(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "We can combine this feature with the `fields` parameter to get only the label and the intensity:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
[["wna:awe", 0.21085262130713067]]\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{[}\\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}wna:awe\\PYZdq{}}\\PY{p}{,} \\PY{l+m+mf}{0.21085262130713067}\\PY{p}{]}\\PY{p}{]}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "[[\"wna:awe\", 0.21085262130713067]]" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res = requests.get(f'{endpoint}/emotion-depechemood',\n", - " params={\"input\": \"Senpy is a wonderful service\",\n", - " \"fields\": 'entries[].\"onyx:hasEmotionSet\"[].\"onyx:hasEmotion\"[][\"onyx:hasEmotionCategory\",\"onyx:hasEmotionIntensity\"]',\n", - " \"maxemotion\": True})\n", - "pretty(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Emotion conversion" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "If the model used by a plugin is not right for your application, you can ask for a specific emotion model in your request.\n", - "\n", - "Senpy ships with emotion conversion capabilities, and it will try to automatically convert the results.\n", - "\n", - "For example, the `emotion-anew` plugin uses the dimensional `pad` (or VAD, valence-arousal-dominance) model, as we can see here:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{\n", - " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQj\",\n", - " \"@type\": \"Results\",\n", - " \"entries\": [\n", - " {\n", - " \"@id\": \"prefix:\",\n", - " \"@type\": \"Entry\",\n", - " \"marl:hasOpinion\": [],\n", - " \"nif:isString\": \"Senpy is a wonderful service and I love it\",\n", - " \"onyx:hasEmotionSet\": [\n", - " {\n", - " \"@id\": \"Emotions0\",\n", - " \"@type\": \"EmotionSet\",\n", - " \"onyx:hasEmotion\": [\n", - " {\n", - " \"@id\": \"Emotion0\",\n", - " \"@type\": \"Emotion\",\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal\": 6.44,\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance\": 7.11,\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence\": 8.72,\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364675.1427004\"\n", - " }\n", - " ],\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364675.1427004\"\n", - " }\n", - " ]\n", - " }\n", - " ]\n", - "}\n" - ] - } - ], - "source": [ - "res = requests.get(f'{endpoint}/emotion-anew',\n", - " params={\"input\": \"Senpy is a wonderful service and I love it\"})\n", - "print(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "If we need a category level, we can ask for the equivalent results in the `big6` model:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
{\n",
-       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYj",\n",
-       "  "@type": "Results",\n",
-       "  "entries": [\n",
-       "    {\n",
-       "      "@id": "prefix:",\n",
-       "      "@type": "Entry",\n",
-       "      "marl:hasOpinion": [],\n",
-       "      "nif:isString": "Senpy is a wonderful service and I love it",\n",
-       "      "onyx:hasEmotionSet": [\n",
-       "        {\n",
-       "          "@id": "Emotions0",\n",
-       "          "@type": "EmotionSet",\n",
-       "          "onyx:hasEmotion": [\n",
-       "            {\n",
-       "              "@id": "Emotion0",\n",
-       "              "@type": "Emotion",\n",
-       "              "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal": 6.44,\n",
-       "              "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance": 7.11,\n",
-       "              "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence": 8.72,\n",
-       "              "prov:wasGeneratedBy": "prefix:Analysis_1554364675.2834926"\n",
-       "            }\n",
-       "          ],\n",
-       "          "prov:wasGeneratedBy": "prefix:Analysis_1554364675.2834926"\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "EmotionSet",\n",
-       "          "onyx:hasEmotion": [\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:algorithmConfidence": 7.449999999999999,\n",
-       "              "onyx:hasEmotionCategory": "emoml:big6fear"\n",
-       "            }\n",
-       "          ],\n",
-       "          "prov:wasGeneratedBy": "prefix:Analysis_1554364675.2902758"\n",
-       "        }\n",
-       "      ]\n",
-       "    }\n",
-       "  ]\n",
-       "}\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYj\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is a wonderful service and I love it\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotions0\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion0\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}arousal\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{6.44}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}dominance\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{7.11}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}valence\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{8.72}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364675.2834926\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364675.2834926\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:algorithmConfidence\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{7.449999999999999}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}emoml:big6fear\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364675.2902758\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - "\\PY{p}{\\PYZcb{}}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "{\n", - " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYj\",\n", - " \"@type\": \"Results\",\n", - " \"entries\": [\n", - " {\n", - " \"@id\": \"prefix:\",\n", - " \"@type\": \"Entry\",\n", - " \"marl:hasOpinion\": [],\n", - " \"nif:isString\": \"Senpy is a wonderful service and I love it\",\n", - " \"onyx:hasEmotionSet\": [\n", - " {\n", - " \"@id\": \"Emotions0\",\n", - " \"@type\": \"EmotionSet\",\n", - " \"onyx:hasEmotion\": [\n", - " {\n", - " \"@id\": \"Emotion0\",\n", - " \"@type\": \"Emotion\",\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal\": 6.44,\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance\": 7.11,\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence\": 8.72,\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364675.2834926\"\n", - " }\n", - " ],\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364675.2834926\"\n", - " },\n", - " {\n", - " \"@type\": \"EmotionSet\",\n", - " \"onyx:hasEmotion\": [\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:algorithmConfidence\": 7.449999999999999,\n", - " \"onyx:hasEmotionCategory\": \"emoml:big6fear\"\n", - " }\n", - " ],\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364675.2902758\"\n", - " }\n", - " ]\n", - " }\n", - " ]\n", - "}" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res = requests.get(f'{endpoint}/emotion-anew',\n", - " params={\"input\": \"Senpy is a wonderful service and I love it\",\n", - " \"emotion-model\": \"emoml:big6\"})\n", - "pretty(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Because we don't usually care about the original emotion, the conversion can be presented in three ways:\n", - "\n", - "* full: the original and converted emotions are included at the same level\n", - "* filtered: the original emotion is replaced by the converted emotion\n", - "* nested: the original emotion is replaced, but the converted emotion points to it\n", - "\n", - "For example, here's how the `nested` structure would look like:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
{\n",
-       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYmY29udmVyc2lvbj1uZXN0ZWQj",\n",
-       "  "@type": "Results",\n",
-       "  "entries": [\n",
-       "    {\n",
-       "      "@id": "prefix:",\n",
-       "      "@type": "Entry",\n",
-       "      "marl:hasOpinion": [],\n",
-       "      "nif:isString": "Senpy is a wonderful service and I love it",\n",
-       "      "onyx:hasEmotionSet": [\n",
-       "        {\n",
-       "          "@type": "EmotionSet",\n",
-       "          "onyx:hasEmotion": [\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:algorithmConfidence": 7.449999999999999,\n",
-       "              "onyx:hasEmotionCategory": "emoml:big6fear"\n",
-       "            }\n",
-       "          ],\n",
-       "          "prov:wasDerivedFrom": {\n",
-       "            "@id": "Emotions0",\n",
-       "            "@type": "EmotionSet",\n",
-       "            "onyx:hasEmotion": [\n",
-       "              {\n",
-       "                "@id": "Emotion0",\n",
-       "                "@type": "Emotion",\n",
-       "                "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal": 6.44,\n",
-       "                "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance": 7.11,\n",
-       "                "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence": 8.72,\n",
-       "                "prov:wasGeneratedBy": "prefix:Analysis_1554364675.4125388"\n",
-       "              }\n",
-       "            ],\n",
-       "            "prov:wasGeneratedBy": "prefix:Analysis_1554364675.4125388"\n",
-       "          },\n",
-       "          "prov:wasGeneratedBy": "prefix:Analysis_1554364675.4143574"\n",
-       "        }\n",
-       "      ]\n",
-       "    }\n",
-       "  ]\n",
-       "}\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYmY29udmVyc2lvbj1uZXN0ZWQj\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is a wonderful service and I love it\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:algorithmConfidence\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{7.449999999999999}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}emoml:big6fear\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasDerivedFrom\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotions0\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion0\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}arousal\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{6.44}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}dominance\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{7.11}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}valence\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{8.72}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364675.4125388\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364675.4125388\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364675.4143574\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - "\\PY{p}{\\PYZcb{}}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "{\n", - " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYmY29udmVyc2lvbj1uZXN0ZWQj\",\n", - " \"@type\": \"Results\",\n", - " \"entries\": [\n", - " {\n", - " \"@id\": \"prefix:\",\n", - " \"@type\": \"Entry\",\n", - " \"marl:hasOpinion\": [],\n", - " \"nif:isString\": \"Senpy is a wonderful service and I love it\",\n", - " \"onyx:hasEmotionSet\": [\n", - " {\n", - " \"@type\": \"EmotionSet\",\n", - " \"onyx:hasEmotion\": [\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:algorithmConfidence\": 7.449999999999999,\n", - " \"onyx:hasEmotionCategory\": \"emoml:big6fear\"\n", - " }\n", - " ],\n", - " \"prov:wasDerivedFrom\": {\n", - " \"@id\": \"Emotions0\",\n", - " \"@type\": \"EmotionSet\",\n", - " \"onyx:hasEmotion\": [\n", - " {\n", - " \"@id\": \"Emotion0\",\n", - " \"@type\": \"Emotion\",\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal\": 6.44,\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance\": 7.11,\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence\": 8.72,\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364675.4125388\"\n", - " }\n", - " ],\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364675.4125388\"\n", - " },\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364675.4143574\"\n", - " }\n", - " ]\n", - " }\n", - " ]\n", - "}" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res = requests.get(f'{endpoint}/emotion-anew',\n", - " params={\"input\": \"Senpy is a wonderful service and I love it\",\n", - " \"emotion-model\": \"emoml:big6\",\n", - " \"conversion\": \"nested\"})\n", - "pretty(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Again, for completion, we could get only the label with the `fields` parameter:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
[["Senpy is a wonderful service and I love it", "emoml:big6fear"]]\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{[}\\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}Senpy is a wonderful service and I love it\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}emoml:big6fear\\PYZdq{}}\\PY{p}{]}\\PY{p}{]}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "[[\"Senpy is a wonderful service and I love it\", \"emoml:big6fear\"]]" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res = requests.get(f'{endpoint}/emotion-anew',\n", - " params={\"input\": \"Senpy is a wonderful service and I love it\",\n", - " \"emotion-model\": \"emoml:big6\",\n", - " \"fields\": 'entries[].[[\"nif:isString\",\"onyx:hasEmotionSet\"[].\"onyx:hasEmotion\"[].\"onyx:hasEmotionCategory\"][]][]',\n", - " \"conversion\": \"filtered\"})\n", - "pretty(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Built-in client" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The built-in senpy client allows you to query any Senpy endpoint. We will illustrate how to use it with the public demo endpoint, and then show you how to spin up your own endpoint using docker." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Building pipelines" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "You can query several senpy services in the same request.\n", - "This feature is called pipelining, and the result of combining several plugins in a request is called a pipeline.\n", - "\n", - "The simplest way to use pipelines is to add every plugin you want to use to the URL, separated by either a slash or a comma.\n", - "\n", - "For instance, to get sentiment (`sentiment140`) and emotion (`depechemood`) annotations at the same time:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
{\n",
-       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MC9lbW90aW9uLWRlcGVjaGVtb29kP2lucHV0PVNlbnB5K2lzK2Erd29uZGVyZnVsK3NlcnZpY2Uj",\n",
-       "  "@type": "Results",\n",
-       "  "entries": [\n",
-       "    {\n",
-       "      "@id": "prefix:",\n",
-       "      "@type": "Entry",\n",
-       "      "marl:hasOpinion": [\n",
-       "        {\n",
-       "          "@type": "Sentiment",\n",
-       "          "marl:hasPolarity": "marl:Neutral",\n",
-       "          "prov:wasGeneratedBy": "prefix:Analysis_1554364675.8928602"\n",
-       "        }\n",
-       "      ],\n",
-       "      "nif:isString": "Senpy is a wonderful service",\n",
-       "      "onyx:hasEmotionSet": [\n",
-       "        {\n",
-       "          "@type": "EmotionSet",\n",
-       "          "onyx:hasEmotion": [\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:negative-fear",\n",
-       "              "onyx:hasEmotionIntensity": 0.06258366271018097\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:amusement",\n",
-       "              "onyx:hasEmotionIntensity": 0.15784834034155437\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:anger",\n",
-       "              "onyx:hasEmotionIntensity": 0.08728815135373413\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:annoyance",\n",
-       "              "onyx:hasEmotionIntensity": 0.12184635680460143\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:indifference",\n",
-       "              "onyx:hasEmotionIntensity": 0.1374081151031531\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:joy",\n",
-       "              "onyx:hasEmotionIntensity": 0.12267040802346799\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:awe",\n",
-       "              "onyx:hasEmotionIntensity": 0.21085262130713067\n",
-       "            },\n",
-       "            {\n",
-       "              "@type": "Emotion",\n",
-       "              "onyx:hasEmotionCategory": "wna:sadness",\n",
-       "              "onyx:hasEmotionIntensity": 0.09950234435617733\n",
-       "            }\n",
-       "          ],\n",
-       "          "prov:wasGeneratedBy": "prefix:Analysis_1554364675.8937423"\n",
-       "        }\n",
-       "      ]\n",
-       "    }\n",
-       "  ]\n",
-       "}\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MC9lbW90aW9uLWRlcGVjaGVtb29kP2lucHV0PVNlbnB5K2lzK2Erd29uZGVyZnVsK3NlcnZpY2Uj\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Neutral\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364675.8928602\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is a wonderful service\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:negative\\PYZhy{}fear\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.06258366271018097}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:amusement\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.15784834034155437}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:anger\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.08728815135373413}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:annoyance\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.12184635680460143}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:indifference\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.1374081151031531}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:joy\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.12267040802346799}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:awe\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.21085262130713067}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionCategory\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}wna:sadness\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionIntensity\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.09950234435617733}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364675.8937423\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - "\\PY{p}{\\PYZcb{}}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "{\n", - " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MC9lbW90aW9uLWRlcGVjaGVtb29kP2lucHV0PVNlbnB5K2lzK2Erd29uZGVyZnVsK3NlcnZpY2Uj\",\n", - " \"@type\": \"Results\",\n", - " \"entries\": [\n", - " {\n", - " \"@id\": \"prefix:\",\n", - " \"@type\": \"Entry\",\n", - " \"marl:hasOpinion\": [\n", - " {\n", - " \"@type\": \"Sentiment\",\n", - " \"marl:hasPolarity\": \"marl:Neutral\",\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364675.8928602\"\n", - " }\n", - " ],\n", - " \"nif:isString\": \"Senpy is a wonderful service\",\n", - " \"onyx:hasEmotionSet\": [\n", - " {\n", - " \"@type\": \"EmotionSet\",\n", - " \"onyx:hasEmotion\": [\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:negative-fear\",\n", - " \"onyx:hasEmotionIntensity\": 0.06258366271018097\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:amusement\",\n", - " \"onyx:hasEmotionIntensity\": 0.15784834034155437\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:anger\",\n", - " \"onyx:hasEmotionIntensity\": 0.08728815135373413\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:annoyance\",\n", - " \"onyx:hasEmotionIntensity\": 0.12184635680460143\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:indifference\",\n", - " \"onyx:hasEmotionIntensity\": 0.1374081151031531\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:joy\",\n", - " \"onyx:hasEmotionIntensity\": 0.12267040802346799\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:awe\",\n", - " \"onyx:hasEmotionIntensity\": 0.21085262130713067\n", - " },\n", - " {\n", - " \"@type\": \"Emotion\",\n", - " \"onyx:hasEmotionCategory\": \"wna:sadness\",\n", - " \"onyx:hasEmotionIntensity\": 0.09950234435617733\n", - " }\n", - " ],\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364675.8937423\"\n", - " }\n", - " ]\n", - " }\n", - " ]\n", - "}" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res = requests.get(f'{endpoint}/sentiment140/emotion-depechemood',\n", - " params={\"input\": \"Senpy is a wonderful service\"})\n", - "pretty(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "In a senpy pipeline, the call is processed by each plugin in sequence.\n", - "The output of a plugin is used as input for the next one.\n", - "\n", - "Pipelines take the same parameters as the plugins they are made of.\n", - "For example, if we want to split the original sentence before analysing its sentiment, we can use a pipeline made out of the `split` and the `sentiment140` plugins.\n", - "\n", - "`split` takes an extra parameter (`delimiter`) to select the type of splitting (by sentence or by paragraph), and `sentiment140` takes a `language` parameter.\n", - "\n", - "This is how the request looks like:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
{\n",
-       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NwbGl0L3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lLitBbmQrc2VydmljZXMrYXJlK2NvbXBvc2FibGUuJmRlbGltaXRlcj1zZW50ZW5jZSZsYW5ndWFnZT1lbiZvdXRmb3JtYXQ9anNvbi1sZCM%3D",\n",
-       "  "@type": "Results",\n",
-       "  "entries": [\n",
-       "    {\n",
-       "      "@id": "prefix:",\n",
-       "      "@type": "Entry",\n",
-       "      "marl:hasOpinion": [\n",
-       "        {\n",
-       "          "@type": "Sentiment",\n",
-       "          "marl:hasPolarity": "marl:Positive",\n",
-       "          "prov:wasGeneratedBy": "prefix:Analysis_1554364676.2060485"\n",
-       "        }\n",
-       "      ],\n",
-       "      "nif:isString": "Senpy is awesome. And services are composable.",\n",
-       "      "onyx:hasEmotionSet": []\n",
-       "    },\n",
-       "    {\n",
-       "      "@id": "prefix:#char=0,17",\n",
-       "      "@type": "Entry",\n",
-       "      "marl:hasOpinion": [\n",
-       "        {\n",
-       "          "@type": "Sentiment",\n",
-       "          "marl:hasPolarity": "marl:Positive",\n",
-       "          "prov:wasGeneratedBy": "prefix:Analysis_1554364676.2060485"\n",
-       "        }\n",
-       "      ],\n",
-       "      "nif:isString": "Senpy is awesome.",\n",
-       "      "onyx:hasEmotionSet": []\n",
-       "    },\n",
-       "    {\n",
-       "      "@id": "prefix:#char=18,46",\n",
-       "      "@type": "Entry",\n",
-       "      "marl:hasOpinion": [\n",
-       "        {\n",
-       "          "@type": "Sentiment",\n",
-       "          "marl:hasPolarity": "marl:Neutral",\n",
-       "          "prov:wasGeneratedBy": "prefix:Analysis_1554364676.2060485"\n",
-       "        }\n",
-       "      ],\n",
-       "      "nif:isString": "And services are composable.",\n",
-       "      "onyx:hasEmotionSet": []\n",
-       "    }\n",
-       "  ]\n",
-       "}\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3NwbGl0L3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lLitBbmQrc2VydmljZXMrYXJlK2NvbXBvc2FibGUuJmRlbGltaXRlcj1zZW50ZW5jZSZsYW5ndWFnZT1lbiZvdXRmb3JtYXQ9anNvbi1sZCM\\PYZpc{}3D\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364676.2060485\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is awesome. And services are composable.\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZsh{}char=0,17\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364676.2060485\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is awesome.\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZsh{}char=18,46\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Neutral\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364676.2060485\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}And services are composable.\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - "\\PY{p}{\\PYZcb{}}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "{\n", - " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NwbGl0L3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lLitBbmQrc2VydmljZXMrYXJlK2NvbXBvc2FibGUuJmRlbGltaXRlcj1zZW50ZW5jZSZsYW5ndWFnZT1lbiZvdXRmb3JtYXQ9anNvbi1sZCM%3D\",\n", - " \"@type\": \"Results\",\n", - " \"entries\": [\n", - " {\n", - " \"@id\": \"prefix:\",\n", - " \"@type\": \"Entry\",\n", - " \"marl:hasOpinion\": [\n", - " {\n", - " \"@type\": \"Sentiment\",\n", - " \"marl:hasPolarity\": \"marl:Positive\",\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364676.2060485\"\n", - " }\n", - " ],\n", - " \"nif:isString\": \"Senpy is awesome. And services are composable.\",\n", - " \"onyx:hasEmotionSet\": []\n", - " },\n", - " {\n", - " \"@id\": \"prefix:#char=0,17\",\n", - " \"@type\": \"Entry\",\n", - " \"marl:hasOpinion\": [\n", - " {\n", - " \"@type\": \"Sentiment\",\n", - " \"marl:hasPolarity\": \"marl:Positive\",\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364676.2060485\"\n", - " }\n", - " ],\n", - " \"nif:isString\": \"Senpy is awesome.\",\n", - " \"onyx:hasEmotionSet\": []\n", - " },\n", - " {\n", - " \"@id\": \"prefix:#char=18,46\",\n", - " \"@type\": \"Entry\",\n", - " \"marl:hasOpinion\": [\n", - " {\n", - " \"@type\": \"Sentiment\",\n", - " \"marl:hasPolarity\": \"marl:Neutral\",\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364676.2060485\"\n", - " }\n", - " ],\n", - " \"nif:isString\": \"And services are composable.\",\n", - " \"onyx:hasEmotionSet\": []\n", - " }\n", - " ]\n", - "}" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res = requests.get(f'{endpoint}/split/sentiment140',\n", - " params={\"input\": \"Senpy is awesome. And services are composable.\", \n", - " \"delimiter\": \"sentence\",\n", - " \"language\": \"en\",\n", - " \"outformat\": \"json-ld\"})\n", - "pretty(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "As you can see, `split` creates two new entries, which are also annotated by `sentiment140`." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Once again, we could use the `fields` parameter to get a list of strings and labels:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
[["Senpy is awesome. And services are composable.", "marl:Positive"], ["Senpy is awesome.", "marl:Positive"], ["And services are composable.", "marl:Neutral"]]\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{[}\\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}Senpy is awesome. And services are composable.\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\\PY{p}{]}\\PY{p}{,} \\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}Senpy is awesome.\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\\PY{p}{]}\\PY{p}{,} \\PY{p}{[}\\PY{l+s+s2}{\\PYZdq{}And services are composable.\\PYZdq{}}\\PY{p}{,} \\PY{l+s+s2}{\\PYZdq{}marl:Neutral\\PYZdq{}}\\PY{p}{]}\\PY{p}{]}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "[[\"Senpy is awesome. And services are composable.\", \"marl:Positive\"], [\"Senpy is awesome.\", \"marl:Positive\"], [\"And services are composable.\", \"marl:Neutral\"]]" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res = requests.get(f'{endpoint}/split/sentiment140',\n", - " params={\"input\": \"Senpy is awesome. And services are composable.\", \n", - " \"delimiter\": \"sentence\",\n", - " \"fields\": 'entries[].[[\"nif:isString\",\"marl:hasOpinion\"[].\"marl:hasPolarity\"][]][]',\n", - " \"language\": \"en\",\n", - " \"outformat\": \"json-ld\"})\n", - "pretty(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Evaluation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Sentiment analysis plugins can also be evaluated on a series of pre-defined datasets, using the `gsitk` tool.\n", - "\n", - "For instance, to evaluate the `sentiment-vader` plugin on the `vader` and `sts` datasets, we would simply call:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
{\n",
-       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2V2YWx1YXRlLz9hbGdvPXNlbnRpbWVudC12YWRlciZkYXRhc2V0PXZhZGVyJTJDc3RzJm91dGZvcm1hdD1qc29uLWxkIw%3D%3D",\n",
-       "  "@type": "AggregatedEvaluation",\n",
-       "  "senpy:evaluations": [\n",
-       "    {\n",
-       "      "@type": "Evaluation",\n",
-       "      "evaluates": "endpoint:plugins/sentiment-vader_0.1.1__vader",\n",
-       "      "evaluatesOn": "vader",\n",
-       "      "metrics": [\n",
-       "        {\n",
-       "          "@type": "Accuracy",\n",
-       "          "value": 0.6907142857142857\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Precision_macro",\n",
-       "          "value": 0.34535714285714286\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Recall_macro",\n",
-       "          "value": 0.5\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "F1_macro",\n",
-       "          "value": 0.40853400929446554\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "F1_weighted",\n",
-       "          "value": 0.5643605528396403\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "F1_micro",\n",
-       "          "value": 0.6907142857142857\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "F1_macro",\n",
-       "          "value": 0.40853400929446554\n",
-       "        }\n",
-       "      ]\n",
-       "    },\n",
-       "    {\n",
-       "      "@type": "Evaluation",\n",
-       "      "evaluates": "endpoint:plugins/sentiment-vader_0.1.1__sts",\n",
-       "      "evaluatesOn": "sts",\n",
-       "      "metrics": [\n",
-       "        {\n",
-       "          "@type": "Accuracy",\n",
-       "          "value": 0.3107177974434612\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Precision_macro",\n",
-       "          "value": 0.1553588987217306\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Recall_macro",\n",
-       "          "value": 0.5\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "F1_macro",\n",
-       "          "value": 0.23705926481620407\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "F1_weighted",\n",
-       "          "value": 0.14731706525451424\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "F1_micro",\n",
-       "          "value": 0.3107177974434612\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "F1_macro",\n",
-       "          "value": 0.23705926481620407\n",
-       "        }\n",
-       "      ]\n",
-       "    }\n",
-       "  ]\n",
-       "}\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL2V2YWx1YXRlLz9hbGdvPXNlbnRpbWVudC12YWRlciZkYXRhc2V0PXZhZGVyJTJDc3RzJm91dGZvcm1hdD1qc29uLWxkIw\\PYZpc{}3D\\PYZpc{}3D\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}AggregatedEvaluation\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}senpy:evaluations\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Evaluation\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}evaluates\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment\\PYZhy{}vader\\PYZus{}0.1.1\\PYZus{}\\PYZus{}vader\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}evaluatesOn\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}vader\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}metrics\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Accuracy\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.6907142857142857}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Precision\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.34535714285714286}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Recall\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.5}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.40853400929446554}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}weighted\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.5643605528396403}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}micro\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.6907142857142857}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.40853400929446554}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Evaluation\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}evaluates\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment\\PYZhy{}vader\\PYZus{}0.1.1\\PYZus{}\\PYZus{}sts\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}evaluatesOn\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}sts\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}metrics\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Accuracy\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.3107177974434612}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Precision\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.1553588987217306}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Recall\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.5}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.23705926481620407}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}weighted\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.14731706525451424}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}micro\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.3107177974434612}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}F1\\PYZus{}macro\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{0.23705926481620407}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - "\\PY{p}{\\PYZcb{}}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "{\n", - " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL2V2YWx1YXRlLz9hbGdvPXNlbnRpbWVudC12YWRlciZkYXRhc2V0PXZhZGVyJTJDc3RzJm91dGZvcm1hdD1qc29uLWxkIw%3D%3D\",\n", - " \"@type\": \"AggregatedEvaluation\",\n", - " \"senpy:evaluations\": [\n", - " {\n", - " \"@type\": \"Evaluation\",\n", - " \"evaluates\": \"endpoint:plugins/sentiment-vader_0.1.1__vader\",\n", - " \"evaluatesOn\": \"vader\",\n", - " \"metrics\": [\n", - " {\n", - " \"@type\": \"Accuracy\",\n", - " \"value\": 0.6907142857142857\n", - " },\n", - " {\n", - " \"@type\": \"Precision_macro\",\n", - " \"value\": 0.34535714285714286\n", - " },\n", - " {\n", - " \"@type\": \"Recall_macro\",\n", - " \"value\": 0.5\n", - " },\n", - " {\n", - " \"@type\": \"F1_macro\",\n", - " \"value\": 0.40853400929446554\n", - " },\n", - " {\n", - " \"@type\": \"F1_weighted\",\n", - " \"value\": 0.5643605528396403\n", - " },\n", - " {\n", - " \"@type\": \"F1_micro\",\n", - " \"value\": 0.6907142857142857\n", - " },\n", - " {\n", - " \"@type\": \"F1_macro\",\n", - " \"value\": 0.40853400929446554\n", - " }\n", - " ]\n", - " },\n", - " {\n", - " \"@type\": \"Evaluation\",\n", - " \"evaluates\": \"endpoint:plugins/sentiment-vader_0.1.1__sts\",\n", - " \"evaluatesOn\": \"sts\",\n", - " \"metrics\": [\n", - " {\n", - " \"@type\": \"Accuracy\",\n", - " \"value\": 0.3107177974434612\n", - " },\n", - " {\n", - " \"@type\": \"Precision_macro\",\n", - " \"value\": 0.1553588987217306\n", - " },\n", - " {\n", - " \"@type\": \"Recall_macro\",\n", - " \"value\": 0.5\n", - " },\n", - " {\n", - " \"@type\": \"F1_macro\",\n", - " \"value\": 0.23705926481620407\n", - " },\n", - " {\n", - " \"@type\": \"F1_weighted\",\n", - " \"value\": 0.14731706525451424\n", - " },\n", - " {\n", - " \"@type\": \"F1_micro\",\n", - " \"value\": 0.3107177974434612\n", - " },\n", - " {\n", - " \"@type\": \"F1_macro\",\n", - " \"value\": 0.23705926481620407\n", - " }\n", - " ]\n", - " }\n", - " ]\n", - "}" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "res = requests.get(f'{endpoint}/evaluate',\n", - " params={\"algo\": \"sentiment-vader\",\n", - " \"dataset\": \"vader,sts\",\n", - " 'outformat': 'json-ld'\n", - " })\n", - "pretty(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The same results can be visualized as a table in the Web interface:\n", - "\n", - "![](evaluation-results.png)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "**note**: to evaluate a plugin on a dataset, senpy will need to predict the labels of the entries using the plugin.\n", - "This process might take long for plugins that use an external service, such as `sentiment140`." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Advanced topics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Verbose output" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "By default, senpy does not include information that might be too verbose, such as the parameters that were used in the analysis.\n", - "\n", - "You can instruct senpy to provide a more verbose output with the `verbose` parameter:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
{\n",
-       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcyt0aGUrYmVzdCtmcmFtZXdvcmsrZm9yK3NlbWFudGljK3NlbnRpbWVudCthbmFseXNpcyUyQythbmQrdmVyeStlYXN5K3RvK3VzZSZ2ZXJib3NlPVRydWUj",\n",
-       "  "@type": "Results",\n",
-       "  "activities": [\n",
-       "    {\n",
-       "      "@id": "prefix:Analysis_1554364688.7944896",\n",
-       "      "@type": "Analysis",\n",
-       "      "marl:maxPolarityValue": 1,\n",
-       "      "marl:minPolarityValue": 0,\n",
-       "      "prov:used": [\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "input",\n",
-       "          "value": "Senpy is the best framework for semantic sentiment analysis, and very easy to use"\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "verbose",\n",
-       "          "value": true\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "in-headers",\n",
-       "          "value": false\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "algorithm",\n",
-       "          "value": "default"\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "expanded-jsonld",\n",
-       "          "value": false\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "with-parameters",\n",
-       "          "value": false\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "outformat",\n",
-       "          "value": "json-ld"\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "help",\n",
-       "          "value": false\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "aliases",\n",
-       "          "value": false\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "conversion",\n",
-       "          "value": "full"\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "intype",\n",
-       "          "value": "direct"\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "informat",\n",
-       "          "value": "text"\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "prefix",\n",
-       "          "value": ""\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "urischeme",\n",
-       "          "value": "RFC5147String"\n",
-       "        },\n",
-       "        {\n",
-       "          "@type": "Parameter",\n",
-       "          "name": "language",\n",
-       "          "value": "auto"\n",
-       "        }\n",
-       "      ],\n",
-       "      "prov:wasAssociatedWith": "endpoint:plugins/sentiment140_0.2"\n",
-       "    }\n",
-       "  ],\n",
-       "  "entries": [\n",
-       "    {\n",
-       "      "@id": "prefix:",\n",
-       "      "@type": "Entry",\n",
-       "      "marl:hasOpinion": [\n",
-       "        {\n",
-       "          "@type": "Sentiment",\n",
-       "          "marl:hasPolarity": "marl:Positive",\n",
-       "          "prov:wasGeneratedBy": "prefix:Analysis_1554364688.7944896"\n",
-       "        }\n",
-       "      ],\n",
-       "      "nif:isString": "Senpy is the best framework for semantic sentiment analysis, and very easy to use",\n",
-       "      "onyx:hasEmotionSet": []\n",
-       "    }\n",
-       "  ]\n",
-       "}\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcyt0aGUrYmVzdCtmcmFtZXdvcmsrZm9yK3NlbWFudGljK3NlbnRpbWVudCthbmFseXNpcyUyQythbmQrdmVyeStlYXN5K3RvK3VzZSZ2ZXJib3NlPVRydWUj\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}activities\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364688.7944896\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Analysis\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:maxPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{1}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:minPolarityValue\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mi}{0}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:used\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}input\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is the best framework for semantic sentiment analysis, and very easy to use\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}verbose\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}in\\PYZhy{}headers\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}algorithm\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}default\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}expanded\\PYZhy{}jsonld\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}with\\PYZhy{}parameters\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}outformat\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}json\\PYZhy{}ld\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}help\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}conversion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}full\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}intype\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}direct\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}informat\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}text\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}urischeme\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}RFC5147String\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Parameter\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}name\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}value\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}auto\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasAssociatedWith\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}endpoint:plugins/sentiment140\\PYZus{}0.2\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Sentiment\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasPolarity\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}marl:Positive\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364688.7944896\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Senpy is the best framework for semantic sentiment analysis, and very easy to use\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - "\\PY{p}{\\PYZcb{}}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "{\n", - " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcyt0aGUrYmVzdCtmcmFtZXdvcmsrZm9yK3NlbWFudGljK3NlbnRpbWVudCthbmFseXNpcyUyQythbmQrdmVyeStlYXN5K3RvK3VzZSZ2ZXJib3NlPVRydWUj\",\n", - " \"@type\": \"Results\",\n", - " \"activities\": [\n", - " {\n", - " \"@id\": \"prefix:Analysis_1554364688.7944896\",\n", - " \"@type\": \"Analysis\",\n", - " \"marl:maxPolarityValue\": 1,\n", - " \"marl:minPolarityValue\": 0,\n", - " \"prov:used\": [\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"input\",\n", - " \"value\": \"Senpy is the best framework for semantic sentiment analysis, and very easy to use\"\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"verbose\",\n", - " \"value\": true\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"in-headers\",\n", - " \"value\": false\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"algorithm\",\n", - " \"value\": \"default\"\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"expanded-jsonld\",\n", - " \"value\": false\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"with-parameters\",\n", - " \"value\": false\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"outformat\",\n", - " \"value\": \"json-ld\"\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"help\",\n", - " \"value\": false\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"aliases\",\n", - " \"value\": false\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"conversion\",\n", - " \"value\": \"full\"\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"intype\",\n", - " \"value\": \"direct\"\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"informat\",\n", - " \"value\": \"text\"\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"prefix\",\n", - " \"value\": \"\"\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"urischeme\",\n", - " \"value\": \"RFC5147String\"\n", - " },\n", - " {\n", - " \"@type\": \"Parameter\",\n", - " \"name\": \"language\",\n", - " \"value\": \"auto\"\n", - " }\n", - " ],\n", - " \"prov:wasAssociatedWith\": \"endpoint:plugins/sentiment140_0.2\"\n", - " }\n", - " ],\n", - " \"entries\": [\n", - " {\n", - " \"@id\": \"prefix:\",\n", - " \"@type\": \"Entry\",\n", - " \"marl:hasOpinion\": [\n", - " {\n", - " \"@type\": \"Sentiment\",\n", - " \"marl:hasPolarity\": \"marl:Positive\",\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364688.7944896\"\n", - " }\n", - " ],\n", - " \"nif:isString\": \"Senpy is the best framework for semantic sentiment analysis, and very easy to use\",\n", - " \"onyx:hasEmotionSet\": []\n", - " }\n", - " ]\n", - "}" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "import requests\n", - "res = requests.get(f'{endpoint}/sentiment140',\n", - " params={\n", - " \"input\": \"Senpy is the best framework for semantic sentiment analysis, and very easy to use\",\n", - " \"verbose\": True}).text\n", - "pretty(res)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Getting help" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
{\n",
-       "  "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpLz9oZWxwPVRydWUj",\n",
-       "  "@type": "Help",\n",
-       "  "valid_parameters": {\n",
-       "    "algorithm": {\n",
-       "      "aliases": [\n",
-       "        "algorithms",\n",
-       "        "a",\n",
-       "        "algo"\n",
-       "      ],\n",
-       "      "default": "default",\n",
-       "      "description": "Algorithms that will be used to process the request.It may be a list of comma-separated names.",\n",
-       "      "processor": "string_to_tuple",\n",
-       "      "required": true\n",
-       "    },\n",
-       "    "aliases": {\n",
-       "      "@id": "aliases",\n",
-       "      "aliases": [],\n",
-       "      "default": false,\n",
-       "      "description": "Replace JSON properties with their aliases",\n",
-       "      "options": [\n",
-       "        true,\n",
-       "        false\n",
-       "      ],\n",
-       "      "required": true\n",
-       "    },\n",
-       "    "conversion": {\n",
-       "      "@id": "conversion",\n",
-       "      "default": "full",\n",
-       "      "description": "How to show the elements that have (not) been converted.\\n\\n* full: converted and original elements will appear side-by-side\\n* filtered: only converted elements will be shown\\n* nested: converted elements will be shown, and they will include a link to the original element\\n(using `prov:wasGeneratedBy`).\\n",\n",
-       "      "options": [\n",
-       "        "filtered",\n",
-       "        "nested",\n",
-       "        "full"\n",
-       "      ],\n",
-       "      "required": true\n",
-       "    },\n",
-       "    "emotion-model": {\n",
-       "      "@id": "emotionModel",\n",
-       "      "aliases": [\n",
-       "        "emoModel",\n",
-       "        "emotionModel"\n",
-       "      ],\n",
-       "      "description": "Emotion model to use in the response.\\nSenpy will try to convert the output to this model automatically.\\n\\nExamples: `wna:liking` and `emoml:big6`.\\n        ",\n",
-       "      "required": false\n",
-       "    },\n",
-       "    "expanded-jsonld": {\n",
-       "      "@id": "expanded-jsonld",\n",
-       "      "aliases": [\n",
-       "        "expanded",\n",
-       "        "expanded_jsonld"\n",
-       "      ],\n",
-       "      "default": false,\n",
-       "      "description": "use JSON-LD expansion to get full URIs",\n",
-       "      "options": [\n",
-       "        true,\n",
-       "        false\n",
-       "      ],\n",
-       "      "required": true\n",
-       "    },\n",
-       "    "fields": {\n",
-       "      "@id": "fields",\n",
-       "      "description": "A jmespath selector, that can be used to extract a new dictionary, array or value\\nfrom the results.\\njmespath is a powerful query language for json and/or dictionaries.\\nIt allows you to change the structure (and data) of your objects through queries.\\n\\ne.g., the following expression gets a list of `[emotion label, intensity]` for each entry:\\n`entries[].\\"onyx:hasEmotionSet\\"[].\\"onyx:hasEmotion\\"[][\\"onyx:hasEmotionCategory\\",\\"onyx:hasEmotionIntensity\\"]`\\n\\nFor more information, see: https://jmespath.org\\n\\n",\n",
-       "      "required": false\n",
-       "    },\n",
-       "    "help": {\n",
-       "      "@id": "help",\n",
-       "      "aliases": [\n",
-       "        "h"\n",
-       "      ],\n",
-       "      "default": false,\n",
-       "      "description": "Show additional help to know more about the possible parameters",\n",
-       "      "options": [\n",
-       "        true,\n",
-       "        false\n",
-       "      ],\n",
-       "      "required": true\n",
-       "    },\n",
-       "    "in-headers": {\n",
-       "      "aliases": [\n",
-       "        "headers",\n",
-       "        "inheaders",\n",
-       "        "inHeaders",\n",
-       "        "in-headers",\n",
-       "        "in_headers"\n",
-       "      ],\n",
-       "      "default": false,\n",
-       "      "description": "Only include the JSON-LD context in the headers",\n",
-       "      "options": [\n",
-       "        true,\n",
-       "        false\n",
-       "      ],\n",
-       "      "required": true\n",
-       "    },\n",
-       "    "informat": {\n",
-       "      "@id": "informat",\n",
-       "      "aliases": [\n",
-       "        "f"\n",
-       "      ],\n",
-       "      "default": "text",\n",
-       "      "description": "input format",\n",
-       "      "options": [\n",
-       "        "text",\n",
-       "        "json-ld"\n",
-       "      ],\n",
-       "      "required": false\n",
-       "    },\n",
-       "    "input": {\n",
-       "      "@id": "input",\n",
-       "      "aliases": [\n",
-       "        "i"\n",
-       "      ],\n",
-       "      "help": "Input text",\n",
-       "      "required": true\n",
-       "    },\n",
-       "    "intype": {\n",
-       "      "@id": "intype",\n",
-       "      "aliases": [\n",
-       "        "t"\n",
-       "      ],\n",
-       "      "default": "direct",\n",
-       "      "description": "input type",\n",
-       "      "options": [\n",
-       "        "direct",\n",
-       "        "url",\n",
-       "        "file"\n",
-       "      ],\n",
-       "      "required": false\n",
-       "    },\n",
-       "    "language": {\n",
-       "      "aliases": [\n",
-       "        "language",\n",
-       "        "l"\n",
-       "      ],\n",
-       "      "default": "en",\n",
-       "      "description": "language of the input",\n",
-       "      "options": [\n",
-       "        "es",\n",
-       "        "en"\n",
-       "      ],\n",
-       "      "required": true\n",
-       "    },\n",
-       "    "outformat": {\n",
-       "      "@id": "outformat",\n",
-       "      "aliases": [\n",
-       "        "o"\n",
-       "      ],\n",
-       "      "default": "json-ld",\n",
-       "      "description": "The data can be semantically formatted (JSON-LD, turtle or n-triples),\\ngiven as a list of comma-separated fields (see the fields option) or constructed from a Jinja2\\ntemplate (see the template option).",\n",
-       "      "options": [\n",
-       "        "json-ld",\n",
-       "        "turtle",\n",
-       "        "ntriples"\n",
-       "      ],\n",
-       "      "required": true\n",
-       "    },\n",
-       "    "prefix": {\n",
-       "      "@id": "prefix",\n",
-       "      "aliases": [\n",
-       "        "p"\n",
-       "      ],\n",
-       "      "default": "",\n",
-       "      "description": "prefix to use for new entities",\n",
-       "      "required": true\n",
-       "    },\n",
-       "    "template": {\n",
-       "      "@id": "template",\n",
-       "      "description": "Jinja2 template for the result. The input data for the template will\\nbe the results as a dictionary.\\nFor example:\\n\\nConsider the results before templating:\\n\\n```\\n[{\\n    \\"@type\\": \\"entry\\",\\n    \\"onyx:hasEmotionSet\\": [],\\n    \\"nif:isString\\": \\"testing the template\\",\\n    \\"marl:hasOpinion\\": [\\n        {\\n            \\"@type\\": \\"sentiment\\",\\n            \\"marl:hasPolarity\\": \\"marl:Positive\\"\\n        }\\n    ]\\n}]\\n```\\n\\n\\nAnd the template:\\n\\n```\\n{% for entry in entries %}\\n{{ entry[\\"nif:isString\\"] | upper }},{{entry.sentiments[0][\\"marl:hasPolarity\\"].split(\\":\\")[1]}}\\n{% endfor %}\\n```\\n\\nThe final result would be:\\n\\n```\\nTESTING THE TEMPLATE,Positive\\n```\\n",\n",
-       "      "required": false\n",
-       "    },\n",
-       "    "urischeme": {\n",
-       "      "@id": "urischeme",\n",
-       "      "aliases": [\n",
-       "        "u"\n",
-       "      ],\n",
-       "      "default": "RFC5147String",\n",
-       "      "description": "scheme for NIF URIs",\n",
-       "      "options": [\n",
-       "        "RFC5147String"\n",
-       "      ],\n",
-       "      "required": false\n",
-       "    },\n",
-       "    "verbose": {\n",
-       "      "@id": "verbose",\n",
-       "      "aliases": [\n",
-       "        "v"\n",
-       "      ],\n",
-       "      "default": false,\n",
-       "      "description": "Show all properties in the result",\n",
-       "      "options": [\n",
-       "        true,\n",
-       "        false\n",
-       "      ],\n",
-       "      "required": true\n",
-       "    },\n",
-       "    "with-parameters": {\n",
-       "      "aliases": [\n",
-       "        "withparameters",\n",
-       "        "with_parameters"\n",
-       "      ],\n",
-       "      "default": false,\n",
-       "      "description": "include initial parameters in the response",\n",
-       "      "options": [\n",
-       "        true,\n",
-       "        false\n",
-       "      ],\n",
-       "      "required": true\n",
-       "    }\n",
-       "  }\n",
-       "}\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@context\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}http://senpy.gsi.upm.es/api/contexts/YXBpLz9oZWxwPVRydWUj\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Help\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}valid\\PYZus{}parameters\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nt}{\\PYZdq{}algorithm\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}algorithms\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}a\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}algo\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Algorithms that will be used to process the request.It may be a list of comma\\PYZhy{}separated names.\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}processor\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}string\\PYZus{}to\\PYZus{}tuple\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Replace JSON properties with their aliases\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{k+kc}{true}\\PY{p}{,}\n", - " \\PY{k+kc}{false}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}conversion\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}conversion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}full\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}How to show the elements that have (not) been converted.\\PYZbs{}n\\PYZbs{}n* full: converted and original elements will appear side\\PYZhy{}by\\PYZhy{}side\\PYZbs{}n* filtered: only converted elements will be shown\\PYZbs{}n* nested: converted elements will be shown, and they will include a link to the original element\\PYZbs{}n(using `prov:wasGeneratedBy`).\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}filtered\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}nested\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}full\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}emotion\\PYZhy{}model\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}emotionModel\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}emoModel\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}emotionModel\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion model to use in the response.\\PYZbs{}nSenpy will try to convert the output to this model automatically.\\PYZbs{}n\\PYZbs{}nExamples: `wna:liking` and `emoml:big6`.\\PYZbs{}n \\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}expanded\\PYZhy{}jsonld\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}expanded\\PYZhy{}jsonld\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}expanded\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}expanded\\PYZus{}jsonld\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}use JSON\\PYZhy{}LD expansion to get full URIs\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{k+kc}{true}\\PY{p}{,}\n", - " \\PY{k+kc}{false}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}fields\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}fields\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}A jmespath selector, that can be used to extract a new dictionary, array or value\\PYZbs{}nfrom the results.\\PYZbs{}njmespath is a powerful query language for json and/or dictionaries.\\PYZbs{}nIt allows you to change the structure (and data) of your objects through queries.\\PYZbs{}n\\PYZbs{}ne.g., the following expression gets a list of `[emotion label, intensity]` for each entry:\\PYZbs{}n`entries[].\\PYZbs{}\\PYZdq{}onyx:hasEmotionSet\\PYZbs{}\\PYZdq{}[].\\PYZbs{}\\PYZdq{}onyx:hasEmotion\\PYZbs{}\\PYZdq{}[][\\PYZbs{}\\PYZdq{}onyx:hasEmotionCategory\\PYZbs{}\\PYZdq{},\\PYZbs{}\\PYZdq{}onyx:hasEmotionIntensity\\PYZbs{}\\PYZdq{}]`\\PYZbs{}n\\PYZbs{}nFor more information, see: https://jmespath.org\\PYZbs{}n\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}help\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}help\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}h\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Show additional help to know more about the possible parameters\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{k+kc}{true}\\PY{p}{,}\n", - " \\PY{k+kc}{false}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}in\\PYZhy{}headers\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}headers\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}inheaders\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}inHeaders\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}in\\PYZhy{}headers\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}in\\PYZus{}headers\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Only include the JSON\\PYZhy{}LD context in the headers\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{k+kc}{true}\\PY{p}{,}\n", - " \\PY{k+kc}{false}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}informat\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}informat\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}f\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}text\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}input format\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}text\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}json\\PYZhy{}ld\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}input\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}input\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}i\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}help\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Input text\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}intype\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}intype\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}t\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}direct\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}input type\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}direct\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}url\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}file\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}language\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}l\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}language of the input\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}es\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}en\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}outformat\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}outformat\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}o\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}json\\PYZhy{}ld\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}The data can be semantically formatted (JSON\\PYZhy{}LD, turtle or n\\PYZhy{}triples),\\PYZbs{}ngiven as a list of comma\\PYZhy{}separated fields (see the fields option) or constructed from a Jinja2\\PYZbs{}ntemplate (see the template option).\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}json\\PYZhy{}ld\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}turtle\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}ntriples\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prefix\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}p\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix to use for new entities\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}template\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}template\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Jinja2 template for the result. The input data for the template will\\PYZbs{}nbe the results as a dictionary.\\PYZbs{}nFor example:\\PYZbs{}n\\PYZbs{}nConsider the results before templating:\\PYZbs{}n\\PYZbs{}n```\\PYZbs{}n[\\PYZob{}\\PYZbs{}n \\PYZbs{}\\PYZdq{}@type\\PYZbs{}\\PYZdq{}: \\PYZbs{}\\PYZdq{}entry\\PYZbs{}\\PYZdq{},\\PYZbs{}n \\PYZbs{}\\PYZdq{}onyx:hasEmotionSet\\PYZbs{}\\PYZdq{}: [],\\PYZbs{}n \\PYZbs{}\\PYZdq{}nif:isString\\PYZbs{}\\PYZdq{}: \\PYZbs{}\\PYZdq{}testing the template\\PYZbs{}\\PYZdq{},\\PYZbs{}n \\PYZbs{}\\PYZdq{}marl:hasOpinion\\PYZbs{}\\PYZdq{}: [\\PYZbs{}n \\PYZob{}\\PYZbs{}n \\PYZbs{}\\PYZdq{}@type\\PYZbs{}\\PYZdq{}: \\PYZbs{}\\PYZdq{}sentiment\\PYZbs{}\\PYZdq{},\\PYZbs{}n \\PYZbs{}\\PYZdq{}marl:hasPolarity\\PYZbs{}\\PYZdq{}: \\PYZbs{}\\PYZdq{}marl:Positive\\PYZbs{}\\PYZdq{}\\PYZbs{}n \\PYZcb{}\\PYZbs{}n ]\\PYZbs{}n\\PYZcb{}]\\PYZbs{}n```\\PYZbs{}n\\PYZbs{}n\\PYZbs{}nAnd the template:\\PYZbs{}n\\PYZbs{}n```\\PYZbs{}n\\PYZob{}\\PYZpc{} for entry in entries \\PYZpc{}\\PYZcb{}\\PYZbs{}n\\PYZob{}\\PYZob{} entry[\\PYZbs{}\\PYZdq{}nif:isString\\PYZbs{}\\PYZdq{}] | upper \\PYZcb{}\\PYZcb{},\\PYZob{}\\PYZob{}entry.sentiments[0][\\PYZbs{}\\PYZdq{}marl:hasPolarity\\PYZbs{}\\PYZdq{}].split(\\PYZbs{}\\PYZdq{}:\\PYZbs{}\\PYZdq{})[1]\\PYZcb{}\\PYZcb{}\\PYZbs{}n\\PYZob{}\\PYZpc{} endfor \\PYZpc{}\\PYZcb{}\\PYZbs{}n```\\PYZbs{}n\\PYZbs{}nThe final result would be:\\PYZbs{}n\\PYZbs{}n```\\PYZbs{}nTESTING THE TEMPLATE,Positive\\PYZbs{}n```\\PYZbs{}n\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}urischeme\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}urischeme\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}u\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}RFC5147String\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}scheme for NIF URIs\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}RFC5147String\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}verbose\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}verbose\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}v\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Show all properties in the result\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{k+kc}{true}\\PY{p}{,}\n", - " \\PY{k+kc}{false}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", - " \\PY{p}{\\PYZcb{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}with\\PYZhy{}parameters\\PYZdq{}}\\PY{p}{:} \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nt}{\\PYZdq{}aliases\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{l+s+s2}{\\PYZdq{}withparameters\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{l+s+s2}{\\PYZdq{}with\\PYZus{}parameters\\PYZdq{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}default\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{false}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}description\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}include initial parameters in the response\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}options\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{k+kc}{true}\\PY{p}{,}\n", - " \\PY{k+kc}{false}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}required\\PYZdq{}}\\PY{p}{:} \\PY{k+kc}{true}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - "\\PY{p}{\\PYZcb{}}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "{\n", - " \"@context\": \"http://senpy.gsi.upm.es/api/contexts/YXBpLz9oZWxwPVRydWUj\",\n", - " \"@type\": \"Help\",\n", - " \"valid_parameters\": {\n", - " \"algorithm\": {\n", - " \"aliases\": [\n", - " \"algorithms\",\n", - " \"a\",\n", - " \"algo\"\n", - " ],\n", - " \"default\": \"default\",\n", - " \"description\": \"Algorithms that will be used to process the request.It may be a list of comma-separated names.\",\n", - " \"processor\": \"string_to_tuple\",\n", - " \"required\": true\n", - " },\n", - " \"aliases\": {\n", - " \"@id\": \"aliases\",\n", - " \"aliases\": [],\n", - " \"default\": false,\n", - " \"description\": \"Replace JSON properties with their aliases\",\n", - " \"options\": [\n", - " true,\n", - " false\n", - " ],\n", - " \"required\": true\n", - " },\n", - " \"conversion\": {\n", - " \"@id\": \"conversion\",\n", - " \"default\": \"full\",\n", - " \"description\": \"How to show the elements that have (not) been converted.\\n\\n* full: converted and original elements will appear side-by-side\\n* filtered: only converted elements will be shown\\n* nested: converted elements will be shown, and they will include a link to the original element\\n(using `prov:wasGeneratedBy`).\\n\",\n", - " \"options\": [\n", - " \"filtered\",\n", - " \"nested\",\n", - " \"full\"\n", - " ],\n", - " \"required\": true\n", - " },\n", - " \"emotion-model\": {\n", - " \"@id\": \"emotionModel\",\n", - " \"aliases\": [\n", - " \"emoModel\",\n", - " \"emotionModel\"\n", - " ],\n", - " \"description\": \"Emotion model to use in the response.\\nSenpy will try to convert the output to this model automatically.\\n\\nExamples: `wna:liking` and `emoml:big6`.\\n \",\n", - " \"required\": false\n", - " },\n", - " \"expanded-jsonld\": {\n", - " \"@id\": \"expanded-jsonld\",\n", - " \"aliases\": [\n", - " \"expanded\",\n", - " \"expanded_jsonld\"\n", - " ],\n", - " \"default\": false,\n", - " \"description\": \"use JSON-LD expansion to get full URIs\",\n", - " \"options\": [\n", - " true,\n", - " false\n", - " ],\n", - " \"required\": true\n", - " },\n", - " \"fields\": {\n", - " \"@id\": \"fields\",\n", - " \"description\": \"A jmespath selector, that can be used to extract a new dictionary, array or value\\nfrom the results.\\njmespath is a powerful query language for json and/or dictionaries.\\nIt allows you to change the structure (and data) of your objects through queries.\\n\\ne.g., the following expression gets a list of `[emotion label, intensity]` for each entry:\\n`entries[].\\\"onyx:hasEmotionSet\\\"[].\\\"onyx:hasEmotion\\\"[][\\\"onyx:hasEmotionCategory\\\",\\\"onyx:hasEmotionIntensity\\\"]`\\n\\nFor more information, see: https://jmespath.org\\n\\n\",\n", - " \"required\": false\n", - " },\n", - " \"help\": {\n", - " \"@id\": \"help\",\n", - " \"aliases\": [\n", - " \"h\"\n", - " ],\n", - " \"default\": false,\n", - " \"description\": \"Show additional help to know more about the possible parameters\",\n", - " \"options\": [\n", - " true,\n", - " false\n", - " ],\n", - " \"required\": true\n", - " },\n", - " \"in-headers\": {\n", - " \"aliases\": [\n", - " \"headers\",\n", - " \"inheaders\",\n", - " \"inHeaders\",\n", - " \"in-headers\",\n", - " \"in_headers\"\n", - " ],\n", - " \"default\": false,\n", - " \"description\": \"Only include the JSON-LD context in the headers\",\n", - " \"options\": [\n", - " true,\n", - " false\n", - " ],\n", - " \"required\": true\n", - " },\n", - " \"informat\": {\n", - " \"@id\": \"informat\",\n", - " \"aliases\": [\n", - " \"f\"\n", - " ],\n", - " \"default\": \"text\",\n", - " \"description\": \"input format\",\n", - " \"options\": [\n", - " \"text\",\n", - " \"json-ld\"\n", - " ],\n", - " \"required\": false\n", - " },\n", - " \"input\": {\n", - " \"@id\": \"input\",\n", - " \"aliases\": [\n", - " \"i\"\n", - " ],\n", - " \"help\": \"Input text\",\n", - " \"required\": true\n", - " },\n", - " \"intype\": {\n", - " \"@id\": \"intype\",\n", - " \"aliases\": [\n", - " \"t\"\n", - " ],\n", - " \"default\": \"direct\",\n", - " \"description\": \"input type\",\n", - " \"options\": [\n", - " \"direct\",\n", - " \"url\",\n", - " \"file\"\n", - " ],\n", - " \"required\": false\n", - " },\n", - " \"language\": {\n", - " \"aliases\": [\n", - " \"language\",\n", - " \"l\"\n", - " ],\n", - " \"default\": \"en\",\n", - " \"description\": \"language of the input\",\n", - " \"options\": [\n", - " \"es\",\n", - " \"en\"\n", - " ],\n", - " \"required\": true\n", - " },\n", - " \"outformat\": {\n", - " \"@id\": \"outformat\",\n", - " \"aliases\": [\n", - " \"o\"\n", - " ],\n", - " \"default\": \"json-ld\",\n", - " \"description\": \"The data can be semantically formatted (JSON-LD, turtle or n-triples),\\ngiven as a list of comma-separated fields (see the fields option) or constructed from a Jinja2\\ntemplate (see the template option).\",\n", - " \"options\": [\n", - " \"json-ld\",\n", - " \"turtle\",\n", - " \"ntriples\"\n", - " ],\n", - " \"required\": true\n", - " },\n", - " \"prefix\": {\n", - " \"@id\": \"prefix\",\n", - " \"aliases\": [\n", - " \"p\"\n", - " ],\n", - " \"default\": \"\",\n", - " \"description\": \"prefix to use for new entities\",\n", - " \"required\": true\n", - " },\n", - " \"template\": {\n", - " \"@id\": \"template\",\n", - " \"description\": \"Jinja2 template for the result. The input data for the template will\\nbe the results as a dictionary.\\nFor example:\\n\\nConsider the results before templating:\\n\\n```\\n[{\\n \\\"@type\\\": \\\"entry\\\",\\n \\\"onyx:hasEmotionSet\\\": [],\\n \\\"nif:isString\\\": \\\"testing the template\\\",\\n \\\"marl:hasOpinion\\\": [\\n {\\n \\\"@type\\\": \\\"sentiment\\\",\\n \\\"marl:hasPolarity\\\": \\\"marl:Positive\\\"\\n }\\n ]\\n}]\\n```\\n\\n\\nAnd the template:\\n\\n```\\n{% for entry in entries %}\\n{{ entry[\\\"nif:isString\\\"] | upper }},{{entry.sentiments[0][\\\"marl:hasPolarity\\\"].split(\\\":\\\")[1]}}\\n{% endfor %}\\n```\\n\\nThe final result would be:\\n\\n```\\nTESTING THE TEMPLATE,Positive\\n```\\n\",\n", - " \"required\": false\n", - " },\n", - " \"urischeme\": {\n", - " \"@id\": \"urischeme\",\n", - " \"aliases\": [\n", - " \"u\"\n", - " ],\n", - " \"default\": \"RFC5147String\",\n", - " \"description\": \"scheme for NIF URIs\",\n", - " \"options\": [\n", - " \"RFC5147String\"\n", - " ],\n", - " \"required\": false\n", - " },\n", - " \"verbose\": {\n", - " \"@id\": \"verbose\",\n", - " \"aliases\": [\n", - " \"v\"\n", - " ],\n", - " \"default\": false,\n", - " \"description\": \"Show all properties in the result\",\n", - " \"options\": [\n", - " true,\n", - " false\n", - " ],\n", - " \"required\": true\n", - " },\n", - " \"with-parameters\": {\n", - " \"aliases\": [\n", - " \"withparameters\",\n", - " \"with_parameters\"\n", - " ],\n", - " \"default\": false,\n", - " \"description\": \"include initial parameters in the response\",\n", - " \"options\": [\n", - " true,\n", - " false\n", - " ],\n", - " \"required\": true\n", - " }\n", - " }\n", - "}" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "import requests\n", - "res = requests.get(f'{endpoint}/',\n", - " params={\n", - " \"help\": True}).text\n", - "pretty(res)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Ignoring the context" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
{\n",
-       "  "@type": "Results",\n",
-       "  "entries": [\n",
-       "    {\n",
-       "      "@id": "prefix:",\n",
-       "      "@type": "Entry",\n",
-       "      "marl:hasOpinion": [],\n",
-       "      "nif:isString": "This will tell senpy to only include the context in the headers",\n",
-       "      "onyx:hasEmotionSet": [\n",
-       "        {\n",
-       "          "@id": "Emotions0",\n",
-       "          "@type": "EmotionSet",\n",
-       "          "onyx:hasEmotion": [\n",
-       "            {\n",
-       "              "@id": "Emotion0",\n",
-       "              "@type": "Emotion",\n",
-       "              "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal": 4.22,\n",
-       "              "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance": 5.17,\n",
-       "              "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence": 5.2,\n",
-       "              "prov:wasGeneratedBy": "prefix:Analysis_1554364689.0180304"\n",
-       "            }\n",
-       "          ],\n",
-       "          "prov:wasGeneratedBy": "prefix:Analysis_1554364689.0180304"\n",
-       "        }\n",
-       "      ]\n",
-       "    }\n",
-       "  ]\n",
-       "}\n",
-       "
\n" - ], - "text/latex": [ - "\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n", - "\\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Results\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}entries\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Entry\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}marl:hasOpinion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}nif:isString\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}This will tell senpy to only include the context in the headers\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotionSet\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotions0\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}EmotionSet\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}onyx:hasEmotion\\PYZdq{}}\\PY{p}{:} \\PY{p}{[}\n", - " \\PY{p}{\\PYZob{}}\n", - " \\PY{n+nd}{\\PYZdq{}@id\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion0\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nd}{\\PYZdq{}@type\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}Emotion\\PYZdq{}}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}arousal\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{4.22}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}dominance\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{5.17}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns\\PYZsh{}valence\\PYZdq{}}\\PY{p}{:} \\PY{l+m+mf}{5.2}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364689.0180304\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\\PY{p}{,}\n", - " \\PY{n+nt}{\\PYZdq{}prov:wasGeneratedBy\\PYZdq{}}\\PY{p}{:} \\PY{l+s+s2}{\\PYZdq{}prefix:Analysis\\PYZus{}1554364689.0180304\\PYZdq{}}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - " \\PY{p}{\\PYZcb{}}\n", - " \\PY{p}{]}\n", - "\\PY{p}{\\PYZcb{}}\n", - "\\end{Verbatim}\n" - ], - "text/plain": [ - "{\n", - " \"@type\": \"Results\",\n", - " \"entries\": [\n", - " {\n", - " \"@id\": \"prefix:\",\n", - " \"@type\": \"Entry\",\n", - " \"marl:hasOpinion\": [],\n", - " \"nif:isString\": \"This will tell senpy to only include the context in the headers\",\n", - " \"onyx:hasEmotionSet\": [\n", - " {\n", - " \"@id\": \"Emotions0\",\n", - " \"@type\": \"EmotionSet\",\n", - " \"onyx:hasEmotion\": [\n", - " {\n", - " \"@id\": \"Emotion0\",\n", - " \"@type\": \"Emotion\",\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal\": 4.22,\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance\": 5.17,\n", - " \"http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence\": 5.2,\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364689.0180304\"\n", - " }\n", - " ],\n", - " \"prov:wasGeneratedBy\": \"prefix:Analysis_1554364689.0180304\"\n", - " }\n", - " ]\n", - " }\n", - " ]\n", - "}" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "import requests\n", - "res = requests.get(f'{endpoint}/',\n", - " params={\n", - " \"input\": \"This will tell senpy to only include the context in the headers\",\n", - " \"inheaders\": True})\n", - "pretty(res.text)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "To retrieve the context URI, use the `LINK` header:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - ";rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"\n" - ] - } - ], + }, "source": [ - "print(res.headers['Link'])" + "* [Senpy in 1 minute](./Quickstart-1minute.ipynb) shows how to query the API.\n", + "* [Senpy in 10 minutes](./Quickstart-10minutes.ipynb) introduces basic sentiment and emotion analysis.\n", + "* [Senpy in 30 minutes](./Quickstart-30minutes.ipynb) builds on the previous and adds more advanced functionalities, such as emotion conversion, field selection and pipelines." ] } ], "metadata": { "anaconda-cloud": {}, + "celltoolbar": "Edit Metadata", "kernelspec": { "display_name": "Python 3", "language": "python", diff --git a/docs/Quickstart.rst b/docs/Quickstart.rst deleted file mode 100644 index 4e401bb..0000000 --- a/docs/Quickstart.rst +++ /dev/null @@ -1,2599 +0,0 @@ - -Consuming Senpy services -======================== - -This short tutorial will teach you how to consume services in several -ways, taking advantage of the features of the framework. - -In particular, we will cover: - -- Annotating text with sentiment -- Annotating text with emotion -- Getting results in different formats (Turtle, XML, text…) -- Asking for specific emotion models (automatic model conversion) -- Listing available services in an endpoint -- Switching to different services -- Calling multiple services in the same request (Pipelines) - -The latest version of this IPython notebook is available at: -https://github.com/gsi-upm/senpy/tree/master/docs/Quickstart.ipynb - -Requirements ------------- - -For the sake of simplicity, this tutorial will use the demo server: -http://senpy.gsi.upm.es: - -.. code:: ipython3 - - endpoint = 'http://senpy.gsi.upm.es/api' - -This server runs some open source plugins for sentiment and emotion -analysis. - -The HTTP API of Senpy can be queried with your favourite tool. This is -just an example using curl: - -.. code:: bash - - curl "http://senpy.gsi.upm.es/api/sentiment140" --data-urlencode "input=Senpy is awesome" - -For simplicity, in this tutorial we will use the requests library. We -will also add a function to add syntax highlighting for the -JSON-LD/Turtle results: - -.. code:: ipython3 - - try: - from IPython.display import Code - def pretty(txt, language='json-ld'): - return Code(txt, language=language) - except ImportError: - def pretty(txt, **kwargs): - print(txt) - -Once you’re familiar with Senpy, you can deploy your own instance quite -easily. e.g. using docker: - -:: - - docker run -ti --name 'SenpyEndpoint' -d -p 5000:5000 gsiupm/senpy - -Then, feel free to change the endpoint variable to run the examples in -your own instance. - -Sentiment Analysis of Text --------------------------- - -To start, let us analyse the sentiment in the following sentence: *senpy -is a wonderful service*. - -For now, we will use the `sentiment140 `__ -service, through the sentiment140 plugin. We will later cover how to use -a different service. - -.. code:: ipython3 - - import requests - res = requests.get(f'{endpoint}/sentiment140', - params={"input": "Senpy is awesome",}) - pretty(res.text) - - - - -.. raw:: html - -
{
-      "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lIw%3D%3D",
-      "@type": "Results",
-      "entries": [
-        {
-          "@id": "prefix:",
-          "@type": "Entry",
-          "marl:hasOpinion": [
-            {
-              "@type": "Sentiment",
-              "marl:hasPolarity": "marl:Positive",
-              "prov:wasGeneratedBy": "prefix:Analysis_1554364667.7955277"
-            }
-          ],
-          "nif:isString": "Senpy is awesome",
-          "onyx:hasEmotionSet": []
-        }
-      ]
-    }
-    
- - - - -Senpy services always return an object of type ``senpy:Results``, with a -list of entries. You can think of an entry as a self-contained textual -context (``nif:Context`` and ``senpy:Entry``). Entries can be as short -as a sentence, or as long as a news article. - -Each entry has a ``nif:isString`` property that contains the original -text of the entry, and several other properties that are provided by the -plugins. - -For instance, sentiment annotations are provided through -``marl:hasOpinion``. - -The annotations are semantic. We can ask Senpy for the expanded JSON-LD -output to reveal the full URIs of each property and entity: - -.. code:: ipython3 - - import requests - res = requests.get(f'{endpoint}/sentiment140', - params={"input": "Senpy is awesome", - "expanded": True}) - pretty(res.text) - - - - -.. raw:: html - -
{
-      "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lJmV4cGFuZGVkPVRydWUj",
-      "@type": [
-        "http://www.gsi.upm.es/onto/senpy/ns#Results"
-      ],
-      "http://www.w3.org/ns/prov#used": [
-        {
-          "@id": "http://senpy.invalid/",
-          "@type": [
-            "http://www.gsi.upm.es/onto/senpy/ns#Entry"
-          ],
-          "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#isString": [
-            {
-              "@value": "Senpy is awesome"
-            }
-          ],
-          "http://www.gsi.dit.upm.es/ontologies/marl/ns#hasOpinion": [
-            {
-              "@type": [
-                "http://www.gsi.upm.es/onto/senpy/ns#Sentiment"
-              ],
-              "http://www.gsi.dit.upm.es/ontologies/marl/ns#hasPolarity": [
-                {
-                  "@value": "marl:Positive"
-                }
-              ],
-              "http://www.w3.org/ns/prov#wasGeneratedBy": [
-                {
-                  "@id": "http://senpy.invalid/Analysis_1554364668.1011338"
-                }
-              ]
-            }
-          ],
-          "http://www.gsi.dit.upm.es/ontologies/onyx/ns#hasEmotionSet": []
-        }
-      ]
-    }
-    
- - - - -.. code:: ipython3 - - pretty(res.text) - - - - -.. raw:: html - -
{
-      "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lJmV4cGFuZGVkPVRydWUj",
-      "@type": [
-        "http://www.gsi.upm.es/onto/senpy/ns#Results"
-      ],
-      "http://www.w3.org/ns/prov#used": [
-        {
-          "@id": "http://senpy.invalid/",
-          "@type": [
-            "http://www.gsi.upm.es/onto/senpy/ns#Entry"
-          ],
-          "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#isString": [
-            {
-              "@value": "Senpy is awesome"
-            }
-          ],
-          "http://www.gsi.dit.upm.es/ontologies/marl/ns#hasOpinion": [
-            {
-              "@type": [
-                "http://www.gsi.upm.es/onto/senpy/ns#Sentiment"
-              ],
-              "http://www.gsi.dit.upm.es/ontologies/marl/ns#hasPolarity": [
-                {
-                  "@value": "marl:Positive"
-                }
-              ],
-              "http://www.w3.org/ns/prov#wasGeneratedBy": [
-                {
-                  "@id": "http://senpy.invalid/Analysis_1554364668.1011338"
-                }
-              ]
-            }
-          ],
-          "http://www.gsi.dit.upm.es/ontologies/onyx/ns#hasEmotionSet": []
-        }
-      ]
-    }
-    
- - - - -Other output formats --------------------- - -Senpy supports several semantic formats, like turtle and xml-RDF. You -can select the format of the output with the ``outformat`` parameter: - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/sentiment140', - params={"input": "Senpy is the best framework for semantic sentiment analysis, and very easy to use", - "outformat": "turtle"}) - pretty(res.text, language='turtle') - - - - -.. raw:: html - -
@prefix : <http://www.gsi.upm.es/onto/senpy/ns#> .
-    @prefix dc: <http://dublincore.org/2012/06/14/dcelements#> .
-    @prefix emoml: <http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/emotionml/ns#> .
-    @prefix endpoint: <http://senpy.gsi.upm.es/api/> .
-    @prefix fam: <http://vocab.fusepool.info/fam#> .
-    @prefix marl: <http://www.gsi.dit.upm.es/ontologies/marl/ns#> .
-    @prefix nif: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .
-    @prefix onyx: <http://www.gsi.dit.upm.es/ontologies/onyx/ns#> .
-    @prefix prefix: <http://senpy.invalid/> .
-    @prefix prov: <http://www.w3.org/ns/prov#> .
-    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-    @prefix senpy: <http://www.gsi.upm.es/onto/senpy/ns#> .
-    @prefix wna: <http://www.gsi.dit.upm.es/ontologies/wnaffect/ns#> .
-    @prefix xml: <http://www.w3.org/XML/1998/namespace> .
-    @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
-    
-    prefix: a senpy:Entry ;
-        nif:isString "Senpy is the best framework for semantic sentiment analysis, and very easy to use" ;
-        marl:hasOpinion [ a senpy:Sentiment ;
-                marl:hasPolarity "marl:Positive" ;
-                prov:wasGeneratedBy prefix:Analysis_1554364668.5153766 ] .
-    
-    [] a senpy:Results ;
-        prov:used prefix: .
-    
- - - - -Selecting fields from the output --------------------------------- - -The full output in the previous sections is very useful because it is -semantically annotated. However, it is also quite verbose if we only -want to label a piece of text, or get a polarity value. - -For such simple cases, the API has a special ``fields`` method you can -use to get a specific field from the results, and even transform the -results. Senpy uses jmespath under the hood, which has its own notation. - -To illustrate this, let us get only the text (``nif:isString``) from -each entry: - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/sentiment140', - params={"input": "Senpy is a wonderful service", - "fields": 'entries[]."nif:isString"'}) - print(res.text) - - -.. parsed-literal:: - - ["Senpy is a wonderful service"] - - -Or we could get both the text and the polarity of the text (assuming -there is only one opinion per entry) with a slightly more complicated -query: - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/sentiment140', - params={"input": "Senpy is a service. Wonderful service.", - "delimiter": "sentence", - "fields": 'entries[0].["nif:isString", "marl:hasOpinion"[0]."marl:hasPolarity"]'}) - print(res.text) - - -.. parsed-literal:: - - ["Senpy is a service. Wonderful service.", "marl:Neutral"] - - -jmespath is rather extensive for this tutorial. We will cover only the -most simple cases, so you do not need to learn much about the notation. - -For more complicated transformations, check out -`jmespath `__. In addition to a fairly complete -documentation, they have a live environment you can use to test your -queries. - -Emotion analysis ----------------- - -Senpy uses the ``onyx`` vocabulary to represent emotions, which -incorporates the notion of ``EmotionSet``\ ’s, an emotion that is -composed of several emotions. In a nutshell, an ``Entry`` is linked to -one or more ``EmotionSet``, which in turn is made up of one or more -``Emotion``. - -Let’s illustrate it with an example, using the ``emotion-depechemood`` -plugin. - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/emotion-depechemood', - params={"input": "Senpy is a wonderful that service"}) - pretty(res.text) - - - - -.. raw:: html - -
{
-      "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q_aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrdGhhdCtzZXJ2aWNlIw%3D%3D",
-      "@type": "Results",
-      "entries": [
-        {
-          "@id": "prefix:",
-          "@type": "Entry",
-          "marl:hasOpinion": [],
-          "nif:isString": "Senpy is a wonderful that service",
-          "onyx:hasEmotionSet": [
-            {
-              "@type": "EmotionSet",
-              "onyx:hasEmotion": [
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:negative-fear",
-                  "onyx:hasEmotionIntensity": 0.06258366271018097
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:amusement",
-                  "onyx:hasEmotionIntensity": 0.15784834034155437
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:anger",
-                  "onyx:hasEmotionIntensity": 0.08728815135373413
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:annoyance",
-                  "onyx:hasEmotionIntensity": 0.12184635680460143
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:indifference",
-                  "onyx:hasEmotionIntensity": 0.1374081151031531
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:joy",
-                  "onyx:hasEmotionIntensity": 0.12267040802346799
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:awe",
-                  "onyx:hasEmotionIntensity": 0.21085262130713067
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:sadness",
-                  "onyx:hasEmotionIntensity": 0.09950234435617733
-                }
-              ],
-              "prov:wasGeneratedBy": "prefix:Analysis_1554364674.7078097"
-            }
-          ]
-        }
-      ]
-    }
-    
- - - - -As you have probably noticed, there are several emotions in this result, -each with a different intensity. - -We can also tell senpy to only return the emotion with the maximum -intensity using the ``maxemotion`` parameter: - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/emotion-depechemood', - params={"input": "Senpy is a wonderful service", - "maxemotion": True}) - pretty(res.text) - - - - -.. raw:: html - -
{
-      "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tZGVwZWNoZW1vb2Q_aW5wdXQ9U2VucHkraXMrYSt3b25kZXJmdWwrc2VydmljZSZtYXhlbW90aW9uPVRydWUj",
-      "@type": "Results",
-      "entries": [
-        {
-          "@id": "prefix:",
-          "@type": "Entry",
-          "marl:hasOpinion": [],
-          "nif:isString": "Senpy is a wonderful service",
-          "onyx:hasEmotionSet": [
-            {
-              "@type": "EmotionSet",
-              "onyx:hasEmotion": [
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:awe",
-                  "onyx:hasEmotionIntensity": 0.21085262130713067
-                }
-              ],
-              "prov:wasGeneratedBy": "prefix:Analysis_1554364674.8374224"
-            }
-          ]
-        }
-      ]
-    }
-    
- - - - -We can combine this feature with the ``fields`` parameter to get only -the label and the intensity: - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/emotion-depechemood', - params={"input": "Senpy is a wonderful service", - "fields": 'entries[]."onyx:hasEmotionSet"[]."onyx:hasEmotion"[]["onyx:hasEmotionCategory","onyx:hasEmotionIntensity"]', - "maxemotion": True}) - pretty(res.text) - - - - -.. raw:: html - -
[["wna:awe", 0.21085262130713067]]
-    
- - - - -Emotion conversion ------------------- - -If the model used by a plugin is not right for your application, you can -ask for a specific emotion model in your request. - -Senpy ships with emotion conversion capabilities, and it will try to -automatically convert the results. - -For example, the ``emotion-anew`` plugin uses the dimensional ``pad`` -(or VAD, valence-arousal-dominance) model, as we can see here: - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/emotion-anew', - params={"input": "Senpy is a wonderful service and I love it"}) - print(res.text) - - -.. parsed-literal:: - - { - "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQj", - "@type": "Results", - "entries": [ - { - "@id": "prefix:", - "@type": "Entry", - "marl:hasOpinion": [], - "nif:isString": "Senpy is a wonderful service and I love it", - "onyx:hasEmotionSet": [ - { - "@id": "Emotions0", - "@type": "EmotionSet", - "onyx:hasEmotion": [ - { - "@id": "Emotion0", - "@type": "Emotion", - "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal": 6.44, - "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance": 7.11, - "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence": 8.72, - "prov:wasGeneratedBy": "prefix:Analysis_1554364675.1427004" - } - ], - "prov:wasGeneratedBy": "prefix:Analysis_1554364675.1427004" - } - ] - } - ] - } - - -If we need a category level, we can ask for the equivalent results in -the ``big6`` model: - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/emotion-anew', - params={"input": "Senpy is a wonderful service and I love it", - "emotion-model": "emoml:big6"}) - pretty(res.text) - - - - -.. raw:: html - -
{
-      "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYj",
-      "@type": "Results",
-      "entries": [
-        {
-          "@id": "prefix:",
-          "@type": "Entry",
-          "marl:hasOpinion": [],
-          "nif:isString": "Senpy is a wonderful service and I love it",
-          "onyx:hasEmotionSet": [
-            {
-              "@id": "Emotions0",
-              "@type": "EmotionSet",
-              "onyx:hasEmotion": [
-                {
-                  "@id": "Emotion0",
-                  "@type": "Emotion",
-                  "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal": 6.44,
-                  "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance": 7.11,
-                  "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence": 8.72,
-                  "prov:wasGeneratedBy": "prefix:Analysis_1554364675.2834926"
-                }
-              ],
-              "prov:wasGeneratedBy": "prefix:Analysis_1554364675.2834926"
-            },
-            {
-              "@type": "EmotionSet",
-              "onyx:hasEmotion": [
-                {
-                  "@type": "Emotion",
-                  "onyx:algorithmConfidence": 7.449999999999999,
-                  "onyx:hasEmotionCategory": "emoml:big6fear"
-                }
-              ],
-              "prov:wasGeneratedBy": "prefix:Analysis_1554364675.2902758"
-            }
-          ]
-        }
-      ]
-    }
-    
- - - - -Because we don’t usually care about the original emotion, the conversion -can be presented in three ways: - -- full: the original and converted emotions are included at the same - level -- filtered: the original emotion is replaced by the converted emotion -- nested: the original emotion is replaced, but the converted emotion - points to it - -For example, here’s how the ``nested`` structure would look like: - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/emotion-anew', - params={"input": "Senpy is a wonderful service and I love it", - "emotion-model": "emoml:big6", - "conversion": "nested"}) - pretty(res.text) - - - - -.. raw:: html - -
{
-      "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2Vtb3Rpb24tYW5ldz9pbnB1dD1TZW5weStpcythK3dvbmRlcmZ1bCtzZXJ2aWNlK2FuZCtJK2xvdmUraXQmZW1vdGlvbi1tb2RlbD1lbW9tbCUzQWJpZzYmY29udmVyc2lvbj1uZXN0ZWQj",
-      "@type": "Results",
-      "entries": [
-        {
-          "@id": "prefix:",
-          "@type": "Entry",
-          "marl:hasOpinion": [],
-          "nif:isString": "Senpy is a wonderful service and I love it",
-          "onyx:hasEmotionSet": [
-            {
-              "@type": "EmotionSet",
-              "onyx:hasEmotion": [
-                {
-                  "@type": "Emotion",
-                  "onyx:algorithmConfidence": 7.449999999999999,
-                  "onyx:hasEmotionCategory": "emoml:big6fear"
-                }
-              ],
-              "prov:wasDerivedFrom": {
-                "@id": "Emotions0",
-                "@type": "EmotionSet",
-                "onyx:hasEmotion": [
-                  {
-                    "@id": "Emotion0",
-                    "@type": "Emotion",
-                    "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal": 6.44,
-                    "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance": 7.11,
-                    "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence": 8.72,
-                    "prov:wasGeneratedBy": "prefix:Analysis_1554364675.4125388"
-                  }
-                ],
-                "prov:wasGeneratedBy": "prefix:Analysis_1554364675.4125388"
-              },
-              "prov:wasGeneratedBy": "prefix:Analysis_1554364675.4143574"
-            }
-          ]
-        }
-      ]
-    }
-    
- - - - -Again, for completion, we could get only the label with the ``fields`` -parameter: - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/emotion-anew', - params={"input": "Senpy is a wonderful service and I love it", - "emotion-model": "emoml:big6", - "fields": 'entries[].[["nif:isString","onyx:hasEmotionSet"[]."onyx:hasEmotion"[]."onyx:hasEmotionCategory"][]][]', - "conversion": "filtered"}) - pretty(res.text) - - - - -.. raw:: html - -
[["Senpy is a wonderful service and I love it", "emoml:big6fear"]]
-    
- - - - -Built-in client ---------------- - -The built-in senpy client allows you to query any Senpy endpoint. We -will illustrate how to use it with the public demo endpoint, and then -show you how to spin up your own endpoint using docker. - -Building pipelines ------------------- - -You can query several senpy services in the same request. This feature -is called pipelining, and the result of combining several plugins in a -request is called a pipeline. - -The simplest way to use pipelines is to add every plugin you want to use -to the URL, separated by either a slash or a comma. - -For instance, to get sentiment (``sentiment140``) and emotion -(``depechemood``) annotations at the same time: - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/sentiment140/emotion-depechemood', - params={"input": "Senpy is a wonderful service"}) - pretty(res.text) - - - - -.. raw:: html - -
{
-      "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MC9lbW90aW9uLWRlcGVjaGVtb29kP2lucHV0PVNlbnB5K2lzK2Erd29uZGVyZnVsK3NlcnZpY2Uj",
-      "@type": "Results",
-      "entries": [
-        {
-          "@id": "prefix:",
-          "@type": "Entry",
-          "marl:hasOpinion": [
-            {
-              "@type": "Sentiment",
-              "marl:hasPolarity": "marl:Neutral",
-              "prov:wasGeneratedBy": "prefix:Analysis_1554364675.8928602"
-            }
-          ],
-          "nif:isString": "Senpy is a wonderful service",
-          "onyx:hasEmotionSet": [
-            {
-              "@type": "EmotionSet",
-              "onyx:hasEmotion": [
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:negative-fear",
-                  "onyx:hasEmotionIntensity": 0.06258366271018097
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:amusement",
-                  "onyx:hasEmotionIntensity": 0.15784834034155437
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:anger",
-                  "onyx:hasEmotionIntensity": 0.08728815135373413
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:annoyance",
-                  "onyx:hasEmotionIntensity": 0.12184635680460143
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:indifference",
-                  "onyx:hasEmotionIntensity": 0.1374081151031531
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:joy",
-                  "onyx:hasEmotionIntensity": 0.12267040802346799
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:awe",
-                  "onyx:hasEmotionIntensity": 0.21085262130713067
-                },
-                {
-                  "@type": "Emotion",
-                  "onyx:hasEmotionCategory": "wna:sadness",
-                  "onyx:hasEmotionIntensity": 0.09950234435617733
-                }
-              ],
-              "prov:wasGeneratedBy": "prefix:Analysis_1554364675.8937423"
-            }
-          ]
-        }
-      ]
-    }
-    
- - - - -In a senpy pipeline, the call is processed by each plugin in sequence. -The output of a plugin is used as input for the next one. - -Pipelines take the same parameters as the plugins they are made of. For -example, if we want to split the original sentence before analysing its -sentiment, we can use a pipeline made out of the ``split`` and the -``sentiment140`` plugins. - -``split`` takes an extra parameter (``delimiter``) to select the type of -splitting (by sentence or by paragraph), and ``sentiment140`` takes a -``language`` parameter. - -This is how the request looks like: - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/split/sentiment140', - params={"input": "Senpy is awesome. And services are composable.", - "delimiter": "sentence", - "language": "en", - "outformat": "json-ld"}) - pretty(res.text) - - - - -.. raw:: html - -
{
-      "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NwbGl0L3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcythd2Vzb21lLitBbmQrc2VydmljZXMrYXJlK2NvbXBvc2FibGUuJmRlbGltaXRlcj1zZW50ZW5jZSZsYW5ndWFnZT1lbiZvdXRmb3JtYXQ9anNvbi1sZCM%3D",
-      "@type": "Results",
-      "entries": [
-        {
-          "@id": "prefix:",
-          "@type": "Entry",
-          "marl:hasOpinion": [
-            {
-              "@type": "Sentiment",
-              "marl:hasPolarity": "marl:Positive",
-              "prov:wasGeneratedBy": "prefix:Analysis_1554364676.2060485"
-            }
-          ],
-          "nif:isString": "Senpy is awesome. And services are composable.",
-          "onyx:hasEmotionSet": []
-        },
-        {
-          "@id": "prefix:#char=0,17",
-          "@type": "Entry",
-          "marl:hasOpinion": [
-            {
-              "@type": "Sentiment",
-              "marl:hasPolarity": "marl:Positive",
-              "prov:wasGeneratedBy": "prefix:Analysis_1554364676.2060485"
-            }
-          ],
-          "nif:isString": "Senpy is awesome.",
-          "onyx:hasEmotionSet": []
-        },
-        {
-          "@id": "prefix:#char=18,46",
-          "@type": "Entry",
-          "marl:hasOpinion": [
-            {
-              "@type": "Sentiment",
-              "marl:hasPolarity": "marl:Neutral",
-              "prov:wasGeneratedBy": "prefix:Analysis_1554364676.2060485"
-            }
-          ],
-          "nif:isString": "And services are composable.",
-          "onyx:hasEmotionSet": []
-        }
-      ]
-    }
-    
- - - - -As you can see, ``split`` creates two new entries, which are also -annotated by ``sentiment140``. - -Once again, we could use the ``fields`` parameter to get a list of -strings and labels: - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/split/sentiment140', - params={"input": "Senpy is awesome. And services are composable.", - "delimiter": "sentence", - "fields": 'entries[].[["nif:isString","marl:hasOpinion"[]."marl:hasPolarity"][]][]', - "language": "en", - "outformat": "json-ld"}) - pretty(res.text) - - - - -.. raw:: html - -
[["Senpy is awesome. And services are composable.", "marl:Positive"], ["Senpy is awesome.", "marl:Positive"], ["And services are composable.", "marl:Neutral"]]
-    
- - - - -Evaluation ----------- - -Sentiment analysis plugins can also be evaluated on a series of -pre-defined datasets, using the ``gsitk`` tool. - -For instance, to evaluate the ``sentiment-vader`` plugin on the -``vader`` and ``sts`` datasets, we would simply call: - -.. code:: ipython3 - - res = requests.get(f'{endpoint}/evaluate', - params={"algo": "sentiment-vader", - "dataset": "vader,sts", - 'outformat': 'json-ld' - }) - pretty(res.text) - - - - -.. raw:: html - -
{
-      "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL2V2YWx1YXRlLz9hbGdvPXNlbnRpbWVudC12YWRlciZkYXRhc2V0PXZhZGVyJTJDc3RzJm91dGZvcm1hdD1qc29uLWxkIw%3D%3D",
-      "@type": "AggregatedEvaluation",
-      "senpy:evaluations": [
-        {
-          "@type": "Evaluation",
-          "evaluates": "endpoint:plugins/sentiment-vader_0.1.1__vader",
-          "evaluatesOn": "vader",
-          "metrics": [
-            {
-              "@type": "Accuracy",
-              "value": 0.6907142857142857
-            },
-            {
-              "@type": "Precision_macro",
-              "value": 0.34535714285714286
-            },
-            {
-              "@type": "Recall_macro",
-              "value": 0.5
-            },
-            {
-              "@type": "F1_macro",
-              "value": 0.40853400929446554
-            },
-            {
-              "@type": "F1_weighted",
-              "value": 0.5643605528396403
-            },
-            {
-              "@type": "F1_micro",
-              "value": 0.6907142857142857
-            },
-            {
-              "@type": "F1_macro",
-              "value": 0.40853400929446554
-            }
-          ]
-        },
-        {
-          "@type": "Evaluation",
-          "evaluates": "endpoint:plugins/sentiment-vader_0.1.1__sts",
-          "evaluatesOn": "sts",
-          "metrics": [
-            {
-              "@type": "Accuracy",
-              "value": 0.3107177974434612
-            },
-            {
-              "@type": "Precision_macro",
-              "value": 0.1553588987217306
-            },
-            {
-              "@type": "Recall_macro",
-              "value": 0.5
-            },
-            {
-              "@type": "F1_macro",
-              "value": 0.23705926481620407
-            },
-            {
-              "@type": "F1_weighted",
-              "value": 0.14731706525451424
-            },
-            {
-              "@type": "F1_micro",
-              "value": 0.3107177974434612
-            },
-            {
-              "@type": "F1_macro",
-              "value": 0.23705926481620407
-            }
-          ]
-        }
-      ]
-    }
-    
- - - - -The same results can be visualized as a table in the Web interface: - -|image0| - -.. |image0| image:: evaluation-results.png - -**note**: to evaluate a plugin on a dataset, senpy will need to predict -the labels of the entries using the plugin. This process might take long -for plugins that use an external service, such as ``sentiment140``. - -Advanced topics ---------------- - -Verbose output -~~~~~~~~~~~~~~ - -By default, senpy does not include information that might be too -verbose, such as the parameters that were used in the analysis. - -You can instruct senpy to provide a more verbose output with the -``verbose`` parameter: - -.. code:: ipython3 - - import requests - res = requests.get(f'{endpoint}/sentiment140', - params={ - "input": "Senpy is the best framework for semantic sentiment analysis, and very easy to use", - "verbose": True}).text - pretty(res) - - - - -.. raw:: html - -
{
-      "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpL3NlbnRpbWVudDE0MD9pbnB1dD1TZW5weStpcyt0aGUrYmVzdCtmcmFtZXdvcmsrZm9yK3NlbWFudGljK3NlbnRpbWVudCthbmFseXNpcyUyQythbmQrdmVyeStlYXN5K3RvK3VzZSZ2ZXJib3NlPVRydWUj",
-      "@type": "Results",
-      "activities": [
-        {
-          "@id": "prefix:Analysis_1554364688.7944896",
-          "@type": "Analysis",
-          "marl:maxPolarityValue": 1,
-          "marl:minPolarityValue": 0,
-          "prov:used": [
-            {
-              "@type": "Parameter",
-              "name": "input",
-              "value": "Senpy is the best framework for semantic sentiment analysis, and very easy to use"
-            },
-            {
-              "@type": "Parameter",
-              "name": "verbose",
-              "value": true
-            },
-            {
-              "@type": "Parameter",
-              "name": "in-headers",
-              "value": false
-            },
-            {
-              "@type": "Parameter",
-              "name": "algorithm",
-              "value": "default"
-            },
-            {
-              "@type": "Parameter",
-              "name": "expanded-jsonld",
-              "value": false
-            },
-            {
-              "@type": "Parameter",
-              "name": "with-parameters",
-              "value": false
-            },
-            {
-              "@type": "Parameter",
-              "name": "outformat",
-              "value": "json-ld"
-            },
-            {
-              "@type": "Parameter",
-              "name": "help",
-              "value": false
-            },
-            {
-              "@type": "Parameter",
-              "name": "aliases",
-              "value": false
-            },
-            {
-              "@type": "Parameter",
-              "name": "conversion",
-              "value": "full"
-            },
-            {
-              "@type": "Parameter",
-              "name": "intype",
-              "value": "direct"
-            },
-            {
-              "@type": "Parameter",
-              "name": "informat",
-              "value": "text"
-            },
-            {
-              "@type": "Parameter",
-              "name": "prefix",
-              "value": ""
-            },
-            {
-              "@type": "Parameter",
-              "name": "urischeme",
-              "value": "RFC5147String"
-            },
-            {
-              "@type": "Parameter",
-              "name": "language",
-              "value": "auto"
-            }
-          ],
-          "prov:wasAssociatedWith": "endpoint:plugins/sentiment140_0.2"
-        }
-      ],
-      "entries": [
-        {
-          "@id": "prefix:",
-          "@type": "Entry",
-          "marl:hasOpinion": [
-            {
-              "@type": "Sentiment",
-              "marl:hasPolarity": "marl:Positive",
-              "prov:wasGeneratedBy": "prefix:Analysis_1554364688.7944896"
-            }
-          ],
-          "nif:isString": "Senpy is the best framework for semantic sentiment analysis, and very easy to use",
-          "onyx:hasEmotionSet": []
-        }
-      ]
-    }
-    
- - - - -Getting help -~~~~~~~~~~~~ - -.. code:: ipython3 - - import requests - res = requests.get(f'{endpoint}/', - params={ - "help": True}).text - pretty(res) - - - - -.. raw:: html - -
{
-      "@context": "http://senpy.gsi.upm.es/api/contexts/YXBpLz9oZWxwPVRydWUj",
-      "@type": "Help",
-      "valid_parameters": {
-        "algorithm": {
-          "aliases": [
-            "algorithms",
-            "a",
-            "algo"
-          ],
-          "default": "default",
-          "description": "Algorithms that will be used to process the request.It may be a list of comma-separated names.",
-          "processor": "string_to_tuple",
-          "required": true
-        },
-        "aliases": {
-          "@id": "aliases",
-          "aliases": [],
-          "default": false,
-          "description": "Replace JSON properties with their aliases",
-          "options": [
-            true,
-            false
-          ],
-          "required": true
-        },
-        "conversion": {
-          "@id": "conversion",
-          "default": "full",
-          "description": "How to show the elements that have (not) been converted.\n\n* full: converted and original elements will appear side-by-side\n* filtered: only converted elements will be shown\n* nested: converted elements will be shown, and they will include a link to the original element\n(using `prov:wasGeneratedBy`).\n",
-          "options": [
-            "filtered",
-            "nested",
-            "full"
-          ],
-          "required": true
-        },
-        "emotion-model": {
-          "@id": "emotionModel",
-          "aliases": [
-            "emoModel",
-            "emotionModel"
-          ],
-          "description": "Emotion model to use in the response.\nSenpy will try to convert the output to this model automatically.\n\nExamples: `wna:liking` and `emoml:big6`.\n        ",
-          "required": false
-        },
-        "expanded-jsonld": {
-          "@id": "expanded-jsonld",
-          "aliases": [
-            "expanded",
-            "expanded_jsonld"
-          ],
-          "default": false,
-          "description": "use JSON-LD expansion to get full URIs",
-          "options": [
-            true,
-            false
-          ],
-          "required": true
-        },
-        "fields": {
-          "@id": "fields",
-          "description": "A jmespath selector, that can be used to extract a new dictionary, array or value\nfrom the results.\njmespath is a powerful query language for json and/or dictionaries.\nIt allows you to change the structure (and data) of your objects through queries.\n\ne.g., the following expression gets a list of `[emotion label, intensity]` for each entry:\n`entries[].\"onyx:hasEmotionSet\"[].\"onyx:hasEmotion\"[][\"onyx:hasEmotionCategory\",\"onyx:hasEmotionIntensity\"]`\n\nFor more information, see: https://jmespath.org\n\n",
-          "required": false
-        },
-        "help": {
-          "@id": "help",
-          "aliases": [
-            "h"
-          ],
-          "default": false,
-          "description": "Show additional help to know more about the possible parameters",
-          "options": [
-            true,
-            false
-          ],
-          "required": true
-        },
-        "in-headers": {
-          "aliases": [
-            "headers",
-            "inheaders",
-            "inHeaders",
-            "in-headers",
-            "in_headers"
-          ],
-          "default": false,
-          "description": "Only include the JSON-LD context in the headers",
-          "options": [
-            true,
-            false
-          ],
-          "required": true
-        },
-        "informat": {
-          "@id": "informat",
-          "aliases": [
-            "f"
-          ],
-          "default": "text",
-          "description": "input format",
-          "options": [
-            "text",
-            "json-ld"
-          ],
-          "required": false
-        },
-        "input": {
-          "@id": "input",
-          "aliases": [
-            "i"
-          ],
-          "help": "Input text",
-          "required": true
-        },
-        "intype": {
-          "@id": "intype",
-          "aliases": [
-            "t"
-          ],
-          "default": "direct",
-          "description": "input type",
-          "options": [
-            "direct",
-            "url",
-            "file"
-          ],
-          "required": false
-        },
-        "language": {
-          "aliases": [
-            "language",
-            "l"
-          ],
-          "default": "en",
-          "description": "language of the input",
-          "options": [
-            "es",
-            "en"
-          ],
-          "required": true
-        },
-        "outformat": {
-          "@id": "outformat",
-          "aliases": [
-            "o"
-          ],
-          "default": "json-ld",
-          "description": "The data can be semantically formatted (JSON-LD, turtle or n-triples),\ngiven as a list of comma-separated fields (see the fields option) or constructed from a Jinja2\ntemplate (see the template option).",
-          "options": [
-            "json-ld",
-            "turtle",
-            "ntriples"
-          ],
-          "required": true
-        },
-        "prefix": {
-          "@id": "prefix",
-          "aliases": [
-            "p"
-          ],
-          "default": "",
-          "description": "prefix to use for new entities",
-          "required": true
-        },
-        "template": {
-          "@id": "template",
-          "description": "Jinja2 template for the result. The input data for the template will\nbe the results as a dictionary.\nFor example:\n\nConsider the results before templating:\n\n```\n[{\n    \"@type\": \"entry\",\n    \"onyx:hasEmotionSet\": [],\n    \"nif:isString\": \"testing the template\",\n    \"marl:hasOpinion\": [\n        {\n            \"@type\": \"sentiment\",\n            \"marl:hasPolarity\": \"marl:Positive\"\n        }\n    ]\n}]\n```\n\n\nAnd the template:\n\n```\n{% for entry in entries %}\n{{ entry[\"nif:isString\"] | upper }},{{entry.sentiments[0][\"marl:hasPolarity\"].split(\":\")[1]}}\n{% endfor %}\n```\n\nThe final result would be:\n\n```\nTESTING THE TEMPLATE,Positive\n```\n",
-          "required": false
-        },
-        "urischeme": {
-          "@id": "urischeme",
-          "aliases": [
-            "u"
-          ],
-          "default": "RFC5147String",
-          "description": "scheme for NIF URIs",
-          "options": [
-            "RFC5147String"
-          ],
-          "required": false
-        },
-        "verbose": {
-          "@id": "verbose",
-          "aliases": [
-            "v"
-          ],
-          "default": false,
-          "description": "Show all properties in the result",
-          "options": [
-            true,
-            false
-          ],
-          "required": true
-        },
-        "with-parameters": {
-          "aliases": [
-            "withparameters",
-            "with_parameters"
-          ],
-          "default": false,
-          "description": "include initial parameters in the response",
-          "options": [
-            true,
-            false
-          ],
-          "required": true
-        }
-      }
-    }
-    
- - - - -Ignoring the context -~~~~~~~~~~~~~~~~~~~~ - -.. code:: ipython3 - - import requests - res = requests.get(f'{endpoint}/', - params={ - "input": "This will tell senpy to only include the context in the headers", - "inheaders": True}) - pretty(res.text) - - - - -.. raw:: html - -
{
-      "@type": "Results",
-      "entries": [
-        {
-          "@id": "prefix:",
-          "@type": "Entry",
-          "marl:hasOpinion": [],
-          "nif:isString": "This will tell senpy to only include the context in the headers",
-          "onyx:hasEmotionSet": [
-            {
-              "@id": "Emotions0",
-              "@type": "EmotionSet",
-              "onyx:hasEmotion": [
-                {
-                  "@id": "Emotion0",
-                  "@type": "Emotion",
-                  "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#arousal": 4.22,
-                  "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#dominance": 5.17,
-                  "http://www.gsi.dit.upm.es/ontologies/onyx/vocabularies/anew/ns#valence": 5.2,
-                  "prov:wasGeneratedBy": "prefix:Analysis_1554364689.0180304"
-                }
-              ],
-              "prov:wasGeneratedBy": "prefix:Analysis_1554364689.0180304"
-            }
-          ]
-        }
-      ]
-    }
-    
- - - - -To retrieve the context URI, use the ``LINK`` header: - -.. code:: ipython3 - - print(res.headers['Link']) - - -.. parsed-literal:: - - ;rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json" - diff --git a/docs/advanced.rst b/docs/advanced.rst index b6665c6..b07c218 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -6,4 +6,5 @@ Advanced usage server-cli conversion - commandline \ No newline at end of file + commandline + development diff --git a/docs/conf.py b/docs/conf.py index aa34d7d..dc38924 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -38,6 +38,8 @@ extensions = [ 'sphinxcontrib.httpdomain', 'sphinx.ext.coverage', 'sphinx.ext.autosectionlabel', + 'nbsphinx', + 'sphinx.ext.mathjax', ] # Add any paths that contain templates here, relative to this directory. @@ -54,7 +56,7 @@ master_doc = 'index' # General information about the project. project = u'Senpy' -copyright = u'2016, J. Fernando Sánchez' +copyright = u'2019, J. Fernando Sánchez' description = u'A framework for sentiment and emotion analysis services' # The version info for the project you're documenting, acts as replacement for @@ -79,7 +81,7 @@ language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['_build'] +exclude_patterns = ['_build', '**.ipynb_checkpoints'] # The reST default role (used for this markup: `text`) to use for all # documents. @@ -286,3 +288,13 @@ texinfo_documents = [ # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False + +nbsphinx_prolog = """ +.. note:: This page has been auto-generated from a Jupyter notebook using nbsphinx_. + + The original source is available at: https://github.com/gsi-upm/senpy/tree/master/docs//{{ env.doc2path(env.docname, base=None) }} + + .. _nbsphinx: https://nbsphinx.readthedocs.io/ + +---- +""" diff --git a/docs/demo.rst b/docs/demo.rst index 5e32e55..96ceea7 100644 --- a/docs/demo.rst +++ b/docs/demo.rst @@ -4,11 +4,10 @@ Demo There is a demo available on http://senpy.gsi.upm.es/, where you can test a live instance of Senpy, with several open source plugins. You can use the playground (a web interface) or make HTTP requests to the service API. -.. image:: senpy-playground.png - :height: 400px +.. image:: playground-0.20.png + :target: http://senpy.gsi.upm.es :width: 800px - :scale: 100 % :align: center -The source code and description of the plugins used in the demo are available here: https://lab.gsi.upm.es/senpy/senpy-plugins-community/. +The source code and description of the plugins used in the demo are available here: https://github.com/gsi-upm/senpy-plugins-community/. diff --git a/docs/index.rst b/docs/index.rst index 21a9bc0..937bc39 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -25,10 +25,9 @@ To get familiar with the concepts behind Senpy, and what it can offer for servic :maxdepth: 2 senpy - Quickstart + demo + Quickstart.ipynb installation - development apischema advanced - demo publications diff --git a/docs/playground-0.20.png b/docs/playground-0.20.png new file mode 100644 index 0000000000000000000000000000000000000000..9c73f2f79ade36984be8f31d1565d8c8ba3a9cf7 GIT binary patch literal 69907 zcmXtf19V*7_jc6SHkvd>W81cE+fI|lPQ!)`8r!zj*qqo-13KEKuJ4?MBd0;2TW8e+P;B+|w;aQ-S8s4XwJ&oI7Y>Db1>@QeE$4EU z?*GTKa|XcR(0`O$z*Ueo{PB*B|1gk*zvS=Ee!TWw%Xn-y zjNv?e!4_PZdN{<}si%pVoW{7pA>fa1zuW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;DFu{Nr!TGY5kn>^B|(DXd*OAM%x!1mua#+f}!6Rq`Mt;-J?ua?-S_WCCU@z z>Cq|RsYnpiD^e|D;Zh5Aq){8g+Q{OLF|{@x*UcW`lm~I##?`X@T}MvC^vmOZX(g{| zlD~HDl!U37W|@nOu{HO!aqbZgMK#{*V3bnnj2+TJ);fF-krb7GT6}@tK|^E@oK)NB6@quQ9ca{uruH*TQlv_Ne3|8`YW+bDHO0+mTB# z2xBp?b3H!xCeXnuc)GZu{mo&i$V*z$(aE~ALe zG}Dnm@a9ZCT=x~)>_w1kmFtCqMpX#SE%t($<{_B+mTmW$OII9hV^`%?-CxD>$<~Y5 zoxbcE}%_5kP5zzd%~D$TRE9}#B7xmr9s{Fpj$m;W_43mrW1uRTJ_ zNT^YuT07CTi)*c_X3ep7(5ybywyn8&wljuH78erm%wxHIyBR1s{r{j76>S8%XCM&w zX>K}GRjN>Hj;;WL=HgOQRAhZ<#(B&8`9=kBQ3A1DwHZzV{vKgctUf+50j#ZTWE~NK pVsH)bXWyF=+${aG0G?;w5pr3U5oPir*By7e)Khu!!Y41^{Rb-X+H(K^ literal 0 HcmV?d00001 diff --git a/docs/plugins-faq.rst b/docs/plugins-faq.rst index 7ddb192..882dc52 100644 --- a/docs/plugins-faq.rst +++ b/docs/plugins-faq.rst @@ -22,7 +22,7 @@ Hence, two parts are necessary: 1) the code that will process the entry, and 2) In practice, this is what a plugin looks like, tests included: -.. literalinclude:: ../senpy/plugins/example/rand_plugin.py +.. literalinclude:: ../example-plugins/rand_plugin.py :emphasize-lines: 5-11 :language: python @@ -76,8 +76,9 @@ Most plugins will need access to files (dictionaries, lexicons, etc.). These files are usually heavy or under a license that does not allow redistribution. For this reason, senpy has a `data_folder` that is separated from the source files. The location of this folder is controlled programmatically or by setting the `SENPY_DATA` environment variable. +You can use the `self.path(filepath)` function to get the path of a given `filepath` within the data folder. -Plugins have a convenience function `self.open` which will automatically prepend the data folder to relative paths: +Plugins have a convenience function `self.open` which will automatically look for the file if it exists, or open a new one if it doesn't: .. code:: python @@ -132,7 +133,7 @@ And you can run it with: docker run -p 5000:5000 gsiupm/exampleplugin -If the plugin uses non-source files (:ref:`loading data and files`), the recommended way is to use `SENPY_DATA` folder. +If the plugin uses non-source files (:ref:`How should I load external data and files`), the recommended way is to use `SENPY_DATA` folder. Data can then be mounted in the container or added to the image. The former is recommended for open source plugins with licensed resources, whereas the latter is the most convenient and can be used for private images. diff --git a/docs/requirements.txt b/docs/requirements.txt index 87087eb..6ebb278 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,2 +1,3 @@ sphinxcontrib-httpdomain>=1.4 +ipykernel nbsphinx