Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/praekelt/feersum-nlu-api-wrappers

Swagger spec and generated Python language wrappers for the FeersumNLU HTTP Rest API for building intelligent chatbots.
https://github.com/praekelt/feersum-nlu-api-wrappers

chatbot-framework nlp nlp-machine-learning

Last synced: 3 days ago
JSON representation

Swagger spec and generated Python language wrappers for the FeersumNLU HTTP Rest API for building intelligent chatbots.

Awesome Lists containing this project

README

        

FeersumNLU API Wrappers
***********************

.. image:: https://badge.fury.io/py/feersum_nlu.svg
:target: https://badge.fury.io/py/feersum_nlu

This git repo hosts Python language wrappers and cURL examples for the FeersumNLU & FeersumVision RESTful HTTP APIs.
FeersumNLU & FeersumVision are the language and image comprehension components of Feersum Engine ``_ .

Overview
********
FeersumNLU & FeersumVision provide machine comprehension for natural chat-like interactions with your users. The components are
designed to be flexible enough to work with any language, even in markets where large bodies of labelled
data do not exist yet.

Our in-house comprehension models are based on the latest research and can be
setup for various specialised verticals like finance and health. The APIs are also designed such that a
user may add multi-lingual Natural Language Understanding (NLU) and image comprehension
to their application without requiring a deep understanding of NLU and computer vision theory.

The examples in this repo demonstrate commonly required NLU and vision functions. The language wrappers
are auto-generated from an API Swagger spec available at ``_.
The cURL examples of direct HTTP access are in the examples_curl folder.

(Note: This repo is currently being updated with more examples. You may subscribe to receive notifications about updates
at ``_ )

Features
********
Current NLU features include natural language FAQ's, detection of the user's intent and sentiment,
information extraction, entity extraction, and text-based language identification.

Current vision features include image classification and information extraction.

Installing
**********

Please have a look at the examples in the repo. It is also recommended that you create a Python virtual environment
and then follow one of the install options below to run the examples. The examples were tested with Python 3.5 and 3.6.

Creating a Python Virtual Environment
=====================================

To get started with the Python wrappers install Python 3.5 (or 3.6) and pip. Then do:

.. code-block:: sh

$ virtualenv -p /usr/local/bin/python3.5 .pyenv
$ source .pyenv/bin/activate
$ pip install pip-tools
$ pip install appdirs

If you don't have virtualenv installed first run:

.. code-block:: sh

$ pip install virtualenv
$ sudo /usr/bin/easy_install virtualenv

Install Option 1 - Using make
=============================
Clone the repo and then to install the dependencies required to run the module's examples run:

.. code-block:: sh

$ make requirements
$ make deps

Install Option 2 - Using setuptools
===================================

Alternatively clone the repo and then install the feersum_nlu wrapper module into your Python environment using setuptools:

.. code-block:: sh

$ make requirements
$ make deps
$ python setup.py install

The benefit of installing the feersum_nlu module into you Python environment is that you can more easily use it in your own projects.

Install Option 3 - Using pip
============================

The feersum_nlu wrapper module is also available from the Python Package Index ``_. To install it using pip run:

.. code-block:: sh

$ pip install feersum_nlu

The benefit of installing the feersum_nlu module into you Python environment is that you can more easily use it in your own projects.

Running the Examples
====================
If you use an IDE like PyCharm you can simply open the folder you cloned the source to (e.g. feersum-nlu-api-wrappers) with the IDE.

Or to start executing example notebooks install Jupyter with

.. code-block:: sh

$ pip install jupyter

and then run:

.. code-block:: sh

$ jupyter notebook

The notebooks are all in the example_notebooks folder.

Alternatively run the example python scripts in the examples folder from the terminal e.g.:

.. code-block:: sh

$ PYTHONPATH=. python examples/faq_matcher.py

Remember to set your API token in the example scripts and notebooks.

The FeersumNLU Playground Server
********************************

A FeersumNLU playground instance of the RESTful web service is hosted at nlu.playground.feersum.io:443/nlu/v2
You may use this URL to run the examples given in this repo.

You'll need an authentication token to access the service, so email us at [email protected] and
we'll send you a token to use. Some autogenerated API documentation is available at
``_

Note that this is just a playground instance. Please contact us at [email protected] for a variety of hosting options including
containerised solutions.

Making your Own API Wrapper
***************************

This Python language wrapper was generated using the swagger-codegen toolchain. The full process is in the makefile target
called `update_spec`. To update the Python wrapper run:

.. code-block:: sh

$ make update_spec

To generate an API wrapper for another language modify the command to use a different generator. See
``_ for some more details.

To generate a PHP wrapper, for example, change the generate command to something like:

.. code-block:: sh

$ swagger-codegen generate -i swagger/swagger.yaml -l php -c swagger/swagger_codegen-python_config.json -o swagger/build_php