-
Notifications
You must be signed in to change notification settings - Fork 8
/
get_sentimentr.R
59 lines (47 loc) · 3.58 KB
/
get_sentimentr.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
library(sentimentr)
library(lexicon)
get_sentimentr_values <- function(s_v) {
print('Processing sentimentr_jockersrinker')
sentimentr_jockersrinker <- sentiment(s_v, polarity_dt=lexicon::hash_sentiment_jockers_rinker,
hypen="", amplifier.weight=0.8, n.before=5, n.after=2,
adversative.weight=0.25, neutral.nonverb.like = FALSE, missing_value = 0)
print('Processing sentimentr_jockers')
sentimentr_jockers <- sentiment(s_v, polarity_dt=lexicon::hash_sentiment_jockers,
hypen="", amplifier.weight=0.8, n.before=5, n.after=2,
adversative.weight=0.25, neutral.nonverb.like = FALSE, missing_value = 0)
print('Processing sentimentr_huliu')
sentimentr_huliu <- sentiment(s_v, polarity_dt=lexicon::hash_sentiment_huliu,
hypen="", amplifier.weight=0.8, n.before=5, n.after=2,
adversative.weight=0.25, neutral.nonverb.like = FALSE, missing_value = 0)
print('Processing sentimentr_nrc')
sentimentr_nrc <- sentiment(s_v, polarity_dt=lexicon::hash_sentiment_nrc,
hypen="", amplifier.weight=0.8, n.before=5, n.after=2,
adversative.weight=0.25, neutral.nonverb.like = FALSE, missing_value = 0)
print('Processing sentimentr_senticnet')
sentimentr_senticnet <- sentiment(s_v, polarity_dt=lexicon::hash_sentiment_senticnet,
hypen="", amplifier.weight=0.8, n.before=5, n.after=2,
adversative.weight=0.25, neutral.nonverb.like = FALSE, missing_value = 0)
print('Processing sentimentr_sentiword')
sentimentr_sentiword <- sentiment(s_v, polarity_dt=lexicon::hash_sentiment_sentiword,
hypen="", amplifier.weight=0.8, n.before=5, n.after=2,
adversative.weight=0.25, neutral.nonverb.like = FALSE, missing_value = 0)
print('Processing sentimentr_loughran_mcdonald')
sentimentr_loughran_mcdonald <- sentiment(s_v, polarity_dt=lexicon::hash_sentiment_loughran_mcdonald,
hypen="", amplifier.weight=0.8, n.before=5, n.after=2,
adversative.weight=0.25, neutral.nonverb.like = FALSE, missing_value = 0)
print('Processing sentimentr_socal_google')
sentimentr_socal_google <- sentiment(s_v, polarity_dt=lexicon::hash_sentiment_socal_google,
hypen="", amplifier.weight=0.8, n.before=5, n.after=2,
adversative.weight=0.25, neutral.nonverb.like = FALSE, missing_value = 0)
anovel_sentimentr_df <- data.frame('text_clean' = s_v,
'sentimentr_jockersrinker' = sentimentr_jockersrinker$sentiment,
'sentimentr_jockers' = sentimentr_jockers$sentiment,
'sentimentr_huliu' = sentimentr_huliu$sentiment,
'sentimentr_nrc' = sentimentr_nrc$sentiment,
'sentimentr_senticnet' = sentimentr_senticnet$sentiment,
'sentimentr_sentiword' = sentimentr_sentiword$sentiment,
'sentimentr_loughran_mcdonald' = sentimentr_loughran_mcdonald$sentiment,
'sentimentr_socal_google' = sentimentr_socal_google$sentiment
)
return(anovel_sentimentr_df)
}