This tool to calculate the word error rate (WER). The word error rate is defined as
\(WER = \frac{\text{#insertions} + \text{#deletions} + \text{#substitutions}}{\text{Words in the reference}}\)
$ asr align --help
usage: asr align [-h] [-s1 S1] [-s2 S2]
align
optional arguments:
-h, --help show this help message and exit
-s1 S1 sequence 1
-s2 S2 sequence 2
Calculate the word error rate (WER) of two word sequences.
Calculation of WER with Levenshtein distance. Works only for iterables up to 254 elements (uint8). O(nm) time and space complexity.
>>> calculate_wer("who is there".split(), "is there".split())
1
>>> calculate_wer("who is there".split(), "".split())
3
>>> calculate_wer("".split(), "who is there".split())
3