Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Text Highlighting in Stanford #11

Open
7evenHeadz opened this issue Dec 30, 2020 · 1 comment
Open

Error with Text Highlighting in Stanford #11

7evenHeadz opened this issue Dec 30, 2020 · 1 comment

Comments

@7evenHeadz
Copy link

The error which comes with the highlight function is

Error in [.data.table(y, , list(sentiment = attributes(x)["averaging.function"], :
attempt to apply non-function

The highlight function was working fine with both stansent and sentimentr previously but now only works with sentimentr. The sentimentr package used is V 2.8.1

@saraemoore
Copy link

This issue seems to be due to an update in sentimentr to fix a reported issue. Manually adding the attribute worked for me:

library(sentimentr)
library(stansent)

data(presidential_debates_2012)
set.seed(100)
dat <- presidential_debates_2012[sample(1:nrow(presidential_debates_2012), 100), ]
out <- with(dat, sentiment_stanford_by(dialogue, list(person, time), stanford.tagger = "/path/to/stanford-corenlp/"))

attributes(out)[["averaging.function"]] <- stansent::average_downweighted_zero
highlight(out)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants