{"id":29823031,"url":"https://github.com/alejo1630/chat_nlp","last_synced_at":"2026-05-20T05:39:21.406Z","repository":{"id":307000256,"uuid":"1024543412","full_name":"alejo1630/chat_NLP","owner":"alejo1630","description":"A personalized chatbot trained on real WhatsApp conversations using a seq2seq LSTM model. It generates context-aware replies by mimicking the user's natural writing style.","archived":false,"fork":false,"pushed_at":"2025-07-28T21:20:26.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-28T23:21:48.748Z","etag":null,"topics":["chatbot","embeddings","nlp","python"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alejo1630.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-22T21:46:54.000Z","updated_at":"2025-07-28T21:21:17.000Z","dependencies_parsed_at":"2025-07-28T23:22:00.334Z","dependency_job_id":"3668fcc3-d5a3-4fc2-ad4f-1d1d107a4647","html_url":"https://github.com/alejo1630/chat_NLP","commit_stats":null,"previous_names":["alejo1630/chat_nlp"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/alejo1630/chat_NLP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejo1630%2Fchat_NLP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejo1630%2Fchat_NLP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejo1630%2Fchat_NLP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejo1630%2Fchat_NLP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alejo1630","download_url":"https://codeload.github.com/alejo1630/chat_NLP/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejo1630%2Fchat_NLP/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267616879,"owners_count":24116171,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","embeddings","nlp","python"],"created_at":"2025-07-29T01:38:44.342Z","updated_at":"2026-05-20T05:39:21.344Z","avatar_url":"https://github.com/alejo1630.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 Chat_NLP: A Personalized WhatsApp Chatbot\n\n## 📌 Description\n\nThis project explores the creation of a neural conversational model trained on real WhatsApp chat history. The goal is to build a chatbot that mimics the communication style of the user **Alejandro** generating context-aware responses based on previous messages using a sequence-to-sequence (seq2seq) architecture with LSTM networks.\n\n## 📁 Dataset\n\n\u003e 🔒 **Note:** The WhatsApp chat dataset used in this project contains personal and private information. For privacy and security reasons, the dataset is **not included** in this repository. Only the preprocessing and training code is provided so users can replicate the pipeline with their own data.\n\n\nThe dataset is a WhatsApp chat export in `.txt` format between two users:\n- **Linda**\n- **Alejandro** (target speaker)\n\nThe chat history was parsed and cleaned to extract valid dialogue turns, excluding media messages and deleted content. From 203,094 messages, over 40,000 valid input–response pairs were generated for training the model.\n\n## ✅ What’s Implemented\n\n- 📄 **Chat Parsing:** Regex-based extraction of messages, users, and timestamps.\n- 🔁 **Dialogue Turn Construction:** Consecutive messages are grouped to form coherent turns.\n- 🔄 **Input–Target Pairing:** Each message by Alejandro is paired with the previous message by Linda.\n- 🧠 **Seq2Seq Model:** Encoder–decoder architecture using LSTM layers implemented with TensorFlow/Keras.\n- 🧪 **Inference Pipeline:** Real-time decoding loop to generate responses token-by-token.\n- 💬 **Interactive Chat Interface:** A console-based chatbot (Alejo_Bot) simulates WhatsApp-style conversation.\n\n## 🛠️ Tools\n\n- Python\n- TensorFlow / Keras\n- NumPy, Pandas, re\n- Google Colab (for training and experimentation)\n- WhatsApp exported `.txt` file\n\n\u003e ⚠️ **Note:** Due to GPU memory limitations on Google Colab, the model was trained with:\n\u003e - `batch_size = 32`  \n\u003e - `embedding_dim = 128`  \n\u003e - `lstm_units = 256`  \n\u003e\n\u003e These values were selected to balance training feasibility with performance.\n\n## 📊 Results\n\n- Model trained for 5 epochs with the limited configuration above.\n- Final **validation perplexity**: ~98.76.\n- Although accuracy metrics are low (due to the nature of free-form language generation and architecture structure), the model is able to generate plausible, stylistically aligned responses.\n- Example:\n  ```\n  Input: Hola\n  Output: cómo vas?\n  ```\n\n## 🔮 Future Work\n\n- 🔁 Train for more epochs and fine-tune hyperparameters (e.g., embedding size, LSTM units).\n- 📈 Evaluate using BLEU, ROUGE, and human evaluation metrics for dialogue quality.\n- 🌍 Expand to multilingual models and multi-speaker chat modeling.\n- 📱 Deploy via a frontend interface (e.g., Streamlit, Telegram bot, or WhatsApp bot via Twilio).\n- 🤗 Explore transfer learning with pre-trained LLMs (e.g., T5, BART, GPT) for improved generation.\n\n## 🧾 Conclusion\n\nThis project demonstrates the feasibility of training a neural chatbot from personal chat history using classical seq2seq architecture. It showcases end-to-end pipeline development, from data wrangling and preprocessing to model training and interactive inference, making it a strong baseline for personalized chatbot applications. While the current implementation is basic, it provides a solid foundation for further experimentation and real-world deployment.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejo1630%2Fchat_nlp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falejo1630%2Fchat_nlp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejo1630%2Fchat_nlp/lists"}