Skip to main content

The Python Flair JSON-NLP package

Project description

Flair JSON-NLP Wrapper

(C) 2019 by Damir Cavar, Oren Baldinger, Maanvitha Gongalla, Anurag Kumar, Murali Kammili

Brought to you by the NLP-Lab.org!

Introduction

Flair v4.1 wrapper for JSON-NLP. Flair provides state-of-the-art embeddings, and tagging capabilities, in particular, POS-tagging, NER, shallow syntax chunking, and semantic frame detection.

FlairPipeline

We provide a FlairPipeline class, with the following parameters for ease of use:

  • lang: defaults to en. Different languages support different models, see the Flair Docs for details.
  • use_ontonotes: defaults to False. Whether or not to use 4-class (True) or 12-class (False) NER tagging.
  • fast: defaults to True. Whether or not to use the smaller, faster, but slightly less accurate versions of the models.
  • use_embeddings: defaults to ''. Passing default will map to glove,multi-forward,multi-backward, the recommended stacked-embedding configuration.
  • char_embeddings: defaults to False. Whether or not to include character-level embeddings.
  • bpe_size: defaults to 0. If you want to include Byte-Pair Encodings, set this value to 50, 100, 200, or 300. See more at Flair Embeddings Docs.
  • pos: defaults to True. Whether or not to include language-specific part-of-speech tags.
  • sentinment: defaults to True. Whether or not to include sentiment analysis, if it is available for the given language.

Tagging and Embedding models are downloaded automatically the first time they are called. This may take a while depending on your internet connection.

Microservice

The JSON-NLP repository provides a Microservice class, with a pre-built implementation of Flask. To run it, execute:

python flairjsonnlp/server.py

Since server.py extends the Flask app, a WSGI file would contain:

from flairjsonnlp.server import app as application

The microservice exposes the following URIs:

  • /expressions
  • /token_list

These URIs are shortcuts to disable the other components of the parse. In all cases, tokenList will be included in the JSON-NLP output. An example url is:

http://localhost:5000/expressions?text=I am a sentence

Text is provided to the microservice with the text parameter, via either GET or POST. If you pass url as a parameter, the microservice will scrape that url and process the text of the website.

The additional Flair parameters can be passed as parameters as well.

Here is an example GET call:

http://localhost:5000?lang=de&constituents=0&text=Ich bin ein Berliner.

Project details


Download files

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

Source Distribution

flairjsonnlp-0.0.8.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

flairjsonnlp-0.0.8-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file flairjsonnlp-0.0.8.tar.gz.

File metadata

  • Download URL: flairjsonnlp-0.0.8.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for flairjsonnlp-0.0.8.tar.gz
Algorithm Hash digest
SHA256 c9b1f6e1b4749dc472e5ff2f843d6e60735601d94c8612b981d88afcd5e60489
MD5 6b3c857076b42a739825c90c075bf8eb
BLAKE2b-256 372ecb350b6ee82a6dd5bc4724faac51c5455a5ec1c7b395206641602b31d5b7

See more details on using hashes here.

File details

Details for the file flairjsonnlp-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: flairjsonnlp-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for flairjsonnlp-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 aaf0fe2b3a323dcab6ee3861aa41d07b27d9f34b1ebf1ed66ede3a35fc46346d
MD5 329c133061da8ed59bf95f70530e0e82
BLAKE2b-256 cf5a5aef9b316415e49dc17cb1989b44ffb3d0d91647b370326a8e34e8cc6484

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page