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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user