All examples
Media

Timed CTC transcripts and NLP

Decode explicit acoustic logits, inspect transcript timing and bridge text into native NLP.

speech_ctc.aner
// Synthetic logits demonstrate a declared CTC contract, not recognition quality.
import aner.tensor
import aner.speech
import aner.nlp

let logits: Tensor = [
    [5.0, -5.0, -5.0],
    [-5.0, 5.0, -5.0],
    [-5.0, 5.0, -5.0],
    [5.0, -5.0, -5.0],
    [-5.0, -5.0, 5.0],
    [-5.0, -5.0, 5.0],
    [5.0, -5.0, -5.0]]
let decoded = speech.ctc_greedy(logits, List("", "h", "i"),
    blank: 0, frame_seconds: 0.02, model: "synthetic-ctc")
print(decoded.text())
print(decoded.count())
print(decoded.token_count())
print(decoded.token_start(0))
print(decoded.token_end(1))
print(speech.wer("hi", decoded.text()))
print(speech.cer("café", "cafe"))

let imported = speech.transcript(List("Hello ", "world"),
    [[0.0, 0.2], [0.2, 0.6]], language: "en", model: "manual-fixture")
print(imported.text())
let documents = decoded.corpus(id: "synthetic-utterance", role: "inference")
print(documents.rows())
print(documents.role())

Make it your experiment.

Use Aner 0.1.0 or newer. Save this program as examples/media/speech_ctc.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/media/speech_ctc.aner
aner run examples/media/speech_ctc.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Requires Aner 0.1.0 or newer. Native PCM/WAV, synthesis, FFT and speech activity are available independently of optional FFmpeg and model backends. Decoding, resampling or local transcription requires the corresponding capability and separately supplied inputs or weights.

Credential setup
aner check examples/media/speech_ctc.aner
aner run examples/media/speech_ctc.aner

Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner