There are two main components here,
- The Notebook
- The Script
It is recommended to go through the notebook to understand the basics of ngram model and how to implement it in PyTorch.
Next we will use the trained model from the notebook to auto complete words of your own. (although it might not be perfect)
It is important to consider this just as a starting point.
I will list out a few things you definitely need to make it run locally,
- Python 3.7 or later
- PyTorch 1.6 or later
- Numpy and Matplotlib
- pkbar - keras style progress bar
These are the major requirements. If you wish you can install my entire setup using this command
$ make install
Note: We will be using Charles Dickens' great novel "A Tale of two cities" to train our model.
You can download the novel using the code in cell 3 of the notebook, or from this link
If you decide to download from the website, make sure to remove unwanted text from gutenberg at the start and end of the txt file. However I have included the text file with all the changes in this repo.
Author: abhinand5
Running the auto-complete.py
script is very simple... just execute it and follow the prompts.