kotlin-tools / afinn

Sentiment analysis in Kotlin.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Afinn

Sentiment analysis in Kotlin.

Dictionaries included:

  • English Language 🇬🇧
  • Danish Language 🇩🇰
  • Emoticons :) :/ :(
  • Emojis 🤣 🤤 👿

Installation

Gradle

Add this line to your project's dependencies:

implementation("org.afinn:afinn:1.0.0")

Maven

Add the following dependency to your pom.xml file:

<dependency>
    <groupId>org.afinn</groupId>
    <artifactId>afinn</artifactId>
    <version>1.0.0</version>
</dependency>

Or install it yourself as:

$ mvn install org.afinn:afinn:1.0.0

Usage

import org.afinn.Afinn

val afinn = Afinn(language = "da", emoticons = true)
println(afinn.score("Hvis ikke det er det mest afskyelige flueknepperi..."))
// Output: -8.0

val afinnEnglish = Afinn(language = "en")
println(afinnEnglish.scoreToWords("I had a slow puncture that needed attending to and they took care of it very well. Friendly and efficient staff and a clean and tidy work area. Happy to recommend them and will use them in the future."))
// Output: "Positive"

Dictionaries

The dictionaries used in this repository are from a project by Finn Årup Nielsen: https://github.com/fnielsen/afinn/tree/master/afinn/data

For more information visit: http://corpustext.com/reference/sentiment_afinn.html

Paper with supplement: http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/6006/pdf/imm6006.pdf

Similar libraries in other programming languages

Contributing

Bug reports and pull requests are welcome on GitHub at Afinn GitHub Repository.

About

Sentiment analysis in Kotlin.

License:MIT License


Languages

Language:Kotlin 100.0%