ASR成绩单的大概有效期

jiwer的Python项目详细描述


自动语音识别的字错误率

这个存储库包含一个简单的Python包来近似抄本的WER。它计算最小编辑距离 一个语音到文本的api,介于基本真句和假设句之间。计算最小编辑距离 使用 Wagner-Fisher 算法。由于该算法计算字符级的最小编辑距离,因此句子中的每个单词都被赋予一个 唯一整数,编辑距离通过一个整数字符串计算。

安装

您应该可以使用pip:

$ pip install jiwer

用法

最简单的用例是计算两个字符串之间的编辑距离:

fromjiwerimportwerground_truth="hello world"hypothesis="hello duck"error=wer(ground_truth,hypothesis)

您还可以计算多个句子的wer:

fromjiwerimportwerground_truth=["hello world","i like monthy python"]hypothesis=["hello duck","i like python"]error=wer(ground_truth,hypothesis)

当基本真理句和假设句的数量不同时,对合并的句子进行最小对齐:

ground_truth=["hello world","i like monthy python","what do you mean, african or european swallow?"]hypothesis=["hello","i like","python","what you mean swallow"]# is equivelent toground_truth="hello world i like monhty python what do you mean african or european swallow"hypothesis="hello i like python what you mean swallow"

附加预处理

可以对输入进行一些额外的预处理。默认情况下,空格被删除,所有内容都设置为小写, .,被删除,从[]<>(对于kaldi模型来说很常见)之间的所有内容都被删除,每个单词都由 被一个或多个空间分割。此外,如果 standardize=True是沿着wer方法传递的。

fromjiwerimportwerground_truth="he's my neminis"hypothesis="he is my <unk> [laughter]"wer(ground_truth,hypothesis,standardize=True)# is equivelent to ground_truth="he is my neminis"hypothesis="he is my"wer(ground_truth,hypothesis)

此外,还有一个选项提供一个单词列表,从 抄写,如“yhe”或“so”。

fromjiwerimportwerground_truth="yhe about that bug"hypothesis="yeah about that bug"wer(ground_truth,hypothesis,words_to_filter=["yhe","yeah"])# is equivelent to ground_truth="about that bug"hypothesis="about that bug"wer(ground_truth,hypothesis)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
gwt java。lang.UnsupportedClassVersionError:不受支持的专业。小版本51.0   java XML解析器trycatch不工作   java Jackson MRBean不工作,无法构造实例   javascript是检查参数的更好方法吗?   java在发生冲突时从ArrayList中删除对象   JavaSpringWebFlux和KeyClope JWTRESTAPI   java Selected选项在微调器中不可见   java在增加分区后,有没有办法在ApacheKafka中保持顺序?   java添加SourceRoot会导致spring启动应用程序出错   java Spring引导:任何bean都没有实现ReactiveCrudepository   java无法注册我的自定义AbstractAnnotationConfigDispatcherServletInitializer   TCP连接上的java Caesar密码   java树集排序不正确   java如何在自定义查询中加载@ElementCollection?