{"id":13641394,"url":"https://github.com/mubaris/urban-robot","last_synced_at":"2025-07-01T13:33:48.392Z","repository":{"id":81717378,"uuid":"103646943","full_name":"mubaris/urban-robot","owner":"mubaris","description":"Reddit bot :computer: which replies to sarcastic comments :trollface: :trollface:","archived":false,"fork":false,"pushed_at":"2017-12-22T11:23:16.000Z","size":22540,"stargazers_count":34,"open_issues_count":3,"forks_count":15,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T11:04:23.022Z","etag":null,"topics":["bot","praw","python","reddit-bot","sarcasm","sentiment-analysis","svm"],"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/mubaris.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}},"created_at":"2017-09-15T10:52:57.000Z","updated_at":"2024-11-17T16:45:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"411d3092-79dc-45af-a038-be0968c76954","html_url":"https://github.com/mubaris/urban-robot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mubaris%2Furban-robot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mubaris%2Furban-robot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mubaris%2Furban-robot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mubaris%2Furban-robot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mubaris","download_url":"https://codeload.github.com/mubaris/urban-robot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247824154,"owners_count":21002217,"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":["bot","praw","python","reddit-bot","sarcasm","sentiment-analysis","svm"],"created_at":"2024-08-02T01:01:20.389Z","updated_at":"2025-04-08T10:32:30.817Z","avatar_url":"https://github.com/mubaris.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook"],"sub_categories":[],"readme":"# Urban Robot\n\n![Urban Robot](ub.png)\n\nReddit bot which replies to sarcastic comments\n\n\n## Libraries\n\n* numpy, scipy - For Mathematical and Scientific processes\n* nltk - NLP Application\n* scikit - Model Training and Feature Extraction\n* textblob - Sentiment Analysis\n* pickle - Pickling Models and Vectorizers\n* langdetect - Language Detection of comments\n* praw - Reddit Bot\n\n## Features Used\n\n* Sentiment Analysis of full text, equal 2 and 3 parts of text\n* n-grams - 1 to 5\n* Term Frequency–Inverse Document Frequency(TF-IFD) after stemming, tokenizing and using n-grams of 1 to 5\n* Part of Speech Dictionary Vector\n* Topic Modeling\n\n## Data Preprocessing\n\n* Removed URLs\n* Removed Stopwords\n* Removed words with less than 4 tokens\n\n## Model Training and Classification\n\nUsing above Features and Preprocessing 4 models are trained,\n\n* Logistic Regression\n* Linear SVM\n* SVM with Gaussian Kernel\n* Random Forest\n\nIf a comment is predicted as 'sarcastic' by 3 out 4 models, it is treated as sarcastic.\n\n## Files\n\n* `classifier.py` - Training and Testing Models\n* `bot.py` - Reddit Bot\n* `cli_bot.py` - A Command Line Interactive Interface for the Reddit Bot\n* `main.ipynb` - iPython Notebook led to the final model hypothesis\n\n## Running\n\n1. Register for new Reddit App [here](https://www.reddit.com/prefs/apps/) and fill details (username, password, client id, client secret) under name 'bot1' in `praw.ini`\n\n2. Run `classifier.py` with Python 3(Optional) or use pretrained models\n\n3. Run `bot.py` with Python 3 for the automated Reddit Bot\n\n4. Run `cli_bot.py` with Python 3 for an interactive version of the Reddit Bot.\n\nThat's it.\n\nLogs can accessed at `comment.log`\n\nHow to fill [praw.ini](https://praw.readthedocs.io/en/v4.0.0/getting_started/configuration/prawini.html)\n\nFinal accuracy of models are in `final_accuracy.txt`\n\n## Dataset\n\nDataset is available in `container`\n\nDownloaded from [here](https://nlds.soe.ucsc.edu/sarcasm1)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmubaris%2Furban-robot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmubaris%2Furban-robot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmubaris%2Furban-robot/lists"}