{"id":32296627,"url":"https://github.com/akashlilhare/dart_sentiment","last_synced_at":"2026-02-23T19:06:02.426Z","repository":{"id":56827770,"uuid":"423284617","full_name":"akashlilhare/dart_sentiment","owner":"akashlilhare","description":"Dart Sentiment is a dart module that uses the AFINN-165 wordlist and Emoji Sentiment Ranking to perform sentiment analysis on arbitrary blocks of input text.","archived":false,"fork":false,"pushed_at":"2023-05-23T14:09:33.000Z","size":261,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-10-06T17:53:09.741Z","etag":null,"topics":["afinn","analysis","dart","flutter","nlp","sentiment","sentiment-analysis"],"latest_commit_sha":null,"homepage":"","language":"Dart","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/akashlilhare.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-31T23:36:41.000Z","updated_at":"2023-05-30T08:24:07.000Z","dependencies_parsed_at":"2022-08-28T21:10:25.717Z","dependency_job_id":null,"html_url":"https://github.com/akashlilhare/dart_sentiment","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/akashlilhare/dart_sentiment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashlilhare%2Fdart_sentiment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashlilhare%2Fdart_sentiment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashlilhare%2Fdart_sentiment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashlilhare%2Fdart_sentiment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akashlilhare","download_url":"https://codeload.github.com/akashlilhare/dart_sentiment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashlilhare%2Fdart_sentiment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29751860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: 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":["afinn","analysis","dart","flutter","nlp","sentiment","sentiment-analysis"],"created_at":"2025-10-23T04:13:11.747Z","updated_at":"2026-02-23T19:06:02.414Z","avatar_url":"https://github.com/akashlilhare.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n# Dart Sentiment\n\n![Flutter Community: dart_sentiment](https://fluttercommunity.dev/_github/header/dart_sentiment)\n\n\n![pub package](https://img.shields.io/pub/v/dart_sentiment.svg)      ![](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)\n\n\n#### AFINN-based sentiment analysis for dart\n\nDart Sentiment is a dart package that uses  \nthe  [AFINN-165](https://github.com/fnielsen/afinn/blob/master/afinn/data/AFINN-en-165.txt)  \nwordlist  \nand  [Emoji Sentiment Ranking](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0144296)  \nto perform  [sentiment analysis](https://en.wikipedia.org/wiki/Sentiment_analysis)  on arbitrary  \nblocks of input text. Dart Sentiment provides several things:\n- Provide Language support for English, Italian, French and German.\n- Provide support for various emojis.\n- Based on analysis of text, provide an integer value in the range -n to +n (see details below)\n\n## Installation\nadd following dependency to your `pubspec.yaml`\n```yaml  \n  \ndependencies:    \n   dart_sentiment: \u003clatest-version\u003e  \n   \n ```   \n## Example\n```dart\n\n import 'package:dart_sentiment/dart_sentiment.dart';    \n void main() {\n \n\t final sentiment = Sentiment();    \n    \n\t print(sentiment.analysis(\"The cake she made was terrible 😐\"));    \n    \n\t print(sentiment.analysis(\"The cake she made was terrible 😐\", emoji: true));    \n    \n\t print(sentiment.analysis(\"I love cats, but I am allergic to them.\",));    \n    \n\t print(sentiment.analysis(\"J'adore les chats, mais j'y suis allergique.\",    \n\t languageCode: LanguageCode.french));    \n    \n\tprint(sentiment.analysis(\"Le gâteau qu'elle a fait était horrible 😐\",    \n\temoji: true, languageCode: LanguageCode.french)); \n\n}  \n\n```\n### Function defination\nParam | Description\n-------- | ----- \n`String text` | Input phrase to analyze\n`bool emoji = false` | Input emoji is present in the phrase to analyze\n`LanguageCode languageCode = LanguageCode.english` |Language to use for sentiment analysis. ` LanguageCode { english, italian, french, german }`\n\n## How it works\n\n### AFINN\n\nAFINN is a list of words rated for valence with an integer between minus five (negative) and plus  \nfive (positive). Sentiment analysis is performed by cross-checking the string tokens (words, emojis)  \nwith the AFINN list and getting their respective scores. The comparative score is  \nsimply:  `sum of each token / number of tokens`. So for example let's take the following:\n\n`I love cats, but I am allergic to them.`\n\nThat string results in the following:\n\n```dart\n{\n    score: 1, \n\tcomparative: 0.1111111111111111,  \n    tokens: [    \n       \"i\",    \n       \"love\",    \n       \"cats\",    \n       \"but\",    \n       \"i\",    \n       \"am\",    \n       \"allergic\",    \n       \"to\",    \n       \"them\"    \n    ],\n    positive: [[love, 3]], \n    negative: [[allergic, 2]]\n} \n``` \n- Returned Objects\n  - **Score**: Score calculated by adding the sentiment values of recognized words.\n  - **Comparative**: Comparative score of the input string.\n  - **Token**: All the tokens like words or emojis found in the input string.\n  - **Words**: List of words from input string that were found in AFINN list.\n  - **Positive**: List of positive words in input string that were found in AFINN list.\n  - **Negative**: List of negative words in input string that were found in AFINN list.\n\nIn this case, love has a value of 3, allergic has a value of -2, and the remaining tokens are  \nneutral with a value of 0. Because the string has 9 tokens the resulting comparative score looks  \nlike:  `(3 + -2) / 9 = 0.111111111`\n\nThis approach leaves you with a mid-point of 0 and the upper and lower bounds are constrained to  \npositive and negative 5 respectively. For example, let's imagine an incredibly \"positive\" string  \nwith 200 tokens and where each token has an AFINN score of 5. Our resulting comparative score would  \nlook like this:\n\n``` (max positive score * number of tokens) / number of tokens (5 * 200) / 200 = 5 ```\n\n## Contribute\n\nIf you have any suggestions, improvements or issues, feel free to contribute to this project. You  \ncan either submit a new issue or propose a pull request. Direct your pull requests into the dev  \nbranch.\n\n## License\n\nDart Sentiment is released under  \nthe  [MIT License](https://github.com/akashlilhare/dart_sentiment/blob/main/LICENSE)\n\n## Credit\n\nDart Sentiment inspired by the Javascript  \npackage [sentiment](https://www.npmjs.com/package/sentiment)\n\n## About me\n\nI am India based flutter developer\n\n[![pub package](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white)](https://www.linkedin.com/in/akash-lilhare-739a80192)   [![](https://img.shields.io/badge/Gmail-D14836?style=for-the-badge\u0026logo=gmail\u0026logoColor=white)](mailto:akashlilhare14@gmail.com) [![twitter](https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge\u0026logo=twitter\u0026logoColor=white)](https://twitter.com/akash__lilhare) [![website](https://img.shields.io/badge/website-000000?style=for-the-badge\u0026logo=About.me\u0026logoColor=white)](https://akash-lilhare.netlify.app)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakashlilhare%2Fdart_sentiment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakashlilhare%2Fdart_sentiment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakashlilhare%2Fdart_sentiment/lists"}