package module
Version: v0.0.0-...-68ffa1d Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2022 License: MIT Imports: 9 Imported by: 4



GoDoc Go Report BuildStatus Mentioned in Awesome Go codecov

GoVader: Vader sentiment analysis in Go

This is a port of from Python to Go.

There are tests which check it gives the same answers as the original package.


import (

analyzer := govader.NewSentimentIntensityAnalyzer()
sentiment := analyzer.PolarityScores("Usage is similar to all the other ports.")

fmt.Println("Compound score:", sentiment.Compound)
fmt.Println("Positive score:", sentiment.Positive)
fmt.Println("Neutral score:", sentiment.Neutral)
fmt.Println("Negative score:", sentiment.Negative)

A server wrapper is available in



Package govader implements the vader sentiment analysis algorithm see



This section is empty.


This section is empty.


This section is empty.


type PythonesqueRegex

type PythonesqueRegex struct {
	LowerRegex        *regexp.Regexp
	UpperRegex        *regexp.Regexp
	PunctuationRegex  *regexp.Regexp
	PunctuationString string

PythonesqueRegex holds all the regex needed to replicate python string manipulation behaviors

func NewPythonesqueRegex

func NewPythonesqueRegex() *PythonesqueRegex

NewPythonesqueRegex builds a new set of regex

type SentiText

type SentiText struct {
	Text                   string
	WordsAndEmoticons      []string
	WordsAndEmoticonsLower []string
	IsCapDiff              bool

SentiText holds sentiment-relevant string-level properties of input text.

func NewSentiText

func NewSentiText(text string, pr *PythonesqueRegex) *SentiText

NewSentiText initliazes and returns a fleshed-out SentiText.

type Sentiment

type Sentiment struct {
	Negative float64
	Neutral  float64
	Positive float64
	Compound float64

Sentiment encapsulates a single sentiment measure for a statement

type SentimentIntensityAnalyzer

type SentimentIntensityAnalyzer struct {
	Lexicon   map[string]float64
	EmojiDict map[string]string
	Constants *TermConstants

SentimentIntensityAnalyzer computes sentiment intensity scores for sentences.

func NewSentimentIntensityAnalyzer

func NewSentimentIntensityAnalyzer() *SentimentIntensityAnalyzer

NewSentimentIntensityAnalyzer constructs and initializes an analyzer for computing intensity scores to sentences.

func (*SentimentIntensityAnalyzer) PolarityScores

func (sia *SentimentIntensityAnalyzer) PolarityScores(text string) Sentiment

PolarityScores returns a score for sentiment strength based on the input text. Positive values are positive valence, negative value are negative valence.

type TermConstants

type TermConstants struct {
	NegateList        []string
	BoosterDict       map[string]float64
	LadenIdioms       map[string]float64
	SpecialCaseIdioms map[string]float64
	Regex             *PythonesqueRegex

TermConstants contains the large list and dictionary constants

func NewTermConstants

func NewTermConstants() *TermConstants

NewTermConstants assembles a fully-populated constant struct


Path Synopsis
Package data Code generated by go-bindata.
Package data Code generated by go-bindata.
Package main provides a simple sentiment scoring example.
Package main provides a simple sentiment scoring example.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL