montreal_forced_aligner.helper.align_phones(ref, test, silence_phone, ignored_phones=None, custom_mapping=None, debug=False)[source]#

Align phones based on how much they overlap and their phone label, with the ability to specify a custom mapping for different phone labels to be scored as if they’re the same phone

  • ref (list[CtmInterval]) – List of CTM intervals as reference

  • test (list[CtmInterval]) – List of CTM intervals to compare to reference

  • silence_phone (str) – Silence phone (these are ignored in the final calculation)

  • custom_mapping (dict[str, str], optional) – Mapping of phones to treat as matches even if they have different symbols

  • debug (bool, optional) – Flag for logging extra information about alignments


  • float – Score based on the average amount of overlap in phone intervals

  • float – Phone error rate

  • dict[tuple[str, str], int] – Dictionary of error pairs with their counts