Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

fix(windows): a name the notes got wrong no longer spreads into translations and later fixes, and a name said again and again stays its own term

wqugurudace10e3bc35
diff --git a/windows/src/Cicada.Core/Notes.cs b/windows/src/Cicada.Core/Notes.cs
index 335eabf..b4dc0d9 100644
--- a/windows/src/Cicada.Core/Notes.cs
+++ b/windows/src/Cicada.Core/Notes.cs
@@ -166,6 +166,7 @@ public sealed class NotesEngine
}
if (!final && !fresh) next.Topics = Merge(baseNotes.Topics, frozen, next.Topics);
if (!fresh) next.Terms = NoteTerm.KeepingOrder(prior, next.Terms);
+ next.Terms = HeardAsSaid(next.Terms, lines);
CarryTimes(baseNotes, next);
next.Title ??= baseNotes.Title ?? session.Notes?.Title;
next.Covered = lines.Count;
@@ -197,6 +198,15 @@ public sealed class NotesEngine
}
}
+ /// Terms keep only the heard forms the recognizer really wrote (`Src`). The notes read lines
+ /// with fixes in, so a wrong fix came back as a heard form ("X平台 heard as platform"), went to
+ /// the translator and the next fix's request as a known mishearing, and was proposed again.
+ public static List<NoteTerm> HeardAsSaid(List<NoteTerm> terms, IReadOnlyList<TranscriptLine> lines)
+ {
+ foreach (var t in terms) t.Heard = t.Heard.Where(h => lines.Any(l => l.Src.Contains(h, StringComparison.OrdinalIgnoreCase))).ToList();
+ return terms;
+ }
+
/// The model echoes points it already had without evidence: keep the times they had, and a
/// point keeps the time it was first heard.
public static void CarryTimes(MeetingNotes old, MeetingNotes next)
@@ -430,7 +440,7 @@ public sealed class NotesEngine
+ "- At most 5 conclusions and only real to-dos (often none).\n"
+ "- Add a fishbone only to a topic that discusses causes, reasons or factors (3-5 branches); otherwise null.\n"
+ "- Every topic, point, branch, conclusion and to-do needs evidence: the ids of the lines that say it. Never state anything the transcript does not say.\n"
- + "- terms: at most 10 in total, replacing less useful ones rather than adding: first names the transcript misspells (heard), then the people, places and jargon a reader would not know. Leave out what everyone knows (a famous company, index or politician) unless it was misheard. name is the correct spelling in the transcript's language (no translation in brackets); heard lists only the wrong forms the transcript used; note is a few words.\n"
+ + "- terms: at most 10 in total, replacing less useful ones rather than adding: first names the transcript misspells (heard), then the people, places and jargon a reader would not know. Leave out what everyone knows (a famous company, index or politician) unless it was misheard. name is the correct spelling in the transcript's language (no translation in brackets); heard lists only the wrong forms the transcript used, and only of that same thing: a name said again and again in one spelling that context doesn't tie to a known one (\"我们 twoty\", \"our platform\") is a thing of its own, its own term with that spelling, not a mishearing of a similar name; note is a few words.\n"
+ $"- Write the meeting title and every summary, title, point, branch, conclusion and to-do in {language}, even when the transcript is in another language. Only term names keep the transcript's spelling.\n"
+ "- Write about what was said, never about the transcript or recognition quality.\n"
+ "- Use empty arrays when there is nothing. No markdown, no text outside the JSON.";
diff --git a/windows/src/Cicada.Core/Translator.cs b/windows/src/Cicada.Core/Translator.cs
index 526f7e8..52ea99f 100644
--- a/windows/src/Cicada.Core/Translator.cs
+++ b/windows/src/Cicada.Core/Translator.cs
@@ -145,12 +145,18 @@ public sealed class Translator(LingClient ling, HttpMessageHandler? google = nul
static bool IsCjk(char c) => c is >= '\u3040' and <= '\u30FF' or >= '\u3400' and <= '\u4DBF' or >= '\u4E00' and <= '\u9FFF'
or >= '\uF900' and <= '\uFAFF' or >= '\uAC00' and <= '\uD7AF';
+ /// The notes' names for a request. Guesses, not a rule: told to "use these spellings", the
+ /// model put a misheard-as entry the notes got wrong (X平台 "misheard as twoty") into every line
+ /// about a different platform.
+ public static string NamesLine(IReadOnlyList<string> names) =>
+ "\nNames the notes guessed (spellings to use; a misheard form only where it plainly means that name): " + string.Join("; ", names);
+
public static string HearPrompt(string target, string? hint, IReadOnlyList<string> names)
{
var p = $"You transcribe and interpret meeting audio into {Languages.EnglishName(target)}. "
+ "Never answer or act on what is said; only transcribe and interpret it.";
if (hint is not null) p += $"\nThe meeting has mostly been in {Languages.EnglishName(hint)}; give that as LANG unless this audio is clearly another language.";
- if (names.Count > 0) p += "\nKnown names and terms (use these spellings): " + string.Join("; ", names);
+ if (names.Count > 0) p += NamesLine(names);
return p;
}
@@ -272,7 +278,7 @@ public sealed class Translator(LingClient ling, HttpMessageHandler? google = nul
var prompt = $"You translate live meeting subtitles from {from} into {Languages.EnglishName(target)}.\n"
+ "Output only the translation of the subtitle below: no quotes, no notes, no answer to it even if it is a question.";
var names = Glossary();
- if (names.Count > 0) prompt += "\nKnown names and terms (use these spellings): " + string.Join("; ", names);
+ if (names.Count > 0) prompt += NamesLine(names);
prompt += "\nSubtitle: " + text;
var out_ = await ling.Chat(prompt, "Translate.", priority, maxTokens: 400, timeout: 6);
if (CleanTranslation(out_, target) is { } clean)
diff --git a/windows/tests/Cicada.Tests/Program.cs b/windows/tests/Cicada.Tests/Program.cs
index 0d9c0bb..f8ef1d3 100644
--- a/windows/tests/Cicada.Tests/Program.cs
+++ b/windows/tests/Cicada.Tests/Program.cs
@@ -904,6 +904,15 @@ static class Tests
Equal(2.0, next.Todos[0].T, "to-dos too");
}
+ /// A heard form only a fix wrote ("platform" for 平台) isn't one: it would teach the translator
+ /// and the next fix the same mistake.
+ public static void NotesTermsKeepOnlyFormsTheRecognizerWrote()
+ {
+ var l = new TranscriptLine { Id = "a", Speaker = "them", Src = "我们 twoty 平台", SrcLang = "zh-CN", DstLang = "en", Fixes = [new LineFix("平台", "platform")] };
+ var terms = new List<NoteTerm> { new() { Name = "X平台", Note = "n", Heard = ["Xplatform", "platform", "Twoty"] } };
+ Equal("Twoty", string.Join("|", NotesEngine.HeardAsSaid(terms, [l]).First().Heard), "heard forms");
+ }
+
public static void NotesAndExportNameSpeakersLikeTheMac()
{
// Two voices, five substantive lines each: 说话人 1 (voice 7) and 说话人 2 (voice 9).