Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Transcripts: a line that starts with the prompt's names shuffled into a label ("GmbH, Corinna Weber Jonas Braun: Okay.") keeps only what was said (#30)

christianmatdcafd6694cc4
diff --git a/app/src/main/asr/hallucination.ts b/app/src/main/asr/hallucination.ts
index ea20edb8..45f50083 100644
--- a/app/src/main/asr/hallucination.ts
+++ b/app/src/main/asr/hallucination.ts
@@ -47,6 +47,9 @@ export function withoutPromptLabel(text: string, prompt: string): string {
if (!m) return text
const label = tokens(m[1]), p = tokens(prompt)
if (!label.length || !p.length) return text
- const inPrompt = p.some((_, i) => label.every((w, k) => p[i + k] === w))
+ // in order, or shuffled with its little words dropped ("GmbH, Corinna Weber Jonas Braun:" from "With Corinna Weber and
+ // Jonas Braun of Acme GmbH", #30): every word of the label is the prompt's, none of its own
+ const words = new Set(p)
+ const inPrompt = p.some((_, i) => label.every((w, k) => p[i + k] === w)) || label.every((w) => words.has(w))
return inPrompt ? m[2] : text
}
diff --git a/app/test/hallucination.test.ts b/app/test/hallucination.test.ts
index 4d2592b8..95082bf5 100644
--- a/app/test/hallucination.test.ts
+++ b/app/test/hallucination.test.ts
@@ -49,6 +49,13 @@ describe('the prompt read back as a speaker label', () => {
expect(withoutPromptLabel('Christian Mathiesen: okay', prompt)).toBe('okay')
expect(withoutPromptLabel('Eric: yeah, let me check', prompt)).toBe('yeah, let me check')
})
+ it('also when whisper shuffles the prompt\'s names and drops its little words (#30)', () => {
+ const p = 'Weekly sync. With Corinna Weber and Jonas Braun of Acme GmbH.'
+ expect(withoutPromptLabel('GmbH, Corinna Weber Jonas Braun: Okay.', p)).toBe('Okay.')
+ expect(withoutPromptLabel('Jonas Braun, Corinna Weber: sounds good', p)).toBe('sounds good')
+ // one word of its own and it is speech
+ expect(withoutPromptLabel('Corinna Weber said: sounds good', p)).toBe('Corinna Weber said: sounds good')
+ })
it('leaves speech alone: a colon that follows words of its own, or names nobody gave it', () => {
expect(withoutPromptLabel('Here is the plan: ship Friday', prompt)).toBe('Here is the plan: ship Friday')
expect(withoutPromptLabel('Note: the product board is late', prompt)).toBe('Note: the product board is late')