lexicon

package
v0.0.0-...-003d5aa Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: GPL-3.0 Imports: 0 Imported by: 9

Documentation

Index

Constants

View Source
const (
	// BoosterIncrease empirically derived mean sentiment intensity rating increase for booster words
	BoosterIncrease float64 = 0.293
	// BoosterDecrease empirically derived mean sentiment intensity rating increase for booster words
	BoosterDecrease float64 = -0.293
	// CapsIncrease empirically derived mean sentiment intensity rating increase for using ALLCAPs to emphasize a word
	CapsIncrease float64 = 0.733
	// NegationScalar empirically derived mean sentiment intensity reflection upon negating
	NegationScalar float64 = -0.74
)

Go port of vader sentiment analysis tool, source: Hutto, C.J. & Gilbert, E.E. (2014). VADER`: A Parsimonious Rule-based Model for Sentiment Analysis of Social Media Text. Eighth International Conference on Weblogs and Social Media (ICWSM-14). Ann Arbor, MI, June 2014.

Variables

View Source
var Boosters map[string]float64 = map[string]float64{"absolutely": BoosterIncrease, "amazingly": BoosterIncrease, "awfully": BoosterIncrease,
	"completely": BoosterIncrease, "considerable": BoosterIncrease, "considerably": BoosterIncrease,
	"decidedly": BoosterIncrease, "deeply": BoosterIncrease, "effing": BoosterIncrease, "enormous": BoosterIncrease, "enormously": BoosterIncrease,
	"entirely": BoosterIncrease, "especially": BoosterIncrease, "exceptional": BoosterIncrease, "exceptionally": BoosterIncrease,
	"extreme": BoosterIncrease, "extremely": BoosterIncrease,
	"fabulously": BoosterIncrease, "flipping": BoosterIncrease, "flippin": BoosterIncrease, "frackin": BoosterIncrease, "fracking": BoosterIncrease,
	"fricking": BoosterIncrease, "frickin": BoosterIncrease, "frigging": BoosterIncrease, "friggin": BoosterIncrease, "fully": BoosterIncrease,
	"fuckin": BoosterIncrease, "fucking": BoosterIncrease, "fuggin": BoosterIncrease, "fugging": BoosterIncrease,
	"greatly": BoosterIncrease, "hella": BoosterIncrease, "highly": BoosterIncrease, "hugely": BoosterIncrease,
	"incredible": BoosterIncrease, "incredibly": BoosterIncrease, "intensely": BoosterIncrease,
	"major": BoosterIncrease, "majorly": BoosterIncrease, "more": BoosterIncrease, "most": BoosterIncrease, "particularly": BoosterIncrease,
	"purely": BoosterIncrease, "quite": BoosterIncrease, "really": BoosterIncrease, "remarkably": BoosterIncrease,
	"so": BoosterIncrease, "substantially": BoosterIncrease,
	"thoroughly": BoosterIncrease, "total": BoosterIncrease, "totally": BoosterIncrease, "tremendous": BoosterIncrease, "tremendously": BoosterIncrease,
	"uber": BoosterIncrease, "unbelievably": BoosterIncrease, "unusually": BoosterIncrease, "utter": BoosterIncrease, "utterly": BoosterIncrease,
	"very":   BoosterIncrease,
	"almost": BoosterDecrease, "barely": BoosterDecrease, "hardly": BoosterDecrease, "just enough": BoosterDecrease,
	"kind of": BoosterDecrease, "kinda": BoosterDecrease, "kindof": BoosterDecrease, "kind-of": BoosterDecrease,
	"less": BoosterDecrease, "little": BoosterDecrease, "marginal": BoosterDecrease, "marginally": BoosterDecrease,
	"occasional": BoosterDecrease, "occasionally": BoosterDecrease, "partly": BoosterDecrease,
	"scarce": BoosterDecrease, "scarcely": BoosterDecrease, "slight": BoosterDecrease, "slightly": BoosterDecrease, "somewhat": BoosterDecrease,
	"sort of": BoosterDecrease, "sorta": BoosterDecrease, "sortof": BoosterDecrease, "sort-of": BoosterDecrease}

Boosters 'intensifiers' or 'degree adverbs' http://en.wiktionary.org/wiki/Category:English_degree_adverbs

View Source
var Contrasts map[string]bool = map[string]bool{"but": true, "although": true, "however": true, "yet": true}

Contrasts are idiomatic ways to indicate a contrasting idea

View Source
var DefaultLexicon = StaticLexicon{}

DefaultLexicon to look up on the static list provided by VADER

View Source
var NegateList = map[string]bool{"aint": true, "arent": true, "cannot": true, "cant": true, "couldnt": true, "darent": true, "didnt": true, "doesnt": true,
	"ain't": true, "aren't": true, "can't": true, "couldn't": true, "daren't": true, "didn't": true, "doesn't": true,
	"dont": true, "hadnt": true, "hasnt": true, "havent": true, "isnt": true, "mightnt": true, "mustnt": true, "neither": true,
	"don't": true, "hadn't": true, "hasn't": true, "haven't": true, "isn't": true, "mightn't": true, "mustn't": true,
	"neednt": true, "needn't": true, "never": true, "none": true, "nope": true, "nor": true, "not": true, "nothing": true, "nowhere": true,
	"oughtnt": true, "shant": true, "shouldnt": true, "uhuh": true, "wasnt": true, "werent": true,
	"oughtn't": true, "shan't": true, "shouldn't": true, "uh-uh": true, "wasn't": true, "weren't": true,
	"without": true, "wont": true, "wouldnt": true, "won't": true, "wouldn't": true, "rarely": true, "seldom": true, "despite": true}

NegateList words that are opposite

View Source
var Sentiments map[string]float64 = map[string]float64{}/* 7503 elements not displayed */

Sentiments as of 2018

Functions

This section is empty.

Types

type CustomLexicon

type CustomLexicon struct {
	//This just acts as the default lexicon based on static files
	NegateList map[string]bool
	Contrasts  map[string]bool
	Sentiments map[string]float64
	Boosters   map[string]float64
}

CustomLexicon can be used to create your own lexicon maps, and be used for mocking

func (*CustomLexicon) BoostValue

func (s *CustomLexicon) BoostValue(text string) float64

func (*CustomLexicon) IsContrast

func (s *CustomLexicon) IsContrast(text string) bool

func (*CustomLexicon) IsNegation

func (s *CustomLexicon) IsNegation(text string) bool

func (*CustomLexicon) Sentiment

func (s *CustomLexicon) Sentiment(text string) float64

type Lexicon

type Lexicon interface {
	// Negation words like aren't, ain't, wouldn't
	IsNegation(string) bool
	// Contrasting conjuctions like however, but, yet
	IsContrast(string) bool
	// Base sentiment value of a word, >0 is positive sentiment, <0 is negative sentiment, =0 no sentiment
	Sentiment(string) float64
	// value of a word, >0 is positive sentiment, <0 is negative sentiment, =0 no sentiment
	BoostValue(string) float64
}

type StaticLexicon

type StaticLexicon struct {
}

func (StaticLexicon) BoostValue

func (s StaticLexicon) BoostValue(text string) float64

func (StaticLexicon) IsContrast

func (s StaticLexicon) IsContrast(text string) bool

func (StaticLexicon) IsNegation

func (s StaticLexicon) IsNegation(text string) bool

func (StaticLexicon) Sentiment

func (s StaticLexicon) Sentiment(text string) float64

Jump to

Keyboard shortcuts

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