- Python 3.7 or newer
- pip3 (should already be installed if you have Python 3.4 or newer)
- venv (should already be installed if you have Python 3.3 or newer)
- curl (optional)
- Clone repo
git clone https://github.com/bradisbon/common-phrases
- cd into project
cd common-phrases
- Create virtualenv in project and activate it
python3 -m venv .venv
source ./.venv/bin/activate
- Install dependencies
pip install -r requirements.txt
Since pytest is installed as a dependency, you only need to run pytest to run all the tests:
pytest
Uvicorn is an ASGI server that talks to the Python application. To run it:
uvicorn common_phrases.main:api
I'm using curl here but you could also do this from within python or with something like Postman
curl -X POST http://127.0.0.1:8000/find_common \
-H 'Content-Type: application/json' \
-d '{"text":"a b c! A\nB C"}'
You should get back the following response body:
{"most_common":["a b c","b c a","c a b"]}