Utilities

Signal Processing

pathbench.utils.normalise_signal(x, method)[source]

Normalise signal to RMS or zero mean

Parameters:
  • x – signal

  • method – Method to use for normalisation

Returns:

pathbench.utils.moving_average_filtering(x, N=5)[source]
pathbench.utils.write_correlation_table(output_file, results, metrics)[source]

Writes a markdown-style summary table of PCC results.

Parameters:
  • output_file – file-like object

  • results (dict) – dataset_dir -> {‘pcc_<metric>’: float}

  • metrics (list) – ordered list of metric names (without ‘pcc_’ prefix)

Text Normalisation

pathbench.string_clean.clean_text(text)[source]

A function to clean text by: 1. Lowercasing 2. Removing punctuation (ASCII and CJK) 3. Removing multiple spaces 4. Stripping whitespace

Return type:

str

pathbench.string_clean.cached_phonemize(text, language)[source]

Cached phonemization via espeak. Pure function: same input -> same output.

Return type:

str