Ever wondered how your phone knows what you're about to type? This project recreates that magic using deep learning! It's an intelligent text prediction app that learns from patterns in language to suggest your next word.
Think of it as your personal writing buddy that:
- Reads your mind (well, almost!) - predicts what word you'll type next
- Learns from context - understands that "I love" is often followed by specific words
- Gives you options - shows 3 smart suggestions you can click to autocomplete
- Gets smarter over time - trained on thousands of sentences to understand natural language
- Click the green "Code" button above
- Select "Codespaces" → "Create codespace"
- Grab a coffee ☕ while it sets up (takes ~2 minutes)
- Your app will automatically open - start typing!
git clone <your-repo-url>
cd next-word-predictor
pip install -r requirements.txt
streamlit run app2.py # The cool smart keyboard version🎹 Smart Keyboard Mode (app2.py) - The Fun One!
- Start typing anything: "The weather is..."
- Watch as 3 word suggestions appear like magic
- Click any suggestion to add it instantly
- Keep going and build entire sentences!
🎯 Simple Predictor (app.py) - The Classic
- Type a phrase and hit "Predict"
- Get one carefully chosen next word
- Perfect for testing specific phrases
- Type: "I love" → Might suggest: "machine", "deep", "natural"
- Type: "The weather is" → Could suggest: "nice", "beautiful", "perfect"
- Type: "I am going to" → Might predict: "the", "work", "sleep"
Results vary based on training data - that's the fun part!
Don't worry, you don't need a PhD to understand this:
- Training Phase: Fed the AI thousands of sentences so it learns patterns
- Smart Memory: Uses LSTM (Long Short-Term Memory) - like giving the AI a really good memory
- Pattern Recognition: Learns that certain words often follow others
- Probability Magic: For each word you type, calculates which words are most likely to come next
🏠 Your Project Home
├── 🎮 app2.py # The smart keyboard (start here!)
├── 🎯 app.py # Simple predictor
├── 🧠 next_word_model.h5 # The trained AI brain
├── 🔤 tokenizer.pkl # Teaches AI to understand words
├── 📓 training_notebook.ipynb # How the AI learned (for curious minds)
└── 📋 requirements.txt # Shopping list for Python packages
Want to improve it? Here are some fun ideas:
- Train on your favorite book - make it predict like Shakespeare or Harry Potter
- Add more suggestions - why stop at 3 words?
- Different languages - teach it Spanish, French, or any language you love
- Smarter UI - add themes, sounds, or animations
As someone fascinated by how our phones seem to "read our minds," I wanted to peek behind the curtain. This project demystifies predictive text and shows that with some Python knowledge and creativity, you can build surprisingly smart applications.
Plus, it's just plain fun to watch an AI try to complete your thoughts! 🤖
- Add support for longer context (remember more than just the last few words)
- Train on larger, more diverse datasets
- Add confidence scores for predictions
- Mobile-friendly interface
- Voice input support
This project represents hours of curiosity, learning, and debugging. If it helps you understand AI a little better or inspires you to build something cool, then it's served its purpose!
Feel free to break it, improve it, or use it as a stepping stone for your own AI adventures.
Happy typing! ✨
Built with curiosity, caffeine, and a lot of trial-and-error by Nilkanth Ahire
P.S. - If the AI suggests something weird, that's just it being creative! 😄