This is a small app working out how to use the NLTK package within a Django app.
- Clone and cd into the cloned dir
- Create a (new) pipenv:
pipenv sync
- Use the NLTK Downloader to obtain the necessary data:
- In your pipenv dir type:
python
to start the interpreter - Type the following to satisfy the dependencies
>>> import nltk
>>> nltk.download('punkt')
>>> nltk.download('averaged_perceptron_tagger')
- In your pipenv dir type:
- Start the django server with
./manage.py runserver
There is no need to migrate the database and/or create a super user since the data is already in the sqlite db file. Logging in to the admin can be done with:
username: wouter
password: 1qaz2wsx
Create a csv file with the following format:
answer,intent_name,pointers|separated|by|pipes
Read the file with the following manage-command:
(pipenv) # ./manage.py import_keywords --path ./data.csv
You can add comments by starting a line with a #
Besides running as a Django web UI a CLI is also provided. Usage as follows:
(pipenv) # python cli.py
> Hello, how can I help you?: [Type your question here]
Using synonyms is also possible:
(pipenv) # python cli.py --use_synonyms True
There is a set of tests which can be run as follows:
(pipenv) # python -m unittest tests.py
Django based tests can be run with the manage command:
(pipenv) # ./manage.py test