Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
import Levenshtein
from typing import Union, List
import jiwer.transforms as tr
__all__ = ["wer"]
################################################################################
# Implementation of the WER method, exposed publicly
_default_transform = tr.Compose(
[
tr.RemoveMultipleSpaces(),
tr.Strip(),
tr.SentencesToListOfWords(),
tr.RemoveEmptyStrings(),
]
)
_standardize_transform = tr.Compose(
[
tr.ToLowerCase(),
tr.ExpandCommonEnglishContractions(),
tr.RemoveKaldiNonWords(),
tr.RemoveWhiteSpace(replace_by_space=True),
]
)