komodojp / tinyld

Simple and Performant Language detection library for NodeJS
https://komodojp.github.io/tinyld/
MIT License
415 stars 12 forks source link
classification detection javascript language language-detection n-grams natural-language nodejs

TinyLD

npm npm CDN Download License

logo

:tada: Description

Tiny Language Detector, simply detect the language of a unicode UTF-8 text:

Links


:floppy_disk: Getting Started

Install

yarn add tinyld # or npm install --save tinyld

Install Documentation


:page_facing_up: TinyLD API

import { detect, detectAll } from 'tinyld'

// Detect
detect('これは日本語です.') // ja
detect('and this is english.') // en

// DetectAll
detectAll('ceci est un text en francais.')
// [ { lang: 'fr', accuracy: 0.5238 }, { lang: 'ro', accuracy: 0.3802 }, ... ]

API Documentation


:paperclip: TinyLD CLI

tinyld This is the text that I want to check
# [ { lang: 'en', accuracy: 1 } ]

More Information


:chart_with_upwards_trend: Performance

Here is a comparison of Tinyld against other popular libraries.

SVG Graph

To summary in one sentence:

Better, Faster, Smaller

More Benchmark Information


Developer

You want to Contribute or Open a PR, it's recommend to take a look at the dev documentation