Improve command, cup task and talk understanding in English and Korean

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 15:30:06 +09:00
co-authored by Claude Opus 5.5
parent e3a1c123c9
commit e3fcfd30ab
23 changed files with 1380 additions and 167 deletions
+80
View File
@@ -338,3 +338,83 @@ notation, regexes, no rounds 1–6 train text, no case in both splits, and print
All r8 files after `_h`: 34754 train / 34196 held cases, 1923 train / 1965 held dialogues; unique text 96.8 % over
~99,700 texts; Korean ~79 %; `logs/w3_gen/check_r8.py` 0 problems.
## r9 (round 9, 2026-10-24/26 nights: Korean / English parity, writer W4)
`r9/train/` and `r9/held/` (train seed 91, held seed 92; growth files seeds 93 / 94), written blind from docs/14,
docs/16, docs/17 and knowledge/. The owner's goal: Korean as good as English. Every meaning of a set is said at
**every level**; every case (sing: the list `LEVELS`, missions: the value, dialogues: every turn) carries NEW field
`level`: `en_native`, `en_nonnative`, `ko_banmal` (반말), `ko_haeyo` (해요체), `ko_hasipsio` (하십시오체), `ko_honorific`
(-시-, 께서, 드리다, 여쭤보다), `ko_hage` (하게체, elderly), `ko_friendly` (친구끼리: ~, ㅎㅎ, ㅋㅋ, ~임?, ㄱㄱ), `ko_dialect`
(경상 / 전라 / 충청; field `dialect` where known), `konglish` (English words in Hangul), `mixed` (code switching). Near
misses at every level (mix `hard`: negation, ability, condition, later, reported, remark, words to others,
take-back; intents end in `:hard_<kind>`), whisper slips (mix `slip`). Formats are round 6's (r6 commands / r6
dialogues sections), NO new expect tokens. De-duplicated inside a split, held against train and both against every
earlier round's train text (exact; a dialogue's scored say used before gets a filler in front). Load as
`tests.blind.r9.<split>.<name>`.
| File | train / held | Notes |
|---|---|---|
| `commands_go`, `_move`, `_turn`, `_look`, `_lift`, `_waist` | 2842/2814, 2524/2527, 1773/1772, 2304/2290, 1225/1225, 884/884 | r6 conventions; numbers in every form (digits, 일 / 이 / 삼, 한 / 두, English words, 원 / 투 / 쓰리) |
| `commands_wave`, `_reach`, `_hand`, `_give`, `_take`, `_put`, `_bring` | 869/836, 869/864, 1006/896, 761/731, 1182/1175, 768/757, 2042/2038 | handshakes = wave, 손 줘 / give me a hand = reach; hand includes "is your hand open?" (`status \| talk`) |
| `commands_follow`, `_come`, `_point`, `_stop`, `_status`, `_voice` | 585/573, 768/753, 483/478, 812/813, 943/741, 977/959 | stop: every running action as `before`; status `_b`: near misses (don't tell, my phone's battery, words to another person, reported, later) |
| `commands_more`, `_chain`, `_detour` | 703/458, 1499/1492, 1759/1688 | more `_b`: near misses at every level; detour `_b`: "why did you stop?" at every level (`talk \| status`) |
| `commands_missions`, `commands_sing`, `speed_short` | 1495/1485, 698/580, 1263/1093 | sing `_b`: every song and the song list at every level; speed_short (≤ 3 words, `fast: True`) `_b`: every short meaning at every level + short near misses |
| `questions_world` | 6311/3659 | quick / knowledge / unknown / lookup / time meanings (field `q`) at every level; held is smaller: same-text questions were kept only in train |
| `dialogues_mixed` | 440/440 (4569/4539 scored turns) | a fact, really? / a false claim / a follow-up, a command on the dialogue's map, a near miss, status, thanks + a question, goodbye; one level per dialogue |
| `followup_dialogues` | 330/330 (2970/2970) | follow-ups on Lumi's answer, contradictions (AGREE in must_not) |
| `closing_context` | 429/414 | field `closing` end / continue |
| `seeing_dialogues` | 328/324 (1640/1620) | r6 person fields; the scene changes |
| `memory_dialogues` | 207/199 (1242/1194) | r6 memory format |
| `lookup_dialogues` | 154/154 (1279/1289) | r6 lookup format (`lookup` field per turn): weather (city / here, day, ask general / rain / temp / dust / wind), day-only / city-only follow-ups, umbrella / 몇 도 / 미세먼지 for the talk's place and day (`lookup:weather \| none`), climate knowledge (장마철, 황사, 태풍: `none` + must), a remark, near misses (already checked, don't tell me, a friend asked, a plan if it rains, news later: `none`, lookup None), news (topic, more, the second / last one), thanks + a new question, goodbye; one speaker = one dialect; the hello is not scored |
A file `<name>_b.py` is a growth file (`logs/w4_gen/gen_grow9.py`) filling the cells the first write left empty;
published files are never changed. Totals: 37345 train / 33581 held cases, 1888 train / 1861 held dialogues. Per
level (cases + scored turns) 7.5–10.1 % each (en_nonnative lowest, ko_dialect highest); near misses 19–26 % at every
level. Unique text 72 % (the same wording on several maps / states / before-actions is one text).
Generators (seeded, not in the repo): `logs/w4_gen/` on the Thor: `ko.py` (Hangul, request endings per level,
negation / ability / condition / later / reported / remark / others / take-back frames, numbers, slips), `qlib.py`
(question endings per level), `caps.py` (command meanings), `spoken9.py` (marker forms), `render.py`, `gen_cmd.py`,
`questions.py`, `gen_dlg.py`, `gen_all.py` (the first write), `gen_lookup9.py`, `gen_grow9.py`; `check_r9.py` checks
imports, fields, levels, maps / markers, expect tokens, steps, regexes, no earlier train text, no case in both splits,
and parity (every set has every level in both splits, every meaning `intent` / `q` / song at every level in both
splits, near misses at every level in every command set, dialogues_mixed and lookup_dialogues): 0 problems.
## r10 (round 10, 2026-10-26: English half, cup tasks, writer W5)
`r10/train/` and `r10/held/`, written blind from docs/14, docs/16 and docs/17 (no assistant code or bank read). The
owner's complaint: round 9 was only ~17 % English. Here English is **half of every set** (en_native 27 %, en_nonnative
23 %), the nine Korean / Konglish / mixed levels of round 9 share the other half (5.6 % each), and every meaning is said
at every level in both splits. English wordings: plain, polite and indirect ("would you mind …ing", "could you
possibly …", "I was wondering if you could …", "I need you to …"), questions that are requests ("can you …?", "how about
…ing?", "any chance you could …?"), casual, rude, long and rambling ("sorry to bother you, but …", "my hands are full,
so …"), children; non-native English (broken frames "you can …?", "I want that you …", articles dropped); accent and
whisper slips ("tern lef", "pleace", "kup", "tay bull"). Near misses at every level in every command set: negation,
ability questions that are no request ("is it possible for a robot like you to …, in general?"), condition, later,
reported, remark, words to others, take-back, hypothetical, quote (`:hard_<kind>`, expect `talk | ask`; "don't look at
me" = `action:look away | talk | ask`). Field `level` as round 9, `style` on English cases (plain, polite, direct,
question, casual, rude, long, child, nonnative, nn_whole, whole). No text in both splits, none of an earlier round's
train text (rounds 1–4, r6, r8, r9). Formats of round 9; NO new expect tokens. Load as `tests.blind.r10.<split>.<name>`.
| File | train / held | Notes |
|---|---|---|
| `commands_go`, `_move`, `_turn`, `_look`, `_lift`, `_waist` | 1754, 2036, 1372, 1975, 782, 697 (each split) | r6 conventions; amounts new to this round (move 15 / 25 / 40 / 60 / 70 cm, 2.5 / 3 m, 3.5 m refused; turn 20–150°; look 5–50°; lift 3–15 cm; waist 20 / 60 / 90°) |
| `commands_wave`, `_reach`, `_hand`, `_give`, `_take`, `_put`, `_bring` | 826, 712, 724, 526, 730, 526, 1029 | handshakes = wave, "lend me your hand" = reach; give / take / put / bring here are apples, oranges and "it" (the cups are in `commands_cup`) |
| `commands_follow`, `_come`, `_point`, `_stop`, `_status`, `_voice` | 524, 712, 473, 968, 1023 / 965, 922 | stop with every running action as `before`; status includes "what's in your hand?", "where are you taking that cup?" and near misses (my phone's battery, don't tell me) |
| `commands_more`, `_chain`, `_detour` | 853 / 846, 1402, 1282 | chain: 45 % cup chains ("pick up the cup and look at me", holding "put the cup down and give us a wave": `chain \| mission`, `parts` "pick cup", "pick red cup", "put down", "give") |
| `commands_missions` | 1800 | step notation of tests/test_steps.py; cup missions: `pick red cup \| go M \| give`, `pick cup \| go M \| place`, `go M \| receive cup wait \| go here`, `go M \| give Sarah`, `pick cup \| go M \| give \| go here`, `go M \| place \| go here`, `receive hand \| go M`, `pick white cup \| give`, `go M \| pick cup \| go here`, `pick cup \| go M \| place dining table`, plus waits, two places, an instruction wait; `?` for coffee, dancing, later, conditions (field `kind` P1–P14 / hard) |
| `commands_sing`, `speed_short` | 828 / 804, 1024 / 1000 | sing: every song at every level; speed_short ≤ 3 words, `fast: True`, every capability at every level incl. the cup ("hand it over", "set it down") |
| `commands_cup` | 11114 | NEW set, command format (scored like the other command sets). Idle: pick by colour (`action:pick red cup \| mission \| refuse`) or by which one ("the cup on the left", "the smaller cup", "제일 가까운 컵": `action:pick cup \| …`); search ("look for the red cup": `seeing \| action:look \| action:pick red cup \| mission \| action:fetch \| ask \| talk`); take from a hand (`receive \| talk`); "pass me the cup" (`mission \| action:fetch \| action:pick cup`); fetch from a marker, from one marker to another, to a named person at a marker, deliver and come back (`action:fetch \| mission`, `\| ask` for a translated marker name); "wait here until I tell you" (`talk \| stop \| ask`); "give me the cup" idle (`empty_hand \| ask \| talk \| mission \| action:fetch \| action:pick cup`). Holding (state `holding`, 44 %): give to me (`give`), to a described person ("the man in the blue shirt", "her": `give \| ask`), to a name only (`ask \| give`), put here / on a named thing / back, carry to a marker (`mission \| action:fetch \| action:go_to M`), carry and put on the table there; new orders on the way (before `("bring the cup to Sarah at the stage", "ACTION: mission")`): stop, wait here (`stop \| talk \| ask`), "no, the other table" (`place \| ask \| talk`), "give it to her instead" (`give \| ask`), "go to M instead", "never mind, bring it back". Whole-sentence corrections are not wrapped in request frames (style `whole`) |
| `dialogues_mixed` (+ `_b`) | 303 (2121 scored turns), _b 502 (2644 / 2646) | one level per dialogue; mixed: 4 commands in a talk, a near miss, status, goodbye. `_b` cup talks: (A) pick → "what are you holding?" → give (`give \| empty_hand \| none`, the checker keeps the start's hand) → thanks (`action:arm open \| give \| none`); (B) holding: put on a named table → "no, the other table" → give to a described person → a near miss; (C) fetch from a marker → stop → to a named person; (D) take from the hand → carry to a marker → "don't move until I say so" → come here → give |
| `memory_dialogues` | 161 (644 scored turns) | r6 memory format with cup memory: `seen` a cup today (where), `self.holding` a cup or nothing, a talk yesterday with the command "bring the red cup to stage"; turns: where was the cup seen, what are you holding (`status \| none`), what did I ask yesterday (cup + place), "do what we said" (`ask \| none`, the place read back) |
Totals: 36614 train / 36501 held cases, 966 / 966 dialogues; per level (cases + scored turns) English 49.8 %
(en_native 26.9, en_nonnative 22.9), each Korean / Konglish / mixed level 5.6 %. Unique text 89.8 %.
Generators (seeded, not in the repo): `logs/w5_gen/` on the Thor: `en10.py` (English frames, -ing forms, non-native
grammar, accent slips, near-miss frames), `render10.py` (a meaning at a level; Korean endings from W4's
`logs/w4_gen/ko.py` plus indirect ones), `caps10.py` (single commands), `cup10.py` (cup tasks), `gen10.py` (all command
sets, missions, chain, sing, status, more, speed_short; train and held filled cell by cell from one pool of taken
texts), `dlg10.py` (dialogues); `check_r10.py` (round 9's checks plus no held text in train and the English share):
0 problems.
+66 -4
View File
@@ -73,7 +73,7 @@ SETS = ["commands_go", "commands_move", "commands_turn", "commands_look", "comma
"commands_stop", "commands_status", "commands_chain", "commands_detour", "speed_short", "commands_sing",
"commands_missions", "seeing_dialogues", "followup_dialogues", "dialogues_mixed", "unknowns", "silence_noise",
"hearing", "questions_world", "memory_dialogues", "commands_come", "commands_hand", "commands_point",
"commands_voice", "commands_waist", "commands_more", "closing_context"]
"commands_voice", "commands_waist", "commands_more", "closing_context", "lookup_dialogues"]
# commands_chain, commands_detour, speed_short, dialogues_mixed: round r2 on;
# questions_world, memory_dialogues: r6 on. Any other file in a round's folder
# is scored too, by the set its name grows ("commands_go_b" as commands_go)
@@ -164,6 +164,7 @@ def _persons(frames=None):
scene.snapshot = lambda cameras=None, since=None: [SCENE["now"]] if SCENE["now"] is not None else []
scene.things, scene.people, scene._persons = _things, _people, _persons
scene.speaker_key = lambda d, b: 0 # scene._front's stable sort keeps _persons' order: the speaker A first (A6)
VLM_ASKED = [("glasses", r"glass|안경|선글"), ("hat", r"\bhat|\bcap\b|beanie|모자|캡"), ("hair", r"hair|머리"),
("bag", r"bag|backpack|가방|배낭"), ("top_pattern", r"pattern|stripe|check|dot|print|무늬|줄무늬|체크|땡땡이"),
("bottom_kind", r"jeans|trousers|pants|skirt|shorts|바지|청바지|치마|반바지"),
@@ -222,6 +223,8 @@ def turn_route(b, say, lang, mk, state="idle", use_llm=True):
"""One turn the way lumi.answer() goes: command_check.rules (drive words, then lumi.route) with seeing.answer on
the fake scene; what the rules leave through dialogue_check.run_turn with the cameras' facts (and the hand) in
the prompt. (route in dialogue_check's notation, reply, by). A rule's fixed line is "" (not judged)."""
if lang not in ("en", "ko"): # r9 "mix" turns: Lumi answers in Korean or English
lang = "ko" if brain.HANGUL.search(say) else "en"
brain.FORCED_LANG["lang"] = lang
said = {}
@@ -256,6 +259,9 @@ def turn_route(b, say, lang, mk, state="idle", use_llm=True):
got if got.startswith("action:") else "action:" + got)
if r.startswith("action:") or r == "mission":
b.history.append((say, f"ACTION: {r.split(':', 1)[1] if ':' in r else r}"))
elif r in ("weather", "search"): # lumi.look_up keeps the question (+ WEATHER_ASKED)
b.last_lookup = say + brain.WEATHER_ASKED if r == "weather" else say
b.history.append((b.last_lookup, ""))
return r, "", "rules"
if not use_llm:
return "llm?", "", "-"
@@ -452,6 +458,7 @@ def score_missions(c, old, use_llm):
got=json.loads(json.dumps(got)), unread=unread)
LOOKUP = {"lookup:weather": "weather", "lookup:news": "search", "lookup:web": "search"} # lookup_dialogues (r9)
FORGOT = set(__import__("assistant.memory", fromlist=["FORGOT"]).FORGOT.values())
@@ -483,6 +490,8 @@ def score_dialogue(d, old, use_llm, judge=False):
r, reply, by = turn_route(b, turn["say"], lang, mk, state, use_llm)
if r == "llm?":
rows.append(row(key, "llm?" if scored else "-", "-", "", route="", reply=""))
if turn.get("closing"):
rows[-1]["closing"] = turn["closing"]
b.history.append((turn["say"], ""))
continue
if r.startswith("action:give") or r.startswith("action:place"):
@@ -492,7 +501,7 @@ def score_dialogue(d, old, use_llm, judge=False):
if not scored:
rows.append(row(key, "-", by, "", route=r, reply=reply))
continue
want = dict(turn, expect_action=" | ".join(a.strip().removeprefix("action:")
want = dict(turn, expect_action=" | ".join(LOOKUP.get(a.strip(), a.strip()).removeprefix("action:")
for a in turn.get("expect_action", "none").split(" | ")))
looked_up = r in ("weather", "search", "search(unsure)") and \
not dialogue_check.action_ok(want["expect_action"], r) # a lookup's answer is talk (not checked)
@@ -512,6 +521,8 @@ def score_dialogue(d, old, use_llm, judge=False):
r, reply, by, probs, note, v = "error", repr(e), "-", [repr(e)], "", "error"
rows.append(row(key, v, by, f"{d['topic']} t{j + 1} {turn['say']!r} -> [{r}] {reply[:120]!r} {probs}{note} "
f"(check: {turn.get('check')})", route=r, reply=reply, judged=judged))
if turn.get("closing"):
rows[-1]["closing"] = turn["closing"] # closing_context: "end" / "continue", counted apart
return rows
@@ -743,6 +754,7 @@ def run_set(split, name, old_rows, use_llm, cached, limit, sample=None):
rows.append(row(str(c)[:200], "error", "-", f"{str(c)[:150]} -> {e!r}"))
for r in rows[n:]:
r["lang"] = lang_of(c, r)
r["level"] = level_of(c, r)
if r["verdict"] in ("wrong", "motion", "error") and "-v" in sys.argv:
print(f" {r['verdict'].upper():6} {r['show'][:200]}", flush=True)
return rows
@@ -764,6 +776,56 @@ def lang_of(c, r):
return "mix" if ko and en else "ko" if ko else "en"
LEVEL_NAME = {"banmal": "ko_banmal", "haeyo": "ko_haeyo", "hapsyo": "ko_hasipsio", "friendly": "ko_friendly",
"honorific": "ko_honorific", "dialect": "ko_dialect"} # W2's names (r6 _i files) -> r9's
LEVEL_GUESS = [("ko_dialect", r"(?:주이소|하이소|하입시더|하이소|데이|카이|라예|랑께|허자잉|줘유|해유|줍서|헙서|마씸|아이가|머꼬|와이라|"
r"하모|맞제|그라제|했노|하노|하나\?|가\?)[.?!~]*$|잉[.?!~]*$|(?:주소|해 ?도)[.?!]*$"),
("ko_hage", r"(?:하게|주게|하네|하세|보게|오게|가게나|하시게)[.?!~]*$|자네"),
("ko_honorific", r"(?:시[어겠었]|으시|하시|주시|가시|보시|께서|드리|드릴|드려|여쭤|여쭙|계세|계십|잡수|주무|말씀)"),
("ko_hasipsio", r"(?:습니다|습니까|[가-힣]니다|[가-힣]니까|십시오|시오|하십시다)[.?!~]*$"),
("ko_friendly", r"ㅋ|ㅎㅎ|~|임\?|ㄱㄱ|ㅇㅇ|ㄹㅇ|당[.?!]*$|용[.?!]*$|쥬[.?!]*$"),
("ko_haeyo", r"요[.?!~,]*(?:\s|$)")]
def level_of(c, r):
"""The speech level of a case or a scored turn: its "level" field (r9; W2's names in r6 _i files read as r9's),
else guessed from the Korean endings (marked "*"); English "en*", mixed "mixed*"."""
turn = {}
if isinstance(c, dict) and "turns" in c and r["key"][:1].isdigit():
j = int(r["key"].split("|", 1)[0]) - 1
turn = c["turns"][j] if 0 <= j < len(c["turns"]) else {}
case = c if isinstance(c, dict) else c[1] if isinstance(c, (list, tuple)) and len(c) > 1 and \
isinstance(c[1], dict) else {}
lv = turn.get("level") or (case.get("level") if not turn or "turns" not in case else None)
if lv:
return LEVEL_NAME.get(lv, lv)
if r.get("lang") == "en":
return "en*"
if r.get("lang") == "mix":
return "mixed*"
text = turn.get("say") or case.get("text") or case.get("heard") or (c[0] if isinstance(c, (list, tuple)) else "")
text = (text or "").strip()
return next((name + "*" for name, rx in LEVEL_GUESS if re.search(rx, text)), "ko_banmal*")
def by_level(saved):
"""right / cases per speech level over every set (r9 / r6 _i: as labelled; "*": guessed from the endings), and the
closing turns (closing_context) by kind."""
lv, cl = collections.defaultdict(collections.Counter), collections.defaultdict(collections.Counter)
for name in ordered(saved):
for r in saved[name]["rows"]:
if r["verdict"] != "-":
lv[r.get("level", "?")][r["verdict"]] += 1
if r.get("closing"):
cl[r["closing"]][r["verdict"]] += 1
lines = ["", "By speech level (right / cases, motions in brackets; * = guessed from the endings):", "",
"| level | right | wrong | motion | llm? |", "|---|---|---|---|---|"]
lines += [f"| {k} | {cell(lv[k])} | {lv[k]['wrong']} | {lv[k]['motion']} | {lv[k]['llm?']} |" for k in sorted(lv)]
if cl:
lines += ["", "Closing turns: " + ", ".join(f"{k} {cell(cl[k])}" for k in sorted(cl))]
return lines
def cell(k):
n = sum(k.values())
return f"{k['right']}/{n} ({100 * k['right'] // max(1, n)} %)" + (f" [{k['motion']}]" if k["motion"] else "") if n else "-"
@@ -801,7 +863,7 @@ def report(split, saved, secs):
n = sum(tot.values())
lines.append(f"| ALL | | {n} | {tot['right']} | {100 * tot['right'] // max(1, n)} | {tot['wrong']} | "
f"{tot['motion']} | {tot['llm?']} | {tot['error']} | |")
lines += by_lang(saved)
lines += by_lang(saved) + by_level(saved)
for name in ordered(saved):
rows = saved[name]["rows"]
dl = {}
@@ -814,7 +876,7 @@ def report(split, saved, secs):
r["show"].replace("\n", "\n ") for r in bad] or ["- none"]
out = ROOT / "logs" / f"blind_{split}.md"
out.write_text("\n".join(lines) + "\n")
print("\n".join(lines[:len(saved) + 7] + by_lang(saved)))
print("\n".join(lines[:len(saved) + 7] + by_lang(saved) + by_level(saved)))
def main(args):
+3 -2
View File
@@ -87,8 +87,9 @@ def rules(text, state, marks, b):
return "refuse" # Lumi.wave refuses with something held (wave.HOLDING)
if data[0] == "put" and not holding:
return "empty_hand" # skills.put_down: nothing picked, nothing moves
if data[0] == "fetch" and not holding and {"object", "place"} & set(brain.parse_fetch(text, marks)[1]):
return "ask" # fetch_dialog asks what is missing before anything moves
if data[0] == "fetch" and (holding or {"object", "place"} & set(brain.parse_fetch(text, marks)[1])):
return "ask" # fetch_dialog asks what is missing before anything moves;
# holding: lumi.fetch_request asks where to put it first
return data[0] if data[0] in ("weather", "search") else f"action:{data[0]} {data[1]}".strip()
return None
+5 -1
View File
@@ -87,7 +87,11 @@ def run_turn(b, text, lang, marks):
bye = b.farewell(text, lang)
b.reset()
return r, bye, time.time() - t0, time.time() - t0
if r.startswith("action:") or r in ("weather", "search"): # quick_command keeps it in the history
if r in ("weather", "search"): # lumi.look_up: the question (+ WEATHER_ASKED) is kept
asked = text + brain.WEATHER_ASKED if r == "weather" else text # so "도쿄는?" / "how about Daegu?" follow it
b.history.append((asked, by_rule[1] or ""))
b.last_lookup = asked
elif r.startswith("action:"): # quick_command keeps it in the history
a = r.split(":", 1)[-1].split(" ", 1)
b.history.append((text, f"ACTION: {a[0]} {a[1] if len(a) > 1 else '-'}"))
return r, by_rule[1], None, time.time() - t0
+68 -3
View File
@@ -5,7 +5,8 @@ part?"), "really?" / "are you sure?" right after a motion (about the talk before
number, settled facts after thanks (answered, not looked up), short follow-ups never answered "say it again".
English, Korean (반말 / 해요체 / 하십시오체 / friendly / honorific / dialect) and mixed; Korean replies polite.
.venv/bin/python tests/dialogues_night4.py [only] # through tests/followup_check.main -> logs/a4n4/night4_check.*
.venv/bin/python tests/dialogues_night4.py [only] [--b] # through tests/followup_check.main -> logs/a4n4/night4_check.*
# (--b: round 2 -> night4b_check.*)
"""
import sys
@@ -81,14 +82,78 @@ DIALOGUES_NIGHT4 = [
T("말씀하신 거 아까랑 좀 다른 것 같은데요?", must=[r"유칼립투스|잎|에너지|6|여섯|개월|18|20"], no=NK + [WHICH],
check="같은 사실을 다시"),
T("감사합니다, 많이 배웠어요. 안녕히 계세요.", "end")),
D("grandfather", "owl_ko_dialect", "ko",
T("부엉이 목 그거 을매나 돌아가노?", must=[r"270|이백칠십"], no=NK + [ME], check="270도; Lumi의 고개가 아님"),
T("그래 돌리믄 피는 우째 되노?", must=[r"피|혈관|혈액|핏줄|흐르|막히"], no=NK + [ME], check="혈관이 특별해서 피가 계속 흐름; " + FU),
T("눈은 와 안 움직이노?", must=[r"크|커|뼈|고정|관|원통"], no=NK + [ME], check="눈이 커서 고정; " + FU),
T("어... 그... 뭐였더라...", "-"),
T("참말이가?", must=[r"네|정말|맞|크|고정|270|피"], no=NK + [ME], check="부엉이 얘기를 다시 (못 알아들은 턴 전의 얘기)"),
T("욕봤다, 간데이.", "end")),
D("engineer", "lotte_mixed_konglish", "ko",
T("롯데월드타워 height 몇 m예요?", must=[r"555|오백오십오"], no=NK, check="555m"),
T("floor는 몇 개?", must=[r"123|백이십삼"], no=NK, check="123층; " + FU),
T("uh... what was it... 그...", "-"),
T("are you sure?", must=[r"555|123|yes|네|맞"], no=NK, rl="en", check="롯데월드타워 숫자를 다시 (못 알아들은 턴 전)"),
T("Okay, thanks. Bye!", "end")),
]
# round 2 (10:50): parts named after a world subject ("심장은 몇 개고?", "Why the name?"), lower-case English subjects,
# Lumi's own numbers asked casually and very politely, "really?" after an uncaught turn, a topic taken up again
DIALOGUES_NIGHT4B = [
D("student", "giraffe_en_native", "en",
T("Why do giraffes have such long necks?", must=[r"leaves|tree|reach|food|fight|eat"], no=N + [ME], check="to reach high leaves"),
T("How many bones are in it?", must=[r"seven|7"], no=N + [ME], check="seven, like ours; " + FU),
T("And the heart, is it big?", must=[r"kilo|kg|big|large|pump|blood|11|60 ?cm"], no=N + [ME], check="about 11 kg; " + FU),
T("hmm... the... uh...", "-"),
T("Really?", must=[r"yes|seven|7|kilo|kg|big"], no=N, check="yes, the giraffe facts again (before the uncaught turn)"),
T("Cool, thanks. Bye!", "end")),
D("grandmother", "lumi_specs_ko_honorific", "ko",
T("루미 님 머리에 든 컴퓨터는 메모리가 얼마나 되시는지요?", must=[r"122|백이십이"], no=NK, check="122GB"),
T("팔로는 얼마나 무거운 걸 드실 수 있으세요?", must=[r"2 ?(?:kg|킬로)|1 ?(?:kg|킬로)|이 ?킬로|일 ?킬로"], no=NK,
check="팔 2kg, 손에는 약 1kg"),
T("아이고 그래요? 정말이세요?", must=[r"네|2|1|킬로|맞"], no=NK, check="네, 같은 숫자를 다시"),
T("고마워요. 그럼 키는 어떻게 되세요?", must=[r"146|186|백사십"], no=NK, check="146cm, 올리면 186cm"),
T("잘 들었어요, 수고하세요.", "end")),
D("friend", "octopus_ko_banmal", "ko",
T("문어 피는 무슨 색이야?", must=[r"파란|푸른|청색"], no=NK + [ME], check="파란색"),
T("왜?", must=[r"구리|헤모시아닌|산소"], no=NK + [ME], check="구리가 든 헤모시아닌; " + FU),
T("심장은 몇 개야?", must=[r"3|세 ?개|셋"], no=NK + [ME], check="3개 (문어의 심장)"),
T("아까 피 색깔 뭐라 했지?", must=[r"파란|푸른|청색"], no=NK, check="파란색 (앞의 얘기로 돌아감)"),
T("ㅇㅋ 고마워, 간다~", "end")),
D("tourist", "namsan_mixed_konglish", "ko",
T("남산타워 언제 오픈했어요?", must=[r"1975|1980|칠십|팔십"], no=NK, check="1975년 완공, 1980년 개방"),
T("height는요?", must=[r"236|480|미터"], no=NK, check="약 236m; " + FU),
T("why 이름이 N이에요?", must=[r"남산|new|새|N"], no=NK + [r"제 이름|루미"], check="Namsan / new; 루미의 이름이 아님"),
T("Okay 땡큐!", "end")),
D("engineer", "sound_ko_hasipsio", "ko",
T("빛의 속도는 초속 몇 킬로미터입니까?", must=[r"30만|300,?000|삼십만|299"], no=NK, check="약 30만 km/s"),
T("소리는 어떻습니까?", must=[r"340|343|삼백사십"], no=NK + [ME], check="공기 중 약 340m/s; " + FU),
T("물속에서는 얼마나 빠릅니까?", must=[r"1,?500|1,?480|천오백|4|네 ?배"], no=NK, check="약 1,500m/s"),
T("확실하십니까?", must=[r"네|1,?500|천오백|맞|확실"], no=NK, check="네, 물속 숫자를 다시"),
T("수고하십시오.", "end")),
D("parent", "lumi_battery_en_nonnative", "en",
T("your battery, how many hour it go?", must=[r"10|ten"], no=N, check="about 10 hours"),
T("and when it is empty, you go charging alone?", must=[r"yes|myself|by myself|on my own|dock|charg"], no=N,
check="yes, goes to the charger by itself"),
T("hm ok, and the arm can carry how much?", must=[r"2 ?kg|two|1 ?kg|one|kilo"], no=N, check="2 kg with the gripper, ~1 kg in the hand"),
T("Sure?", must=[r"yes|2|two|1|one|kilo"], no=N, check="yes, the same numbers"),
T("Okay, see you.", "end")),
D("grandfather", "palace_ko_dialect", "ko",
T("경복궁 그거 언제 지었노?", must=[r"1395|조선|태조"], no=NK, check="1395년"),
T("이름은 와 그래 지었노?", must=[r"복|큰|하늘|복을|경사|시경|백성|태평"], no=NK + [r"제 이름|루미"],
check="큰 복을 누리라는 뜻; 루미의 이름이 아님"),
T("불은 몇 번 났노?", must=[r"임진왜란|1592|불|탔|화재|여러"], no=NK, check="임진왜란 때 탔고 1867년 다시 지음; " + FU),
T("고맙데이, 수고하그래이.", "end")),
]
if __name__ == "__main__":
from tests import followup_check as fc
from tests import dialogue_check as dc
fc.DIALOGUES = DIALOGUES_NIGHT4
b = "--b" in sys.argv # round 2: its own report
fc.DIALOGUES = DIALOGUES_NIGHT4B if b else DIALOGUES_NIGHT4
(dc.ROOT / "logs" / "a4n4").mkdir(exist_ok=True)
dc.OUT_JSON, dc.OUT_MD = dc.ROOT / "logs" / "a4n4" / "night4_check.json", dc.ROOT / "logs" / "a4n4" / "night4_check.md"
name = "night4b_check" if b else "night4_check"
dc.OUT_JSON, dc.OUT_MD = dc.ROOT / "logs" / "a4n4" / f"{name}.json", dc.ROOT / "logs" / "a4n4" / f"{name}.md"
args = [a for a in sys.argv[1:] if not a.startswith("--")]
fc.main(args[0] if args else None, failed="--failed" in sys.argv)
+12 -1
View File
@@ -44,6 +44,16 @@ CAPS = {
"sing": ("sing a song", "노래", "부르", "불러", ["노래 싱 해 줘"]),
"louder": ("speak louder", "더 크게", "말하", "말해", []),
"slower": ("speak slower", "좀 천천히", "말하", "말해", []),
"quieter": ("speak more quietly", "좀 작게", "말하", "말해", []),
"look_dn": ("look down", "아래를", "보", "봐", ["다운 봐 줘", "look down 해 주세요"]),
"look_me": ("look at me", "저를", "보", "봐", ["룩 앳 미 해 줘"]),
"around": ("turn around", "뒤로", "돌", "돌아", ["유턴 해 줘", "turn around 해 주세요"]),
"come_back": ("come back", "", "돌아오", "돌아와", ["컴백 해 줘"]),
"waist": ("turn your waist left", "허리를 왼쪽으로", "돌리", "돌려", ["웨이스트 레프트로 돌려 줘"]),
"body_up": ("raise your body", "몸을", "올리", "올려", ["리프트 업 해 줘", "바디 업 해 줘"]),
"open": ("open your hand", "손", "펴", "펴", ["핸드 오픈 해 줘"]),
"put": ("put the cup down", "컵 내려", "놓", "놔", []),
"charge": ("go charge", "충전하러", "가", "가", ["차지하러 가 줘"]),
}
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, {}",
@@ -138,7 +148,8 @@ def check(names=None):
"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
moves = got is not None and got.split()[0] not in command_check.NO_MOTION and \
not (got == "action:look away" and "지 마" in t) # "저를 보지 마세요": looking away is asked
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
+151
View File
@@ -0,0 +1,151 @@
"""Self-check of cup-task wordings (night 4, F1), no robot, no LLM: python tests/test_fetch_words.py
1. brain.parse_fetch: where the thing is (source), where it goes (dest), which one (prefer), at every speech level.
2. steps.rules: cup tasks of several parts (fetch then more, deliver and come back, put it at a place, wait until
someone takes it, Korean calls / endings of every level, Korean written without spaces).
Notation of tests/test_steps.py."""
from assistant import brain, steps
def short(s):
"""The notation of tests/test_steps.py, the kinds used here."""
w = s.split()
if w[0] == "go":
return {"do": "go", "to": w[1]}
if w[0] == "pick":
return {"do": "pick", "object": w[-1], "colour": w[1] if len(w) == 3 else None}
if w[0] == "receive":
return {"do": "receive", "object": w[1], **({"wait_s": steps.WAIT_GIVE_S} if w[-1] == "wait" else {})}
if w[0] == "wait":
if w[1:2] == ["order"]:
return {"do": "wait", "s": steps.WAIT_ORDER_S, "until": "instruction"}
return {"do": "wait", "s": float(w[1]) if len(w) > 1 else None}
if w[0] == "turn":
return {"do": "turn", "deg": float(w[1])}
if w[0] == "place":
return {"do": "place", "on": {"name": "dining table", "colour": None, "side": None} if len(w) > 1 else None}
if w[0] == "give" and len(w) > 1:
return {"do": "give", "person": s[5:]}
return {"do": w[0]}
M = ["home", "p1", "p2", "p3", "p4", "p5", "Registration", "Main_Stage", "Coffee_Bar"]
P = lambda n: {"marker": n}
# ---- 1. one fetch: (object, colour, source, dest, finish[, prefer]); None = asked ----
FETCH = {
"bring me the red cup from p3": ("cup", "red", P("p3"), "here", "hold"),
"could you grab me the cup that's on p2?": ("cup", None, P("p2"), "here", "hold"),
"get me the cup on the left from p1": ("cup", None, P("p1"), "here", "hold", "left"),
"fetch the white cup from the coffee bar": ("cup", "white", P("Coffee_Bar"), "here", "hold"),
"would you mind bringing the cup over from p5": ("cup", None, P("p5"), "here", "hold"),
"p1 red cup bring me please": ("cup", "red", P("p1"), "here", "hold"),
"bring the cup on p1 to p4": ("cup", None, P("p1"), P("p4"), "hold"),
"take the cup from p1 to p4": ("cup", None, P("p1"), P("p4"), "hold"),
"bring the cup to p1": ("cup", None, "here", P("p1"), "hold"),
"p3에서 빨간 컵 가져와": ("cup", "red", P("p3"), "here", "hold"),
"피삼에 있는 컵 좀 가져다줄래?": ("cup", None, P("p3"), "here", "hold"),
"피투에 있는 왼쪽 컵 가져와 줘": ("cup", None, P("p2"), "here", "hold", "left"),
"피원 컵 가져와": ("cup", None, P("p1"), "here", "hold"),
"p1의 컵 가져와": ("cup", None, P("p1"), "here", "hold"),
"커피 바에서 하얀 컵 갖다 주시겠어요?": ("cup", "white", P("Coffee_Bar"), "here", "hold"),
"피오에서 작은 컵 좀 가져다 주십시오": ("cup", None, P("p5"), "here", "hold", "small"),
"일 번 포인트에 있는 컵 좀 갖다 줘": ("cup", None, P("p1"), "here", "hold"),
"피원에서 컵 가져다가 피사에 있는 테이블에 놔": ("cup", None, P("p1"), P("p4"), "place"),
"컵을 p1에 갖다 놔": ("cup", None, "here", P("p1"), "place"),
# a person, not a place: asked
"bring the cup from p2 to Minsu": ("cup", None, P("p2"), None, "hold"),
"p2에서 컵 가져다가 민수한테 줘": ("cup", None, P("p2"), None, "hold"),
"빨간 옷 입은 여자분께 컵 갖다 드려": ("cup", None, "here", None, "hold"),
}
bad = []
for text, want in FETCH.items():
task, _ = brain.parse_fetch(text, M)
got = (task["object"], task["colour"], task["source"], task["dest"], task["finish"]) + \
((task["prefer"],) if task.get("prefer") else ())
if got != want:
bad.append(f"FAIL fetch {text!r}\n want {want}\n got {got}")
# ---- 2. several parts ----
STEPS = {
"deliver the cup to p5 and come back": "pick cup | go p5 | give | go here",
"take the cup to p5, leave it there and come back": "pick cup | go p5 | place | go here",
"컵을 p5에 갖다 주고 돌아와": "pick cup | go p5 | give | go here",
"컵 피오에 갖다 놓고 돌아와 주세요": "pick cup | go p5 | place | go here",
"컵을 피오에 갖다 드리고 돌아오십시오": "pick cup | go p5 | give | go here",
"bring me the cup from p2 and then go back home": "go p2 | pick cup | go here | give | go home",
"p2에서 컵 가져다 주고 충전기로 가": "go p2 | pick cup | go here | give | go home",
"p1에서 병 가져다 p2에 놔 주고 여기로 돌아와": "go p1 | pick bottle | go p2 | place | go here",
"p1에 있는 컵을 p4로 가져다 놔": "go p1 | pick cup | go p4 | place",
"go to p3 and wait until someone takes the cup": "go p3 | give",
"피삼에 가서 누가 가져갈 때까지 기다려": "go p3 | give",
"피삼에 가서 누가 받을 때까지 기다려 주세요": "go p3 | give",
"p3에 가서 민수한테 컵 받아서 가져와": "go p3 | receive cup | go here",
"go to p3, take the cup from Minsu and bring it to me": "go p3 | receive cup | go here | give",
"컵 들고 p2로 가서 거기 있는 사람한테 줘": "pick cup | go p2 | give",
"빨간 컵을 p4에 있는 민수한테 갖다 줘": "pick red cup | go p4 | give 민수",
"fetch the cup from p1, then wait here": "go p1 | pick cup | go here | wait",
"피원에서 빨간 컵 가져다가 피삼에 놔 줘": "go p1 | pick red cup | go p3 | place",
"피일에서 컵 가져다 주시고 홈으로 가십시오": "go p1 | pick cup | go here | give | go home",
"take the bottle to p2 and wait there until someone takes it, then come back": "pick bottle | go p2 | give | go here",
"병 들고 피투로 가서 누가 가져갈 때까지 기다렸다가 돌아와": "pick bottle | go p2 | give | go here",
"컵 피삼에 갖다 주고 10초 기다렸다가 홈으로 가": "pick cup | go p3 | give | wait 10 | go home",
"빨간 컵을 피사에 갖다 놓으시고 돌아오세요": "pick red cup | go p4 | place | go here",
"take the cup to the main stage and hand it to whoever is there": "pick cup | go Main_Stage | give",
"find the red cup and bring it to me": "pick red cup | go here | give",
"빨간 컵 찾아서 나한테 가져다 줘": "pick red cup | go here | give",
"point one에서 빨간 컵 가져와서 P5에 있는 사람한테 줘": "go p1 | pick red cup | go p5 | give",
"take the banana to the main stage and give it too Mr. Kim": "pick banana | go Main_Stage | give Mr. Kim",
"에구 하얀 컵 집어서 p4로 가져가서 테이블에 놔, 응": "pick white cup | go p4 | place dining table",
"p4에 가서 누가 빨간 컵 주면 받아 가지고 와": "go p4 | receive cup wait | go here",
"p4 가서 십 초 wait 하고 와": "go p4 | wait 10 | go here",
# a new order on the way (lumi.mission_talk reads it with steps.read)
"no, bring it to p4 instead": "go p4",
"아니야 피사로 가져가 줘": "go p4",
"change of plan, go to p4 and put it down": "go p4 | place",
"그거 저 사람한테 줘": "give",
# calls and endings of every level, Konglish, no spaces
"이보게 루미, 피삼에 가서 30초 기다렸다가 돌아오게나": "go p3 | wait 30 | go here",
"루미 님께서 피삼으로 가서 30초 기다렸다가 돌아와 주시길 부탁드립니다": "go p3 | wait 30 | go here",
"아야 루미, 피투로 가서 1분 기다렸다가 돌아와 주시겄슈": "go p2 | wait 60 | go here",
"우리 루미, 피투로 가서 한 바퀴 돌고 돌아와 주라~": "go p2 | turn 360 | go here",
"자네, 피투로 가서 오더 받고 컴백해 주게나": "go p2 | wait order | go here",
"피사에가서5분있다가다시오세요": "go p4 | wait 300 | go here",
"홈 포지션에 들렀다가 피투로 가게나": "go home | go p2",
}
for text, want in STEPS.items():
got, unread = steps.rules(text, M)
if unread or got != [short(s.strip()) for s in want.split(" | ")]:
bad.append(f"FAIL steps {text!r}\n want {want}\n got {got}\n unread {unread}")
# ---- 3. holding: put it at a place = a drive there and a put-down ----
for text in ("put it on p3", "p3에 갖다 놔", "피삼에 놔 줘", "leave it at the registration"):
got, unread = steps.rules(text, M)
if unread or [s["do"] for s in got] != ["go", "place"]:
bad.append(f"FAIL put at {text!r}: {got} {unread}")
# ---- near misses: nothing is read as a task part ----
NEAR = ["did you bring the cup from p1 and go home?", "don't bring the cup from p1, go home", "I'll bring the cup from p1 myself",
"tomorrow bring me the cup from p1 and go to p2", "my friend brought the cup from p1 and went home",
"p1에서 컵 가져오지 마", "내가 p1에서 컵 가져올게", "어제 p1에서 컵 가져왔지?", "컵을 p5에 갖다 줬어?",
"p3에 갖다 놓지 마", "did you deliver the cup to p5?"]
for text in NEAR:
got, unread = steps.rules(text, M)
if not unread and got:
bad.append(f"FAIL near miss {text!r}: {got}")
# ---- 4. a correction after the read-back (fetch_dialog): what changes ----
T = {"object": "cup", "colour": "red", "source": P("p1"), "dest": "here", "finish": "hold"}
FIX = {"no, the blue one": {"colour": "blue"}, "아니 파란 거": {"colour": "blue"}, "not p1, p2": {"source": P("p2")},
"피원 말고 피투": {"source": P("p2")}, "the one on the left": {"prefer": "left"}, "왼쪽 거": {"prefer": "left"},
"the smaller one": {"prefer": "small"}, "아니 작은 거": {"prefer": "small"}, "no, from p2": {"source": P("p2")},
"아니 피사로": {"dest": P("p4")}, "no, the bottle": {"object": "bottle", "colour": None},
"the other one": {}, "아니 다른 거": {}} # not said which: nothing changes, Lumi asks what to change
for text, want in FIX.items():
task, changed = brain.parse_correction(text, T, M)
if {k: task.get(k) for k in changed} != want:
bad.append(f"FAIL correction {text!r}: want {want}, got {({k: task.get(k) for k in changed})}")
print("\n".join(bad))
print(f"{len(FETCH) + len(STEPS) + len(FIX) + len(NEAR) + 4 - len(bad)}/{len(FETCH) + len(STEPS) + len(FIX) + len(NEAR) + 4} right")
assert not bad
print("fetch words ok")
+23
View File
@@ -203,4 +203,27 @@ if __name__ == "__main__":
assert brain._follow_examples(t, h), t
for t in ("Where is p3?", "세종대왕이 누구예요?", "oh cool", "What's your name?", "Tell me about the Korean War."):
assert not brain._follow_examples(t, h), t
# a world subject keeps Lumi's notes out (also lower-case English and a part named after it); Lumi's own things keep them
b = brain.Brain()
for h, t, want in (([], "Why do whales sing?", ["whales"]), ([], "부엉이는 고개를 몇 도까지 돌려요?", ["부엉이"]),
([("Why do whales sing?", "ACTION: none -\nTo find mates.")], "How far can the song go?", ["whales"]),
([("문어는 다리가 몇 개고?", "ACTION: none -\n여덟 개예요.")], "심장은 몇 개고?", ["문어", "다리", "심장"]),
([], "속도는 얼마예요?", []), ([], "How fast can you go?", []), ([], "Is the song yours?", []),
([], "Can the arm lift 2 kg?", [])):
b.history = list(h)
assert b.world_talk(t) == want, (t, b.world_talk(t))
# "really?" after a turn Lumi did not catch asks about the answer before it
h = [("롯데월드타워 높이 몇 m예요?", "ACTION: none -\n555미터예요."),
("uh... what was it... 그...", "ACTION: unclear -\n죄송해요, 다시 말씀해 주시겠어요?")]
assert brain.topic_turn(h)[0].startswith("롯데월드타워"), brain.topic_turn(h)
# the model's "search" with its answer after it: said (none); a lookup promise or "don't know" keeps the search
s = {"action": "search", "target": "x"}
q = "윤초는 뭐예요?"
for w in ("윤초는 지구 자전과 시계를 맞추는 1초예요.", "Mount Fuji is 3,776 metres high."):
assert brain.Brain._settled(s, w, q)["action"] == "none", w
for w in ("확인해 볼게요.", "Let me check.", "search whale song distance", "잘 모르겠어요.", "", "윤초는 뭐예요?",
"윤초가 궁금하시군요. 잠시만요.", "What exactly do you mean?"):
assert brain.Brain._settled(s, w, q) is s, w
assert brain.CHANGES.search("지금 비트코인 얼마야?") and brain.CHANGES.search("Who won the game yesterday?")
assert not brain.CHANGES.search("윤초는 뭐예요?") and not brain.CHANGES.search("How do bees dance?")
print("followup ok")
+17
View File
@@ -0,0 +1,17 @@
"""Korean speech levels read as the English request (a fixed part of tests/ko_levels_check.py): every level of a few
capabilities gives the same action, and the same phrase said as a past, a negation, a later time or a condition
gives no motion. No robot; the embedding server answers the bank.
.venv/bin/python tests/test_ko_levels.py
"""
from tests import ko_levels_check
CAPS = {"wave", "turn45", "head_up", "follow", "fetch", "go_to"}
rows = ko_levels_check.check(CAPS)
bad = [r for r in rows if r[-1] != "right"]
for name, level, text, got, want, v in bad:
print(f"FAIL {name} [{level}] {text!r} -> {got} (want {want}, {v})")
assert not bad, f"{len(bad)} of {len(rows)} not right"
assert len(rows) > 400, len(rows)
print(f"ok: {len(rows)} forms")
+142
View File
@@ -0,0 +1,142 @@
"""Commands, questions and asides through the voice / Command box route (command_check.rules = lumi.route without the
LLM), night 4: tag questions, take-backs at every Korean level, other people addressed, polite stops, chains that are
one order, amounts not read. A wrong motion is the worst error: None (the LLM reads it) is right for the no-motion
cases. No robot.
.venv/bin/python tests/test_route_words.py
"""
from assistant import brain, detour
from tests import command_check
M = ["p1", "p2", "p3", "p5", "p6", "home", "dock2"]
CASES = [ # (text, state, route)
# a statement with a tag, an ability said back: asked
("you went to P5 earlier, right?", "idle", None), ("you can lift your arm, right?", "idle", None),
("너 팔 접을 수 있지, 그치?", "idle", None), ("너 팔 접을 수 있지?", "idle", None), ("wave, right?", "idle", "action:wave"),
("손 흔들고 나 봐, 알았지?", "idle", "chain:wave+look_me"), ("팔 접어, 알겠죠?", "idle", "action:arm fold"),
("팔 뻗을 줄 아세요?", "idle", None), ("팔을 뻗을 줄 압니까?", "idle", None), ("robot, you know how reach out to me?", "idle", None),
("robot can say hi with your hand or not? I just ask", "idle", None), ("멸 센티까지 잡아?", "idle", None),
("Back to your arm, what did you say?", "idle", None),
# one order, not a chain
("손 흔들어서 작별 인사 해 주시겠어요?", "idle", "action:wave"), ("손 흔들어서 인사해", "idle", "action:wave"),
("컵 들고 몇으로 가?", "idle", None), ("잔 들고 천천히 가는 속도가 얼마야?", "idle", None),
("하객분들 앞에서 손 거둬!, 아 거두시겠어요?", "idle", "action:arm fold"),
("로봇아, 좌측으로 10 센티미터 움직여라, 아 움직여 주실래요?", "idle", "action:move left 0.1"),
("이장이 말하는디, 팔 제자리로 해", "idle", "action:arm fold"), ("take your hand back, da?", "idle", "action:arm fold"),
("so, robot, head to p6, da?", "idle", "action:go_to p6"), ("could you possibly hand it over?, eh?", "holding", "give"),
("exactly please I'll hold it, give it here", "holding", "give"),
("pick up the cup, how fast do you go?", "idle", "chain:steps+talk"), ("고개 들고 몇 시야?", "idle", "chain:look_up+talk"),
("치수 불러 줄게, 내 머리 무슨 색이야?", "idle", "seeing"),
# handed over or not
("이거 줄게", "idle", "receive"), ("컵 줄게요", "idle", "receive cup"), ("사진 찍어 줄게", "idle", None),
("자 그럼 Lumi, wave your hand 해 봐요", "holding", "refuse"), ("give 해 줘", "holding", "give"),
("it'd be cool if you could give me the cup someday", "holding", None),
# polite stops, calls, Konglish
("멈춰 주시겠어요?", "idle", "stop"), ("멈춰 주실래요?", "idle", "stop"), ("정지해 주시겠습니까?", "idle", "stop"),
("can you stop for me?", "idle", "stop"), ("루미 씨, 잠깐 멈춰 주실 수 있나요?", "idle", "stop"),
("can you stop for coffee?", "idle", None), ("루미 씨, 팔 접어 주세요", "idle", "action:arm fold"),
("컴 히어 해 줘", "idle", "action:come"), ("이리 컴", "idle", "action:come"), ("컴퓨터 꺼 줘", "idle", None),
# other people addressed
("쉿 아기 자니까 엄마 그거 나 줘", "holding", None), ("질문을 바꿔서, 엄마 그거 나 줘", "holding", None),
("이륙 전 점검, 할머니 이제 팔 접어 좀", "idle", None), ("어머님, 컵을 들어 보세요, 저기 로봇 있어요", "idle", None),
("김 군, 자네도 팔 뻗어 보게", "idle", None), ("우리 아들, 빠빠이 해 봐 봐~", "idle", None),
("shh, Sarah, make your way to p2", "idle", None), ("우리 p3 갈까 여보", "idle", None),
("루미야 할머니한테 손 흔들어 줘", "idle", "action:wave"), ("okay, Lumi, go to p5", "idle", "action:go_to p5"),
# taken back, later, negated: every level
("로봇 씨, 손 흔들어 주시길 바랍니다, 아, 하지 않으셔도 됩니다", "idle", "talk"), ("저기유, 손 흔들어 줘유, 아녀, 됐슈", "idle", None),
("악수해 주십시오, 아닙니다, 취소하겠습니다", "idle", "talk"), ("루미야~ 나랑 악수해~, 장난이야~", "idle", "talk"),
("wave 해 줄 수 있지?, 아냐 아냐 됐어 ㅋㅋ", "idle", "talk"), ("음악 나오믄 악수해 보이소", "idle", None),
("나중에~ 손 wave 해~", "idle", None), ("행사가 끝난 후에 나한테 손 흔드십시오", "idle", None),
("robot, if I say go, then reach out to me", "idle", None), ("you not give me the cup", "holding", None),
("no hold out your hand, please", "idle", None),
("no need to return it to where it was", "holding", None), ("put down 하지 않으셔도 됩니다", "holding", None),
("파란 컵 좀 들지 마이소", "idle", None), ("자네 컵 잡는 거 제법이더군", "idle", None),
# 하게체 / dialect requests to Lumi, floor, status
("자네, 손을 흔들어 주게나", "idle", "action:wave"), ("이보게 루미, 악수하게", "idle", "action:wave"),
("나한테 손 흔들어 줄 수 있지?", "idle", "action:wave"), ("어이 로봇아, 손 흔들어 주드라고", "idle", "action:wave"),
("바닥에 내려놔 주이소", "holding", "refuse"), ("의자 밑에 놔", "holding", "refuse"), ("의자 위에 놔", "holding", "place chair"),
("그리퍼 오픈 상태야?", "idle", "status"), ("is it possible for you to open your fingers, in general?", "idle", None),
("can you look up for me?", "idle", "action:look up"), ("would you stop, please?", "idle", "stop"),
("흰색 머그컵 잡아!, 아 잡아 줄 수 있어요?", "idle", "action:pick white cup"),
("제자리에, 루미, 손 앞으로 내밀어 봐", "idle", "action:arm reach"), ("Lumi, I heard you can put that back", "holding", None),
# gives at every level, self-corrections said again, head / body / base words
("로봇아, 선생님께 드려라", "holding", "give"), ("자네, 할머니께 드리시게", "holding", "give"),
("grandma한테주십시오", "holding", "give"), ("루미, 이리 좀 조", "holding", "give"), ("루미야, 기브 미 해 주세여", "holding", "give"),
("로봇아, 그거 주세요", "idle", "empty_hand"), ("좌측으로 20센티 움직여 줘, 아니 움직이실래요?", "idle", "action:move left 0.2"),
("루미야 우측으로 15도 돌아 봐, 아니 돌아 봐요 허허", "idle", "action:turn right 15"), ("p6로 가, 아니지 p2로 가", "idle", "action:go_to p2"),
("이제 팔 접어 좀. 아니야 그냥 있어", "idle", "talk"), ("두 걸음 뒤로 물러서 줘, 부탁해", "idle", "action:move back 1"),
("어이로봇아,상체오른쪽으로십오도쫌돌려줘유", "idle", None), ("저기 루미야, 웨이스트 레프트로 좀 돌리세요", "idle", "action:waist left"),
("몸통째 왼쪽으로 돌려", "idle", "action:turn left 90"), ("실례합니다. 왼쪽을 돌아봐 주시겠습니까?", "idle", "action:look left"),
("look right at me 해 하하", "idle", "action:look me"), ("Lumi go ahead and look down at the ground", "idle", "action:look down"),
("루미 씨, 발 밑 바라보지 마세요", "idle", None), ("쳐다보지 마", "idle", "action:look away"),
("prove you're smart: come on back", "idle", "action:come_back"), ("루미 360 돌아 봐", "idle", "action:turn right 360"),
("dude, stick your hand out", "idle", None), ("dude, halt", "idle", "stop"), ("손님상에 여보 후진 2미터 반 움직여 봐", "idle", None),
("이따가 멈춰 주세요", "idle", None),
# amounts
("루미,앞으로삼십센티미터가", "idle", "ask"), ("뒤로1미터50이동해부러", "idle", "action:move back 1.5"),
("앞으로 30센티 가", "idle", "action:move forward 0.3"),
# a stop for later or reported (night 4, round 3)
("행사가 끝난 후에 멈춰 주시길 바랍니다", "idle", None), ("내일 그만하시게", "idle", None),
("아까 직원분이 그만하라고 지시했습니다", "idle", None), ("루미 군, 그만하시게", "idle", "stop"),
("저기요, 당장 멈춰 주시길 바랍니다", "idle", "stop"),
# turn (try turning) or look round; a correction said as a new order in full
("왼쪽으로 돌아 봐", "idle", "action:turn left 90"), ("오른쪽으로 돌아봐 줄래요?", "idle", "action:look right"),
("왼쪽으로 돌아보시게", "idle", "action:look left"), ("레프트 턴 해 봐", "idle", "action:turn left 90"),
("루미 오른편으로 135도 돌아— 아니 왼편으로 백이십 도 돌아 주세요~", "idle", "action:turn left 120"),
("우리 루미, 오른쪽으로 백삼십오 도 돌아... 아 잘못 말했다, 몸통째 왼쪽으로 돌려 주세요", "idle", "action:turn left 90"),
("go forward half a metre, no wait, back up 10 cm", "idle", "action:move back 0.1"),
("turn left 45 degrees, no, right", "idle", "action:turn right 45"),
("좌측으로 20센티 움직여 줘, 아니 움직이실래요?", "idle", "action:move left 0.2"),
("부스 B로 가서 왼쪽으로 돌아요", "idle", "talk"), ("hello robot, please come back for me, thank you", "idle", "action:come_back"),
("애플 그랩 해", "idle", "action:pick apple"), ("실례합니다. 제자리에 지금 갖다 놓으십시오", "holding", "action:put back"),
# round 4: new wordings
("back to your arm. what was it again?", "idle", None), ("now face the other way", "idle", "action:turn around 180"),
("do a 180, please", "idle", "action:turn around 180"), ("룩 다운 해 주세요", "idle", "action:look down"),
("룩 앳 미 해 줘", "idle", "action:look me"), ("룩 업 할 수 있어?", "idle", None),
("바이바이 좀 하세요", "idle", "action:wave"), ("어이 로봇, 빠빠이 하시게", "idle", "action:wave"),
("멈추시게", "idle", "stop"), ("hold it right there", "idle", "stop"), ("내일 멈추시게", "idle", None),
("you put down arm please", "idle", "action:arm fold"), ("어이 로봇아, 손 쪼까 내려 줘", "idle", "action:arm fold"),
("Lumi, may I ask you to stretch your arm out?", "idle", "action:arm reach"), ("is your arm out?", "idle", "status"),
("Lumi, robot, put it down ok?", "holding", "place"), ("I put it down, now?", "holding", "seeing"),
("할머니 드려라", "holding", "give"), ("우리 할머니 드리십시오", "holding", "give"), ("전화 드려", "holding", None),
("인사 드려", "holding", None), ("연락 줘", "holding", None),
("손 흔들면서 인사하고 고개 숙여", "idle", "chain:wave+look_down"),
("왔던 길로 돌아가", "idle", "action:come_back"), ("원래 있던 자리로 가 주세요", "idle", "action:come_back"),
("go back the way you came", "idle", "action:come_back"), ("원래 있던 자리로 가지 마", "idle", None),
("어제 왔던 길로 가면 돼요", "idle", None), ("knock it off, Lumi", "idle", "stop"), ("whoa there", "idle", "stop"),
("whoa, that's cool", "idle", None), ("lemme have it", "holding", "give"),
# "would you mind …ing", polite conditions and "-주시면 안 될까요" (lead, 11:30)
("would you mind shaking hands", "idle", "action:wave"), ("would you mind coming here?", "idle", "action:come"),
("do you mind waving at the kids?", "idle", "action:wave"), ("would you mind stopping here, please", "idle", "stop"),
("would you mind if I took a photo?", "idle", None), ("would you mind not moving?", "idle", None),
("손 흔들어 주시면 안 될까요?", "idle", "action:wave"), ("괜찮으시면 악수해 주실래요?", "idle", "action:wave"),
("p3로 가 주시면 안 될까요?", "idle", "action:go_to p3"), ("실례가 안 된다면 이리 와 주시겠어요?", "idle", "action:come"),
("혹시 괜찮으시면 컵 좀 집어 주실 수 있을까요?", "idle", "action:pick cup"), ("if you don't mind, wave at me", "idle", "action:wave"),
("괜찮으시면 손 흔들지 마세요", "idle", None), ("괜찮으시면 내일 p3로 가 주세요", "idle", None),
("괜찮으시면 저한테 주시면 안 될까요?", "holding", "give"), ("hello robot", "idle", None),
("hello robot, wave", "idle", "action:wave"),
]
DETOUR = [ # right after a blocked drive to p2: (text, detour.read)
("아까 저 아저씨가 루미한테 다시 가라고 했어", None), ("아까 재시도하는 거 정말 신기했어요", None),
("다른 루트로 가시겠어요?, 아, 아닙니다, 괜찮습니다", None), ("얘 뒤로 조금 갔다가 다시 가는 거 봤냐?", None),
("지가 말하믄 재시도해부러", None), ("다시 시도할 줄은 알아?", None), ("그냥 돌아올 줄 아는가?", None),
("다시 시도해 줘", "retry"), ("다른 길로 가 주세요", "around"), ("루미야 포기하지 마", "retry"),
("never mind that, just try again", "retry"),
("루미야, 다른 길 있나 민수야?", None), ("여러분, 모두 포기하고 돌아와 보시기 바랍니다", None),
]
def main():
detour.recent = lambda: None # no blocked drive just now (whatever the live state says)
bad = [f"detour {t!r} -> {detour.read(t, M, 'p2')!r} (want {w!r})" for t, w in DETOUR if detour.read(t, M, "p2") != w]
for text, state, want in CASES:
got = command_check.rules(text, state, M, brain.Brain())
if got != want:
bad.append(f"{text!r} [{state}] -> {got!r} (want {want!r})")
print("\n".join(bad) or f"route words ok ({len(CASES)} cases)")
assert not bad
if __name__ == "__main__":
main()
+3 -1
View File
@@ -118,7 +118,8 @@ said = lambda: [d[1] for d in done if isinstance(d, tuple) and d[0] == "say"]
# ---- the calls that wake Lumi (EN + KO + whisper slips) and what does not ----
for call in ("Lumi.", "Hi Lumi.", "Hi.", "Hello Lumi!", "Hello.", "Hey Lumi", "How are you?", "Hi, how are you?",
"루미야.", "루미.", "안녕.", "안녕하세요.", "하이.", "하이 루미!", "Hi, Loomi.", "Hello, Rumi.", "Hai.",
"Lummy?", "누미야", "안녕하십니까."):
"Lummy?", "누미야", "안녕하십니까.", "Wake up.", "Wake up, Lumi!", "Hey Lumi.", "Lumi, wake up.",
"헤이 루미", "루미야 일어나", "루미 일어나세요.", "일어나세요.", "깨어나 루미야"):
L = fresh()
L.mic = Mic(U(call))
assert L.check_wake(), call
@@ -128,6 +129,7 @@ for heard in ("Let's make music.", "What is that?", "We make it.", "Let's.", "It
L.mic = Mic(U(heard))
assert not L.check_wake(), heard # 16:57:00, 17:05:03 live: "(no wake word)"
assert not lumi.call_only("Lumi, what time is it?") and not lumi.call_only("루미야 노래 불러줘")
assert not lumi.WAKE.search("I wake up at 7 every day") and not lumi.WAKE.search("일어나서 밥 먹었어") # no call
L = fresh() # "How are you?" is answered, not "Yes? How can I help?"
L.mic = Mic(U("How are you?"))
L.check_wake()