Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BoosterMap = map[string]float64{"absolutely": bIncr, "amazingly": bIncr, "awfully": bIncr, "completely": bIncr, "considerably": bIncr,
"decidedly": bIncr, "deeply": bIncr, "effing": bIncr, "enormously": bIncr,
"entirely": bIncr, "especially": bIncr, "exceptionally": bIncr, "extremely": bIncr,
"fabulously": bIncr, "flipping": bIncr, "flippin": bIncr,
"fricking": bIncr, "frickin": bIncr, "frigging": bIncr, "friggin": bIncr, "fully": bIncr, "fucking": bIncr,
"greatly": bIncr, "hella": bIncr, "highly": bIncr, "hugely": bIncr, "incredibly": bIncr,
"intensely": bIncr, "majorly": bIncr, "more": bIncr, "most": bIncr, "particularly": bIncr,
"purely": bIncr, "quite": bIncr, "really": bIncr, "remarkably": bIncr,
"so": bIncr, "substantially": bIncr,
"thoroughly": bIncr, "totally": bIncr, "tremendously": bIncr,
"uber": bIncr, "unbelievably": bIncr, "unusually": bIncr, "utterly": bIncr,
"very": bIncr,
"almost": bDecr, "barely": bDecr, "hardly": bDecr, "just enough": bDecr,
"kind of": bDecr, "kinda": bDecr, "kindof": bDecr, "kind-of": bDecr,
"less": bDecr, "little": bDecr, "marginally": bDecr, "occasionally": bDecr, "partly": bDecr,
"scarcely": bDecr, "slightly": bDecr, "somewhat": bDecr,
"sort of": bDecr, "sorta": bDecr, "sortof": bDecr, "sort-of": bDecr}
BoosterMap booster/dampener 'intensifiers' or 'degree adverbs' http://en.wiktionary.org/wiki/Category:English_degree_adverbs
var Negations = []string{"aint", "arent", "cannot", "cant", "couldnt", "darent", "didnt", "doesnt",
"ain't", "aren't", "can't", "couldn't", "daren't", "didn't", "doesn't",
"dont", "hadnt", "hasnt", "havent", "isnt", "mightnt", "mustnt", "neither",
"don't", "hadn't", "hasn't", "haven't", "isn't", "mightn't", "mustn't",
"neednt", "needn't", "never", "none", "nope", "nor", "not", "nothing", "nowhere",
"oughtnt", "shant", "shouldnt", "uhuh", "wasnt", "werent",
"oughtn't", "shan't", "shouldn't", "uh-uh", "wasn't", "weren't",
"without", "wont", "wouldnt", "won't", "wouldn't", "rarely", "seldom", "despite"}
Negations ..
var Punctuations = []string{".", "..", "...", "!", "?", ",", ";", ":", "-", "'", "\"", "!!", "!!!", "??", "???", "?!?", "!?!", "?!?!", "!?!?", "????", "?????"}
Punctuations ..
var RegexRemovePunctuation = regexp.MustCompile(fmt.Sprintf("[%s]", regexp.QuoteMeta(`!"//$%&'#()*+,-./:;<=>?@[\]^_{|}~`+"`")))
RegexRemovePunctuation for removing punctuation
var SentimentLadenIdioms = map[string]int{"cut the mustard": 2, "hand to mouth": -2,
"back handed": -2, "blow smoke": -2, "blowing smoke": -2,
"upper hand": 1, "break a leg": 2,
"cooking with gas": 2, "in the black": 2, "in the red": -2,
"on the ball": 2, "under the weather": -2}
SentimentLadenIdioms check for sentiment laden idioms that do not contain lexicon words (future work, not yet implemented)
var SpecialCaseIdioms = map[string]float64{"the shit": 3, "the bomb": 3, "bad ass": 1.5, "yeah right": -2,
"kiss of death": -1.5}
SpecialCaseIdioms check for special case idioms containing lexicon words
Functions ¶
This section is empty.
Types ¶
type SentimentIntensityAnalyzer ¶
type SentimentIntensityAnalyzer struct {
LexiconMap map[string]float64
EmojiLexiconMap map[string]string
SpecialCaseIdioms map[string]float64
}
SentimentIntensityAnalyzer Give a sentiment intensity score to sentences.
func (*SentimentIntensityAnalyzer) Init ¶
func (sia *SentimentIntensityAnalyzer) Init(filenames ...string) error
Init sentiment analyzer with lexicons if no filepaths passed to init, using default lexicon files
func (*SentimentIntensityAnalyzer) PolarityScores ¶
func (sia *SentimentIntensityAnalyzer) PolarityScores(text string) map[string]float64
PolarityScores Return a float for sentiment strength based on the input text. Positive values are positive valence, negative value are negative valence.