The project can be either downloaded as a zip file from the git repository WordWranglers or cloned using the following git command:
git clone https://github.com/ThusharaN/WordWranglers.git
The project can then be opened in Visual Studio Code or any other IDE.
Poetry is used as a package management and dependency resolution tool to simplify the management of dependencies in this project. Make sure both poetry and pre-commit packages are installed before following the set-up instructions.
pip install poetry
pip install pre-commit
Follow the below steps to create an initial setup for the project:
Configuring poetry to make an env in the project
poetry config virtualenvs.in-project true
Create a new vitual environment using poetry
poetry install
Activating the environment
poetry shell
Install dependencies
pip install -r requirements.txt
Now install the precommit hooks by running this in the activated environment
pre-commit install
Select the interpreter with path ./.venv/bin/python in VSCode.
Do a test run (after installing matplotlib) to check if the environment has been setup correctly
python3 app/src/test_run.py
Note: Instructions for installing git can be found here. Most Mac/Linux machines will have git pre-installed.
Dependencies can added to the current virtual environemt by running the following command
pip install <package_name> && pip freeze > requirements.txt
Note: Make sure you are insidethe virtual environment created by poetry before installing any dependencies
A pull request needs to be created in order to push any changes to code.
After cloning, create a local branch to work on.
git checkout master
git checkout -b <your_branch_name>
In case a change has been made to hello.py, run the following commands to commit the changes
git status // Gives the paths of the files that have been updated
git add <file_path>/hello.py
git commit -m <some_commit_message>
In case new packages were installed, add the updated requirements.txt to the commit. Push your branch to GitHub
git push origin <your_branch_name>
Raise a pull request through GitHub. If the request shows conflicts, run the following commands locally
git fetch origin
git rebase origin/master
Fix all the conflicts in the files; add, commit and push.
Note: More git commands can be found here
Run the following command in the console to train the model:
python3 question_classifier.py --train --config [configuration_file_path]
and the following command to test the model:
python3 question_classifier.py --test --config [configuration_file_path]
Once training and testing of the model is complete, the environment can be deactivated by running the followig command in the terminal
source deactivate