2015-10-28 20:25:23 +00:00
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
2017-04-03 16:18:35 +00:00
|
|
|
First of all, you need to install the package.
|
|
|
|
See :doc:`installation` for installation instructions.
|
|
|
|
Once installed, the `senpy` command should be available.
|
2016-03-31 09:56:32 +00:00
|
|
|
|
|
|
|
Useful command-line options
|
|
|
|
===========================
|
|
|
|
|
|
|
|
In case you want to load modules, which are located in different folders under the root folder, use the next option.
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
2017-04-03 16:18:35 +00:00
|
|
|
senpy -f .
|
2016-03-31 09:56:32 +00:00
|
|
|
|
2017-04-03 16:18:35 +00:00
|
|
|
The default port used by senpy is 5000, but you can change it using the `--port` flag.
|
2016-03-31 09:56:32 +00:00
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
2017-04-03 16:18:35 +00:00
|
|
|
senpy --port 8080
|
2016-03-31 09:56:32 +00:00
|
|
|
|
|
|
|
Also, the host can be changed where senpy is deployed. The default value is `127.0.0.1`.
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
2017-04-03 16:18:35 +00:00
|
|
|
senpy --host 0.0.0.0
|
2016-03-31 09:56:32 +00:00
|
|
|
|
2015-10-28 20:25:23 +00:00
|
|
|
For more options, see the `--help` page.
|
|
|
|
|
|
|
|
Alternatively, you can use the modules included in senpy to build your own application.
|
2016-03-31 09:56:32 +00:00
|
|
|
|
|
|
|
Senpy server
|
|
|
|
============
|
|
|
|
|
|
|
|
Once the server is launched, there is a basic endpoint in the server, which provides a playground to use the plugins that have been loaded.
|
|
|
|
|
|
|
|
In case you want to know the different endpoints of the server, there is more information available in the NIF API section_.
|
|
|
|
|
2017-04-03 16:18:35 +00:00
|
|
|
CLI demo
|
|
|
|
========
|
2016-03-31 09:56:32 +00:00
|
|
|
|
|
|
|
This video shows how to use senpy through command-line tool.
|
|
|
|
|
2017-04-03 16:18:35 +00:00
|
|
|
.. image:: https://asciinema.org/a/9uwef1ghkjk062cw2t4mhzpyk.png
|
|
|
|
:width: 100%
|
|
|
|
:target: https://asciinema.org/a/9uwef1ghkjk062cw2t4mhzpyk
|
|
|
|
:alt: CLI demo
|
|
|
|
|
2016-03-31 09:56:32 +00:00
|
|
|
|
2017-04-03 16:18:35 +00:00
|
|
|
Built-in client
|
|
|
|
===============
|
2016-03-31 09:56:32 +00:00
|
|
|
|
2017-02-28 18:38:01 +00:00
|
|
|
This example shows how to make a request to the default plugin:
|
2016-03-31 09:56:32 +00:00
|
|
|
|
|
|
|
.. code:: python
|
|
|
|
|
2017-02-28 18:38:01 +00:00
|
|
|
from senpy.client import Client
|
2016-03-31 09:56:32 +00:00
|
|
|
|
2017-02-28 18:38:01 +00:00
|
|
|
c = Client('http://127.0.0.1:5000/api/')
|
|
|
|
r = c.analyse('hello world')
|
|
|
|
|
|
|
|
for entry in r.entries:
|
|
|
|
print('{} -> {}'.format(entry.text, entry.emotions))
|
2016-03-31 09:56:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _section: http://senpy.readthedocs.org/en/latest/api.html
|
|
|
|
|
2017-03-01 16:56:17 +00:00
|
|
|
|
|
|
|
Conversion
|
|
|
|
==========
|
|
|
|
See :doc:`conversion`
|