Skip to main content

A Bottle API for performing nlp actions on provided text.

Project description Documentation Status

A Bottle API for processing text via NLP. Intended for personal use, but built so others can use it as well.



Installing from pypi

$ pip install nlp-api

Installing from github source

$ git clone
$ cd NLP-API
$ python install



$ python nlp_api -h

usage: nlp_api [-h] [-v] [host] [port]

A Bottle api for processing text with nlp.

positional arguments:
host           The host NLP-API should run on. Defaults to localhost.
port           The port NLP-API should be available on. Defaults to 8888.

optional arguments:
-h, --help     show this help message and exit
-v, --verbose  Whether or not to provide verbose logging output when running NLP-API.

After pypi installation

$ python -m nlp_api hostname port

After github source installation, executed from the root NLP-API directory

$ python nlp_api hostname port



Requests need to have a json body with the following format:

    "text": "Some text to process."

Multiple texts can also be accepted by providing a list:

    "text": [
        "The first text to process.",
        "The second text to process."


  • /help : Provides help, I.e. a listing of available endpoints and links to useful documentation.


  • /snt : Extracts Sentences.
  • /word : Extracts Words.
  • /phrs : Extracts Phrases.
  • /ne : Extracts Named Entities.


  • /pos : Pos Tags words.
  • /unq : Filters out duplicate items.
  • /rev : Reverses a dictionary of content.
  • /cnsl : Consolidates content to a dictionary.


  • /freq : Calculates a Frequency Analysis.
  • /sntmnt : Performs a sentiment analysis.

Mix and match endpoints for different results, E.g.


    "action": "WordExtraction",
    "result": [
    "history": [
    "original": "Check back tomorrow ... after all."


    "action": "FrequencyCalculation",
    "result": {
        ".": 9,
        "I": 6,
        "the": 6,
        "and": 6,
        "bad": 1,
        "after": 1
    "history": [
    "original": "Check back tomorrow ... after all."

If the results you get back aren’t what you expected you likely used a combination that didn’t work out.

You can find more in depth info/examples in the Usage section.


This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.


0.1.0 (2019-1-7)

  • First release on PyPI.

0.1.1 (2019-1-8)

  • Bug fix re: ImportError post-pypi install.

0.1.2 (2019-1-8)

  • Bug fix re: tox flake8 failing.

0.2.0 (2019-1-9)

  • Changed minimum python version to 3.6.
  • Updated documentation re: pypi installation.
  • Removed the command from tox.ini.
  • Added unittests re: /word and /snt.
  • Added travis deployment functionality.
  • Updated dependencies via pyup.
  • Added /help endpoint .

0.2.1 (2019-1-9)

  • Bugfix re: case-insensitive endpoints.

0.3.0 (2019-1-10)

  • Added history to returned content.

0.4.0 (2019-1-11)

  • Added verbose (-v, –verbose) command line option for logging.
  • Output of Consolidation and Content Reversal actions is now sorted by how long the value lists are.
  • Altered test_nlp_api so it determines when the endpoints are ready for testing rather than sleeping.
  • Now accepts multiple texts.

0.4.1 (2019-1-11)

  • Removing some testing code which accidentally made it into 0.4.0.

0.4.2 (2019-1-11)

  • Bugfix re: argparse.
  • Added help/descriptions, available via -h option.

0.4.3 (2019-1-13)

  • Bugfix re: ImportError.

0.5.0 (2019-1-14)

  • Replaced unittest with pytest.
  • Put the /help endpoint in its own method.
  • Added the original text to the returned json.
  • Implemented constants in nlp_api and abstract_action.
  • Added docstrings where needed, updated documentation examples.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for nlp-api, version 0.5.0
Filename, size File type Python version Upload date Hashes
Filename, size nlp_api-0.5.0-py3-none-any.whl (32.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size nlp_api-0.5.0.tar.gz (25.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page