Fast and accurate natural language detection. Detector written in Typescript. Based on Nito-ELD
Find a file
2025-09-23 20:19:05 -03:00
.github ci: add github workflows 2023-10-30 02:03:37 +01:00
.vscode refactor: move to typescript 2023-10-30 00:50:41 +01:00
src skibidi 2025-09-23 20:19:05 -03:00
.gitignore refactor: move to typescript 2023-10-30 00:50:41 +01:00
.prettierignore refactor: move to typescript 2023-10-30 00:50:41 +01:00
LICENSE Initial commit 2023-05-31 19:05:17 +02:00
package.json build: include lib/ in files 2023-10-30 00:59:44 +01:00
README.md docs: fix installation blurb since this is not published to npm 2023-10-30 02:16:28 +01:00
tsconfig.json refactor: move to typescript 2023-10-30 00:50:41 +01:00
vitest.config.ts refactor: move to typescript 2023-10-30 00:50:41 +01:00
yarn.lock refactor: move to typescript 2023-10-30 00:50:41 +01:00

Efficient Language Detector, Refactored

Refactored version of Nito-ELD which exports type definitions and avoids toplevel await() for easier bundling.

Install

  • For Node.js
$ yarn add https://github.com/bkw/eldr

Usage

import { eldr } from "eldr";
/* or, to save bandwidth and memory usage:
import { eldr } from "eldr/lib/extra-small"
import { eldr } from "eldr/lib/small"
import { eldr } from "eldr/lib/medium" // default
import { eldr } from "eldr/lib/large"
*/

const detected = eldr.detect("Hola, cómo te llamas?");
console.log(
  detected.isReliable(),
  detected.iso639_1,
  detected.languageName,
  detected.getScores()
);

Output:

true es Spanish {
  es: 0.5289772727272727,
  et: 0.20935132575757573,
  ro: 0.20913825757575755,
  lv: 0.20886600378787873,
  nl: 0.11145833333333333,
  sq: 0.10797821969696969,
  lt: 0.10658143939393938,
  hr: 0.1064867424242424,
  pl: 0.1047466856060606,
  ca: 0.10466382575757575,
  sl: 0.10466382575757575,
  pt: 0.10445075757575756,
  yo: 0.1044152462121212
}

Languages

These are the ISO 639-1 codes of the 60 supported languages for Nito-ELD v1

'am', 'ar', 'az', 'be', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en', 'es', 'et', 'eu', 'fa', 'fi', 'fr', 'gu', 'he', 'hi', 'hr', 'hu', 'hy', 'is', 'it', 'ja', 'ka', 'kn', 'ko', 'ku', 'lo', 'lt', 'lv', 'ml', 'mr', 'ms', 'nl', 'no', 'or', 'pa', 'pl', 'pt', 'ro', 'ru', 'sk', 'sl', 'sq', 'sr', 'sv', 'ta', 'te', 'th', 'tl', 'tr', 'uk', 'ur', 'vi', 'yo', 'zh'

Full name languages:

Amharic, Arabic, Azerbaijani (Latin), Belarusian, Bulgarian, Bengali, Catalan, Czech, Danish, German, Greek, English, Spanish, Estonian, Basque, Persian, Finnish, French, Gujarati, Hebrew, Hindi, Croatian, Hungarian, Armenian, Icelandic, Italian, Japanese, Georgian, Kannada, Korean, Kurdish (Arabic), Lao, Lithuanian, Latvian, Malayalam, Marathi, Malay (Latin), Dutch, Norwegian, Oriya, Punjabi, Polish, Portuguese, Romanian, Russian, Slovak, Slovene, Albanian, Serbian (Cyrillic), Swedish, Tamil, Telugu, Thai, Tagalog, Turkish, Ukrainian, Urdu, Vietnamese, Yoruba, Chinese