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(android): saying yes to a new name fixes the rest of the meeting heard the same way at once, not only with the next line

wquguruf2e6945e8c90
diff --git a/android/cli/src/main/kotlin/cicada/cli/FixTests.kt b/android/cli/src/main/kotlin/cicada/cli/FixTests.kt
index b5a130f..5a10d4f 100644
--- a/android/cli/src/main/kotlin/cicada/cli/FixTests.kt
+++ b/android/cli/src/main/kotlin/cicada/cli/FixTests.kt
@@ -7,6 +7,7 @@ import cicada.*
object FixTests {
val tests: List<Pair<String, () -> Unit>> = listOf(
"fixesReadAndWrittenLikeTheMac" to ::recordWithFixes,
+ "yesFixesTheRestOfTheMeetingHeardTheSameWayAtOnce" to ::yesFixesTheRestOfTheMeetingHeardTheSameWayAtOnce,
"recordFormatUnchangedWithoutFixes" to ::recordFormatUnchangedWithoutFixes,
"exportsShowTheFixedText" to ::exportsShowTheFixedText,
"applyReplacesAndMarks" to ::applyReplacesAndMarks,
@@ -359,6 +360,17 @@ object FixTests {
check(t.fx.vocabulary.terms.isEmpty(), "not taught")
}
+ fun yesFixesTheRestOfTheMeetingHeardTheSameWayAtOnce() {
+ val t = setup("最近那个开布特提了", "开布特那边也有", "别的")
+ t.fx.received(t.line("l0").src, listOf(Correction.Edit("开布特", "Curve", 0.9)))
+ t.fx.answer(t.fx.asking(t.id)!!.fix, true, t.id)
+ equal("Curve那边也有", t.line("l1").shown, "the other line follows at once")
+ equal(null, t.line("l2").fixes, "a line without it untouched")
+ t.fx.undo()
+ equal("开布特那边也有", t.line("l1").shown, "undo takes it back too")
+ equal("最近那个开布特提了", t.line("l0").shown, "and the asked line")
+ }
+
fun laterTakesItOffTheCardButKeepsItWaiting() {
val t = setup("最近那个开布特提了")
t.fx.received("最近那个开布特提了", listOf(Correction.Edit("开布特", "Curve", 0.9)))
diff --git a/android/core/src/main/kotlin/cicada/LiveFixes.kt b/android/core/src/main/kotlin/cicada/LiveFixes.kt
index 95f2e37..d383d4e 100644
--- a/android/core/src/main/kotlin/cicada/LiveFixes.kt
+++ b/android/core/src/main/kotlin/cicada/LiveFixes.kt
@@ -138,15 +138,23 @@ class LiveFixes(val store: SessionStore, val vocabulary: Vocabulary, private val
/// and a yes goes into the word list so the next meeting fixes it without asking.
@Synchronized fun answer(fix: LineFix, yes: Boolean, id: String) {
val c = Correction.core(fix.from, fix.to)
- val touched = store.lines(id).filter { l -> (l.fixes ?: emptyList()).any { it.ask == true && Correction.core(it.from, it.to) == c } }
- remember(id, touched.map { it.id })
+ val lines = store.lines(id)
+ val touched = lines.filter { l -> (l.fixes ?: emptyList()).any { it.ask == true && Correction.core(it.from, it.to) == c } }
+ val others = if (yes) lines.filter { l -> l.src.contains(c.first) && touched.none { it.id == l.id } } else emptyList()
+ remember(id, (touched + others).map { it.id })
for (l in touched) {
val fixes = (l.fixes ?: emptyList()).map { f ->
if (f.ask == true && Correction.core(f.from, f.to) == c) f.copy(ask = null, user = if (yes) true else f.user, off = if (yes) f.off else true) else f
}
set(fixes, l.id, id)
}
- if (yes) vocabulary.confirm(c.first, c.second) else refused.add(pair(c.first, c.second))
+ if (yes) {
+ vocabulary.confirm(c.first, c.second)
+ // The rest of the meeting heard the same way follows now, not with the next line.
+ for (l in others) applyKnown(l.id, id)
+ } else {
+ refused.add(pair(c.first, c.second))
+ }
Log.d("fix answered ${if (yes) "yes" else "no"}")
say(if (yes) Strings.LF("已改 %@ → %@,记进词表", c.first, c.second) else Strings.LF("这场不再问 %@", c.first))
}
diff --git a/site/changelog.json b/site/changelog.json
index 4d3f9e6..6ce61ad 100644
--- a/site/changelog.json
+++ b/site/changelog.json
@@ -78,6 +78,14 @@
"title": "Android 设置里多了“词表”:常用的人名、产品名一次贴进来,写法和听错的形式都能就地改。",
"text": "一行一个,常被听错的写法写在 = 后面(Morpho = 莫拉),导入前先显示会新增几个。会中答“对”的词也会记进来,标着“会中确认”和改过几次;删掉的词可以撤销。词表只存在这台手机上。"
},
+ {
+ "kind": "fixed",
+ "platforms": [
+ "android"
+ ],
+ "title": "Android 上对新名字答“对”以后,这场会里同样听错的其他句子马上一起改,不用等下一句。",
+ "text": "以前答“对”只记进词表,同样听错的其他句子要等再说一句才改过来;现在当场就改,按“撤销”也一起撤回。"
+ },
{
"kind": "fixed",
"platforms": [