feat: controller supports vocabulary bias, prompt-echo guard, corrector and result hook

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 14:54:49 +02:00
co-authored by Claude Sonnet 5.5
parent aec4aa7a5b
commit 7fbc182fa7
5 changed files with 236 additions and 7 deletions
+28
View File
@@ -41,3 +41,31 @@ final class FakeInserter: TextInserting {
inserted.append(text)
}
}
final class FakeVocabularyTranscriber: Transcriber {
var result = "hallo wereld"
private(set) var vocabularies: [[String]] = []
func transcribe(_ samples: [Float]) async throws -> String { result }
func transcribe(_ samples: [Float], vocabulary: [String]) async throws -> String {
vocabularies.append(vocabulary)
return result
}
}
struct UppercaseCorrector: TextCorrecting {
func correct(_ text: String) -> CorrectionResult {
let upper = text.uppercased()
return CorrectionResult(
text: upper,
corrections: [AppliedCorrection(heard: text, wrote: upper, rule: "upper", start: 0, length: upper.utf16.count)]
)
}
}
final class PassthroughCleaner: Cleaner {
func clean(_ text: String, context: CleaningContext) async throws -> String {
text
}
}