Search packages, repositories and app categories

GitHub repositorybuckthorndev/sentiment_dart

sentiment_dart

Sentiment Dart is a dart module that uses the AFINN-165 wordlist and Emoji Sentiment Ranking to perform sentiment analysis on arbitrary blocks of input text. Sentiment Dart heavily inspired by the Javascript package sentiment

sentiment_dart project cover
Stars
10
Forks
7
Last push (UTC)
Mar 11, 2022
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

Sentiment Dart

Sentiment Dart is a dart module that uses the AFINN-165 wordlist and Emoji Sentiment Ranking to perform sentiment analysis on arbitrary blocks of input text. Sentiment Dart heavily inspired by the Javascript package sentiment

Usage

import 'package:sentiment_dart/sentiment_dart.dart';

main() {
  void main() {

  print(Sentiment.analysis('i hate you piece of shit 💩'));

  print(Sentiment.analysis('i hate you piece of shit 💩',emoji: true));
}
}

output

{score: -7, comparative: -1.1666666666666667, words: [i, hate, you, piece, of, shit], good words: [], badword: [[hate, -3], [shit, -4]]}

{score: -8, comparative: -1.1428571428571428, words: [i, hate, you, piece, of, shit, 💩], good words: [], badword: [[hate, -3], [shit, -4], [💩, -1]]}
Other language

example

import 'package:sentiment_dart/sentiment_dart.dart';

main() {
  void main() {


  print(Sentiment.analysis('ti odio un pezzo di merda 💩',languageCode: 'it'));

  print(Sentiment.analysis('ti odio un pezzo di merda 💩',emoji: true,languageCode: 'it'));

}
}

output

{score: -7, comparative: -1.1666666666666667, words: [ti, odio, un, pezzo, di, merda], good words: [], badword: [[odio, -3], [merda, -4]]}

{score: -8, comparative: -1.1428571428571428, words: [ti, odio, un, pezzo, di, merda, 💩], good words: [], badword: [[odio, -3], [merda, -4], [💩, -1]]}
Custom language

example

import 'package:sentiment_dart/sentiment_dart.dart';

main() {
  void main() {


  var customLang = {'i': 1, 'love': 1, 'dart': 5,'car':2};
  print(Sentiment.analysis('i love dart',customLang: customLang));
}
}

output

{score: 7, comparative: 2.3333333333333335, words: [i, love, dart], good words: [[i, 1], [love, 1], [dart, 5]], badword: []}

How it works ?

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.

source

Languages and code

language code
English en
Italian it
french fr
german de

Contribution 🤓

Happy 😍 to recieve or provide contributions related to this package.

Features and bugs 🐛

Please file feature requests and bugs at the issue tracker.

Contact 📧

if you have any questions , feel free to wite us on

Buckthorn GitHub avatar
GitHub author

Buckthorn ↗

Pushing the possibilities of the Internet

LanguagesDart

Categories

Packages published by this repository

Dependencies used

Dependency list 3 items

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