Giter Club home page Giter Club logo

Comments (4)

trinker avatar trinker commented on July 18, 2024

Can you provide a minimal working example?

from sentimentr.

sivaram10 avatar sivaram10 commented on July 18, 2024

When there are no positive or negative words in the text, extract_sentiment_terms is not returning positive and negative lists.

extract_sentiment_terms("Data analysis, also known as analysis of data or data analytics, is a process of inspecting and modeling data with the goal of suggesting conclusions, and decision-making.")
image

extract_sentiment_terms("Data analysis, also known as analysis of data or data analytics, is a process of inspecting, cleansing, transforming, and modeling data with the goal of discovering useful information, suggesting conclusions, and supporting decision-making.")
image

If I use this along with data table, data table is throwing error as it was not able to find positive named list.
Is there any way you can update the code so that extract_sentiment_terms gives empty list of positive/negative terms when there are no positive/negative terms in the text.

from sentimentr.

trinker avatar trinker commented on July 18, 2024

I'm not seeing how you're using this with data.table? Can you show the use case?

from sentimentr.

sivaram10 avatar sivaram10 commented on July 18, 2024

dt <- data.table(comments = c("She is a good girl and I like her.", "He is arrogant."))
dt[, positive.terms := extract_sentiment_terms(comments)[,positive], by = "comments"]

Error in [.data.table(extract_sentiment_terms(comments), , positive) :
j (the 2nd argument inside [...]) is a single symbol but column name 'positive' is not found. Perhaps you intended DT[,..positive] or DT[,positive,with=FALSE]. This difference to data.frame is deliberate and explained in FAQ 1.1.
In addition: Warning message:
In [.data.table(dt, , :=(positive.terms, extract_sentiment_terms(comments)[, :
RHS 1 is length 2 (greater than the size (1) of group 1). The last 1 element(s) will be discarded.

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.