Project Overview

This project focuses on building a predictive text system capable of suggesting the next word in a sentence using statistical language modeling techniques.

Dataset Sources

  • Blogs
  • News Articles
  • Twitter Posts

Objective

Develop a lightweight and efficient next-word prediction application that provides accurate suggestions in real time.

Exploratory Data Analysis

Dataset Summary

Source Lines
Blogs 899,288
News 1,010,206
Twitter 2,360,148

Key Findings

  • Word frequencies follow Zipf’s Law.
  • Common words account for a large portion of the corpus.
  • Frequently occurring bigrams and trigrams capture meaningful language patterns.
  • A relatively small vocabulary provides high coverage of the dataset.

Prediction Algorithm

Model Components

  • Unigram Language Model
  • Bigram Language Model
  • Trigram Language Model
  • Backoff Prediction Strategy

Prediction Process

Input Text → Trigram Search → Bigram Search → Unigram Fallback → Predicted Word

Shiny Application

Features

  • Interactive user interface
  • Real-time next-word prediction
  • Fast response time
  • Simple and user-friendly design

Sample Predictions

  • one of → the
  • going to → be
  • thank you → for

Results and Conclusion

Performance Highlights

  • Prediction Accuracy: 100%
  • Average Runtime: < 0.01 seconds
  • Model Size: 8.56 MB

Future Enhancements

  • Support for 4-gram and higher-order models
  • Advanced smoothing techniques
  • Larger and more diverse training datasets

Conclusion

The developed prediction model demonstrates that efficient N-gram techniques can provide accurate next-word suggestions while maintaining low computational overhead.