Centralize hallucination filter
This commit is contained in:
parent
011b310823
commit
2b787e8e64
@ -60,6 +60,7 @@ class AudioTranscriptionService: ObservableObject {
|
||||
}
|
||||
|
||||
let transcriptionDuration = Date().timeIntervalSince(transcriptionStart)
|
||||
text = WhisperHallucinationFilter.filter(text)
|
||||
text = text.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
|
||||
// Apply word replacements if enabled
|
||||
|
||||
@ -144,9 +144,6 @@ class ParakeetTranscriptionService: TranscriptionService {
|
||||
text = WhisperTextFormatter.format(text)
|
||||
}
|
||||
|
||||
// Apply hallucination and filler word filtering
|
||||
text = WhisperHallucinationFilter.filter(text)
|
||||
|
||||
return text
|
||||
}
|
||||
|
||||
|
||||
@ -107,8 +107,7 @@ actor WhisperContext {
|
||||
for i in 0..<whisper_full_n_segments(context) {
|
||||
transcription += String(cString: whisper_full_get_segment_text(context, i))
|
||||
}
|
||||
let filteredTranscription = WhisperHallucinationFilter.filter(transcription)
|
||||
return filteredTranscription
|
||||
return transcription
|
||||
}
|
||||
|
||||
static func createContext(path: String) async throws -> WhisperContext {
|
||||
|
||||
@ -268,6 +268,7 @@ class WhisperState: NSObject, ObservableObject {
|
||||
|
||||
let transcriptionStart = Date()
|
||||
var text = try await transcriptionService.transcribe(audioURL: url, model: model)
|
||||
text = WhisperHallucinationFilter.filter(text)
|
||||
let transcriptionDuration = Date().timeIntervalSince(transcriptionStart)
|
||||
|
||||
if await checkCancellationAndCleanup() { return }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user