{"id":13484272,"url":"https://github.com/7compass/sentimental","last_synced_at":"2025-03-27T16:30:40.438Z","repository":{"id":7738638,"uuid":"9105346","full_name":"7compass/sentimental","owner":"7compass","description":"Simple sentiment analysis with Ruby","archived":false,"fork":false,"pushed_at":"2019-05-10T17:37:24.000Z","size":382,"stargazers_count":465,"open_issues_count":5,"forks_count":71,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-03-20T06:45:43.606Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/7compass.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-29T19:45:19.000Z","updated_at":"2024-12-12T14:54:36.000Z","dependencies_parsed_at":"2022-07-08T03:20:28.193Z","dependency_job_id":null,"html_url":"https://github.com/7compass/sentimental","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7compass%2Fsentimental","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7compass%2Fsentimental/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7compass%2Fsentimental/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7compass%2Fsentimental/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/7compass","download_url":"https://codeload.github.com/7compass/sentimental/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245882217,"owners_count":20687852,"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-07-31T17:01:21.649Z","updated_at":"2025-03-27T16:30:39.305Z","avatar_url":"https://github.com/7compass.png","language":"Ruby","readme":"# sentimental\n\nSimple sentiment analysis with Ruby\n\n## How it works\n\nSentences are tokenized and tokens are assigned a numerical score\nfor their average sentiment.  The total score is then used to\ndetermine the overall sentiment in relation to the threshold.\n\nFor example, the default threshold is 0.0.  If a sentence has\na score of 0, it is deemed \"neutral\".  Higher than the thresold\nis \"positive\", lower is \"negative\".\n\nIf you set the threshold to a non-zero amount, e.g. 0.25:\n\n- Positive scores are \u003e 0.25\n- Neutral scores are -0.25 - 0.25\n- Negative scores are \u003c -0.25\n\n\n## Usage\n\n```ruby\n\n# Create an instance for usage\nanalyzer = Sentimental.new\n\n# Load the default sentiment dictionaries\nanalyzer.load_defaults\n\n# And/or load your own dictionaries\nanalyzer.load_senti_file('path/to/your/file.txt')\n\n# Set a global threshold\nanalyzer.threshold = 0.1\n\n# Use your analyzer\nanalyzer.sentiment 'I love ruby'\n#=\u003e :positive\n\nanalyzer.sentiment 'I like ruby'\n#=\u003e :neutral\n\nanalyzer.sentiment 'I really like ruby'\n#=\u003e :positive\n\n# You can make new analyzers with individual thresholds:\nanalyzer = Sentimental.new(threshold: 0.9)\nanalyzer.sentiment 'I love ruby'\n#=\u003e :positive\n\nanalyzer.sentiment 'I like ruby'\n#=\u003e :neutral\n\nanalyzer.sentiment 'I really like ruby'\n#=\u003e :neutral\n\n# Get the numerical score of a string:\nanalyzer.score 'I love ruby'\n#=\u003e 0.925\n\n```\n\n## Sentiment dictionaries\n\nThese are currently plain-text files containing whitespace-separated\nscores and tokens, e.g.:\n\n    1.0 Awesome\n    0.0 Meh\n    -1.0 Horrible\n\n## N-grams\n\nYou can parse n-grams of words by specifying their max size in the initializer:\n```\n  Sentimental.new(ngrams: 4)\n```\n\nThe dictionary must have this format:\n\n    1.0 very happy\n    -2.0 no\n    0.0 meh\n\n## Installation\n\n    gem install sentimental\n\n## License\n\nMIT License\n\n## Credits\n\nBased largely on Christopher MacLellan's script:\nhttps://github.com/cmaclell/Basic-Tweet-Sentiment-Analyzer\n\n## Changes\n- 2013-10-13 Adding :-) to slang\n\n\n","funding_links":[],"categories":["Open Source Implementations","Natural Language Processing"],"sub_categories":["Ruby"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F7compass%2Fsentimental","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F7compass%2Fsentimental","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F7compass%2Fsentimental/lists"}