Skip to content

AITestingOrg/spaCy-service

Repository files navigation

spaCy Service

Build Status

Small prototype, currently only scaffolding for converting values to abstractions.

Features

  • Convert values like 'Jack' to VALID_NAME
  • Return random, concrete examples of abstractions ** Supports First Name, Last Name, ** Coming soon Full Name, Currency

Running the API

pip install -r requirements.txt
pip install -U spacy
python -m spacy download en
python src/app.py

Endpoints

Get Abstraction

POST /abstraction { label: 'First name', value: 'John' }
REPONSE { abstraction: 'VALID_FIRST_NAME', target: 'John' }

Get Concrete Example

GET /abstraction/concrete/example/:abstraction
REPONSE { abstraction: 'VALID_FIRST_NAME', example: 'John' }

Get Supported Abstractions

GET /abstraction/supported
RESPONSE ['VALID_FIRST_NAME', 'VALID_LAST_NAME']

Running Demo

Run the prototype.

pip install -r requirements.txt
pip install -U spacy
python -m spacy download en
python src/console_app.py

Follow the instructions in the console. You don't need to train or import the model, there is a default one provided. Note, that the default model is very poor as it was trained on a tiny fraction of the data to avoid growing too large. To train a better model: choose 3 to train on the data, if you want to change the data then update the text files in models/data then choose 2 at the prompt to import the new data, finally choosing 3 to train on that data. Once done, you can start testing out concrete values using the 1 prompt.

Tests

Run the tests.

pip install -r requirements.txt
python -m spacy download en
pytest

About

Returns abstractions of concrete values and fragments

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages