{"id":19032832,"url":"https://github.com/nomadsdev/lstm-based-next-word-prediction-text-using","last_synced_at":"2025-07-04T22:36:01.879Z","repository":{"id":256294791,"uuid":"854866940","full_name":"nomadsdev/lstm-based-next-word-prediction-text-using","owner":"nomadsdev","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-09T22:52:07.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-21T20:36:50.828Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/nomadsdev.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}},"created_at":"2024-09-09T22:49:56.000Z","updated_at":"2024-09-11T00:43:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"501de0ea-e33a-4f76-810f-1081207a974a","html_url":"https://github.com/nomadsdev/lstm-based-next-word-prediction-text-using","commit_stats":null,"previous_names":["nomadsdev/lstm-based-next-word-prediction-text-using"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nomadsdev/lstm-based-next-word-prediction-text-using","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomadsdev%2Flstm-based-next-word-prediction-text-using","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomadsdev%2Flstm-based-next-word-prediction-text-using/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomadsdev%2Flstm-based-next-word-prediction-text-using/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomadsdev%2Flstm-based-next-word-prediction-text-using/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nomadsdev","download_url":"https://codeload.github.com/nomadsdev/lstm-based-next-word-prediction-text-using/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomadsdev%2Flstm-based-next-word-prediction-text-using/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263628640,"owners_count":23491012,"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","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":[],"created_at":"2024-11-08T21:31:52.061Z","updated_at":"2025-07-04T22:36:01.854Z","avatar_url":"https://github.com/nomadsdev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LSTM-Based Next-Word Prediction Text\n\nThis project implements a next-word prediction model for Thai text using Long Short-Term Memory (LSTM) networks and natural language processing techniques. The model is trained to predict the next word given a sequence of words from Thai text.\n\n## Overview\n\nThe project includes a Python script `model.py` that performs the following tasks:\n\n1. **Data Preparation**: Reads Thai text data, tokenizes it, and prepares sequences for training.\n2. **Model Training**: Builds and trains an LSTM-based model for predicting the next word in a sequence.\n3. **Prediction**: Uses the trained model to predict the next word based on a given input text.\n\n## Project Structure\n\n- `model.py`: The main script that contains the code for data preparation, model training, and prediction.\n- `data/language.txt`: The text file containing the Thai language data used for training.\n\n## Installation\n\nEnsure you have the necessary libraries installed. You can install them using pip:\n\n```bash\npip install numpy tensorflow pythainlp\n```\n\n## Usage\n\n1. **Prepare Data**: Ensure that `data/language.txt` contains the Thai text data you want to use for training.\n\n2. **Run the Script**: Execute the `model.py` script to train the model and make predictions:\n\n   ```bash\n   python model.py\n   ```\n\n3. **Input Text Prediction**: The script will print the predicted next word for the input text \"วันนี้\".\n\n## Code Details\n\n### Data Preparation\n\nThe script reads the text from `data/language.txt`, tokenizes it using `pythainlp`, and creates sequences of a specified length to be used for training.\n\n### Model\n\n- **Embedding Layer**: Converts words into dense vectors of fixed size.\n- **LSTM Layer**: A Long Short-Term Memory layer to capture dependencies in sequences.\n- **Dense Layer**: A fully connected layer with a softmax activation function to output probabilities for each word in the vocabulary.\n\n### Training\n\nThe model is compiled with categorical crossentropy loss and the Adam optimizer. It is trained for 10 epochs.\n\n### Prediction\n\nThe trained model predicts the next word based on an input text. The predicted word is displayed in the console.\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Acknowledgments\n\n- [PyThaiNLP](https://pythainlp.github.io/) for Thai language tokenization.\n- [TensorFlow](https://www.tensorflow.org/) for the machine learning framework.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomadsdev%2Flstm-based-next-word-prediction-text-using","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnomadsdev%2Flstm-based-next-word-prediction-text-using","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomadsdev%2Flstm-based-next-word-prediction-text-using/lists"}