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第三方库


热门话题
如何使用运行时从JAVA运行openssl命令?   不使用线程安全类(如AtomicInteger和SynchronizedList)的java ProducerConsumer问题   匹配字符串的java模式   在java中使用泛型接口作为返回类型   java将可能具有序列化JSON值的hashmap作为节点添加到JSON字符串中   Eclipse无法从Java8流推断正确的类型   java无法了解标准JButton的大小   java我能用一个循环优化这个函数吗(在第一种方法中)?   Apache CXF中基于WebSocket的java SOAP?   java想要运行奇偶和求和三步   矩阵上随机元素的java集值   java布尔相等:0==a,操作数顺序重要吗?   java Eclipse不会退出我的插件   java如何在spring的SOAP拦截器中获取HttpServletRequest和HttpServletResponse