{"id":20147274,"url":"https://github.com/machphy/twitter_sentiment_analysis","last_synced_at":"2025-11-07T13:03:39.438Z","repository":{"id":249428676,"uuid":"831489888","full_name":"machphy/twitter_sentiment_analysis","owner":"machphy","description":"Classify tweets as positive or negative using the Naive Bayes classifier with NLTK. This project processes tweets from the `twitter_samples` dataset, extracts features, and trains a sentiment analysis model. ","archived":false,"fork":false,"pushed_at":"2024-07-20T18:24:57.000Z","size":892,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T11:15:55.783Z","etag":null,"topics":["api","nltk-library","pickle-file","python","twitter","twitter-api","webpage"],"latest_commit_sha":null,"homepage":"","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/machphy.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-07-20T17:47:55.000Z","updated_at":"2024-09-03T17:27:03.000Z","dependencies_parsed_at":"2024-07-20T19:04:32.456Z","dependency_job_id":null,"html_url":"https://github.com/machphy/twitter_sentiment_analysis","commit_stats":null,"previous_names":["machphy/-twitter_sentiment_analysis"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machphy%2Ftwitter_sentiment_analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machphy%2Ftwitter_sentiment_analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machphy%2Ftwitter_sentiment_analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machphy%2Ftwitter_sentiment_analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/machphy","download_url":"https://codeload.github.com/machphy/twitter_sentiment_analysis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241587803,"owners_count":19986628,"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":["api","nltk-library","pickle-file","python","twitter","twitter-api","webpage"],"created_at":"2024-11-13T22:28:17.144Z","updated_at":"2025-11-07T13:03:34.407Z","avatar_url":"https://github.com/machphy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Twitter Sentiment Analysis\n\nPerform sentiment analysis on Twitter data using the Naive Bayes classifier and NLTK.\n\n\n\n## Introduction\n\nThis project uses machine learning techniques to classify tweets as positive or negative. It leverages the NLTK library for natural language processing and the Naive Bayes classifier for sentiment analysis.\n\n## How It Works\n\n1. **Data Collection**: Utilizes the `twitter_samples` dataset from NLTK, which includes positive and negative tweets.\n2. **Data Preprocessing**: Tokenizes tweets and removes usernames.\n3. **Feature Extraction**: Incorporates bigram collocations to enhance feature representation.\n4. **Model Training**: Trains a Naive Bayes classifier using the processed tweets.\n5. **Model Evaluation**: Tests the classifier and calculates its accuracy.\n\n## Technologies Used\n\n- **Python**: The programming language used.\n- **NLTK**: Natural Language Toolkit for text processing.\n- **Naive Bayes Classifier**: A probabilistic classifier for sentiment analysis.\n\n## Setup\n\n**Install Dependencies**:\n   `bash\n   pip install nltk\n\n**Download NLTK Data:**\n**Open a Python interpreter and run:**\n\n**python**\nCopy code\nimport nltk\nnltk.download('twitter_samples')\nnltk.download('punkt')\nRun the Script:\nSave the provided script in a file named twitter_sentiment_analysis.py and execute it:\n\nbash\nCopy code\npython twitter_sentiment_analysis.py\n\n**Accuracy**\nThe classifier's accuracy is printed at the end of the script execution.\n*99.15\n\n\n**License**\n© 2024 Rajeev Sharma (rajeevsharmamachphy@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachphy%2Ftwitter_sentiment_analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmachphy%2Ftwitter_sentiment_analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachphy%2Ftwitter_sentiment_analysis/lists"}