computeFrequencies: Normalized Frequencies.

Description Usage Arguments Value Examples

View source: R/computeFrequencies.R

Description

Generate the Normalized Frequency table from textual data input.

Usage

1
computeFrequencies(corpus, sentimentWord, shifterWord, clusterSize = 1)

Arguments

corpus

corpus with column docID, regID, and texts. docID indicate a unique ID for the document. regID is used for aggregation of document for the regression. It must match with the specific regID of the response variable in fitGWP. texts are the textual data.

sentimentWord

Vector of words used for computing the sentiment.

shifterWord

Matrix with element x and y. x is a vector of valence shifting words while y is the modifier values.

clusterSize

Scalar indicating the window in which valance shifting words have an influence.

Value

A list with the following elements:

Examples

1
2
3
4
5
6
7
8
9
# Load example data
data("corpus",  package = "GWP")

# Setup the lexicons
sentimentWord <- sentometrics::list_lexicons$LM_en$x
shifterWord <- sentometrics::list_valence_shifters$en[, c("x", "y")]

# Generate the frequency data
frequencies <- computeFrequencies(corpus, sentimentWord, shifterWord, clusterSize = 5)

keblu/GWP documentation built on June 15, 2020, 11:43 p.m.