Diffing algorithm: Obtaining timestamps of spoken syllables given actual transcript

80 Views Asked by At

I have an audio file that is a recording of a person speaking different letters in sequence, along with a correct, human created transcript of this audio file, e.g. a string ABCDEF.

This audio file is then passed into a speech-to-text transcription API, and I'm given an ordered mapping of each character to the timestamp that it occurred (began) in the audio clip. For example, for a simple 5 second clip, the mapping may look like:

['A' => 0.2, 'B' => 1.5, 'C' => 2.2, 'D' => 3.2, 'E' => 3.8, 'F' => 4.2]

The twist is that this timestamp mapping returned from the API occasionally incorrectly transcribes the letters. In addition to just mistaking a letter for a different one (replacement), it could perceive that letters exist that in fact do not (insertions), or omit spoken letters entirely (removals). For example, the audio containing ABCDEF may have an API response like:

['A' => 0.2, 'B' => 1.5, 'C' => 2.2, 'X' => 2.8, 'D' => 3.2, 'E' => 3.8, 'F' => 4.2]

The ultimate desired result here is to reconcile the actual transcript and the potentially erroneous letter-to-timestamp mapping from the API to obtain the timestamps of when each letter was actually spoken in the clip. I believe I can use some linear interpolation along with a diffing algorithm to reach an ideal solution, but need some guidance on getting started. Thank you.

Note: the "letters" in this example are in practice actually Mandarin Chinese characters, but for the sake of example I use letters as they are monosyllabic and easier to visualize.

0

There are 0 best solutions below