@devries-cameron20 / t3code Mirror · read-only / commits / 39f465a926
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 18:30 UTC

fix(server): a C# dictionary term no longer rewrites standalone letters (#35700)

Julius Marminge committed Nov 12, 2026 at 16:00 UTC 39f465a926ca95496708f798a823600e07fe6060
2 files changed +11 -4
apps/server/src/speech/SpeechService.test.ts
+3 -2
@@ -449,14 +449,15 @@ it.effect("honors exact aliases and phrase boundaries in batch and streamed text
449 { term: "GitHub", aliases: [] },
450 { term: "McDonald’s", aliases: [] },
451 { term: "King’s Cross", aliases: [] },
452 + { term: "C#", aliases: [] },
453 ],
454 };
455 const spoken =
456 'a test with a i and ay eye. Robert, Roberts. "the publisher" and the publisher. (git hub), git (hub). ' +
456 - "git hub's API, git hub’s API, git’s hub, mac donald's menu, king's cross.";
457 + "git hub's API, git hub’s API, git’s hub, mac donald's menu, king's cross. vitamin c and plan c.";
458 const expected =
459 "a test with AI and AI. Bob, Roberts. O'Reilly and the publisher. (GitHub), git (hub). " +
459 - "GitHub's API, GitHub’s API, git’s hub, McDonald’s menu, King’s Cross.";
460 + "GitHub's API, GitHub’s API, git’s hub, McDonald’s menu, King’s Cross. vitamin c and plan c.";
461 native.transcribe.mockResolvedValueOnce({ text: spoken });
462 native.finish.mockResolvedValueOnce(spoken);
463 expect(yield* speech.transcribe(pcm(), options)).toBe(expected);
apps/server/src/speech/customWords.ts
+8 -2
@@ -71,8 +71,14 @@ export function makeSpeechTextCorrector(
71
72 const customWordKeys = (words: readonly string[]): CustomWordKey[] =>
73 words.flatMap((word) => {
74 - const keys = [matchKey(word)];
75 - if (word.includes("&")) keys.push(matchKey(word.replaceAll("&", " and ")));
74 + const sources = [word];
75 + if (word.includes("&")) sources.push(word.replaceAll("&", " and "));
76 + const keys = sources.flatMap((source) => {
77 + const key = matchKey(source);
78 + // A term that loses its symbols to one letter (C# -> c) would claim every standalone letter.
79 + const lostSymbols = key !== source.replace(/\s+/gu, "").toLocaleLowerCase();
80 + return key.length < 2 && lostSymbols ? [] : [key];
81 + });
82 return [...new Set(keys)].filter(isAsciiKey).map((key) => ({ word, key }));
83 });
84