7 个稳定版本
2.0.3 | 2024年5月31日 |
---|---|
2.0.2 | 2024年5月30日 |
2.0.1 | 2023年8月18日 |
1.2.0 | 2023年8月16日 |
#804 在 文本处理
494 每月下载量
82KB
384 行
Unicode 语言
该库根据一系列 Unicode 码点检测语言支持。主要用于查找字体支持的语言。
// Input codepoints as a vector of Unicode ranges
let codepoints = vec![[65, 121]];
// Detect languages with a threshold of 0.5
let results = detect(codepoints, 0.5);
// results[0].tag = "en"
// results[1].tag = "nl"
// ...
结果是包含以下签名的 Match
结构体的向量
struct Match {
// BCP 47 language tag.
tag: &'static str,
// English name.
name: &'static str,
// Name in native script.
native: &'static str,
// Number of codepoints matched.
count: u32,
// Score (number of codepoints matched divided by the total).
score: f64,
}
语言数据来源于 Adobe 字体的 speakeasy 库。数据在构建时提取,并作为库的一部分静态编译。
许可协议
本库采用 Apache-2.0 许可协议。版权所有 2023,The Type Founders。
无运行时依赖
~0–1.4MB
~19K SLoC