Skip to main content

NLP Sandbox Client Library for Python

Project description

NLP Sandbox Client

GitHub Release GitHub CI GitHub License PyPi Docker Pulls Discord

NLP Sandbox Client Library for Python

Usage

Create configuration

  1. Create the file that contains the future environment variables

     cp .env.sample .env
    
  2. Update the configuration values in .env. Set the values of SYNAPSE_USERNAME and SYNAPSE_APIKEY with the credentials of your Synapse account.

  3. 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


Download files

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

Source Distribution

nlpsandbox-client-0.3.1.tar.gz (114.5 kB view hashes)

Uploaded Source

Supported by

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