Commit a20252e4 authored by J. Fernando Sánchez's avatar J. Fernando Sánchez
Browse files

Update docs + notebooks

parent 9758a297
......@@ -21,16 +21,16 @@ before_script:
- tags # Avoid unnecessary double testing
<<: *test_definition
<<: *test_definition
allow_failure: true
stage: push
......@@ -101,4 +101,3 @@ cleanup_py:
when: always # this is important; run even if preceding stages failed.
- rm -vf ~/.pypirc # we don't want to leave these around, but GitLab may clean up anyway.
- docker logout
......@@ -6,7 +6,10 @@ services:
language: python
- 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
This diff is collapsed.
%% Cell type:markdown id: tags:
# Senpy in 1 minute
This mini-tutorial is the first in the series of senpy tutorials. It only shows how to annotate with a service.
In this first tutorial, we will use the [demo server](, which runs some open source plugins for sentiment and emotion analysis.
%% Cell type:markdown id: tags:
Annotating with senpy is as simple as issuing an HTTP request to the API using your favourite tool.
This is just an example using curl:
%% Cell type:code id: tags:
``` python
!curl "" --data-urlencode "input=Senpy is awesome"
%% Cell type:markdown id: tags:
Congratulations, you've used your first senpy service!
%% Cell type:markdown id: tags:
Here is the equivalent using the `requests` library:
%% Cell type:code id: tags:
``` python
import requests
res = requests.get('',
params={"input": "Senpy is awesome",})
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -6,4 +6,5 @@ Advanced usage
\ No newline at end of file
......@@ -38,6 +38,8 @@ extensions = [
# 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:{{ env.doc2path(env.docname, base=None) }}
.. _nbsphinx:
......@@ -4,11 +4,10 @@ Demo
There is a demo available on, 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
:width: 800px
:scale: 100 %
:align: center
The source code and description of the plugins used in the demo are available here:
The source code and description of the plugins used in the demo are available here:
......@@ -25,10 +25,9 @@ To get familiar with the concepts behind Senpy, and what it can offer for servic
:maxdepth: 2
......@@ -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/
.. literalinclude:: ../example-plugins/
: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 `` which will automatically prepend the data folder to relative paths:
Plugins have a convenience function `` 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.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment