{"id":15141787,"url":"https://github.com/wei-rongrong2/rojaklanguagesentimentanalysis","last_synced_at":"2026-01-19T06:02:25.122Z","repository":{"id":252581084,"uuid":"840835557","full_name":"Wei-RongRong2/RojakLanguageSentimentAnalysis","owner":"Wei-RongRong2","description":"This is a machine learning project focused on analysing and classifying sentiments in code-switched and code-mixed text, specifically targeting the unique linguistic characteristics found in Malaysian conversations.","archived":false,"fork":false,"pushed_at":"2024-08-11T08:19:53.000Z","size":21651,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-04T05:57:01.930Z","etag":null,"topics":["code-mixing","code-switching","deep-learning","docker-image","flask-application","lstm","machine-learning","malaya-library","malaysian-language","multilingual-nlp","multinomial-naive-bayes","named-entity-recognition","natural-language-processing","render-deployment","sentiment-analysis","support-vector-machine"],"latest_commit_sha":null,"homepage":"https://malaysian-rojak-language-sentiment.onrender.com/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Wei-RongRong2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-08-10T20:43:20.000Z","updated_at":"2025-04-16T15:23:36.000Z","dependencies_parsed_at":"2024-09-21T14:12:42.166Z","dependency_job_id":null,"html_url":"https://github.com/Wei-RongRong2/RojakLanguageSentimentAnalysis","commit_stats":null,"previous_names":["wei-rongrong2/rojaklanguagesentimentanalysis"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Wei-RongRong2/RojakLanguageSentimentAnalysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wei-RongRong2%2FRojakLanguageSentimentAnalysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wei-RongRong2%2FRojakLanguageSentimentAnalysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wei-RongRong2%2FRojakLanguageSentimentAnalysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wei-RongRong2%2FRojakLanguageSentimentAnalysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wei-RongRong2","download_url":"https://codeload.github.com/Wei-RongRong2/RojakLanguageSentimentAnalysis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wei-RongRong2%2FRojakLanguageSentimentAnalysis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28562238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["code-mixing","code-switching","deep-learning","docker-image","flask-application","lstm","machine-learning","malaya-library","malaysian-language","multilingual-nlp","multinomial-naive-bayes","named-entity-recognition","natural-language-processing","render-deployment","sentiment-analysis","support-vector-machine"],"created_at":"2024-09-26T09:01:59.107Z","updated_at":"2026-01-19T06:02:25.106Z","avatar_url":"https://github.com/Wei-RongRong2.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RojakLanguageSentimentAnalysis\nThis is a machine learning project focused on analysing and classifying sentiments in code-switched and code-mixed text, specifically targeting the unique linguistic characteristics found in Malaysian conversations.\n\n## Table of Contents\n- [Introduction](#introduction)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Web Application](#web-application)\n- [GUI Application](#gui-application)\n- [Methodology](#methodology)\n- [Results](#results)\n- [Contributing](#contributing)\n- [License](#license)\n- [Contact](#contact)\n- [References](#references)\n\n## Introduction\n\nRojakLanguageSentimentAnalysis is a machine learning project designed to analyze and classify sentiments within code-switched and code-mixed text, specifically focusing on Malaysian linguistic patterns. This project tackles the unique challenges of multilingual sentiment analysis by employing both deep learning and traditional machine learning models, offering a comprehensive approach to understanding sentiments in a linguistically diverse context.\n\n## Installation\n\nTo set up the project environment, follow these steps:\n\n1. Clone the repository:\n    ```bash\n    git clone https://github.com/Wei-RongRong2/RojakLanguageSentimentAnalysis\n    ```\n2. Navigate to the project directory:\n    ```bash\n    cd RojakLanguageSentimentAnalysis\n    ```\n3. Install the required Python packages:\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n## Usage\n\nTo run the clustering analysis, follow these steps:\n\n1. Ensure you have Jupyter Notebook installed. If not, you can install it using:\n    ```bash\n    pip install notebook\n    ```\n\n2. Navigate to the project directory where the Jupyter Notebook is located:\n    ```bash\n    cd RojakLanguageSentimentAnalysis\n    ```\n\n3. Launch Jupyter Notebook:\n    ```bash\n    jupyter notebook\n    ```\n\n4. In the Jupyter Notebook interface, open the `RojakLanguageSentimentAnalysis.ipynb` file.\n\n5. Run the cells in the notebook to execute the clustering analysis.\n\n## Web Application\n\nThe `web_app` folder contains the code for the website development. This includes:\n\n- **app.py**: The Flask application used to serve the web application.\n- **templates/**: Contains the HTML, CSS, and JavaScript files that define the front-end of the web application.\n- **static/**: Contains static assets such as images.\n\n### Running the Web Application\n\nTo run the web application locally:\n\n1. Navigate to the `web_app` directory:\n    ```bash\n    cd web_app\n    ```\n2. Install the required Python packages:\n    ```bash\n    pip install -r requirements.txt\n    ```\n3. Run the Flask application:\n    ```bash\n    python app.py\n    ```\n\nThis will start the web application locally, and you can access it by navigating to `http://127.0.0.1:5000` in your web browser.\n\nThe web application is also deployed on Render and can be accessed online at [Malaysian Rojak Language Sentiment Analysis](https://malaysian-rojak-language-sentiment.onrender.com/).\n\n## GUI Application\n\nIn addition to the web application, you can also run a graphical user interface (GUI) application:\n\n1. Navigate to the `web_app` directory:\n    ```bash\n    cd web_app\n    ```\n2. Install `tkinter` if it's not already installed:\n    ```bash\n    pip install tk\n    ```\n3. Run the GUI application:\n    ```bash\n    python GUI_model_deployment.py\n    ```\n\nThis will launch a desktop application using Tkinter, providing an interface to make predictions.\n\n## Methodology\n\nThis project focused on sentiment analysis of Malaysian code-switched and code-mixed text, using data from Reddit and Hugging Face. Key steps included:\n\n### Data Collection\n\n- **Source:** A fusion of two datasets: a Reddit dataset from the Malaysia subreddit and a Twitter rojak dataset from [mesolitica](https://huggingface.co/mesolitica) on Hugging Face.\n- **Reddit Dataset:** Derived from the Malaysia subreddit using the Reddit API, capturing diverse discussions within the Malaysian community. The [Malaya](https://malaya.readthedocs.io/en/stable/) library was used to identify and gather Rojak languages.\n- **Twitter Rojak Dataset:** Sourced from Hugging Face's [language-detection-dataset](https://huggingface.co/datasets/mesolitica/language-detection-dataset/tree/main), focusing on Twitter Rojak records.\n\n### Preprocessing\n\n- **Data Cleaning:** Removed duplicates, converted emojis to text, expanded contractions, and handled reduplicated words. Noise, including URLs and usernames, was removed while retaining punctuation for segmentation.\n- **Segmentation \u0026 Tokenization:** Used Malaya HuggingFace for sentence segmentation and NLTK for tokenization, enabling precise analysis of code-switched text.\n- **Language Detection \u0026 Stemming:** Detected language at the word level with Malaya’s FastText; applied stemming/lemmatization based on language.\n- **Normalization:** Replaced abbreviations and removed redundant or non-standard words using regex rules.\n- **Named Entity Recognition (NER):** Applied NER using Malaya and SpaCy, with challenges in code-mixed text.\n- **Data Splitting:** Divided the data into training, validation, and test sets (70-15-15 ratio).\n- **Feature Extraction:** Used TF-IDF, PCA (95% variance), and Truncated SVD for dimensionality reduction.\n\n### Model Training\n\n1. **Multinomial Naive Bayes (MultinomialNB):** Utilized for text classification due to its efficiency with count-based features like word frequencies. Trained on TF-IDF features to capture text patterns.\n\n2. **Support Vector Machine (SVM):** Chosen for its ability to handle high-dimensional text data and its versatility in finding the optimal hyperplane in the TF-IDF feature space. Also trained on TruncatedSVD-reduced features for enhanced speed and robustness.\n\n3. **Long Short-Term Memory (LSTM):** A deep learning model used to capture sequential and long-range dependencies in text data. The LSTM-based neural network was designed to understand contextual flow and nuanced sentiment patterns.\n\n## Results\n\n### Model Evaluation Results\n\n1. **Multinomial Naive Bayes (MNB):**\n   - Improved accuracy, recall, and F1 score post-tuning, though precision slightly decreased, indicating more false positives.\n\n2. **Support Vector Machine (SVM):**\n   - No significant change after tuning, suggesting default parameters were optimal, showing stability in performance.\n\n3. **Truncated SVM:**\n   - Marginal changes in performance, indicating the model likely reached its peak with the given features.\n\n4. **Long Short-Term Memory (LSTM):**\n   - Significant improvements in all metrics post-tuning, highlighting its strength in capturing temporal dependencies and reducing overfitting.\n\n### Best Model Configuration\n\n- **Accuracy:** LSTM (65%) slightly outperformed SVM.\n- **Precision vs. Recall Balance:** LSTM provides the best balance.\n- **Complexity and Interpretability:** SVM and MNB are simpler to interpret and quicker to train, ideal for scenarios requiring interpretability or efficiency.\n\nFor a more detailed explanation of these steps and results, refer to the full report: [Report - Sentiment Analysis on Out-Of-Vocabulary (OOV) Malaysia Rojak Language.pdf](./Report%20-%20Sentiment%20Analysis%20on%20Out-Of-Vocabulary%20(OOV)%20Malaysia%20Rojak%20Language.pdf).\n\n## Contributing\n\nContributions are welcome! Please fork this repository, make your changes in a new branch, and submit a pull request for review.\n\n1. Fork the repo\n2. Create a feature branch (`git checkout -b feature-name`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin feature-name`)\n5. Create a new Pull Request\n\n## Acknowledgments\n\nThis project was developed in collaboration with [naruto sun](https://github.com/limjosun). We worked together on the sentiment analysis, model development, and project documentation.\n\n## License\n\nThis project is part of an academic course and is intended for educational purposes only. It may contain references to copyrighted materials, and the use of such materials is strictly for academic use. Please consult your instructor or institution for guidance on sharing or distributing this work.\n\nFor more details, see the [LICENSE](./LICENSE) file.\n\n## Contact\n\nCreated by [Wrrrrr](https://github.com/Wei-RongRong2) - feel free to contact me!  \nFor any inquiries, you can also reach out to [naruto sun](https://github.com/limjosun)\n\n## References\n\n- **Reddit Dataset:** [Reddit API](https://www.reddit.com/dev/api/)\n- **Twitter Rojak Dataset:** [Hugging Face - Mesolitica](https://huggingface.co/mesolitica)\n- **Natural Language Processing:** [Malaya Library Documentation](https://malaya.readthedocs.io/en/stable/)\n- **Machine Learning Algorithms:** [Scikit-Learn Documentation](https://scikit-learn.org/stable/)\n- **Evaluation Metrics:** Accuracy, Precision, Recall, F1 Score\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwei-rongrong2%2Frojaklanguagesentimentanalysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwei-rongrong2%2Frojaklanguagesentimentanalysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwei-rongrong2%2Frojaklanguagesentimentanalysis/lists"}