Skip to content

Commit 5e54d7c

Browse files
felixlagaclaude
andcommitted
fix(server): removing filler words no longer leaves ".." in dictated text
With "remove filler words" on, a filler followed by an ellipsis lost only the first dot, so "Um... make it red" became ".. make it red" and "uh… blue" left "… blue". The pattern took one trailing comma or period after a filler. The filler's trailing punctuation now also covers "..." (one to three dots) and "…". Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0f4a130 commit 5e54d7c

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎apps/server/src/speech/SpeechService.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,12 @@ it.effect.each([
544544
text: "Uh, Make it red, um, blue.",
545545
expected: "Make it red, blue.",
546546
},
547+
{
548+
cue: undefined,
549+
remove: true,
550+
text: "Um... make it red, uh… blue.",
551+
expected: "make it red, blue.",
552+
},
547553
{
548554
cue: "um",
549555
remove: false,

‎apps/server/src/speech/fillerWords.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function removeSpeechFillerWords(
3434
];
3535
const cuePattern = correctionCue?.trim().split(/\s+/).map(escapeRegex).join("\\s+");
3636
const pattern = new RegExp(
37-
`(?<![\\p{L}\\p{N}_])(?:(${cuePattern || "(?!)"})(?![\\p{L}\\p{N}_])|(?:${words.map(escapeRegex).join("|")})(?![\\p{L}\\p{N}_])[,.]?)`,
37+
`(?<![\\p{L}\\p{N}_])(?:(${cuePattern || "(?!)"})(?![\\p{L}\\p{N}_])|(?:${words.map(escapeRegex).join("|")})(?![\\p{L}\\p{N}_])(?:,|\\.{1,3}|…)?)`,
3838
"giu",
3939
);
4040
const filtered = text.replace(pattern, (_match, cue: string | undefined) => cue ?? "");

0 commit comments

Comments
 (0)