Dart Sentiment ist ein Dart-Modul, das die AFINN-165-Wortliste und die Emoji-Sentiment-Rangliste verwendet, um eine Stimmungsanalyse auf beliebigen Eingabetextblöcken durchzuführen.
Aus öffentlichen Paketdaten erstellte Orientierung.
Dart Sentiment ist ein leichtgewichtiges Dart-Paket, das die Stimmungsanalyse von Texten mithilfe der AFINN-165-Wortliste und des Emoji-Sentiment-Rankings durchführt. Es weist Eingabetexten Stimmungswerte zu, wodurch Entwickler den emotionalen Ton in benutzererzeugtem Inhalt bewerten können. Das Paket unterstützt mehrere Plattformen wie Android, iOS, Web, macOS, Windows und Linux und ist daher ideal für plattformübergreifende Anwendungen, die eine Echtzeit-Stimmungsanalyse erfordern. Es ist einfach und effizient gestaltet und hat keine externen Abhängigkeiten außer den Kern-Dart-Bibliotheken.
Anwendungsfälle
Analyse von Nutzerbewertungen
Überwachung der Stimmung in sozialen Medien
Kundenfeedback bewerten
Verbesserung der Chatbot-Antworten
Markenwahrnehmung verfolgen
Hauptmerkmale
Verwendet AFINN-165 und Emoji-Sentiment-Daten
Plattformübergreifende Kompatibilität
Einfache API-Integration
Echtzeit-Gefühlsbewertung
Keine externen Abhängigkeiten
Geeignet für
Mobile und Web-Apps
Tools für Kundenerfahrung
Gefühlsgetriebene Analytik
Social Media Monitoring
Feedback-Systeme
Hinweise
Beschränkt auf vordefinierte Lexika
Unterstützt keine benutzerdefinierten Sentiment-Wörterbücher
Kann Kontext oder Sarkasmus möglicherweise nicht erfassen
Die Genauigkeit hängt vom Eingabetextstil ab
Nicht geeignet für die mehrsprachige Sentimentanalyse
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
Provide Language support for English, Italian, French and German.
Provide support for various emojis.
Based on analysis of text, provide an integer value in the range -n to +n (see details below)
Installation
add following dependency to your pubspec.yaml
dependencies:dart_sentiment:<latest-version>
Example
import'package:dart_sentiment/dart_sentiment.dart';
voidmain() {
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));
}
Function defination
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 }
How it works
AFINN
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:
Score: Score calculated by adding the sentiment values of recognized words.
Comparative: Comparative score of the input string.
Token: All the tokens like words or emojis found in the input string.
Words: List of words from input string that were found in AFINN list.
Positive: List of positive words in input string that were found in AFINN list.
Negative: List of negative words in input string that were found in AFINN list.
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
Contribute
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.