Giter Club home page Giter Club logo

Comments (6)

trinker avatar trinker commented on July 18, 2024

Please provide a reproducible example.

from sentimentr.

prudhviraju535 avatar prudhviraju535 commented on July 18, 2024

Hi,

require(sentimentr)
require(qdap)

Texts

mytext <- c(
"hopefully wallet will comeback",
"excelente",
"duplicate photo finder",
"Thanks Staff!",
"limit your sentence"
)

Polarity table

set.seed(10)
key <- data.frame(
words = c("excelente","limit","duplicate photo finder","wallet will comeback","thanks"),
polarity = c(1,-1,-1,-1,1),
stringsAsFactors = FALSE
)

mykey <- as_key(key)

striptext=function(x){
x=removePunctuation(stripWhitespace(tolower(x))) }

text=as.character(striptext(mytext))
text=replace_number(text)
text=replace_emoticon(text,emoticon_dt = sentimentr::emoticons)
text=replace_grade(text, grade_dt = sentimentr::grades)

Sentimentr polarity

Sentir=sentiment_by(text,mykey,valence_shifters_dt = valence_shifters_table,by=NULL,
amplifier.weight = 3, n.before = 5, n.after = 3
,question.weight = 2, but.weight = 0.85, missing_value = 0)

Qdap Polarity

QDAPoutput=counts(polarity(striptext(mytext),polarity.frame = mykey,
constrain = F,negators = qdapDictionaries::negation.words,
amplifiers = qdapDictionaries::amplification.words,
deamplifiers = qdapDictionaries::deamplification.words,
question.weight = 3, amplifier.weight = 2,
n.before = 5, n.after = 3))[, "polarity"]

Final output

outp=cbind(Sentir,QDAPoutput)

from sentimentr.

prudhviraju535 avatar prudhviraju535 commented on July 18, 2024

If u check the final output "outp", Sentimentr is not scoring but Qdap does.

from sentimentr.

trinker avatar trinker commented on July 18, 2024

I believe you need to name the argument to sentiment_by as the second argument to this function is not the polarity table as you assume, polarity_dt =mykey

from sentimentr.

prudhviraju535 avatar prudhviraju535 commented on July 18, 2024

Hi .. i changed it to Sentiment . its working .. Thanks..

But it shows this warning :

Warning message:
In [.data.table(dat[, :=(indx, wc < 1), by = c("id", "sentences", :
with=FALSE ignored, it isn't needed when using :=. See ?':=' for examples.

from sentimentr.

trinker avatar trinker commented on July 18, 2024

You need the latest version from github. A change in data.table. If you don't feel like updating the warning message can be ignored.

from sentimentr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.