Coder Social home page Coder Social logo

Amend sentiment.md about nlp.js HOT 3 OPEN

michael-evrythngwrx avatar michael-evrythngwrx commented on May 27, 2024
Amend sentiment.md

from nlp.js.

Comments (3)

jesus-seijas-sp avatar jesus-seijas-sp commented on May 27, 2024 1

The sentiment analysis is done with Lexicons, and there are three type of possible lexicons for each language:

In sentiment analysis usually you look for a classification into 3 classes: negative, neutral and positive. So if the score is negative, then the sentiment is negative; if the score is 0, then the sentiment is neutral; if the score is positive, then the sentiment is positive.

The result of the sentiment analysis indicates the type of lexicon used in the property type.

Example of response of the sentiment analysis:

 { score: 0.313,
   numWords: 3,
   numHits: 1,
   comparative: 0.10433333333333333,
   type: 'senticon',
   language: 'en' }
  • score will contain the total score for the sentence calculated with the lexicon
  • numWords will contain the number of words of the sentence
  • numHits will contain the number of words of the sentence that are in the lexicon dictionary
  • comparative will contain score / numWords
  • type will contain 'afinn', 'senticon' or 'pattern'
  • language: the language

To understand better AFINN I recommend the lecture of the original paper from Finn Årup Nielsen:
https://arxiv.org/abs/1103.2903

To understand the accuracy between different methods of lexicon sentiment analysis,
https://www.researchgate.net/publication/343473213_Evaluating_the_performance_of_the_most_important_Lexicons_used_to_Sentiment_analysis_and_opinions_Mining

In NLP.js there are two main improvements: negations and calculation of the stem of words.
There is also a paper analyzing improvements on sentiment analysis, not all used in NLP.js:
https://www.sciencedirect.com/science/article/pii/S2090447921003105

I hope you enjoy the reading

from nlp.js.

michael-evrythngwrx avatar michael-evrythngwrx commented on May 27, 2024

Here is something I am running into:
{
sentiment: {
score: 1.563,
numWords: 20,
numHits: 7,
average: 0.07815,
type: 'senticon',
locale: 'en',
vote: 'positive'
}
}

Senticon is returning a score greater than 1.

from nlp.js.

jesus-seijas-sp avatar jesus-seijas-sp commented on May 27, 2024

In my previous comment: "score will contain the total score for the sentence calculated with the lexicon"
Total = Sum of several
numHits is 7, so there are 7 words in your sentence that are in the lexicon, as numWords is 20 that means that there are 13 words not present in the lexicon.
1.563 is the sum of all scores of this 7 words.

from nlp.js.

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.