Markov Chain implementation at learning to generate dad jokes using icanhazdadjoke.com
- Install Python 3.7:
brew install python
- Install virtualenv:
pip install virtualenv
- Install virtualenvwrapper:
pip install virtualenvwrapper
- Add these to your ~/.bash_profile. This will cause virtualenv to create all your virtual envs in your home directory.
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
export WORKON_HOME=$HOME/.venv
source /usr/local/bin/virtualenvwrapper.sh
- Setup virtual environment.
mkvirtualenv dadjokes
- Install requirements.txt for applicable environment.
pip install -r requirements/dev.txt
Dev environment is currently set up to use SQLite by default.
Migrate the database.
./manage.py migrate
Data sources are data driven (hear an echo?). So load the initial data into the database:
./manage.py loaddata database.json
This serves the django app locally.
./manage.py runserver
Run this to test out the API download, Markov Chain, and joke generation, all at once.
./manage.py fetch_jokes 1000
Install dependencies and start the webpack/React dev server.
cd src/frontend/
npm start
- Train the Markov model using fitness functions.
- Convert Markov Chain build step to use matrices.
- Parallelize the Markov Chain build process to use multiple threads.
- Better caching.
- More data sources.