I am learning sentiment analysis in R using tidytext package. However, i am unable to set nrc as lexicon. Whenever i type get_sentiments ("nrc"), the above error is displayed. It says that lexicon coud only be "afinn", "bing" or "loughran". I tried updating the package (tidytext) and also installed 'syuzhet' package but still the problem exists. Please help!
Asked
Active
Viewed 852 times
2
-
1Please make your question reproducible by adding sample code and data that can **reproduce the problem**. – NelsonGon Jul 05 '19 at 12:27
-
There are only three lexicons as the error states: `"afinn", "bing" or "loughran".` which can be seen in the arguments although I do recall using `nrc` some time. Perhaps it was replaced. No mention of it in the docs: https://cran.r-project.org/web/packages/tidytext/tidytext.pdf – NelsonGon Jul 05 '19 at 12:28
-
It was removed. See [here](https://github.com/juliasilge/tidytext/search?q=nrc&unscoped_q=nrc). If you really need to use it, just use an older version of the package. – NelsonGon Jul 05 '19 at 12:35
-
I simply loaded tidytext package and accessed the 'sentiments' dataset from the library. According to the book, https://www.tidytextmining.com/sentiment.html , the sentiments dataset should be a 27,314 x 4 tibble. However, when i load it, R shows it to be a 6,786 x 2 tibble. – AhmadAli Jul 05 '19 at 17:59
-
I read the CRAN page on tidytext and it also says that lexicon could only be "affin", "bing" or "loughran". I am using tidytext version 0.2.1 – AhmadAli Jul 05 '19 at 18:02
-
The book is behind the latest in the package. NRC was removed for licensing reasons. Sentiments only has the `bing` lexicon. – NelsonGon Jul 05 '19 at 18:02
-
Alright! Thanks for your help. :) – AhmadAli Jul 05 '19 at 18:04
-
Cool then,nice day. – NelsonGon Jul 05 '19 at 18:08