-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hurley.R
131 lines (112 loc) · 2.76 KB
/
Hurley.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
library(syuzhet)
##tokenizes input and stores sentiment in vectors
input <- get_text_as_string("Texts/Hurley.txt")
iSent <- get_sentences(input)
syuzhetInput <- get_sentiment(iSent, method="syuzhet")
bingInput <- get_sentiment(iSent, method="bing")
nrcInput <- get_sentiment(iSent, method="nrc", lang = "english")
afinnInput <- get_sentiment(iSent, method="afinn")
##signed head of all vectors
x <- (rbind(
sign(head(syuzhetInput)),
sign(head(bingInput)),
sign(head(afinnInput)),
sign(head(nrcInput))
))
## writes table (fix this)
write.table(x, file = "binded.csv", sep = " ", col.names = NA,
qmethod = "double")
print(x)
#################
#Unsigned
#################
png("Plots/Unsigned/Hurley/Syuzhet.png", width = 1200,height = 700)
plot(
syuzhetInput,
type="l",
main="Syuzhet Analysis",
xlab = "Narrative Time",
ylab= "Emotional Valence"
)
dev.off()
png("Plots/Unsigned/Hurley/Bing.png", width = 1200,height = 700)
plot(
bingInput,
type="l",
main="Bing Analysis",
xlab = "Narrative Time",
ylab= "Emotional Valence"
)
dev.off()
png("Plots/Unsigned/Hurley/afinn.png", width = 1200,height = 700)
plot(
afinnInput,
type="l",
main="afinn Analysis",
xlab = "Narrative Time",
ylab= "Emotional Valence"
)
dev.off()
png("Plots/Unsigned/Hurley/nrc.png", width = 1200,height = 700)
plot(
nrcInput,
type="l",
main="nrc Analysis",
xlab = "Narrative Time",
ylab= "Emotional Valence"
)
dev.off()
##########################
#Signed
##########################
png("Plots/Signed/Hurley/Syuzhet.png", width = 1200,height = 700)
plot(
sign(syuzhetInput),
type="l",
main="Syuzhet Analysis",
xlab = "Narrative Time",
ylab= "Emotional Valence"
)
dev.off()
png("Plots/Signed/Hurley/Bing.png", width = 1200,height = 700)
plot(
sign(bingInput),
type="l",
main="Bing Analysis",
xlab = "Narrative Time",
ylab= "Emotional Valence"
)
dev.off()
png("Plots/Signed/Hurley/afinn.png", width = 1200,height = 700)
plot(
sign(afinnInput),
type="l",
main="afinn Analysis",
xlab = "Narrative Time",
ylab= "Emotional Valence"
)
dev.off()
png("Plots/Signed/Hurley/nrc.png", width = 1200,height = 700)
plot(
sign(nrcInput),
type="l",
main="nrc Analysis",
xlab = "Narrative Time",
ylab= "Emotional Valence"
)
dev.off()
##############
#Simple
##############
png("Plots/Simple/Hurley/syuzhet.png", width = 1200,height = 700)
simple_plot(syuzhetInput)
dev.off()
png("Plots/Simple/Hurley/bing.png", width = 1200,height = 700)
simple_plot(bingInput, title = "Bing Plot")
dev.off()
png("Plots/Simple/Hurley/afinn.png", width = 1200,height = 700)
simple_plot(afinnInput, title = "afinn Plot")
dev.off()
png("Plots/Simple/Hurley/nrc.png", width = 1200,height = 700)
simple_plot(nrcInput, title = "nrc Plot")
dev.off()