Whatlang
Natural language detection in Rust.
Features
- 100% written in Rust
- No dependencies
- Support about 30 most popular languages
- Recognizes not only a language, but also a script (Latin, Cyrillic, etc)
Get started
The library is still in active development. Here is the short example how to use it:
Add to you Cargo.toml
:
```
[dependencies]
whatlang = "*"
```
In you program:
```rust
extern crate whatlang;
use whatlang::{detect_lang, Lang, Script, Query};
fn main() {
let text = "Guten Abend, meine Damen und Herren!".tostring();
let query = Query::new(&text);
let result = detectlang(query).unwrap();
asserteq!(result.lang, Lang::Deu);
asserteq!(result.lang.tocode(), "deu");
asserteq!(result.script, Script::Latin);
}
```
Roadmap
- Support 100 most popular languages
- Allow to specify whitelist/blacklist in
Query
struct
- Provide some metrics about reliability in
Result
struct
- Tune performance
Supported languages (there gonna be much more)
- Esperanto (epo)
- English (eng)
- Russian (rus)
- Mandarin (cmn)
- Spanish (spa)
- Portuguese (por)
- Italian (ita)
- Bengali (ben)
- French (fra)
- German (deu)
- Ukrainian (ukr)
- Georgian (kat)
- Arabic (arb)
- Hindi (hin)
- Japanese (jpn)
- Hebrew (heb)
- Yiddish (ydd)
- Polish (pol)
- Amharic (ahm)
- Tigrinya (tir)
- Javanese (jav)
- Korean (kor)
- Bokmål (nob)
- Nynorsk (nno)
- Danish (dan)
- Swedish (swe)
License
MIT
Contributors
- greyblake Potapov Sergey - creator, maintainer