This project includes a sentence autocomplete feature powered by an N-gram model. Follow the steps below to run the model and see it in action.
-
Prepare your Data:
- Make sure you have your text data ready (e.g.,
en_US.twitter.txt
). - Run the preprocessing steps if required.
- Make sure you have your text data ready (e.g.,
-
Run the N-gram Autocomplete Script:
- Execute the
N-gram.py
script to start the interactive sentence autocomplete feature.
python N-gram.py
- Execute the
-
User Interaction:
- When prompted, enter a sequence of words to get the next word suggestion.
- Optionally, specify a starting letter or sequence for the next word.
- The program will complete your sentence based on the highest probability suggestion.
Enter a sequence of words: I love
Optional: Enter a starting letter or sequence for the suggested word (or press Enter to skip): y
Completed Sentence:
I love you
- Adjust N-gram Size: You can modify the N-gram size by adjusting the relevant parameters in the code.
- Change Smoothing: Tweak the smoothing parameter
k
to experiment with different probability estimates.