feat: add vocabulary-aware Transcriber and shared correction/result types
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
@testable import SstCore
|
||||
|
||||
private struct PlainTranscriber: Transcriber {
|
||||
func transcribe(_ samples: [Float]) async throws -> String { "plain \(samples.count)" }
|
||||
}
|
||||
|
||||
struct TranscriberVocabularyTests {
|
||||
@Test func vocabularyVariantFallsBackToPlainTranscribe() async throws {
|
||||
let result = try await PlainTranscriber().transcribe([0, 0, 0], vocabulary: ["Anthropic"])
|
||||
#expect(result == "plain 3")
|
||||
}
|
||||
|
||||
@Test func appliedCorrectionRoundTripsThroughJSON() throws {
|
||||
let original = AppliedCorrection(heard: "cloud code", wrote: "Claude Code", rule: "cloud code", start: 12, length: 11)
|
||||
let data = try JSONEncoder().encode(original)
|
||||
let decoded = try JSONDecoder().decode(AppliedCorrection.self, from: data)
|
||||
#expect(decoded == original)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user