搜索插件、代码仓与 APP 分类

插件详情v0.0.5

sentiment_dart

Sentiment Dart 是一个 Dart 模块,使用 AFINN-165 词表对任意文本块进行情感分析。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1540
喜欢数
19
Pub 分数
150

安装插件

flutter pub add sentiment_dart

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Sentiment Dart 是一个轻量级的 Dart 包,使用 AFINN-165 词表对文本进行情感分析,根据词语的情感极性分配数值评分。它使开发者能够快速评估用户输入、评论或社交媒体内容的情感,适用于跨平台的 Flutter 应用程序。该包易于集成,无需外部 API 即可实现基本的情感检测。支持 Android、iOS、Web、macOS、Windows 和 Linux,适用于多种跨平台场景。

适合场景

  • 分析用户评论
  • 监控社交媒体情绪
  • 评估客户反馈
  • 检测聊天消息中的情绪
  • 内容审核

主要特点

  • 使用 AFINN-165 词表
  • 轻便且快速
  • 跨平台支持
  • 简单 API 集成
  • 无外部依赖

适合对象

  • 基本情感分析
  • 带有文本输入的 Flutter 应用
  • 实时反馈系统
  • 教育项目
  • 低延迟情感检查

使用建议

  • 限于预定义的单词得分
  • 无深度学习或上下文感知
  • 可能无法处理讽刺或复杂的语言细微差别
  • 不适合高精度企业使用场景

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

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

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。