@nlpjs-neo/sentiment
v5.2.1
Published
Sentiment analysis using the AFINN, Senticon and Pattern dictionaries, with negation support
Maintainers
Readme

@nlpjs-neo/sentiment
Part of NLP.js Neo, a refreshed and maintained fork of axa-group/nlp.js. The packages are ESM only, written in TypeScript, and require Node.js 22.12 or later.
Introduction
@nlpjs-neo/sentiment scores the sentiment of an utterance using the dictionary of its
language, with support for negations where the language provides them. Three dictionary
types are used: AFINN, Senticon and Pattern.
Installation
pnpm add @nlpjs-neo/sentiment @nlpjs-neo/lang-enExample of use
The analyzer takes the language plugins from its container, so mount the languages you need:
import { containerBootstrap } from '@nlpjs-neo/core';
import { SentimentAnalyzer } from '@nlpjs-neo/sentiment';
import { LangEn } from '@nlpjs-neo/lang-en';
import { Nlu } from '@nlpjs-neo/nlu';
const container = await containerBootstrap();
container.use(LangEn);
container.use(Nlu);
const analyzer = new SentimentAnalyzer({ container });
const result = await analyzer.process({ utterance: 'I like cats', locale: 'en' });
console.log(result.sentiment);
// { score: 0.344, numWords: 3, numHits: 1, average: 0.114..., type: 'senticon', locale: 'en', vote: 'positive' }node-nlp-neo wraps this in SentimentAnalyzer and SentimentManager, which mount every
language for you; see
Sentiment analysis.
The per-language coverage is at
Language support.
Contributing
You can read the guide of how to contribute at Contributing.
Code of Conduct
You can read the Code of Conduct at Code of Conduct.
Who is behind it
NLP.js was created and developed by AXA Group Operations Spain S.A., with Jesus Seijas as its main author; AXA Group is no longer involved in maintaining it. nlpjs-neo is a fork of that project, currently maintained by Igor Savin and the contributors to the fork.
License
Copyright (c) AXA Group Operations Spain S.A.
Copyright (c) 2026 Igor Savin
Released under the MIT License.
