> library(sentimentr)
> sentimentr_data()
                            Data
1             course_evaluations
2        crowdflower_deflategate
3           crowdflower_products
4  crowdflower_self_driving_cars
5            crowdflower_weather
6                  hotel_reviews
7            hu_liu_apex_reviews
8          hu_liu_cannon_reviews
9         hu_liu_jukebox_reviews
10          hu_liu_nikon_reviews
11          hu_liu_nokia_reviews
12          kaggle_movie_reviews
13  kotzias_reviews_amazon_cells
14          kotzias_reviews_imdb
15          kotzias_reviews_yelp
16                  nyt_articles
17     presidential_debates_2012
18                      sam_i_am
                                                             Description
1                                     Student Course Evaluation Comments
2                                   Twitter Tweets About the Deflategate
3                                      Twitter Tweets About the Products
4                                 Twitter Tweets About Self Driving Cars
5                                       Twitter Tweets About the Weather
6                                                          Hotel Reviews
7    Apex AD2600 Progressive-scan DVD player Product Reviews From Amazon
8                           Cannon G3 Camera Product Reviews From Amazon
9  Creative Labs Nomad Jukebox Zen Xtra 40GB Product Reviews From Amazon
10                        Nikon Coolpix 4300 Product Reviews From Amazon
11                                Nokia 6610 Product Reviews From Amazon
12                                                         Movie Reviews
13                                         Kotzias Reviews: Amazon Cells
14                                                 Kotzias Reviews: IMBD
15                                                 Kotzias Reviews: Yelp
16                              Sentiment Scored New York Times Articles
17                                        2012 U.S. Presidential Debates
18                                                         Sam I Am Text
> emotion("this is good and worth reading book")
    element_id sentence_id word_count         emotion_type emotion_count
 1:          1           1          7         anticipation             4
 2:          1           1          7                  joy             4
 3:          1           1          7             surprise             4
 4:          1           1          7                trust             4
 5:          1           1          7                anger             0
 6:          1           1          7        anger_negated             0
 7:          1           1          7 anticipation_negated             0
 8:          1           1          7              disgust             0
 9:          1           1          7      disgust_negated             0
10:          1           1          7                 fear             0
11:          1           1          7         fear_negated             0
12:          1           1          7          joy_negated             0
13:          1           1          7              sadness             0
14:          1           1          7      sadness_negated             0
15:          1           1          7     surprise_negated             0
16:          1           1          7        trust_negated             0
      emotion
 1: 0.5714286
 2: 0.5714286
 3: 0.5714286
 4: 0.5714286
 5: 0.0000000
 6: 0.0000000
 7: 0.0000000
 8: 0.0000000
 9: 0.0000000
10: 0.0000000
11: 0.0000000
12: 0.0000000
13: 0.0000000
14: 0.0000000
15: 0.0000000
16: 0.0000000
> emotion(c("this is good and worth reading book", "that was a bad and scary movie"))
    element_id sentence_id word_count         emotion_type emotion_count
 1:          1           1          7                anger             0
 2:          1           1          7         anticipation             4
 3:          1           1          7              disgust             0
 4:          1           1          7                 fear             0
 5:          1           1          7                  joy             4
 6:          1           1          7              sadness             0
 7:          1           1          7             surprise             4
 8:          1           1          7                trust             4
 9:          1           1          7        anger_negated             0
10:          1           1          7 anticipation_negated             0
11:          1           1          7      disgust_negated             0
12:          1           1          7         fear_negated             0
13:          1           1          7          joy_negated             0
14:          1           1          7      sadness_negated             0
15:          1           1          7     surprise_negated             0
16:          1           1          7        trust_negated             0
17:          2           1          7                anger             4
18:          2           1          7         anticipation             0
19:          2           1          7              disgust             4
20:          2           1          7                 fear             4
21:          2           1          7                  joy             0
22:          2           1          7              sadness             4
23:          2           1          7             surprise             0
24:          2           1          7                trust             0
25:          2           1          7        anger_negated             0
26:          2           1          7 anticipation_negated             0
27:          2           1          7      disgust_negated             0
28:          2           1          7         fear_negated             0
29:          2           1          7          joy_negated             0
30:          2           1          7      sadness_negated             0
31:          2           1          7     surprise_negated             0
32:          2           1          7        trust_negated             0
    element_id sentence_id word_count         emotion_type emotion_count
      emotion
 1: 0.0000000
 2: 0.5714286
 3: 0.0000000
 4: 0.0000000
 5: 0.5714286
 6: 0.0000000
 7: 0.5714286
 8: 0.5714286
 9: 0.0000000
