@nlpjs-neo/language
v5.1.2
Published
Language guesser that identifies the language of a text from its trigrams
Maintainers
Readme

@nlpjs-neo/language
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/language guesses the language of a text from its trigrams, over the full
trigram database. Use @nlpjs-neo/language-min when you want the same API with a much
smaller dataset.
Installation
pnpm add @nlpjs-neo/languageExample of use
import { Language } from '@nlpjs-neo/language';
const language = new Language();
console.log(language.guess('When the night has come And the land is dark')[0]);
// { alpha3: 'eng', alpha2: 'en', language: 'English', score: 1 }
console.log(language.guessBest('Quan arriba la nit i la terra es fosca'));
// { alpha3: 'cat', alpha2: 'ca', language: 'Catalan', score: 1 }guess(text, allowList, limit) returns every candidate ordered by descending score;
guessBest(text, allowList) returns only the first one. allowList restricts the answer to
a set of locales.
The full documentation is at Language guesser.
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.
