Skip to main content

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.

Release files for flairjsonnlp 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flairjsonnlp 0.0.5
File Size Uploaded
flairjsonnlp-0.0.5.tar.gz 11.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flairjsonnlp 0.0.5
File Interpreter ABI Platform
flairjsonnlp-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 29.2 kB

Release files / flairjsonnlp-0.0.5.tar.gz

Download URL flairjsonnlp-0.0.5.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
048d2bbe0bc340633388eaa6845c216f21be38d01866f81c86b4ad77dcb02bf0
BLAKE2b-256 checksum
How to use checksums
f8cc09b654728f9c84a659aa38284a210632be3391efa6812618137ea5458bdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Release files / flairjsonnlp-0.0.5-py3-none-any.whl

Download URL flairjsonnlp-0.0.5-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1fd60d86c08c26a41edba58b619e0bf055cf8b3e9438ed9350288edef665c5f7
BLAKE2b-256 checksum
How to use checksums
c564e3507e2e140560e8f3bc5380b557ba6affe31fba7d55901117c9f68007cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Release history Release notifications | RSS feed

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

This release

0.0.5 This release

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page