Sentiment analyzer using sentiwordnet lexicon in Go. This library produce sentiment score for each word, including positive, negative, and objective score.
First of all, download and install Go 1.14
or higher is required.
Install this library using the go get
command:
$ go get github.com/dinopuguh/gosentiwordnet/v2
package main
import (
"fmt"
goswn "github.com/dinopuguh/gosentiwordnet/v2"
)
func main() {
sa := goswn.New()
scores, exist := sa.GetSentimentScore("love", "v", "2")
if exist {
fmt.Println("๐ฌ Sentiment score:", scores) // => ๐ฌ Sentiment score: {1 0 0}
}
}
The GetSentimentScore
required 3 parameters(word, pos-tag, and word usage):
- Word: the word want to process
- POS tag: part-of-speech tag of the word
- Word usage: 1 for most common usage and a higher number would indicate lesser common usages
If you want to say thank you and/or support the active development of Gosentiwordnet
:
- Add a GitHub Star to the project.
- Write a review or tutorial on Medium, Dev.to or personal blog.
- Be a part of our sponsors to support this project.
- Dino Puguh (initial works)
Open for any pull requests to develop this project.