{"id":18075634,"url":"https://github.com/aneeshmurali-n/nlp-emotion-classification-in-text","last_synced_at":"2026-05-10T06:45:49.642Z","repository":{"id":258291791,"uuid":"871332440","full_name":"aneeshmurali-n/NLP-Emotion-Classification-in-Text","owner":"aneeshmurali-n","description":"Develop machine learning models to classify emotions in text samples.","archived":false,"fork":false,"pushed_at":"2024-10-16T18:02:38.000Z","size":1706,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-11T17:57:23.875Z","etag":null,"topics":["bag-of-words","data","emotion-classification","feature-extraction","machine-learning","naive-bayes","natural-language-processing","nlp","nltk","preprocessing","python","scikit-learn","svm","text-classification","tf-idf","tokenizer","vectorizer"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aneeshmurali-n.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-10-11T18:30:11.000Z","updated_at":"2024-10-16T18:02:42.000Z","dependencies_parsed_at":"2024-10-21T11:37:10.440Z","dependency_job_id":null,"html_url":"https://github.com/aneeshmurali-n/NLP-Emotion-Classification-in-Text","commit_stats":null,"previous_names":["aneeshmurali-n/nlp-emotion-classification-in-text"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshmurali-n%2FNLP-Emotion-Classification-in-Text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshmurali-n%2FNLP-Emotion-Classification-in-Text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshmurali-n%2FNLP-Emotion-Classification-in-Text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshmurali-n%2FNLP-Emotion-Classification-in-Text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aneeshmurali-n","download_url":"https://codeload.github.com/aneeshmurali-n/NLP-Emotion-Classification-in-Text/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393541,"owners_count":20931809,"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":["bag-of-words","data","emotion-classification","feature-extraction","machine-learning","naive-bayes","natural-language-processing","nlp","nltk","preprocessing","python","scikit-learn","svm","text-classification","tf-idf","tokenizer","vectorizer"],"created_at":"2024-10-31T11:06:44.996Z","updated_at":"2026-05-10T06:45:49.613Z","avatar_url":"https://github.com/aneeshmurali-n.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NLP Emotion Classification in Text\n\nThis project focuses on classifying emotions (fear, anger, joy) in text comments using Natural Language Processing (NLP) techniques and machine learning models.\n\n## Project Overview\n\nThe project involves the following steps:\n\n1. **Data Loading and Preprocessing:** Loads a dataset of comments and emotions, cleans the text by removing unnecessary characters and converting to lowercase, and tokenizes the text into individual words.\n2. **Feature Extraction:** Creates numerical representations of the text using the Bag-of-Words (BoW) and TF-IDF methods.\n3. **Model Development:** Trains two machine learning models - Naive Bayes and Support Vector Machine (SVM) - using the extracted features and emotion labels.\n4. **Model Evaluation and Comparison:** Evaluates the performance of both models using metrics like accuracy, precision, recall, and F1-score, and compares their results.\n\n## Results\n\nThe SVM classifier with BoW achieved the highest accuracy (91.7%) and demonstrated superior performance across various evaluation metrics. It is identified as the most suitable model for emotion classification in this project.\n\n| Model | Accuracy | Precision (macro avg) | Recall (macro avg) | F1-score (macro avg) |\n|---|---|---|---|---|\n| SVM classifier with bow | 0.9166 | 0.92 | 0.92 | 0.92 |\n| SVM classifier with TF-IDF | 0.9141 | 0.92 | 0.91 | 0.91 |\n| Naive Bayes classifier with bow | 0.8905 | 0.89 | 0.89 | 0.89 |\n| Naive Bayes classifier with TF-IDF | 0.8947 | 0.90 | 0.89 | 0.89 |\n\n## Usage\n\nTo run this project:\n\nSimply [Open Project in Google Colab](https://colab.research.google.com/github/aneeshmurali-n/NLP-Emotion-Classification-in-Text/blob/main/NLP_Emotion_Classification_in_Text.ipynb)\n\nOtherwise:\n1. Clone the repository.\n2. Install the required libraries: `nltk`, `pandas`, `scikit-learn`.\n3. Execute the Jupyter Notebook provided in the repository.\n\n## Dataset\n\nThe dataset used in this project is located in this repository:  `nlp_dataset.csv`.\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faneeshmurali-n%2Fnlp-emotion-classification-in-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faneeshmurali-n%2Fnlp-emotion-classification-in-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faneeshmurali-n%2Fnlp-emotion-classification-in-text/lists"}