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: drop commas between punctuation
altic-dev0816b13012cd
diff --git a/Sources/Fluid/Services/ASRService+SpokenPunctuationFormatting.swift b/Sources/Fluid/Services/ASRService+SpokenPunctuationFormatting.swiftindex 87f55103..c28d4ccf 100644--- a/Sources/Fluid/Services/ASRService+SpokenPunctuationFormatting.swift+++ b/Sources/Fluid/Services/ASRService+SpokenPunctuationFormatting.swift@@ -548,6 +548,10 @@ private enum SpokenPunctuationFormatter {["+", "=", "%", "-", "—", "–", "/", "\\", "@", "#", "$", "&", "*", "_", "|", "~", "^", "<", ">"])+ private static let punctuationPairCommaCleanupCharacters = Set<Character>(+ ["+", "=", "%", "-", "—", "–", "/", "\\", "@", "#", "$", "&", "*", "_", "|", "~", "^", "<", ">", "(", ")", "[", "]", "{", "}", "\"", "'", "`", ".", "?", "!", ":", ";"]+ )+private static func cleanSymbolCommaNoise(in text: String) -> String {guard text.contains(",") else { return text }@@ -577,8 +581,11 @@ private enum SpokenPunctuationFormatter {}private static func shouldRemoveComma(previous: Character?, next: Character?) -> Bool {- previous.map { self.symbolCommaCleanupCharacters.contains($0) } == true ||+ let isNextToSymbol = previous.map { self.symbolCommaCleanupCharacters.contains($0) } == true ||next.map { self.symbolCommaCleanupCharacters.contains($0) } == true+ let isBetweenPunctuationPair = previous.map { self.punctuationPairCommaCleanupCharacters.contains($0) } == true &&+ next.map { self.punctuationPairCommaCleanupCharacters.contains($0) } == true+ return isNextToSymbol || isBetweenPunctuationPair}private static func indexAfterSkippableComma(diff --git a/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift b/Tests/FluidDictationIntegrationTests/DictationE2ETests.swiftindex 23cbe924..602b38a6 100644--- a/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift+++ b/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift@@ -431,6 +431,18 @@ final class DictationE2ETests: XCTestCase {ASRService.applySpokenPunctuationFormatting("50, %"),"50%")+ XCTAssertEqual(+ ASRService.applySpokenPunctuationFormatting("open bracket comma close bracket"),+ "[]"+ )+ XCTAssertEqual(+ ASRService.applySpokenPunctuationFormatting("open paren comma close paren"),+ "()"+ )+ XCTAssertEqual(+ ASRService.applySpokenPunctuationFormatting("question mark comma exclamation mark"),+ "?!"+ )}}