#语言检测 #语言 #Unicode #检测 #字体 #码点 #覆盖率

unicode-language

根据一系列码点检测语言覆盖范围的库

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文本处理

Download history 166/week @ 2024-05-03 138/week @ 2024-05-10 9/week @ 2024-05-17 177/week @ 2024-05-24 391/week @ 2024-05-31 85/week @ 2024-06-07 232/week @ 2024-06-14 194/week @ 2024-06-21 210/week @ 2024-06-28 28/week @ 2024-07-05 69/week @ 2024-07-12 111/week @ 2024-07-19 45/week @ 2024-07-26 139/week @ 2024-08-02 40/week @ 2024-08-09 270/week @ 2024-08-16

494 每月下载量

Apache-2.0

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