kahne / fastwer

A PyPI package for fast word/character error rate (WER/CER) calculation
MIT License
68 stars 15 forks source link
natural-language-processing speech-processing speech-recognition spoken-language-processing spoken-language-recognition

FastWER

A PyPI package for fast word/character error rate (WER/CER) calculation

Installation

pip install pybind11 fastwer

Example

import fastwer
hypo = ['This is an example .', 'This is another example .']
ref = ['This is the example :)', 'That is the example .']

# Corpus-Level WER: 40.0
fastwer.score(hypo, ref)
# Corpus-Level CER: 25.5814
fastwer.score(hypo, ref, char_level=True)

# Sentence-Level WER: 40.0
fastwer.score_sent(hypo[0], ref[0])
# Sentence-Level CER: 22.7273
fastwer.score_sent(hypo[0], ref[0], char_level=True)

Contact

Changhan Wang (wangchanghan@gmail.com)