# tinyld

> Simple and Performant Language detection library (pure JS and zero dependencies)

Latest version **1.3.4** (published 2023-05-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install tinyld
pnpm add tinyld
yarn add tinyld
bun add tinyld
```

Provides the commands `tinyld`, `tinyld-heavy`, `tinyld-light`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.4 |
| Published | 2023-05-17 |
| First published | 2021-08-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >= 12.10.0 |
| Dependencies | 0 |
| Unpacked size | 11.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 478 |
| Author | Kevin Destrem |
| Maintainers | kefniark |
| Keywords | lang, language, language detection, natural-language, detect, detector, n-gram |

## Links

- npm: https://www.npmjs.com/package/tinyld
- Repository: https://github.com/komodojp/tinyld
- npm.io page: https://npm.io/package/tinyld

## Recent versions

- 1.3.4 (latest) — 2023-05-17
- 1.3.3 — 2023-02-20
- 1.3.2 — 2022-11-10
- 1.3.1 — 2022-09-29
- 1.3.0 — 2022-07-23
- 1.2.3 — 2022-01-22
- 1.2.2 — 2022-01-12
- 1.2.1 — 2022-01-06
- 1.2.0 — 2022-01-05
- 1.1.5 — 2021-12-16
- 1.1.4 — 2021-11-27
- 1.1.3 — 2021-08-29
- 1.1.2 — 2021-08-17
- 1.1.1 — 2021-08-17
- 1.1.0 — 2021-08-17
- … 8 more at https://npm.io/package/tinyld/versions

## README

# TinyLD

[![npm](https://img.shields.io/npm/v/tinyld)](https://www.npmjs.com/package/tinyld)
[![npm](https://img.shields.io/npm/dm/tinyld)](https://www.npmjs.com/package/tinyld)
[![CDN Download](https://data.jsdelivr.com/v1/package/npm/tinyld/badge)](https://www.jsdelivr.com/package/npm/tinyld)
[![License](https://img.shields.io/npm/l/tinyld.svg)](https://npmjs.org/package/tinyld)

![logo](./banner.png)

## :tada: Description

**Tiny** **L**anguage **D**etector, simply detect the language of a unicode UTF-8 text:

- Pure JS, No api call, No dependencies (Node and Browser compatible)
- Blazing fast and low memory footprint (unlike ML methods)
- Train with dataset from [Tatoeba](https://tatoeba.org/en/) and [UDHR](https://unicode.org/udhr/)
- Support [62 languages](./docs/langs.md) (24 for [the web version](./docs/light.md))
- Reliable even for really short texts (chatbot, keywords, ...)
- Support both ISO-639-1 & ISO-639-2
- Available for NodeJS (`CommonJS` and `ESM`), Deno and Browser

## Links

- [**Playground** - Try the library](https://komodojp.github.io/tinyld/)
- [Play with some code](https://runkit.com/kefniark/tinyld)
- [Getting Started](./docs/install.md)
- [Supported Languages](./docs/langs.md)
- [Algorithm](./docs/algorithm.md)
- [Frequently Asked Questions](./docs/faq.md)

---

## :floppy_disk: Getting Started

### Install

```sh
yarn add tinyld # or npm install --save tinyld
```

[Install Documentation](./docs/install.md)

---

### :page_facing_up: **TinyLD API**

```js
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](./docs/api.md)

---

### :paperclip: **TinyLD CLI**

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

[More Information](./docs/cli.md)

---

## :chart_with_upwards_trend: Performance

Here is a comparison of **Tinyld** against other popular libraries.

![SVG Graph](./docs/overall.svg)

To summary in one sentence:

> Better, Faster, Smaller

[More Benchmark Information](./docs/benchmark.md)

---

## Developer

You want to **Contribute** or **Open a PR**, it's recommend to take a look [at the dev documentation](./docs/dev.md)

---
_Source: https://npm.io/package/tinyld · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
