Local native speech transcription
Load compatible local weights explicitly and transcribe a bounded recording with source and model provenance.
// Supply the local files described in docs/SPEECH.md before executing ASR.
// No model or audio is downloaded by this program.
import aner.audio
import aner.speech
import aner.nlp
print(speech.available())
if speech.available() {
let recognizer = speech.load("models/ggml-tiny.en.bin",
device: "cpu", threads: 4, max_seconds: 60.0)
let recording = audio.load("data/jfk.wav", max_seconds: 60.0)
let transcript = recognizer.transcribe(recording,
language: "en", token_timestamps: true)
print(transcript.text())
print(transcript.language())
print(transcript.model())
print(transcript.clock())
for index in Range(transcript.count()) {
print(transcript.start(index))
print(transcript.end(index))
print(transcript.segment_text(index))
}
let documents = transcript.corpus(id: "jfk-fixture", role: "inference")
print(documents.rows())
recognizer.close()
} else {
print("This executable omits the optional native speech backend.")
}
Make it your experiment.
Use Aner 0.1.0 or newer. Save this program as examples/media/speech_transcription.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/media/speech_transcription.aner
aner run examples/media/speech_transcription.anerThe 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.
aner check examples/media/speech_transcription.aner
aner run examples/media/speech_transcription.anerBundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution