Skip to content

Better evaluation #33

@MetroCat69

Description

@MetroCat69

we can use the jiwer library to improve the evaluation by removing multiple spaces and we can also add character error rate to the evaluation

example:

transformation = jiwer.Compose([
jiwer.RemovePunctuation(),
jiwer.RemoveEmptyStrings(),
jiwer.ToLowerCase(),
jiwer.RemoveWhiteSpace(replace_by_space=True),
jiwer.RemoveMultipleSpaces(),
jiwer.Strip(),
jiwer.ReduceToListOfListOfWords(word_delimiter=" ")
])

def wer(ground_truth, hypothesis):
return jiwer.wer(
ground_truth,
hypothesis,
truth_transform=transformation,
hypothesis_transform=transformation
)

def cer(ground_truth, hypothesis):
return jiwer.cer(
ground_truth.replace('.', '').replace(',', '').replace('?', '').replace('-', '').replace('"', ''),
hypothesis.replace('.', '').replace(',', '').replace('?', '').replace('-', '').replace('"', ''),
    )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions