align_phones#
- 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
- Parameters:
ref (list[
CtmInterval
]) – List of CTM intervals as referencetest (list[
CtmInterval
]) – List of CTM intervals to compare to referencesilence_phone (str) – Silence phone (these are ignored in the final calculation)
ignored_phones (set[str], optional) – Phones that should be ignored in score calculations (silence phone is automatically added)
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
- Returns:
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