Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🔍 LSTM-based Next Word Predictor

This project implements a word-level Next Word Prediction and Search Autocomplete system using an LSTM neural network. The model is trained on real-world search-style questions from the Quora Question Pairs dataset and deployed using Streamlit for interactive usage.


📚 Dataset

  • Dataset Name : Quora Question Pairs
  • Total Questions : 150,000 (subset used)
  • Total Tokens : ~1.4 million (14 lakh)
  • Language : English
  • Data Type : Natural user-generated questions
  • Use Case : Search queries & autocomplete

The Quora dataset is well-suited for autocomplete tasks because it closely resembles real Google search queries: short, natural, and intent-driven questions.


🧠 Model Architecture

  • Model Type : Word-level LSTM
  • Embedding Size : 128
  • LSTM Hidden Units : 256
  • Number of Layers : 1
  • Sequence Length : 4 words
  • Loss Function : CrossEntropyLoss
  • Optimizer : Adam

The model predicts the next word based on the previous N words and is capable of generating coherent query continuations.


⚙️ Features

✔ Progressive Query Expansion

  • Predicts words one-by-one
  • Expands the original query step-by-step

✔ Alternative Sentence Suggestions

  • Generates multiple full sentences
  • Predicts the next 4 words for each alternative
  • Same base query, diverse completions

✔ Single Input, Dual Output

  • One search bar
  • One Predict button
  • Parallel outputs on the same page

✔ Clean & Wide UI

  • Built entirely with Streamlit
  • Side-by-side results for better readability

🖥️ Frontend

  • Framework : Streamlit
  • Runtime : CPU
  • UI Style : Wide layout with parallel columns
  • Interaction:
    • User types a query once
    • Clicks "Predict"
    • Sees progressive + alternative suggestions

🚀 Use Cases

  • Search engine autocomplete demo
  • NLP / Deep Learning portfolio project
  • Understanding sequence modeling with LSTM
  • Real-world text generation example
  • LinkedIn / resume showcase

🚧 Future Improvements

  • Implement live autocomplete for instant suggestions as the user types.
  • Train on larger and more diverse datasets to improve generalization.
  • Enhance the UI with progressive word highlights and interactive features.

👤 Author

  • Built by: Aman Verma
  • Domain : Deep Learning | NLP | PyTorch

Give a Star to repo if you like it!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages