Rename and relocate transcription filter
This commit is contained in:
parent
a830fe5a1a
commit
0508c3a3b1
@ -111,7 +111,7 @@ class AudioTranscriptionManager: ObservableObject {
|
||||
}
|
||||
|
||||
let transcriptionDuration = Date().timeIntervalSince(transcriptionStart)
|
||||
text = WhisperHallucinationFilter.filter(text)
|
||||
text = TranscriptionOutputFilter.filter(text)
|
||||
text = text.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
|
||||
let powerModeManager = PowerModeManager.shared
|
||||
|
||||
@ -61,7 +61,7 @@ class AudioTranscriptionService: ObservableObject {
|
||||
}
|
||||
|
||||
let transcriptionDuration = Date().timeIntervalSince(transcriptionStart)
|
||||
text = WhisperHallucinationFilter.filter(text)
|
||||
text = TranscriptionOutputFilter.filter(text)
|
||||
text = text.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
|
||||
let powerModeManager = PowerModeManager.shared
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import Foundation
|
||||
import os
|
||||
|
||||
struct WhisperHallucinationFilter {
|
||||
private static let logger = Logger(subsystem: "com.prakashjoshipax.voiceink", category: "WhisperHallucinationFilter")
|
||||
struct TranscriptionOutputFilter {
|
||||
private static let logger = Logger(subsystem: "com.prakashjoshipax.voiceink", category: "TranscriptionOutputFilter")
|
||||
|
||||
private static let hallucinationPatterns = [
|
||||
#"\[.*?\]"#, // []
|
||||
@ -11,7 +11,7 @@ struct WhisperHallucinationFilter {
|
||||
]
|
||||
|
||||
private static let fillerWords = [
|
||||
"uh", "um", "uhm", "umm", "uhh", "uhhh", "er", "ah", "eh",
|
||||
"uh", "um", "uhm", "umm", "uhh", "uhhh", "ah", "eh",
|
||||
"hmm", "hm", "mmm", "mm", "mh", "ha", "ehh"
|
||||
]
|
||||
static func filter(_ text: String) -> String {
|
||||
@ -268,7 +268,7 @@ class WhisperState: NSObject, ObservableObject {
|
||||
|
||||
let transcriptionStart = Date()
|
||||
var text = try await transcriptionService.transcribe(audioURL: url, model: model)
|
||||
text = WhisperHallucinationFilter.filter(text)
|
||||
text = TranscriptionOutputFilter.filter(text)
|
||||
let transcriptionDuration = Date().timeIntervalSince(transcriptionStart)
|
||||
|
||||
let powerModeManager = PowerModeManager.shared
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user