10: 0.0000000
11: 0.0000000
12: 0.0000000
13: 0.0000000
14: 0.0000000
15: 0.0000000
16: 0.0000000
17: 0.5714286
18: 0.0000000
19: 0.5714286
20: 0.5714286
21: 0.0000000
22: 0.5714286
23: 0.0000000
24: 0.0000000
25: 0.0000000
26: 0.0000000
27: 0.0000000
28: 0.0000000
29: 0.0000000
30: 0.0000000
31: 0.0000000
32: 0.0000000
      emotion
> emo <- emotion(c("this is good and worth reading book", "that was a bad and scary movie", "this is a nice food"))
> plot(emo)


> sent <- get_sentences(c('this is a good food', 'that was a bad and scary movie', 'it is a nice and interesting book'))
> sent
[[1]]
[1] "this is a good food"

[[2]]
[1] "that was a bad and scary movie"

[[3]]
[1] "it is a nice and interesting book"

attr(,"class")
[1] "get_sentences"           "get_sentences_character" "list"                   
> emo_term <- extract_emotion_terms(sent)
> emo_term
   element_id sentence_id anger anticipation disgust fear       joy sadness surprise     trust
1:          1           1               good              food,good             good food,good
2:          2           1   bad                  bad  bad               bad                   
3:          3           1                                                                     
                            sentence
1:               this is a good food
2:    that was a bad and scary movie
3: it is a nice and interesting book
> attributes (emo_term)$counts
          words emotion_type emotion n
 1:         bad        anger       1 1
 2:         bad      disgust       1 1
 3:         bad         fear       1 1
 4:         bad      sadness       1 1
 5:        food          joy       1 1
 6:        food        trust       1 1
 7:        good anticipation       1 1
 8:        good          joy       1 1
 9:        good     surprise       1 1
10:        good        trust       1 1
11:           a         <NA>       0 3
12:         and         <NA>       0 2
13:          is         <NA>       0 2
14:        book         <NA>       0 1
15: interesting         <NA>       0 1
16:          it         <NA>       0 1
17:       movie         <NA>       0 1
18:        nice         <NA>       0 1
19:       scary         <NA>       0 1
20:        that         <NA>       0 1
21:        this         <NA>       0 1
22:         was         <NA>       0 1
          words emotion_type emotion n
> attributes (emo_term)$elements
          words element_id sentence_id emotion_type emotion
 1:         bad          2           1        anger       1
 2:         bad          2           1      disgust       1
 3:         bad          2           1         fear       1
 4:         bad          2           1      sadness       1
 5:        food          1           1          joy       1
 6:        food          1           1        trust       1
 7:        good          1           1 anticipation       1
 8:        good          1           1          joy       1
 9:        good          1           1     surprise       1
10:        good          1           1        trust       1
11:           a          1           1         <NA>       0
12:           a          2           1         <NA>       0
13:           a          3           1         <NA>       0
14:         and          2           1         <NA>       0
15:         and          3           1         <NA>       0
16:        book          3           1         <NA>       0
17: interesting          3           1         <NA>       0
18:          is          1           1         <NA>       0
19:          is          3           1         <NA>       0
20:          it          3           1         <NA>       0
21:       movie          2           1         <NA>       0
22:        nice          3           1         <NA>       0
23:       scary          2           1         <NA>       0
24:        that          2           1         <NA>       0
25:        this          1           1         <NA>       0
26:         was          2           1         <NA>       0
          words element_id sentence_id emotion_type emotion
> 

