Skip to content

Here, we have predicted the next word of the context given by the user. We made two separate models of Bigram(2-Gram) and Trigram(3-Gram)

Notifications You must be signed in to change notification settings

WasifAsad/N-Gram-Language-Model-to-predict-next-word

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

About

This project implements bigram and trigram language models to predict the next word in a given phrase. It uses the NLTK library and well-known corpora (like Gutenberg, Brown, Webtext, etc.) as training datasets. The program runs as a console application where the user enters text, and the model predicts the most probable next word.

Features

Train bigram and trigram models on NLTK corpora.

Calculate conditional probabilities of words.

Interactive console-based predictions.

Works with multiple corpora (Gutenberg, Brown, Webtext, etc.).

Shows how probability-based text prediction works in NLP.

Installation

Make sure you have Python 3.8+ installed.

Clone the repository:

git clone https://github.com/WasifAsad/N-Gram-Language-Model-to-predict-next-word.git
cd N-Gram-Language-Model-to-predict-next-word

Future Improvements

Add smoothing techniques (Laplace, Kneser-Ney).

Support larger n-grams (4-grams, 5-grams).

Create a simple GUI or web app version.

Allow combining multiple corpora for training.

About

Here, we have predicted the next word of the context given by the user. We made two separate models of Bigram(2-Gram) and Trigram(3-Gram)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages