Comments (3)
The sentiment analysis is done with Lexicons, and there are three type of possible lexicons for each language:
- AFINN: each word of the lexicon has a value between -5 (very negative) and 5 (very positive)
- Senticon: each word of the lexicon has a value between -1 (very negative) and 1 (very positive)
- Pattern: each word of the lexicon has a value between -1 (very negative) and 1 (very positive)
There is a table of the lexicons available per language:
https://github.com/axa-group/nlp.js/blob/master/docs/v4/language-support.md#sentiment-analysis
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.
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.
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)
- Is there a code example for reading a .txt or .pdf file by using bert
- ContextData can't be saved and loaded
- Can't run dockStart
- Do not remove dots from utterance in entity recognition HOT 1
- Not able to extract entities HOT 9
- @nlpjs/xtables depends on vulnerable version of xlsx HOT 3
- [QUESTION] How to change the NLP dock logger ? HOT 2
- Bug in extractor-enum.js with original text indexes HOT 1
- Critical dependency: the request of a dependency is an expression HOT 2
- Question - How to run Entity extraction HOT 5
- [Question] How to define epoch & loss threshold? HOT 1
- How to extract date when intent is "What date is today?" HOT 3
- Provide timezone to Duckling API HOT 4
- Is it possible to filter the detection of the intent by the entity type? HOT 1
- Error when process regex with group
- get score from 1 and not less
- Simple question: can NLP.js be used for the app I describe?
- Can we document nlpmanager options better?
- Is NLP.js still maintained? HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nlp.js.