dart_sentiment
डार्ट सेंटिमेंट एक डार्ट मॉड्यूल है जो एफिन-165 शब्द सूची और इमोजी सेंटिमेंट रैंकिंग का उपयोग करके आर्बिट्रेट इनपुट टेक्स्ट ब्लॉक पर सेंटिमेंट विश्लेषण करता है।
डार्ट सेंटिमेंट एक डार्ट मॉड्यूल है जो एफिन-165 शब्द सूची और इमोजी सेंटिमेंट रैंकिंग का उपयोग करके आर्बिट्रेट इनपुट टेक्स्ट ब्लॉक पर सेंटिमेंट विश्लेषण करता है।
{"sdk":"flutter"}^0.0.6{"sdk":"flutter"}^1.0.0यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।
Flutter Community: dart_sentiment
pub package https://img.shields.io/badge/PRs-welcome-brightgreen.svg
Dart Sentiment is a dart package that uses
the AFINN-165
wordlist
and Emoji Sentiment Ranking
to perform sentiment analysis on arbitrary
blocks of input text. Dart Sentiment provides several things:
add following dependency to your pubspec.yaml
dependencies:
dart_sentiment: <latest-version>
import 'package:dart_sentiment/dart_sentiment.dart';
void main() {
final sentiment = Sentiment();
print(sentiment.analysis("The cake she made was terrible 😐"));
print(sentiment.analysis("The cake she made was terrible 😐", emoji: true));
print(sentiment.analysis("I love cats, but I am allergic to them.",));
print(sentiment.analysis("J'adore les chats, mais j'y suis allergique.",
languageCode: LanguageCode.french));
print(sentiment.analysis("Le gâteau qu'elle a fait était horrible 😐",
emoji: true, languageCode: LanguageCode.french));
}
| Param | Description |
|---|---|
String text |
Input phrase to analyze |
bool emoji = false |
Input emoji is present in the phrase to analyze |
LanguageCode languageCode = LanguageCode.english |
Language to use for sentiment analysis. LanguageCode { english, italian, french, german } |
AFINN is a list of words rated for valence with an integer between minus five (negative) and plus
five (positive). Sentiment analysis is performed by cross-checking the string tokens (words, emojis)
with the AFINN list and getting their respective scores. The comparative score is
simply: sum of each token / number of tokens. So for example let's take the following:
I love cats, but I am allergic to them.
That string results in the following:
{
score: 1,
comparative: 0.1111111111111111,
tokens: [
"i",
"love",
"cats",
"but",
"i",
"am",
"allergic",
"to",
"them"
],
positive: [[love, 3]],
negative: [[allergic, 2]]
}
In this case, love has a value of 3, allergic has a value of -2, and the remaining tokens are
neutral with a value of 0. Because the string has 9 tokens the resulting comparative score looks
like: (3 + -2) / 9 = 0.111111111
This approach leaves you with a mid-point of 0 and the upper and lower bounds are constrained to
positive and negative 5 respectively. For example, let's imagine an incredibly "positive" string
with 200 tokens and where each token has an AFINN score of 5. Our resulting comparative score would
look like this:
(max positive score * number of tokens) / number of tokens (5 * 200) / 200 = 5
If you have any suggestions, improvements or issues, feel free to contribute to this project. You
can either submit a new issue or propose a pull request. Direct your pull requests into the dev
branch.
Dart Sentiment is released under
the MIT License
Dart Sentiment inspired by the Javascript
package sentiment
I am India based flutter developer
pub package [https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white](mailto:akashlilhare14@gmail.com) twitter website