sentiment: Calculates sentiment score.

Description Usage Arguments Value See Also Examples

Description

Splits string into words (by default at space), looks up affinity score for each word and returns average.

Usage

1
2
  sentiment(x, dict = c("afinn111", "afinn96"), sep = " ",
    removePunct = TRUE, ...)

Arguments

x

String

dict

Dictionary to use: either "afinn111" or "afinn96"

sep

Charater string to use as word boundary

removePunct

If TRUE, removes punctuation from words

...

not used

Value

A numerical value between -5 and +5. Returns NaN if none of the words are found in the dictionary.

See Also

Other sentiment.functions: sentiment.status

Examples

1
sentiment(c("There is a terrible mistake in this work", "This is wonderful!"))

andrie/sentiment documentation built on May 10, 2019, 11:20 a.m.