Nlp.js
An NLP library for building bots, with entity extraction, sentiment analysis, automatic language identify, and so more
Install / Use
/learn @axa-group/Nlp.jsREADME

NLP.js
If you're looking for the version 3 docs, you can find them here Version 3
"NLP.js" is a general natural language utility for nodejs. Currently supporting:
- Guess the language of a phrase
- Fast Levenshtein distance of two strings
- Search the best substring of a string with less Levenshtein distance to a given pattern.
- Get stemmers and tokenizers for several languages.
- Sentiment Analysis for phrases (with negation support).
- Named Entity Recognition and management, multi-language support, and acceptance of similar strings, so the introduced text does not need to be exact.
- Natural Language Processing Classifier, to classify an utterance into intents.
- NLP Manager: a tool able to manage several languages, the Named Entities for each language, the utterances, and intents for the training of the classifier, and for a given utterance return the entity extraction, the intent classification and the sentiment analysis. Also, it is able to maintain a Natural Language Generation Manager for the answers.
- 40 languages natively supported, 104 languages supported with BERT integration
- Any other language is supported through tokenization, even fantasy languages

New in version 4!
Version 4 is very different from previous versions. Before this version, NLP.js was a monolithic library. The big changes:
- Now the library is split into small independent packages.
- So every language has its own package
- It provides a plugin system, so you can provide your own plugins or replace the existing ones.
- It provides a container system for the plugins, settings for the plugins and also pipelines
- A pipeline is code defining how the plugins interact. Usually it is linear: there is an input into the plugin, and this generates the input for the next one. As an example, the preparation of a utterance (the process to convert the utterance to a hashmap of stemmed features) is now a pipeline like this:
normalize -> tokenize -> removeStopwords -> stem -> arrToObj - There is a simple compiler for the pipelines, but they can also be built using a modified version of javascript and python (compilers are also included as plugins, so other languages can be added as a plugin).
- NLP.js now includes connectors, a connector is understood to be something that has at least 2 methods:
hearandsay. Examples of connectors included: Console Connector, Microsoft Bot Framework Connector and a Direct Line Offline Connector (this one allows you to build a web chatbot using the Microsoft Webchat, but without having to deploy anything in Azure). - Some plugins can be registered by language, so for different languages different plugins will be used. Also some plugins, like NLU, can be registered not only by language but also by domain (a functional set of intents that can be trained separately)
- As an example of per-language/domain plugins, a Microsoft LUIS NLU plugin is provided. You can configure your chatbot to use the NLU from NLP.js for some languages/domains, and LUIS for other languages/domains.
- Having plugins and pipelines makes it possible to write chatbots by only modifying the configuration and the pipelines file, without modifying the code.
TABLE OF CONTENTS
<!--ts-->- Installation
- QuickStart
- Install the library
- Create the code
- Extracting the corpus into a file
- Extracting the configuration into a file
- Creating your first pipeline
- Console Connector
- Extending your bot with the pipeline
- Adding multiple languages
- Adding API and WebChat
- Using Microsoft Bot Framework
- Recognizing the bot name and the channel
- One bot per connector
- Different port for Microsoft Bot Framework and Webchat
- Adding logic to an intent
- Mini FAQ
- Web and React Native
- QnA
- NER Quickstart
- NeuralNetwork
- Logger
- @nlpjs/emoji
- @nlpjs/console-connector
- @nlpjs/similarity
- @nlpjs/nlu
- React Native
- Example of use
- False Positives
- Log Training Progress
- Benchmarking
- Language Support
- Language Guesser
- Similar Search
- NLU
Related Skills
openhue
337.7kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
337.7kElevenLabs text-to-speech with mac-style say UX.
weather
337.7kGet current weather and forecasts via wttr.in or Open-Meteo
tweakcc
1.4kCustomize Claude Code's system prompts, create custom toolsets, input pattern highlighters, themes/thinking verbs/spinners, customize input box & user message styling, support AGENTS.md, unlock private/unreleased features, and much more. Supports both native/npm installs on all platforms.
