Improve Korean understanding at every speech level and long talks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -151,12 +151,17 @@ regexes, expect tokens and markers.
|
||||
| `dialogues_mixed` (+ `_b`, `_c`) | 259/261 (3641/3697), _b 194/206 (2730/2963), _c 143/177 | the same talks with commands said in the middle on the dialogue's map (all seven maps: go to, look, look at me, shake hands = `action:wave \| refuse`, give me your hand = `action:arm reach \| refuse`, `voice louder`, `action:lift up`, battery now `status \| none`), hard negatives inside the talk (a remark about a wave seen earlier, "when the talk ends, go to the stage", "저기 가 봐" / "bring me that" with nothing named = `ask \| none \| refuse`), the topic taken up again right after the command, "thanks! and …" (answered, not a goodbye), ~85 % end with a goodbye |
|
||||
| `followup_dialogues_d` … `_g` | _d 66/64 (904/918 scored), _e 99/101 (1331/1413), _f 96/97 (1355/1382), _g 104/106 (1433/1515) | growth files from 409 chain topics (careers, school subjects, Korean holidays and geography, explainers, K-pop, K-drama, Korean film, programming, climate, cooking how-tos, finance and medicine basics, Seoul / Busan places, nature, world history, music, sports figures, animals, space; _f: world landmarks, inventions, geography, literature, maths, art, festivals, kids' whys, sports rules, transport, everyday tech, the body, psychology, thought, robots and AI; _g: Korean everyday culture (food, drink, customs, games, arts, companies), world food, world history, weather and earth, space): nested follow-ups 3–4 levels deep (why → why that → when → who), ~60 % Korean and ~19 % mixed dialogues (하십시오체 for elderly visitors, some dialect), checks of Lumi's answer named by the topic ("빼빼로데이 얘기 진짜야?"); every scored say is new (never used in an earlier r6 file or rounds 1–4 train) |
|
||||
| `dialogues_mixed_d` … `_g` | _d 86/74 (1300/1211), _e 118/115 (2033/1951), _f 123/110 (1928/1783), _g 110/123 (1785/2013) | the same chain talks with commands tied to the talk ("광복절 얘기는 이따 하고 무대로 가 줘", "look at me while you tell me about X"), remarks / later / unnamed places, a goodbye naming the topic; ~60 % Korean; every scored say new |
|
||||
| `followup_dialogues_h` / `dialogues_mixed_h` | 31/49 (404/637 scored), 43/37 (660/619) | as _d … _g, topics everyday life, money, business, sports to play (topics_o) and science / tech explained (topics_p); ~60 % Korean |
|
||||
| `followup_dialogues_i` / `dialogues_mixed_i` | 28/25 (419/364 scored), 30/28 (536/478) | night 3, generator `gen_dialogues3.py`, 24 new topics (topics_q / _r: haenyeo, ginseng, bamboo, whale song, owls, salmon, cicadas, anglerfish, ants, koalas, leap years, lunar calendar, mammoths, dodo, zodiac 띠, MBTI, kimchi fridge, temple stay, hydrogen cars, Velcro, Post-it, barcodes, fireworks, Paralympics), nested 3-step chains; Korean in SIX speech levels at the same depth as English: 반말, 해요체, 하십시오체, friendly (친구끼리: ㅋㅋ, ~임?, ㄱㄱ), honorific (-시-, 께서, 드리다, 여쭤봐도 될까요), dialect (경상 / 전라); a speaker may switch level once (unscored line). ~72 % of scored turns Korean / mixed. NEW fields: dialogue `levels` (levels used, in order), scored turn `lang` (en / ko / mix) and `level` (banmal / haeyo / hapsyo / friendly / honorific / dialect, None for English) for per-level scoring. Followup goodbyes are scored here (`end`, a goodbye word) |
|
||||
| `closing_context` (+ `_b`) | 326/314 (370/352 scored turns), _b 232/268 (266/302) | NEW set, dialogue format as followup_dialogues; scored turns carry NEW field `"closing"`: `"end"` (expect_action `end`, must a goodbye word) or `"continue"` (expect_action `none`, or `action:arm open \| give \| none` when thanks comes while Lumi hands a thing over, `action:arm fold \| none` after Lumi held out its hand; must_not a goodbye word; must the fact when a question came with the thanks). End: "no thanks, that's all" to "anything else?", thanks after "I have to go" and the answer, thanks + bye. Continue: thanks + a new question, thanks for an answer with no sign of leaving (then a follow-up), "okay" = yes to "shall I tell you more?", "okay / 알겠어" + a question, thanks to someone else nearby, the hand cases, "no thanks… oh wait, one more" |
|
||||
| `closing_context_c` | 172/170 (239/225 scored; closing turns 84 end / 267 continue) | night 3, generator `gen_closing2.py`: the closing turn comes after a real talk of 1-4 turns on a topics_q / _r chain topic (those turns are scored too, `closing` absent); kinds as closing_context plus "take_back"; Korean in six speech levels (반말 / 해요체 / 하십시오체 / friendly / honorific / dialect); NEW fields `levels`, turn `lang` / `level` as in followup_dialogues_i |
|
||||
| `lookup_dialogues` | 76/82 (411/467 scored) | NEW set (night 3, generator `gen_lookup.py --seed 6901`): weather / news asked, then followed up leaving out what the talk already said ("and tomorrow?" / "내일은?" keeps the city, "what about Busan?" / "부산은요?" keeps the day, "우산 챙겨야 돼?" = rain for the place and day of the talk, "그거 자세히" / "the second one" = the news just read, "sports news?"); inside: climate questions that are NOT lookups (장마, 황사: `none` + must the fact), weather remarks, thanks + a new question, goodbye. Dialogue fields `now`, `here` ("Seoul"), `levels`; scored turn NEW field `lookup` ({kind weather, city (English name or None = here), day, ask general / rain / temp / dust / wind} or {kind news, topic} / {kind news, more: True} / {kind news, which: 1 / 2 / -1}, None = no lookup), expect `lookup:weather`, `lookup:news`, `… | none` when the last reply may already hold it, `none`, `end`; must_not also "I can't look that up". Six Korean levels, `lang` / `level` per turn |
|
||||
| `seeing_dialogues` (+ `_b`) | 211/229 (2160/2307), _b 137/163 (1426/1615) | NEW person fields `top_pattern` (plain / striped / checked / dotted / print / None), `bottom_kind` (jeans / trousers / skirt / shorts / None), `hair` {colour, length short / long / bald} or None, `glasses` (True / False / "sunglasses" / None), `hat` {kind cap / beanie / hat, colour} or None, `bag` {kind backpack / handbag / shoulder bag, colour} or None, `posture` (standing / sitting / crouching), `action` (None / waving / pointing / phone / drinking / walking / talking); at most two other people, on different sides. Asks about clothes, patterns, hair, glasses, hat, bag, posture, raised hand, held thing and hand, actions, people B / C by side; scenes change (jacket / glasses / hat off, sits / stands, other hand, put down, new speaker, someone leaves): must = the fact now, must_not = the stale fact, agreement with a wrong claim, and "can't tell / don't know" whenever the scene has the fact; a None field: not sure is right, no invented value |
|
||||
| `seeing_dialogues_c` | 156/184 (1569/1844 scored turns) | growth file, same format and person fields; Korean-heavy (KO 67 %, mixed 19 %): 반말 / 해요체 / 하십시오체 (elderly), 주세요 / 줄래, dialect for some speakers (뭐고? / 썼나? / 들고 있노?); fragments with the subject left out ("그럼 바지는?", "안경은?"); the person just asked about named again without a side ("그 사람 모자는?", "저분 안경 쓰셨어요?", check "that person (<id>, <side>) asked about again"); wrong claims ("나 안경 안 꼈지?" with glasses on); every say new against rounds 1–4 and the earlier r6 seeing files |
|
||||
| `memory_dialogues` (+ `_b`) | 184/156 (1036/878), _b 196/164 (1061/929) | NEW set (HANDOFF §16.3): dialogue fields `now` (ISO clock) and `memory` {`talks` [{title, when, person, summary, facts, commands}], `seen` [{object, colour, where, when}], `self` {arm, gripper, holding, head, lift_mm, place, doing, battery}, `forget_person`} to load into a fake store; turns in dialogues_mixed format; recall by topic (+ day / time), facts of that talk, topics never talked about (offer the closest or "can't remember", never yes), "what did we talk about yesterday", older than 48 h (only the last two days), seen today yes (place / time) / no / other colour, "do what we said" (`ask \| none`: read back first), "forget this / 잊어 줘" (NEW token `forget`, later recall not answered with its facts), name told or not, self state from the self line, a topic from earlier in the same talk; must_not "I have no memory", "ask staff", hesitation |
|
||||
| `questions_world` (+ `_b`) | 976/966, _b 215/237 | NEW set: `CASES = [{"text", "lang", "kind" (lumi / company / jaka / weather / news / web / time), "expect", "must", "must_not", "q" (meaning id), "crowd", "mix"}]`; 52 meanings (_b 14 more) in 30+ wordings each. NEW expect tokens: `quick` (a fixed fact at once, no LLM: name, what, age, maker, height, weight, speed, battery life, languages, which AI, alive, what can you do, time / date / day), `knowledge` (from the notes, never online: other Lumi facts, Cutshion, JAKA), `lookup:weather` / `lookup:news` / `lookup:web` (looked up; no must on changing content), `unknown` (not in the notes: a not-sure phrase, no guessed value) |
|
||||
| `questions_world_c` | 1012/1006 | growth file, questions_world format: 45 new meanings (new `q` ids), 42+ wordings each, 77 % Korean / mixed (all speech levels, elderly 하십시오체, 경상도 dialect, omitted subjects, Konglish, slips, false claims): Lumi (head / waist turn, DOF, microphones, TTS, speech recognition, reply time, repeatability, gripper and width, paper cups, emergency stop, pushing, map accuracy, step / slope, passage, carrying speed, learning, ultrasonic sensors), Cutshion (slogan, TIPS, seed investment, exhibitions, Pionoid, CUVision, GOMCOOK, candy ball / palletizing / education robots, US office, Daegu branch), JAKA (customers, branches, K1, Lumi platform, Mini), weather (fine dust, snow, other cities), news (tech, top story), web (Australia's capital, KOSPI), time (days to Christmas, the month) |
|
||||
| `questions_world_d` | 364/369 | night 3, generator `gen_questions_d.py` (seed 6621): 56 NEW meanings (q ids new) from knowledge/: Lumi (footprint, top height, base / arm weight, reach, payload, gripper speed, cup tilt, what it picks, floor and doors and faces = can't, YOLOv8, base camera range, lidar blind spots, battery spec, self-charging, computer specs, navigation computer, model size / maker, Ollama, Python, teaching, hearing range, 3 m move limit, drive, end tools, clip mic, number of songs; unknown: charge time, learning algorithm), Cutshion (founding month, lab, venture, partners, VivaTech, US deal, ice cream robot, drawing robot customers, TUSK, PEITIAN; unknown: hiring, office hours, warranty), JAKA (patents, installed base, K1L, K1W, Pro, FAST / Mars, Coboπ; unknown: founder), web (Hallasan, yen rate, this year's Nobel, Korean Series). Korean in six speech levels, Konglish, false claims, slips; NEW field `level`; "can't" meanings have two must regexes (a no-word and the topic word) |
|
||||
| `unknowns` (+ `_b`) | 247/250, _b 72/78 | round 4 format; JAKA facts from the notes as known (2014, Shanghai / Changzhou, the name, 21.9 %, K1 / K1L …); unknown: JAKA CEO / staff / prices, Lumi internals the notes don't give (charge time, ROS, night vision, waterproof, OS …), Cutshion plans, staff names, conference / venue facts (schedule, Wi-Fi, tickets, parking) |
|
||||
|
||||
Number patterns in regexes are written `(?<![\d.])8(?!\d)` (not `\b8\b`) so "3개", "10시간" match.
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
"""Korean speech levels against English: the same request said at every level must be read as the same action.
|
||||
|
||||
For each capability one English request (and its polite English forms) and one Korean verb phrase; the Korean forms
|
||||
are made from the verb's stem at each level (반말, friendly, 해요체, 하십시오체, 하게체, honorific, question-form
|
||||
requests, dialect, whisper slips). Every form must give the English base's reading (lumi.answer()'s rules, as
|
||||
tests/command_check.rules). The same phrase as a past remark, an ability question, a negation, a later time or a
|
||||
condition must give no motion.
|
||||
|
||||
.venv/bin/python tests/ko_levels_check.py # -> logs/ko_levels.md, a table by level and the misses
|
||||
.venv/bin/python tests/ko_levels_check.py wave turn # only these capabilities
|
||||
"""
|
||||
import collections
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
from assistant import brain, voice_words
|
||||
from tests import command_check
|
||||
from tests.blind.maps import MAPS
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
MARKS = MAPS["office"]
|
||||
|
||||
# name: (English request, Korean words before the verb, verb stem, its 아/어 form, Konglish / mixed forms)
|
||||
CAPS = {
|
||||
"go_to": ("go to p3", "p3로", "가", "가", ["p3로 고 해 줘", "go to p3 해 주세요"]),
|
||||
"home": ("go home", "홈으로", "가", "가", ["홈으로 무브 해 줘"]),
|
||||
"forward": ("move forward one meter", "앞으로 1미터", "가", "가", ["포워드로 1미터 가 줘"]),
|
||||
"back": ("move back half a meter", "뒤로 50센티", "가", "가", ["백으로 50센티 가 주세요"]),
|
||||
"turn": ("turn left", "왼쪽으로", "돌", "돌아", ["레프트로 턴 해 줘", "왼쪽으로 turn 해 주세요"]),
|
||||
"turn45": ("turn right 45 degrees", "오른쪽으로 45도", "돌", "돌아", ["라이트로 45도 턴 해요"]),
|
||||
"look": ("look left", "왼쪽", "보", "봐", ["왼쪽 룩 해 줘"]),
|
||||
"look_up": ("look up", "위를", "보", "봐", ["업 봐 줘"]),
|
||||
"head_up": ("raise your head", "고개", "들", "들어", ["헤드 업 해 줘"]),
|
||||
"head_dn": ("lower your head", "고개", "숙이", "숙여", ["고개 다운 해 줘"]),
|
||||
"wave": ("wave", "손", "흔들", "흔들어", ["웨이브 해 줘", "wave 해 주세요"]),
|
||||
"shake": ("let's shake hands", "악수", "하", "해", ["셰이크 핸드 해 줘"]),
|
||||
"reach": ("give me your hand", "손", "내밀", "내밀어", []),
|
||||
"follow": ("follow me", "저를", "따라오", "따라와", ["팔로우 미 해 줘", "follow me 해 주세요"]),
|
||||
"come": ("come here", "이리", "오", "와", ["컴 히어 해 줘"]),
|
||||
"stop": ("stop", "", "멈추", "멈춰", ["스탑 해 주세요"]),
|
||||
"fetch": ("bring me the cup", "컵", "가져오", "가져와", []),
|
||||
"pick": ("pick up the cup", "컵", "집", "집어", ["컵 픽업 해 줘"]),
|
||||
"fold": ("fold your arm", "팔", "접", "접어", []),
|
||||
"sing": ("sing a song", "노래", "부르", "불러", ["노래 싱 해 줘"]),
|
||||
"louder": ("speak louder", "더 크게", "말하", "말해", []),
|
||||
"slower": ("speak slower", "좀 천천히", "말하", "말해", []),
|
||||
}
|
||||
EN_FORMS = ["{}", "please {}", "{}, please", "could you {}?", "can you {} for me?", "would you {}, please?",
|
||||
"I'd like you to {}", "I'd love it if you could {}", "{}, if you don't mind", "lumi, {}",
|
||||
"it would be great if you could {}"]
|
||||
# English forms where the verb must be first ("would you mind ...ing" is not made: no gerunds here)
|
||||
|
||||
|
||||
def _j(c):
|
||||
n = ord(c) - 0xAC00
|
||||
return (n // 588, n // 28 % 21, n % 28) if 0 <= n < 11172 else None
|
||||
|
||||
|
||||
def _with_final(c, final):
|
||||
l, v, _ = _j(c)
|
||||
return chr(0xAC00 + (l * 21 + v) * 28 + final)
|
||||
|
||||
|
||||
def hon(stem):
|
||||
"""The stem before an honorific -시- ending: 돌 -> 도, 집 -> 집으, 가 -> 가."""
|
||||
j = _j(stem[-1])
|
||||
if j[2] == 8: # ㄹ drops: 도세요, 흔드세요
|
||||
return stem[:-1] + _with_final(stem[-1], 0)
|
||||
return stem + "으" if j[2] else stem
|
||||
|
||||
|
||||
def ul(stem):
|
||||
"""The stem's 관형형 before 수 / 줄: 가 -> 갈, 돌 -> 돌, 집 -> 집을."""
|
||||
j = _j(stem[-1])
|
||||
if j[2] == 8:
|
||||
return stem
|
||||
return stem + "을" if j[2] else stem[:-1] + _with_final(stem[-1], 8)
|
||||
|
||||
|
||||
def past(a):
|
||||
"""The past of the 아/어 form: 돌아 -> 돌았, 가 -> 갔, 해 -> 했."""
|
||||
return a[:-1] + _with_final(a[-1], 20)
|
||||
|
||||
|
||||
def levels(pre, stem, a):
|
||||
"""{level: [Korean forms]} for one verb phrase."""
|
||||
p = (pre + " ") if pre else ""
|
||||
h = hon(stem)
|
||||
return {
|
||||
"반말": [f"{p}{a}", f"{p}{a} 줘", f"{p}{a} 줄래?", f"{p}{a} 줄 수 있어?", f"{p}좀 {a} 줘"],
|
||||
"friendly": [f"{p}{a} 봐", f"{p}한번 {a} 봐", f"{p}{a} 줘 봐", f"{p}{a} 줘라", f"{p}{a} 줘~", f"루미야 {p}{a} 줘"],
|
||||
"해요": [f"{p}{a}요", f"{p}{a} 주세요", f"{p}{a} 줄래요?", f"{p}{a} 줄 수 있어요?", f"{p}좀 {a} 주세요"],
|
||||
"하십시오": [f"{p}{h}십시오", f"{p}{a} 주십시오", f"{p}{a} 주시겠습니까?", f"{p}{a} 주시기 바랍니다",
|
||||
f"{p}{a} 주실 수 있습니까?"],
|
||||
"하게": [f"{p}{a} 주게", f"{p}{a} 주시게"],
|
||||
"honorific": [f"{p}{h}세요", f"{p}{a} 주시겠어요?", f"{p}{a} 주실 수 있으신가요?", f"{p}{a} 주셨으면 해요",
|
||||
f"{p}{a} 주시면 감사하겠습니다", f"{p}{a} 주시길 부탁드립니다", f"{p}{a} 주세요, 부탁드립니다",
|
||||
f"루미 씨, {p}{a} 주시겠어요?"],
|
||||
"question": [f"{p}{a} 주면 안 돼?", f"{p}{a} 주면 안 될까요?", f"{p}{a} 주실래요?", f"{p}{ul(stem)} 수 있으세요?",
|
||||
f"{p}{a} 줄 수 있을까요?"],
|
||||
"dialect": [f"{p}{a} 도", f"{p}{a} 주이소", f"{p}{a} 주랑께", f"{p}{a} 줘유", f"{p}{a} 줍서", f"{p}{a}라 마"],
|
||||
"slip": [f"{p}{a}줘", f"{p}{a} 주세여", f"{p}{a}조", f"{(pre + a).replace(' ', '')} 줘"],
|
||||
}
|
||||
|
||||
|
||||
def not_now(pre, stem, a):
|
||||
"""The same phrase with no order now: a past, an ability question, a negation, a later time, a condition."""
|
||||
p = (pre + " ") if pre else ""
|
||||
return [f"아까 {p}{past(a)}어요", f"어제 {p}{past(a)}잖아", f"{p}{ul(stem)} 줄 알아요?", f"{p}{stem}지 마세요",
|
||||
f"{p}{stem}지 마", f"이따가 {p}{a} 주세요", f"제가 손 들면 {p}{a} 주세요", f"{p}{a} 주면 어떻게 돼요?",
|
||||
f"우리 애가 {p}{past(a)}어요", f"{p}{hon(stem) if _j(stem[-1])[2] == 8 else stem}는 거 봤어요"]
|
||||
|
||||
|
||||
def read(text):
|
||||
"""The reading lumi.answer()'s rules give (None: left to the LLM)."""
|
||||
voice = voice_words.read(text, "")
|
||||
if voice:
|
||||
return f"voice {voice[0]} {voice[1]:+d}"
|
||||
return command_check.rules(text, "idle", MARKS, brain.Brain())
|
||||
|
||||
|
||||
def same(want, got):
|
||||
return got == want or got is not None and want is not None and command_check.ok(want, got) == "right"
|
||||
|
||||
|
||||
def check(names=None):
|
||||
"""rows: (capability, level, text, reading, want, verdict) with verdict right / missed / wrong / motion."""
|
||||
rows = []
|
||||
for name, (en, pre, stem, a, mixed) in CAPS.items():
|
||||
if names and name not in names:
|
||||
continue
|
||||
want = read(en)
|
||||
forms = {"en": [f.format(en) for f in EN_FORMS], **levels(pre, stem, a), "konglish": mixed}
|
||||
for level, texts in forms.items():
|
||||
for t in texts:
|
||||
got = read(t)
|
||||
rows.append((name, level, t, got, want, "right" if same(want, got) else
|
||||
"missed" if got is None or got.split()[0] in command_check.NO_MOTION else "wrong"))
|
||||
for t in not_now(pre, stem, a):
|
||||
got = read(t)
|
||||
moves = got is not None and got.split()[0] not in command_check.NO_MOTION
|
||||
rows.append((name, "not_now", t, got, "no motion", "right" if not moves else
|
||||
"wrong" if got in ("stop", "sing") else "motion")) # a stop or a song moves nothing
|
||||
return rows
|
||||
|
||||
|
||||
def report(rows):
|
||||
by = collections.defaultdict(collections.Counter)
|
||||
for name, level, *_, v in rows:
|
||||
by[level][v] += 1
|
||||
lines = ["# Korean speech levels against English (tests/ko_levels_check.py)", "",
|
||||
"| level | right | missed | wrong | motion | total |", "|---|---|---|---|---|---|"]
|
||||
for level, c in by.items():
|
||||
lines.append(f"| {level} | {c['right']} | {c['missed']} | {c['wrong']} | {c['motion']} | {sum(c.values())} |")
|
||||
tot = collections.Counter(v for *_, v in rows)
|
||||
lines += [f"| all | {tot['right']} | {tot['missed']} | {tot['wrong']} | {tot['motion']} | {len(rows)} |", "",
|
||||
"## Not right", ""]
|
||||
lines += [f"- {name} [{level}] {t!r} -> {got} (want {want})" for name, level, t, got, want, v in rows if v != "right"]
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
out = report(check(set(sys.argv[1:]) or None))
|
||||
(ROOT / "logs" / "ko_levels.md").write_text(out)
|
||||
print(out[:out.index("## Not right")])
|
||||
Reference in New Issue
Block a user