🚀 GlotLID
GlotLID 是一個基於 Fasttext 的語言識別(LID)模型,支持超過 2000 種語言標籤,能高效準確地識別文本語言。
🚀 快速開始
模型使用
以下是使用該模型檢測給定文本語言的示例代碼:
>>> import fasttext
>>> from huggingface_hub import hf_hub_download
>>> model_path = hf_hub_download(repo_id="cis-lmu/glotlid", filename="model.bin")
>>> model = fasttext.load_model(model_path)
>>> model.predict("Hello, world!")
直接下載模型
若你不喜歡使用 huggingface_hub
,也可以直接下載模型:
>>> ! wget https://huggingface.co/cis-lmu/glotlid/resolve/main/model.bin
>>> import fasttext
>>> model = fasttext.load_model("/path/to/model.bin")
>>> model.predict("Hello, world!")
✨ 主要特性
- 支持眾多語言:支持超過 2000 種語言標籤,最新的 V3 版本支持 2102 種語言標籤(帶書寫系統的三字母 ISO 代碼)。
- 持續更新:模型不斷迭代更新,從 V1 到 V3 版本,逐步增加支持的語言數量,清理噪聲語料和修正錯誤的元數據標籤。
📚 詳細文檔
📄 許可證
該模型遵循 Apache 許可證 2.0 版本進行分發。
🔖 版本說明
我們在倉庫中始終保留 GlotLID 的舊版本。若要訪問特定版本,只需在 filename
後添加版本號:
- V1:
model_v1.bin
(在 GlotLID 論文 中引入,並用於所有實驗)。
- V2:
model_v2.bin
(V1 的改進版本,支持更多語言,基於 V1 的分析清理了噪聲語料)。
- V3:
model_v3.bin
(V2 的改進版本,支持更多語言,排除宏觀語言,基於 V2 的分析進一步清理了噪聲語料和錯誤的元數據標籤,支持 "zxx" 和 "und" 系列標籤)。
model.bin
始終指代最新版本(V3)。
📑 參考文獻
如果您使用此模型,請引用以下論文:
@inproceedings{
kargaran2023glotlid,
title={{GlotLID}: Language Identification for Low-Resource Languages},
author={Kargaran, Amir Hossein and Imani, Ayyoob and Yvon, Fran{\c{c}}ois and Sch{\"u}tze, Hinrich},
booktitle={The 2023 Conference on Empirical Methods in Natural Language Processing},
year={2023},
url={https://openreview.net/forum?id=dl4e3EBz5j}
}