
Last chance! 50% off unlimited learning
Sale ends in
This routine reads a sentiment dictionary from a text file. Such a text file can
be created e.g. via write
. The dictionary type is recognized
according to the internal format of the file.
read(file)
Dictionary of type SentimentDictionaryWordlist
,
SentimentDictionaryBinary
or
SentimentDictionaryWeighted
File name pointing to text file
write
for creating such a file
d.out <- SentimentDictionary(c("uncertain", "possible", "likely"))
write(d.out, "example.dict")
d.in <- read("example.dict")
print(d.in)
d.out <- SentimentDictionary(c("increase", "rise", "more"),
c("fall", "drop"))
write(d.out, "example.dict")
d.in <- read("example.dict")
print(d.in)
d.out <- SentimentDictionary(c("increase", "decrease", "exit"),
c(+1, -1, -10),
rep(NA, 3),
intercept=5)
write(d.out, "example.dict")
d.in <- read("example.dict")
print(d.in)
unlink("example.dict")
Run the code above in your browser using DataLab