-
Notifications
You must be signed in to change notification settings - Fork 0
/
KerriganNrc.R
54 lines (46 loc) · 1.27 KB
/
KerriganNrc.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
library(syuzhet)
##tokenizes input and stores sentiment in vectors
input <- get_text_as_string("Texts/Kerrigan.txt")
iSent <- get_sentences(input)
nrcInput <- get_nrc_sentiment(iSent)
png("Plots/nrc/Kerrigan/total.png", width = 1200,height = 700)
barplot(
sort(colSums(prop.table(nrcInput[, 1:8]))),
horiz = TRUE,
cex.names = 0.7,
las = 1,
main = "Emotions in Kerrigan", xlab="Percentage"
)
dev.off()
png("Plots/nrc/Kerrigan/Sent.png", width = 1200,height = 700)
barplot(
sort(colSums(prop.table(nrcInput[, 9:10]))),
horiz = TRUE,
cex.names = 0.7,
las = 1,
main = "Sentiment in Kerrigan", xlab="Percentage"
)
dev.off()
library(syuzhet)
##tokenizes input and stores sentiment in vectors
input <- get_text_as_string("Texts/Kerrigan.txt")
iSent <- get_sentences(input)
nrcInput <- get_nrc_sentiment(iSent)
png("Plots/nrc/Kerrigan/total.png", width = 1200,height = 700)
barplot(
sort(colSums(prop.table(nrcInput[, 1:8]))),
horiz = TRUE,
cex.names = 0.7,
las = 1,
main = "Emotions in Kerrigan", xlab="Percentage"
)
dev.off()
png("Plots/nrc/Kerrigan/Sent.png", width = 1200,height = 700)
barplot(
sort(colSums(prop.table(nrcInput[, 9:10]))),
horiz = TRUE,
cex.names = 0.7,
las = 1,
main = "Sentiment in Kerrigan", xlab="Percentage"
)
dev.off()