Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more
fix(asr): reject repeated tail artifacts
altic-dev742e88e2e6b7
diff --git a/Sources/Fluid/Services/FluidAudioProvider.swift b/Sources/Fluid/Services/FluidAudioProvider.swiftindex 0967304f..e48cea07 100644--- a/Sources/Fluid/Services/FluidAudioProvider.swift+++ b/Sources/Fluid/Services/FluidAudioProvider.swift@@ -319,6 +319,10 @@ final class FluidAudioProvider: TranscriptionProvider {DebugLogger.shared.info("ASR_BENCH provider_sliding_rejected reason=repeated_clause_opening", source: "ASRBenchmark")return false}+ guard !self.hasRepeatedWordTail(cleaned) else {+ DebugLogger.shared.info("ASR_BENCH provider_sliding_rejected reason=repeated_word_tail", source: "ASRBenchmark")+ return false+ }guard !self.latestStreamingPreviewText.isEmpty else { return true }let minimumLength = Int(Double(self.latestStreamingPreviewText.count) * 0.92)@@ -391,6 +395,29 @@ final class FluidAudioProvider: TranscriptionProvider {return false}+ private func hasRepeatedWordTail(_ text: String) -> Bool {+ let words = text+ .lowercased()+ .split { !$0.isLetter && !$0.isNumber }+ .map(String.init)++ for word in words where word.count >= 12 {+ let characters = Array(word)+ let maxTailLength = min(10, characters.count / 2 + 2)+ guard maxTailLength >= 5 else { continue }++ for tailLength in 5...maxTailLength {+ let tail = String(characters.suffix(tailLength))+ let prefix = String(characters.dropLast(tailLength))+ if prefix.contains(tail) {+ return true+ }+ }+ }++ return false+ }+private func createPCMBuffer(from samples: [Float]) throws -> AVAudioPCMBuffer {guardlet format = AVAudioFormat(commonFormat: .pcmFormatFloat32, sampleRate: 16_000, channels: 1, interleaved: false),