overlap_scoring#

montreal_forced_aligner.helper.overlap_scoring(first_element, second_element, silence_phone, mapping=None)[source]#

Method to calculate overlap scoring

\[\begin{split}Score = -(\lvert begin_{1} - begin_{2} \rvert + \lvert end_{1} - end_{2} \rvert + \begin{cases} 0, & if label_{1} = label_{2} \\ 2, & otherwise \end{cases})\end{split}\]

See also

Blog post

For a detailed example that using this metric

Parameters:
  • first_element (CtmInterval) – First CTM interval to compare

  • second_element (CtmInterval) – Second CTM interval

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

Returns:

Score calculated as the negative sum of the absolute different in begin timestamps, absolute difference in end timestamps and the label score

Return type:

float