패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.0.9

dart_sentiment

Dart Sentiment은 AFINN-165 단어 목록과 이모지 감정 순위를 사용하여 임의의 입력 텍스트 블록에 대한 감성 분석을 수행하는 Dart 모듈입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
168
좋아요
36
Pub 점수
145

패키지 설치

flutter pub add dart_sentiment

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Dart Sentiment은 AFINN-165 단어 목록과 이모지 감성 순위를 사용하여 텍스트의 정서 분석을 수행하는 가벼운 Dart 패키지입니다. 입력 텍스트에 정서 점수를 할당하여 개발자가 사용자 생성 콘텐츠의 감정적 어조를 평가할 수 있도록 합니다. Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼을 지원하며 실시간 감성 평가가 필요한 크로스플랫폼 애플리케이션에 적합합니다. 핵심 Dart 라이브러리 외에는 외부 종속성이 없으며 간단하고 효율적으로 설계되었습니다.

사용 사례

  • 사용자 리뷰 분석
  • 소셜 미디어 감성 모니터링
  • 고객 피드백 평가
  • 채팅봇 응답 향상
  • 브랜드 인식 추적

주요 기능

  • AFINN-165 및 이모지 감정 데이터 사용
  • 크로스 플랫폼 호환성
  • 간단한 API 통합
  • 실시간 감정 점수
  • 외부 종속성 없음

적합한 대상

  • 모바일 및 웹 앱
  • 고객 경험 도구
  • 감정 기반 분석
  • 소셜 미디어 모니터링
  • 피드백 시스템

고려 사항

  • 사전에 정의된 어휘에 제한됨
  • 사용자 정의 감정 사전을 지원하지 않습니다
  • 맥락이나 비꼬는 말을 포착하지 못할 수 있음
  • 정확도는 입력 텍스트 스타일에 따라 달라집니다
  • 다국어 감정 분석에 적합하지 않습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Dart Sentiment

Flutter Community: dart_sentiment

pub package

AFINN-based sentiment analysis for dart

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:

  • 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';    
 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)); 

}  

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:

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]]
} 
  • Returned Objects
    • 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.

License

Dart Sentiment is released under
the MIT License

Credit

Dart Sentiment inspired by the Javascript
package sentiment

About me

I am India based flutter developer

pub package [](mailto:akashlilhare14@gmail.com) twitter website

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트