BabelFy API Client
Project description
Python BabelFy entity tagger. Can be used as a library or command-line tool. Compatible with both Python 2.7 as well as Python 3.
Installation
pip install babelpy
or clone this github repository and run python setup.py install, optionally prepend the commands with sudo for global installation.
Usage
Add your Babelfy API Key to the config file or provide it as an argument.
Use as command-line tool
babelpy [-h] [-t | -tf ] [-e] [-ae] [-m] [-am] [-p] [-ex]
Options:
-h, --help show a help message and exit -key --api-key BabelFy API key -t --text text to be annotated by BabelFy API -tf --text-file path to the file containing the input text -e, --entities get entity data -ae --all-entities get entity and non-entity data -m --merged-entities get merged entities only -am --all-merged-entities get all merged entities -p --print dump all babelfy data to stdout -ex --export filename of the output file
Example:
babelpy -tf ~/data/fashion.txt -am -ex ~/data/fashion.json
See babelpy -h for help.
Use as a library
from babelfy import BabelfyClient
# Instantiate BabelFy client.
params = dict()
params['lang'] = LANG
babel_client = BabelfyClient(API_KEY, params)
# Babelfy sentence.
babel_client.babelfy(TEXT_TO_BE_BABELFIED)
# Get entity data.
print(babel_client.entities)
# Get entity and non-entity data.
print(babel_client.all_entities)
# Get merged entities only.
print(babel_client.merged_entities)
# Get all merged entities.
babel_client.all_merged_entities
Run Tests with python tests/run_tests.py
License
GNU - GPL 3.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
BabelPy-1.0.tar.gz
(8.0 kB
view details)
File details
Details for the file BabelPy-1.0.tar.gz
.
File metadata
- Download URL: BabelPy-1.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 669910e215ade96718df43b844ab3ea29f7eb3d26ef92c99b065c07ff27c03a9 |
|
MD5 | 1b285e846d99538e39851abcda1791fe |
|
BLAKE2b-256 | 483b2caa7466fac1b3f71d0b3c89329f16e266564d17c8aec9f8da97b2c9f66b |