Modules

Modules available in werpy

The following table provides an overview of the modules that can be used in werpy:

Module

Description

normalize(text)

Preprocess input text to put it into Unicode Normalization Form C, remove ASCII and Unicode punctuation, remove duplicated spaces, leading/trailing blanks and convert all words to lowercase.

wer(reference, hypothesis)

Calculate the overall Word Error Rate for the entire reference and hypothesis texts.

wers(reference, hypothesis)

Calculates a list of the Word Error Rates for each of the reference and hypothesis texts.

werp(reference, hypothesis, insertions_weight=1, deletions_weight=1, substitutions_weight=1)

Calculates a weighted Word Error Rate for the entire reference and hypothesis texts.

werps(reference, hypothesis, insertions_weight=1, deletions_weight=1, substitutions_weight=1)

Calculates a list of weighted Word Error Rates for each of the reference and hypothesis texts.

summary(reference, hypothesis, *, output="pandas")

Provides a comprehensive breakdown of the calculated results including the WER, Levenshtein Distance and all the insertion, deletion and substitution errors. Returns a pandas DataFrame, a polars DataFrame with output="polars", or a list of dictionaries with output="records".

summaryp(reference, hypothesis, insertions_weight=1, deletions_weight=1, substitutions_weight=1, *, output="pandas")

Delivers an in-depth breakdown of the results, covering metrics like WER, Levenshtein Distance, and a detailed account of insertion, deletion, and substitution errors, inclusive of the weighted WER. Returns a pandas DataFrame, a polars DataFrame with output="polars", or a list of dictionaries with output="records".

Refer to the documentation for specific examples and usage instructions for these modules.