关于 jiwer
- github : https://github.com/jitsi/jiwer
- 文档:https://jitsi.github.io/jiwer/
- https://www.cnpython.com/pypi/jiwer
JiWER 是一个简单快速的 python包,用于评估自动语音识别系统。它支持以下measures:
- word error rate (WER)
- match error rate (MER)
- word information lost (WIL)
- word information preserved (WIP)
- character error rate (CER)
这些度量是通过使用一个或多个参考句和假设句之间的最小编辑距离来计算的。
使用 RapidFuzz 计算最小编辑距离,它在后台使用C++,因此比纯python实现更快。
RapidFuzz : https://github.com/maxbachmann/RapidFuzz
安装
方式一:pip
需要 python >= 3.7
pip install jiwer
方式二:poetry
poetry add jiwer
使用
最简单的用例是计算两个字符串之间的 词错误率:
from jiwer import wer
reference = "hello world"
hypothesis = "hello duck"
error = wer(reference, hypothesis) # 0.5
计算多个句子
from jiwer import wer
ground_truth=["hello world","i like monthy python"]
hypothesis=["hello duck","i like python"]
error=wer(ground_truth,hypothesis) # 0.3333333333333333
2023-04-04(二)