Pieces

object Pieces(source)

Cutting a recording into the pieces a recogniser is given one at a time.

Every side that listens to the same reading has to cut it the same way. A piece boundary changes what comes back near it, and a runtime left to cut on its own cuts elsewhere: a forty-second reading handed whole to one recogniser and in fifteen-second windows to another is two different questions, and the answers cannot be held against each other. So the cut is made here, by rule, before any of them is asked.

Functions

Link copied to clipboard
fun cuts(samples: FloatArray, sampleRate: Double): List<IntRange>

The pieces the recording is asked in, in samples, each overlapping the one before.

Link copied to clipboard
fun heard(piece: FloatArray, sampleRate: Double, asking: (FloatArray) -> List<RecognizedWord>): List<RecognizedWord>

What one piece comes back as, recovering an empty or prematurely stopped answer.

fun heard(piece: FloatArray, sampleRate: Double, coveredPrefix: Double, asking: (FloatArray) -> List<RecognizedWord>): List<RecognizedWord>
Link copied to clipboard
fun joined(heard: List<List<RecognizedWord>>, pieces: List<IntRange>, sampleRate: Double): List<RecognizedWord>

One reading out of what each piece came back with.

Link copied to clipboard
fun pauses(samples: FloatArray, sampleRate: Double): List<Int>

Where the recording is quiet long enough that a cut there takes no word in half.