NLP Sandbox Client Library for Python
Project description
NLP Sandbox Client
NLP Sandbox Client Library for Python
Usage
Create configuration
-
Create the file that contains the future environment variables
cp .env.sample .env
-
Update the configuration values in .env. Set the values of
SYNAPSE_USERNAME
andSYNAPSE_APIKEY
with the credentials of your Synapse account. -
Export the variables defined in .env to environment variables
export $(grep -v '^#' .env | xargs -d '\n')
Run the client using Docker
docker run --rm nlpsandbox/cli
Evaluate the performance of a local prediction file
docker run --rm nlpsandbox/cli evaluate
Development
Create a new conda environment using the Python version listed in the Dockerfile of this repository (currently Python 3.8.5).
conda create --name nlp-sandbox-client python=3.8.5
conda activate nlp-sandbox-client
Install the project in develop mode. This command must be executed each time the content of setup.py is updated.
pip install -e .
Run the program
$ nlp-cli
Usage: nlp-cli [OPTIONS] COMMAND [ARGS]...
NLP Sandbox client
Options:
--help Show this message and exit.
Commands:
evaluate Evaluate the performance of a local prediction file
Tests
nlp-cli evaluate prediction --pred_filepath test/data/new_prediction.json --gold_filepath test/data/new_goldstandard.json --eval_type person
Create clients
Data node client
openapi-generator generate -g python -o . --package-name datanode -i https://nlpsandbox.github.io/nlpsandbox-schemas/data-node/edge/openapi.json
Annotator client
Must merge the three NLP annotator specifications together:
openapi-generator generate -g python -o . --package-name annotator -i openapi.yaml
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.