get_dct_transform: Discrete Cosine Transformation with Reverse Transform.

View source: R/syuzhet.R

get_dct_transformR Documentation

Discrete Cosine Transformation with Reverse Transform.

Description

Converts input values into a standardized set of filtered and reverse transformed values for easy plotting and/or comparison.

Usage

get_dct_transform(
  raw_values,
  low_pass_size = 5,
  x_reverse_len = 100,
  scale_vals = FALSE,
  scale_range = FALSE
)

Arguments

raw_values

the raw sentiment values calculated for each sentence

low_pass_size

The number of components to retain in the low pass filtering. Default = 5

x_reverse_len

the number of values to return via decimation. Default = 100

scale_vals

Logical determines whether or not to normalize the values using the scale function Default = FALSE. If TRUE, values will be scaled by subtracting the means and scaled by dividing by their standard deviations. See ?scale

scale_range

Logical determines whether or not to scale the values from -1 to +1. Default = FALSE. If set to TRUE, the lowest value in the vector will be set to -1 and the highest values set to +1 and all the values scaled accordingly in between.

Value

The transformed values

Examples

s_v <- get_sentences("I begin this story with a neutral statement.
Now I add a statement about how much I despise cats.  
I am allergic to them. I hate them. Basically this is a very silly test. But I do love dogs!")
raw_values <- get_sentiment(s_v, method = "syuzhet")
dct_vals <- get_dct_transform(raw_values)
plot(dct_vals, type="l", ylim=c(-0.1,.1))

mjockers/syuzhet documentation built on Aug. 22, 2023, 7:42 a.m.