Created
May 24, 2016 23:22
-
-
Save johnlaudun/d97eeb2c39952b7600d0cdebe76b74b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Syuzhet Outputs | |
## Sentiment by Sentence for 4 Small Texts | |
```R | |
# Load libraries | |
library(syuzhet) | |
library(readr) | |
# Here's the process: | |
# Load file | |
anc089_v <- get_sentences(read_file("../texts/legends/anc-089.txt")) | |
# Get sentiment | |
anc089_sentiment <- get_sentiment(anc089_v, method="syuzhet") | |
# Print result | |
print(anc089_sentiment) | |
``` | |
[1] 0.00 0.75 0.00 0.25 0.00 0.00 -0.60 0.00 0.50 0.00 -0.75 -0.25 | |
```R | |
lau013_v <- get_sentences(read_file("../texts/legends/lau-013.txt")) | |
lau013_sentiment <- get_sentiment(lau013_v, method="syuzhet") | |
print(lau013_sentiment) | |
``` | |
[1] 0.25 0.60 0.40 -0.25 0.00 0.00 0.00 0.00 0.40 -0.25 -0.25 0.00 | |
[13] 0.50 0.00 -0.40 -1.60 0.75 0.00 0.00 -0.25 0.15 0.00 0.00 0.00 | |
[25] 0.40 0.00 0.00 0.00 0.00 -0.60 -1.25 -1.55 0.00 -0.75 0.50 -0.60 | |
```R | |
lau014_v <- get_sentences(read_file("../texts/legends/lau-014.txt")) | |
lau014_sentiment <- get_sentiment(lau014_v, method="syuzhet") | |
print(lau014_sentiment) | |
``` | |
[1] 1.35 1.10 0.40 0.40 -0.35 0.00 0.00 1.05 0.25 0.25 0.00 0.10 | |
[13] -0.25 0.00 0.60 0.10 0.50 0.00 0.00 1.25 0.50 0.00 -0.10 0.00 | |
[25] 0.00 0.00 -1.00 0.80 0.00 -0.50 0.00 0.00 0.00 -0.10 -0.10 -0.10 | |
[37] 0.00 0.00 0.00 0.80 0.00 0.80 0.00 0.00 0.60 0.00 -1.00 0.00 | |
[49] 0.00 0.00 0.00 0.00 0.00 0.00 -1.00 0.00 0.50 0.00 0.50 -0.25 | |
[61] 0.00 0.00 -0.75 0.00 -0.60 -0.65 -0.50 0.00 | |
```R | |
loh164_v <- get_sentences(read_file("../texts/legends/loh-164.txt")) | |
loh164_sentiment <- get_sentiment(loh164_v, method="syuzhet") | |
print(loh164_sentiment) | |
``` | |
[1] 0.35 0.80 0.35 0.00 0.00 0.00 0.00 0.00 -1.00 -0.15 0.05 -0.75 | |
[13] 0.00 0.80 0.05 0.00 0.55 -1.00 0.75 0.35 0.00 0.30 -0.75 0.80 | |
[25] 0.00 0.50 0.80 0.80 0.00 1.00 0.00 0.00 0.00 0.80 0.80 0.20 | |
[37] -0.35 0.00 0.00 0.60 0.00 1.05 0.00 0.00 0.00 0.00 0.35 0.00 | |
[49] -0.25 0.00 0.80 0.00 0.00 0.00 0.00 -0.60 0.00 0.40 0.00 0.00 | |
[61] -0.25 0.80 0.00 0.80 -0.25 0.40 0.00 0.50 0.25 0.50 1.10 0.00 | |
[73] 0.80 -0.25 0.00 -0.35 0.00 0.00 0.80 -0.60 0.25 0.00 0.00 1.60 | |
[85] 0.00 0.50 0.60 -0.15 -0.35 -1.75 -0.50 0.60 0.80 0.80 0.25 0.00 | |
[97] 0.00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment