py3langid in compact form for metldr
Browse files- README.md +49 -0
- py3langid-compact.lidc.gz +3 -0
README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: bsd-3-clause
|
| 3 |
+
library_name: metldr
|
| 4 |
+
pipeline_tag: text-classification
|
| 5 |
+
tags:
|
| 6 |
+
- language-identification
|
| 7 |
+
- langid
|
| 8 |
+
- int8
|
| 9 |
+
- quantized
|
| 10 |
+
language:
|
| 11 |
+
- multilingual
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# py3langid-compact
|
| 15 |
+
|
| 16 |
+
The py3langid language identification model (langid.py by Marco Lui and Timothy Baldwin, as shipped in
|
| 17 |
+
[rust-py3langid](https://github.com/markusmobius/rust-py3langid) 0.4.1, BSD-3-Clause; 142 labels) in a
|
| 18 |
+
compact form for the browser: int8 weights with one scale per feature, and the byte automaton stored as each
|
| 19 |
+
row's differences from the start row (a 256-bit mask plus its targets). In memory it takes 25 MB instead of
|
| 20 |
+
97 MB, and this gzip file is 5.2 MB. It is the language detector of the metldr browser extension, read by
|
| 21 |
+
its vendored `py3langid` Rust crate.
|
| 22 |
+
|
| 23 |
+
## Format (`py3langid-compact.lidc.gz`, gzip of a little-endian file)
|
| 24 |
+
|
| 25 |
+
Magic `LIDC1\0\0\0`; num_features, num_languages, num_states, num_rows, num_targets, history bytes (u32
|
| 26 |
+
each); the start row (256 u32); per row a 256-bit mask (4 u64); per row its first target (u32); the targets
|
| 27 |
+
(u32); each state's row (u16); each state's output feature (i32, -1 for none); priors (f32 per language);
|
| 28 |
+
scales (f32 per feature); weights (i8, features by languages); labels (u16 length and UTF-8 bytes each).
|
| 29 |
+
|
| 30 |
+
Converted from the upstream `py3langid.lidg` (SHA-256
|
| 31 |
+
`da6860a9218a6122bcf26ba6e8752946336dc4f9c0816c6eb4fa790c7444dec2`) by
|
| 32 |
+
`pack-langid in.lidg out.lidc`.
|
| 33 |
+
|
| 34 |
+
## Evaluation (papluca/language-identification test, 10,000 texts, 20 languages)
|
| 35 |
+
|
| 36 |
+
| detector | sentence accuracy | four-word accuracy | time per text | memory |
|
| 37 |
+
| --- | --- | --- | --- | --- |
|
| 38 |
+
| **this model** | **99.14%** | **93.62%** | 26 µs | 25 MB |
|
| 39 |
+
| py3langid upstream | 99.14% | 93.65% | 23 µs | 97 MB |
|
| 40 |
+
| lingua, high accuracy | 98.80% | 93.49% | 1,165 µs | 275 MB of models |
|
| 41 |
+
| fastText lid.176.ftz | 97.63% | 89.42% | 11 µs | 1 MB |
|
| 42 |
+
| langidentify lite | 94.34% | 91.93% | 27 µs | |
|
| 43 |
+
| whatlang | 90.59% | 77.81% | 39 µs | |
|
| 44 |
+
|
| 45 |
+
It agrees with upstream on 19,981 of 20,000 texts (each sentence and its first four words).
|
| 46 |
+
|
| 47 |
+
## License
|
| 48 |
+
|
| 49 |
+
BSD-3-Clause, as the upstream model.
|
py3langid-compact.lidc.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f76f8dab751f43eeea3877784629b000c87bb49dceaa61ffa21010a80681d3a2
|
| 3 |
+
size 5173990
|