Skip to content

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

[filler-words] - remove filler words

Elisei_Nicolaecfb5c9588de6
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swift
index 21732338..f40d0719 100644
--- a/Sources/Fluid/Persistence/SettingsStore.swift
+++ b/Sources/Fluid/Persistence/SettingsStore.swift
@@ -52,6 +52,10 @@ final class SettingsStore: ObservableObject
// Stats Keys
static let userTypingWPM = "UserTypingWPM"
+
+ // Filler Words
+ static let fillerWords = "FillerWords"
+ static let removeFillerWordsEnabled = "RemoveFillerWordsEnabled"
}
struct SavedProvider: Codable, Identifiable, Hashable
@@ -519,4 +523,29 @@ final class SettingsStore: ObservableObject
DebugLogger.shared.info("✓ Dock visibility preference saved: \(visible)", source: "SettingsStore")
#endif
}
+
+ // MARK: - Filler Words
+
+ static let defaultFillerWords = ["um", "uh", "er", "ah", "eh", "umm", "uhh", "err", "ahh", "ehh", "hmm", "hm", "mm", "mmm", "erm", "urm", "ugh"]
+
+ var fillerWords: [String] {
+ get {
+ if let stored = defaults.array(forKey: Keys.fillerWords) as? [String] {
+ return stored
+ }
+ return Self.defaultFillerWords
+ }
+ set {
+ objectWillChange.send()
+ defaults.set(newValue, forKey: Keys.fillerWords)
+ }
+ }
+
+ var removeFillerWordsEnabled: Bool {
+ get { defaults.object(forKey: Keys.removeFillerWordsEnabled) as? Bool ?? true }
+ set {
+ objectWillChange.send()
+ defaults.set(newValue, forKey: Keys.removeFillerWordsEnabled)
+ }
+ }
}
diff --git a/Sources/Fluid/Services/ASRService.swift b/Sources/Fluid/Services/ASRService.swift
index 256728eb..a69794d1 100644
--- a/Sources/Fluid/Services/ASRService.swift
+++ b/Sources/Fluid/Services/ASRService.swift
@@ -271,7 +271,9 @@ final class ASRService: ObservableObject
DebugLogger.shared.debug("stop(): full transcription finished", source: "ASRService")
DebugLogger.shared.debug("Transcription completed: '\(result.text)' (confidence: \(result.confidence))", source: "ASRService")
// Do not update self.finalText here to avoid instant binding insert in playground
- return result.text
+ let cleanedText = ASRService.removeFillerWords(result.text)
+ DebugLogger.shared.debug("After filler removal: '\(cleanedText)'", source: "ASRService")
+ return cleanedText
}
catch
{
@@ -790,7 +792,8 @@ final class ASRService: ObservableObject
"Streaming chunk CoreML transcription finished in \(String(format: "%.2f", duration))s",
source: "ASRService"
)
- let newText = result.text.trimmingCharacters(in: .whitespacesAndNewlines)
+ let rawText = result.text.trimmingCharacters(in: .whitespacesAndNewlines)
+ let newText = ASRService.removeFillerWords(rawText)
if !newText.isEmpty {
// Smart diff: only show truly new words
@@ -849,5 +852,19 @@ final class ASRService: ObservableObject
{
typingService.typeTextInstantly(text)
}
+
+ /// Removes filler sounds from transcribed text
+ static func removeFillerWords(_ text: String) -> String {
+ guard SettingsStore.shared.removeFillerWordsEnabled else { return text }
+
+ let fillers = Set(SettingsStore.shared.fillerWords.map { $0.lowercased() })
+
+ let words = text.split(separator: " ", omittingEmptySubsequences: true)
+ let filtered = words.filter { word in
+ !fillers.contains(word.lowercased().trimmingCharacters(in: .punctuationCharacters))
+ }
+
+ return filtered.joined(separator: " ")
+ }
}
diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swift
index 4c9b23c8..598bd29f 100644
--- a/Sources/Fluid/UI/SettingsView.swift
+++ b/Sources/Fluid/UI/SettingsView.swift
@@ -553,7 +553,34 @@ struct SettingsView: View {
}
.padding(16)
}
-
+
+ // Filler Words Card
+ ThemedCard(style: .standard) {
+ VStack(alignment: .leading, spacing: 14) {
+ Label("Filler Words", systemImage: "text.badge.minus")
+ .font(.headline)
+ .foregroundStyle(.primary)
+
+ VStack(alignment: .leading, spacing: 12) {
+ optionToggleRow(
+ title: "Remove Filler Words",
+ description: "Automatically remove filler sounds like 'um', 'uh', 'er' from transcriptions.",
+ isOn: Binding(
+ get: { SettingsStore.shared.removeFillerWordsEnabled },
+ set: { SettingsStore.shared.removeFillerWordsEnabled = $0 }
+ )
+ )
+
+ if SettingsStore.shared.removeFillerWordsEnabled {
+ Divider()
+
+ FillerWordsEditor()
+ }
+ }
+ }
+ .padding(16)
+ }
+
// Debug Settings Card
ThemedCard(style: .standard) {
VStack(alignment: .leading, spacing: 14) {
@@ -751,6 +778,116 @@ struct SettingsView: View {
}
}
+// MARK: - Filler Words Editor
+
+struct FillerWordsEditor: View {
+ @State private var fillerWords: [String] = SettingsStore.shared.fillerWords
+ @State private var newWord: String = ""
+ @Environment(\.theme) private var theme
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 10) {
+ Text("Filler words to remove:")
+ .font(.subheadline)
+ .foregroundStyle(.secondary)
+
+ // Word chips
+ FlowLayout(spacing: 6) {
+ ForEach(fillerWords, id: \.self) { word in
+ HStack(spacing: 4) {
+ Text(word)
+ .font(.caption)
+ Button {
+ removeWord(word)
+ } label: {
+ Image(systemName: "xmark")
+ .font(.caption2)
+ }
+ .buttonStyle(.plain)
+ }
+ .padding(.horizontal, 8)
+ .padding(.vertical, 4)
+ .background(
+ RoundedRectangle(cornerRadius: 6, style: .continuous)
+ .fill(.quaternary)
+ )
+ }
+ }
+
+ // Add new word
+ HStack(spacing: 8) {
+ TextField("Add word", text: $newWord)
+ .textFieldStyle(.roundedBorder)
+ .frame(width: 100)
+ .onSubmit { addWord() }
+
+ Button("Add") { addWord() }
+ .buttonStyle(.bordered)
+ .controlSize(.small)
+ .disabled(newWord.trimmingCharacters(in: .whitespaces).isEmpty)
+
+ Spacer()
+
+ Button("Reset") {
+ fillerWords = SettingsStore.defaultFillerWords
+ SettingsStore.shared.fillerWords = fillerWords
+ }
+ .buttonStyle(.bordered)
+ .controlSize(.small)
+ }
+ }
+ }
+
+ private func addWord() {
+ let word = newWord.trimmingCharacters(in: .whitespaces).lowercased()
+ guard !word.isEmpty, !fillerWords.contains(word) else { return }
+ fillerWords.append(word)
+ SettingsStore.shared.fillerWords = fillerWords
+ newWord = ""
+ }
+
+ private func removeWord(_ word: String) {
+ fillerWords.removeAll { $0 == word }
+ SettingsStore.shared.fillerWords = fillerWords
+ }
+}
+
+// MARK: - Flow Layout
+
+struct FlowLayout: Layout {
+ var spacing: CGFloat = 8
+
+ func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize {
+ let result = arrangeSubviews(proposal: proposal, subviews: subviews)
+ return result.size
+ }
+
+ func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) {
+ let result = arrangeSubviews(proposal: proposal, subviews: subviews)
+ for (index, position) in result.positions.enumerated() {
+ subviews[index].place(at: CGPoint(x: bounds.minX + position.x, y: bounds.minY + position.y), proposal: .unspecified)
+ }
+ }
+ private func arrangeSubviews(proposal: ProposedViewSize, subviews: Subviews) -> (size: CGSize, positions: [CGPoint]) {
+ let maxWidth = proposal.width ?? .infinity
+ var positions: [CGPoint] = []
+ var x: CGFloat = 0
+ var y: CGFloat = 0
+ var rowHeight: CGFloat = 0
+ for subview in subviews {
+ let size = subview.sizeThatFits(.unspecified)
+ if x + size.width > maxWidth && x > 0 {
+ x = 0
+ y += rowHeight + spacing
+ rowHeight = 0
+ }
+ positions.append(CGPoint(x: x, y: y))
+ rowHeight = max(rowHeight, size.height)
+ x += size.width + spacing
+ }
+ return (CGSize(width: maxWidth, height: y + rowHeight), positions)
+ }
+}