Improve command understanding with bigger wording banks; tested
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ leaves to the LLM. Nothing moves; only the embedding server is asked.
|
||||
# be wrong there either (its guards and margins, not the rules)
|
||||
.venv/bin/python tests/bank_check.py --blind # tests/blind/train/*.py and tests/blind/r2/train/*.py too
|
||||
.venv/bin/python tests/bank_check.py -v # print every hit too, not only the wrong ones
|
||||
.venv/bin/python tests/bank_check.py --blind --rounds r4,r6 --out bank_check_a3.md # some rounds, own report
|
||||
|
||||
A case reaches the bank when command_check's rules (lumi.route without the bank) leave it to the LLM.
|
||||
-> logs/bank_check.md
|
||||
@@ -70,6 +71,8 @@ def cases(blind):
|
||||
for f in sorted((ROOT / "tests" / "blind" / "train").glob("*.py")) + \
|
||||
sorted((ROOT / "tests" / "blind").glob("r*/train/*.py")): # round 1, then r2, r3 ... (never held/)
|
||||
rnd = f.parent.parent.name if f.parent.parent.name != "blind" else ""
|
||||
if ROUNDS and (rnd or "r1") not in ROUNDS:
|
||||
continue
|
||||
mod = importlib.import_module(f"tests.blind.{rnd + '.' if rnd else ''}train.{f.stem}")
|
||||
tag = f"blind/{rnd + '/' if rnd else ''}{f.stem}"
|
||||
got = getattr(mod, "CASES", [])
|
||||
@@ -98,7 +101,15 @@ def judge(expect, got):
|
||||
return "right" if command_check.ok(expect.lower(), command_check.refused(got).lower()) == "right" else "wrong"
|
||||
|
||||
|
||||
ROUNDS = [] # --rounds r1,r2: only these blind rounds (r1 = tests/blind/train)
|
||||
|
||||
|
||||
def main(args):
|
||||
global OUT
|
||||
if "--rounds" in args:
|
||||
ROUNDS[:] = args[args.index("--rounds") + 1].split(",")
|
||||
if "--out" in args:
|
||||
OUT = OUT.with_name(args[args.index("--out") + 1])
|
||||
marks = markers()
|
||||
stress, verbose = "--stress" in args, "-v" in args
|
||||
from assistant import steps
|
||||
|
||||
@@ -131,3 +131,205 @@ are round 4's (with `"crowd"` and `"mix"`). Load them as `tests.blind.r5.held.<n
|
||||
| `unknowns` | 100 (57 unknown / 43 known) |
|
||||
| `silence_noise` | 60 |
|
||||
| `hearing` | 120 |
|
||||
|
||||
## r6 dialogues (round 6, 2026-10-23 night: dialogues and questions, writer W2)
|
||||
|
||||
`r6/train/` and `r6/held/` (split ~50/50 at random per dialogue / case, the same mix in both), written blind from
|
||||
docs/14, docs/16, docs/17, HANDOFF §16.3, knowledge/*.md and knowledge/jaka_zh, de-duplicated against rounds 1–4's
|
||||
train texts (a scored turn whose exact text was used before gets a short filler in front). Formats are round 4's (with
|
||||
`"crowd"` / `"who"` and `"mix"`) unless a row says NEW. Every Korean speech level (반말 / 해요체 / 하십시오체), mixed
|
||||
talks that switch language turn by turn and Konglish word swaps ("배터리" → "battery"), slips. A file `<name>_b.py` … `<name>_g.py` is a
|
||||
later growth file of the same format and kind (new cases only; earlier published cases are never changed). Load them as
|
||||
`tests.blind.r6.<split>.<name>` (`blind_check.py --round r6`). Generators (seeded): `logs/w2_gen/gen_*.py` with
|
||||
`r6lib.py`, topic tables `topics_a.py` … `topics_n.py` (513 topics; f–n in a chain schema with 3–4-level nested follow-ups, generator `gen_dialogues2.py`: each with Lumi's earlier answer, the core-fact regex,
|
||||
a false claim, follow-ups and a "back to …" wording); `logs/w2_gen/check_r6.py` imports every file and checks the
|
||||
regexes, expect tokens and markers.
|
||||
|
||||
| File | train / held | New |
|
||||
|---|---|---|
|
||||
| `followup_dialogues` (+ `_b`, `_c`) | 258/262 (3053/3014 scored turns), _b 193/207 (2214/2396), _c 155/165 | world topics (science, space, animals, kids' questions, history, Korea, culture, food, travel, sports, music, movies, tech, AI, robots, health, economy, philosophy) and Lumi / Cutshion / JAKA / conference facts, 2–4 topics per talk, 10–25 turns: nested follow-ups on Lumi's own answer (bare "why?" / "when?" / "왜?" / "언제요?", "what did you mean?", "그게 무슨 뜻이야?", "really?", "진짜?"), subject left out, contradictions to keep the fact against (AGREE in must_not), returns to an earlier topic ("아까 문어 얘기 다시요"; check "back to an earlier topic: <id>"), facts the notes don't have with "roughly?" (not sure, no number); _b / _c also "you said something different before" (Lumi's own answer doubted: keep it, AGREE in must_not); _c adds why-chains on what Lumi can't do (stairs, the floor, faces, dance, waving while holding) and dialect words for some Korean speakers (참말이가?, 와 그렇노?, 그기 무슨 말이고?; topic "…:dialect:…") |
|
||||
| `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 |
|
||||
| `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" |
|
||||
| `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) |
|
||||
| `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.
|
||||
|
||||
## r6 commands (round 6, 2026-10-23 night: every command capability, writer W1)
|
||||
|
||||
`r6/train/` and `r6/held/` (split ~50/50 at random per case, the same mix in both), written blind from docs/14,
|
||||
docs/16, docs/17, HANDOFF §13–16 and knowledge/, de-duplicated against rounds 1–4's train texts (exact text) and
|
||||
between the splits (text + state + before). Every command Lumi has, in as many wordings as the writer could find:
|
||||
English (native, non-native, children, slang, testers), Korean (반말 / 해요체 / 하십시오체 / 주세요 / 줄래 / 하게체,
|
||||
경상 / 전라 dialect words), Konglish both ways and mixed; whisper slips and typos (also Korean written without
|
||||
spaces), fillers, stutters, self-corrections read to the last thing said, take-backs (no motion); numbers as digits /
|
||||
English words / sino / native Korean; all seven fake maps. In every set ~60 % ordinary requests, ~25 % hard negatives
|
||||
(negation, condition / later, ability questions, remarks, quotes, plans between people, words to others, past
|
||||
events, hypotheticals) and ~15 % slips; Korean ~45 %, English ~40 %, mixed ~15 %. Formats are round 4's (`crowd`,
|
||||
`mix` on every dict case and missions value; `commands_sing` stays tuples). Handshake wordings ("shake hand(s)",
|
||||
"let's shake hands", "악수하자") are wave; "give me your / a hand", "손 줘", "손 내밀어" are reach (owner).
|
||||
A name like `commands_<cap>_b.py` holds more cases of the same set written later (never changed once published).
|
||||
Load them as `tests.blind.r6.<split>.<name>`.
|
||||
|
||||
| File | train / held | Notes |
|
||||
|---|---|---|
|
||||
| `commands_go`, `_move`, `_turn` | 699/701, 723/677, 636/618 | go: every marker of every map in its spoken forms; home / charger / dock (`dock2 \| home \| ask` on maps with a dock2); not on the map `ask \| talk \| refuse`; "gallery" alone / "gate" alone (airport) `ask \| talk`. move: amounts in cm / mm / m, words, sino and native Korean; fuzzy amounts ("a little", "살짝", "한 걸음") = the direction only (`action:move back`, any amount) `\| ask`; no unit `ask \| talk`; over 3 m `refuse \| ask \| talk`; drive speed `speed faster / slower`. turn: 180 also allows `action:turn around`; "좌향좌 / 우향우" |
|
||||
| `commands_look`, `_lift` | 710/690, 393/367 | look: left / right / up / down / me / center / behind (`action:look`) / away, head by degrees (= that direction), a small step, a thing ("look at the cup" `action:look \| seeing \| ask`), questions about what is there `seeing \| talk`, idioms. lift: by 10 cm or more also `refuse \| talk` (round 4) |
|
||||
| `commands_waist` | 354/346 | NEW set. NEW tokens `action:waist left [deg]`, `action:waist right [deg]`, `action:waist center` (the waist / upper body, never the base), always `\| refuse` (Greeter only refuses waist moves) |
|
||||
| `commands_wave`, `_reach` | 367/403, 495/467 | wave holding = `refuse \| talk`; wave goodbye `\| end`. reach: fold / retract / "arm down" / "take your hand back" / "back to look position" / "손 내려" / "팔 거둬" = `action:arm fold \| action:arm look` (NEW token `action:arm look`: the arm back to its look pose); "thanks" after a reach also `end \| talk` |
|
||||
| `commands_hand` | 401/378 | NEW set: open / close (`action:arm open \| refuse`, `action:arm close \| refuse`); open while holding `refuse \| talk`; "놔 / let go" while holding `place \| action:put down \| refuse \| talk`; hand-state questions (open? holding? where is your arm?) `status \| talk`, idle and holding |
|
||||
| `commands_give`, `_take`, `_put`, `_bring` | 355/374, 411/460, 375/394, 462/506 | give / put mostly holding; the same words idle `empty_hand \| ask \| talk`. take: pick with colours that exist for that object, receive (`receive \| talk`), things it can't pick `refuse \| talk \| ask`, holding `refuse \| talk`. bring: object from a marker; without a place also `action:pick \| ask`; coffee / shopping `refuse \| talk \| ask` |
|
||||
| `commands_follow`, `_come` | 273/270, 409/338 | come is a NEW set: come here `action:come \| refuse`; come back `action:come_back \| ask` (some with the trip as `before`); bare "go back" `action:move back \| action:come_back \| ask`; "come back here" also `action:come` |
|
||||
| `commands_point` | 217/213 | NEW set, NEW token `point`: drive to the floor spot the speaker points at ("go where I point", "go over there", "저기로 가"), always `point \| ask`; "what am I pointing at?" `seeing \| talk` |
|
||||
| `commands_stop`, `_status` | 221/229, 198/208 | stop with a running action as `before` (drive, turn, follow, move, wave, song, mission, fetch, reach, pick); "stop looking at me" = `action:look away`; bare stop with nothing running `stop \| talk \| ask`; "don't stop" while driving = `talk \| ask`. status: doing / going / holding / battery / charging, idle and holding, some during a trip or mission |
|
||||
| `commands_voice` | 421/412 | NEW set: `voice louder / quieter / slower / faster` (speech), be quiet `action:quiet \| stop \| talk`; "I can't hear you" `voice louder \| talk` |
|
||||
| `commands_more` | 242/227 | NEW set: again / more / one more / 더 / 한 번 더 / 또 with the last action as `before`: the same action again (`action:turn left` = any angle that way; an amount said: that much). Nothing before or after talk `ask \| talk`. NEW field `at_limit` (head_down, head_up, head_left, lift_top, lift_bottom) with NEW token `limit`: the axis is already at its end, Lumi says so plainly and nothing moves (HANDOFF §16.2); the checker must give the reader that body state |
|
||||
| `commands_chain`, `_detour` | 407/493, 469/431 | round 2–4 formats. chain parts also `arm reach`, `ask:battery`; detour: every marker of every map as the blocked goal, a few idle with no block |
|
||||
| `commands_missions` | 708/749 | step lists parse with tests/test_steps.short, every marker on its map; translated marker names left out; `?` for conditions, later, people talking, places not on the map, things it can't do, take-backs |
|
||||
| `commands_sing` | 243/248 | `(text, want, context)`; contexts written out as round 4 (song just sung, song list, an offer) |
|
||||
| `speed_short` | 306/295 | `fast: True`; also `point`, `action:waist left`, `action:arm look` |
|
||||
|
||||
More cases of the same sets, same formats and expects, each de-duplicated against every file above (exact text):
|
||||
`_b` (other request frames, prefixes, Korean endings: -ㄹ래 / -시지요 / -주이소예 / -줘불어 …, other hard-negative
|
||||
frames, a new seed) and `_c` (requests inside context: "for the photo, …", "사진 찍게 …", "…, 애들이 좋아해요", the
|
||||
press, a demo, a birthday; context-laden negatives) for every file; `_d` for go, move, turn, look, lift (whisper
|
||||
homophones and number transcriptions: "turn write", "move for word one meter", "pee three", "1미터50", "왼쪽바";
|
||||
questions as requests: "how about turning left?", "would you be able to …", "왼쪽 볼 수 있을까?", "…는 거 돼요?";
|
||||
rambling requests). With them, train / held per set: go 2249/2299, move 2278/2182, turn 1972/1978, look 2257/2185,
|
||||
lift 1236/1228, waist 1063/1037, wave 1071/1124, reach 1388/1381, hand 1087/1032, give 987/1026, take 1231/1228,
|
||||
put 1116/1165, bring 1427/1465, follow 818/770, come 1102/1076, point 626/628, stop 407/422, status 432/438,
|
||||
voice 1238/1221, more 389/381, chain 1307/1393, detour 802/772, missions 2038/2078, sing 360/359, speed_short 382/376
|
||||
(all files: 29263 train / 29244 held).
|
||||
|
||||
Generators (seeded, not in the repo): `logs/w1_gen/` on the Thor (`r6lib.py`, `spoken.py`, `gen_*.py`, `run_b.py`,
|
||||
`run_c.py`, `gen_d.py`); `check_r6.py`
|
||||
checks imports, fields, markers on their maps, expect tokens, missions step notation, no text of rounds 1–4 and no
|
||||
case in both splits.
|
||||
|
||||
## r8 (round 8, 2026-10-24 night: scene-driven, writer W3)
|
||||
|
||||
`r8/train/` and `r8/held/` (split ~50/50 at random per case / dialogue, the same mix in both), written blind from
|
||||
docs/14, docs/16, docs/17, HANDOFF §13–16 and knowledge/, with a new method: not template frames but **scenes**. 41
|
||||
visitor archetypes, each played on three of the seven fake maps (123 scenes): a family with jumping kids, an elderly
|
||||
couple from Busan (경상 dialect), a grandmother from Gwangju (전라), a Japanese engineer and a Chinese buyer in broken
|
||||
English, an Indian researcher, a Korean-American family switching languages mid-sentence, a CEO testing before buying,
|
||||
teenage trolls (slang, ㅋㅋ), a busy staff member, a TV reporter filming, a wheelchair visitor, a noisy hall (whisper
|
||||
drops spaces and words), a cooking demo, a photo session, a lost child, a delivery job across the hall, a streamer
|
||||
reading chat, a VIP tour with an interpreter, a cleaner at closing, a middle-school coding club, a seminar MC, …
|
||||
Each scene has its own words around the requests (addresses, openers, tails), speech levels and slip rate; the
|
||||
requests are hand-written cores in Korean (verbs conjugated to 반말 / 해요체 / 하십시오체 / 경상 / 전라 endings), English
|
||||
(native, formal, non-native, kids, slang) and Konglish, ~60 % plain, ~25 % hard negatives built from the same core
|
||||
(negation, later / condition, "할 줄 알아?" know-how questions, remarks about the past, words to another person, quotes,
|
||||
take-backs, hypotheticals) and ~15 % whisper slips (homophones, lost spaces, stutters, lowercase without punctuation).
|
||||
Korean ~80 % of all texts. De-duplicated against rounds 1–6's train texts (exact) and between the splits; unique
|
||||
text 96.7 % over all files (commands 98.5 %). Formats are round 4 / round 6's; NO new expect tokens. Every case,
|
||||
missions value and dialogue carries an extra field `"scene"` (seeing dialogues: `"scene_id"`, since `scene` is the
|
||||
camera scene of a turn) naming the scene, e.g. `busan_couple@korean`; checkers ignore it. Load as
|
||||
`tests.blind.r8.<split>.<name>`.
|
||||
|
||||
| File | train / held | Notes |
|
||||
|---|---|---|
|
||||
| `commands_go`, `_move`, `_turn`, `_look`, `_lift`, `_waist` | 392/456, 368/348, 298/302, 359/360, 259/199, 184/167 | r6 conventions (go: Korean word for an English marker and the reverse also `ask`; charger `dock2 \| home \| ask`; fuzzy amounts direction only `\| ask`; over 3 m `refuse \| ask \| talk`; lift ≥ 10 cm `\| refuse \| talk`; waist always `\| refuse`) |
|
||||
| `commands_wave`, `_reach`, `_hand`, `_give`, `_take`, `_put`, `_bring` | 244/215, 210/233, 223/207, 228/189, 299/268, 231/225, 298/294 | handshakes = wave, 손 줘 / give me a hand = reach (owner); idle give / put `empty_hand \| ask \| talk` |
|
||||
| `commands_follow`, `_come`, `_point`, `_stop`, `_status`, `_voice` | 175/164, 247/228, 176/173, 235/232, 133/178, 270/305 | stop with a running action as `before` |
|
||||
| `commands_more`, `_chain`, `_detour` | 245/256, 395/343, 251/275 | more: `limit` with `at_limit`; chain `parts` (r2 notation) |
|
||||
| `commands_missions`, `commands_sing`, `speed_short` | 534/554, 194/185, 112/99 | missions dict (steps notation, `?`); sing tuples; `fast: True` |
|
||||
| `questions_world` | 467/517 | quick / knowledge / unknown from the notes, `lookup:weather / news / web`, time |
|
||||
| `followup_dialogues` | 63/60 (465/412 scored turns) | setup turns with `reply`; follow-ups, really?, contradictions (AGREE in must_not), back to an earlier topic |
|
||||
| `dialogues_mixed` | 67/56 (709/600) | commands inside talks on the scene's map, remarks / later / unnamed things (no motion), thanks + a new question, goodbye |
|
||||
| `seeing_dialogues` | 72/51 (507/371) | person fields of r6; the scene changes between turns (glasses off, other hand, sits down, someone arrives / leaves) |
|
||||
| `closing_context` | 118/128 (133/142) | field `closing` end / continue |
|
||||
| `memory_dialogues` | 72/51 (576/411) | r6 memory format: recall, facts, never talked (offer / can't remember, never yes), older than 48 h, seen yes / no, self state, `forget` |
|
||||
|
||||
Totals: 7027 train / 6972 held cases, 392 train / 346 held dialogues. A file `<name>_b.py`, `_c.py` … is a later growth
|
||||
file with NEW scenes (new archetypes) in the same format; published files are never changed.
|
||||
|
||||
Generators (seeded, not in the repo): `logs/w3_gen/` on the Thor (`scenes.py` archetypes, `engine.py` scene wrapper
|
||||
and hard negatives, `caps1.py` – `caps3.py` hand-written cores, `spoken8.py` marker forms, `topics8.py` facts,
|
||||
`gen_cmd.py`, `gen_dlg.py`); `check_r8.py` checks imports, fields, markers on their maps, expect tokens, step
|
||||
notation, regexes, no rounds 1–6 train text, no case in both splits, and prints the unique-text share.
|
||||
- `_b` (23:30): 30 NEW archetypes (`logs/w3_gen/scenes_b.py`, 90 scenes): a Jeju grandmother (-줍서), a Chungcheong
|
||||
uncle (-유), a retired professor (하게체), a Manila K-drama fan (Taglish), a Russian engineer, Thai tourists, an
|
||||
Australian teacher, a British retiree, a kindergarten, e-sports teens, a hospital patient, a hotel concierge, a museum
|
||||
docent, a passenger late for a flight, a Samsung PM (Konglish), a shy first-timer, grandfather + grandson, a kid
|
||||
YouTuber, a rival vendor, a tour leader with a megaphone, a ROS dad, a parent on the phone, a bickering couple, a
|
||||
Mongolian student, a child typing into the Command box, a marathon runner, a Busan ramen chef, a dance crew, the
|
||||
owner's boss, a sign-language interpreter. Every set has a `_b` file: 5205 train / 5002 held cases (commands +
|
||||
questions_world), 258 train / 282 held dialogues.
|
||||
- `_c` (23:35): 26 more archetypes (`scenes_c.py`: quarrelling twins, a Gangnam mother mixing English, soldiers on
|
||||
leave (-다 / -까), a monk, a French designer, a German distributor, a robotics grad student, a taxi driver, a
|
||||
grandmother typing into the Command box, an English stage MC, a pharmacist, a high-school couple, Gyeongbuk farmers,
|
||||
an English travel vlogger, the night janitor, a robot competition team, a realtor (사장님), nursing students, Korean
|
||||
teens practising English, a charity volunteer, a philosophy professor, a barista on a break, a dad in baby talk,
|
||||
staff checking after a power cut, a Chinese tour guide, a whispering visitor far from the mic) and new ways of
|
||||
saying a plain core: self-corrections read to the last thing said (`<cap>:correct`, "왼쪽 봐— 아니 오른쪽 봐",
|
||||
"turn left, no wait, turn right": the expect of the second), overlap with other people's words in front
|
||||
(`:overlap`), indirect requests ("왼쪽 볼 수 있을까?", "…해 주시면 감사하겠습니다", "I was wondering if you could …":
|
||||
the same action), honorific shifts in one turn ("봐 줘, 아니 봐 주세요"), sarcasm ("퍽이나 … 수 있겠다", "yeah right,
|
||||
like you could …": `talk | ask`). 31 more talk topics (`topics_c.py`: Lumi can't dance / alive / where used / how it
|
||||
learns / e-stop / reply time / 12 DOF / head range / voice engine; Cutshion drawing, cooking, candy ball,
|
||||
palletizing, investment, US office, exhibitions; JAKA offices, products; cheetahs, Saturn, light, lightning,
|
||||
pyramids, the Eiffel Tower, Lotte World Tower, taekwondo, bats, dolphins, honey, hanbok, kimjang, giraffes).
|
||||
4168 train / 4061 held cases, 246 train / 222 held dialogues.
|
||||
- `_d` (23:37): 25 more archetypes (`scenes_d.py`: a hiking-club group of 아주머니, a startup founder, a blind visitor
|
||||
with a guide dog, a PE teacher with a whistle, a wedding planner, a quiz-show game, a Vietnamese mother long in
|
||||
Korea, a drone club ("roger, over"), a night-shift clerk, a boy with a toy robot, a Spanish tourist, a grandmother
|
||||
taking selfies, IT support after a network change, a live radio host, a yoga instructor, a baseball fan, an English
|
||||
speaker with a hearing aid, an event-rental company, an exhausted parent, a theatre actor, an English-speaking
|
||||
mall guard, a nursery teacher, a stern Gyeongnam grandfather, a Silicon Valley engineer switching every few words,
|
||||
a university festival crowd); plus rambling remarks before a request (`<cap>:ramble`), seeing turns about objects
|
||||
("빨간 컵 보여?" yes / "그럼 바나나는 있어?" no), and talks that start holding something: a wave / handshake is refused
|
||||
(`refuse | none`) and "왜?" must give the reason (it holds something). 3662 train / 3627 held cases, 216 train /
|
||||
234 held dialogues.
|
||||
- `_e` (23:40): 24 more archetypes (`scenes_e.py`: a press conference, a grandfather with mild memory loss, a
|
||||
Singaporean guest (Singlish), a police officer, a couple with a barking dog, an English Twitch streamer, a stressed
|
||||
exam student, a Korean BBQ owner (전라), a visiting American professor, a scout troop, a dog trainer, an AI researcher
|
||||
paraphrasing on purpose, a robot-vacuum owner, a KTX traveller, a bilingual child, an Osaka couple, a stage manager
|
||||
with a headset, a Taiwanese student (textbook Korean), old school friends, a safety inspector, a party-planning group,
|
||||
an English robot-movie kid, a mother-in-law and daughter-in-law, a Cutshion engineer testing at midnight); ~60 more
|
||||
hand-written cores (`caps_more.py`: 쳐다봐 / 바라봐, 방향 바꿔, 전진 / 후진, clockwise / counterclockwise, U-turn, advance /
|
||||
back off / sidestep, 손 좀 잡아 보자 = reach, 주먹 꽉 쥐어, 할머니 드려, 살포시 내려놔, 뒤에 바짝 붙어, 브레이크 / 얼음 = stop, …:
|
||||
intents ending in `2`) and 24 more topics (`topics_e.py`: Lumi's software, obstacles, gripper, charging on patrol,
|
||||
internet use, object recognition; Pionoid, the education kit, Cutshion's mission; JAKA's FAST / Mars work; koalas,
|
||||
sharks, butterflies, the blue sky, seasons, snowflakes, Gyeongbokgung, bibimbap, Mount Fuji, bones, the Moon landing,
|
||||
the Mona Lisa, vitamin C, Antarctica). 3543 train / 3424 held cases, 202 train / 230 held dialogues.
|
||||
- `_f` (23:45): 24 more archetypes (`scenes_f.py`: a Daegu aunt, an Incheon fisherman, a Cutshion intern on day one
|
||||
(over-polite), a Mexican family, a Canadian couple, Seoul teens (ㄹㅇ, 킹받네), a lawyer, a cosplayer in character, a
|
||||
teacher-parent, a Korean English teacher, a pro photographer, a veteran (다나까), two podcast hosts, a child with a
|
||||
cochlear implant, an award judge, a firefighter on duty, a TikTok creator, a Chungcheong village head, a medical-device
|
||||
rep (Konglish), a librarian whispering, a jet-lagged traveller, a robot-vs-human quiz, multicultural-centre children,
|
||||
a maintenance technician); missions with `say`, `turn 360`, `look`, `move`, `lift up`, `receive … place` steps;
|
||||
seeing turns about the top's pattern, jeans / skirt and what the person is doing (phone, drinking, waving,
|
||||
pointing); memory turns "do what we said" (`ask | none`, read back: the marker / wave in must), "where are you
|
||||
now?" and "battery?" from the self line (`status | none`). 3471 train / 3508 held cases, 223 train / 209 held
|
||||
dialogues.
|
||||
- 23:46 fix in place (all r8 files, before anyone scored them): three scene openers that read as a condition were
|
||||
replaced ("행사 대여하면" → "행사 때처럼", "청소기보다 똑똑하면" → "청소기보다 똑똑한지 보자,", "손님 오면" → "손님 왔다 치고,"),
|
||||
and "이렇게 말하면 돼," (a demonstration) dropped; the expects stay.
|
||||
- `_g` (23:47): 24 more archetypes (`scenes_g.py`: a Jeonju grandfather, a Seoul office worker in a hurry, an
|
||||
Indonesian worker, a K-pop trainee counting beats, guide-dog school staff, a French-Korean family, an e-sports caster,
|
||||
a vet, a chess player, a TV weather caster, a church group, a Perth backpacker, a pun-making uncle, a Hong Kong buyer,
|
||||
a robotics teacher (1단계, 2단계), a sleepy five-year-old, a hotel GM, a band drummer during sound check, a Chuncheon
|
||||
student, a Polish engineer, an English-speaking couple bickering, a ten-year-old coder, tourists in hanbok, staff
|
||||
closing the booth); closing kinds "bye, but <question>" (continue, answered), "you can go / 가 보세요" (end) and
|
||||
"thanks, bye / 고마워 잘 있어" (end); missions (`mission`) and songs (`sing`) said inside talks; questions_world with
|
||||
2–4 more hand-written wordings per Lumi / Cutshion / JAKA meaning. 3679 train / 3671 held cases, 212 train / 220
|
||||
held dialogues.
|
||||
- `_h` (23:48): 22 more archetypes, many who speak in numbers (`scenes_h.py`: a carpenter, a maths teacher, a golfer
|
||||
uncle, an English site surveyor, a parking attendant (오라이), a dance teacher counting turns, a baker, kids playing a
|
||||
number game, a corner where whisper writes numbers oddly, a retired sailor, a camera operator, a physiotherapist, a
|
||||
taxi dispatcher, the exhibition planner, a Korean-American grandson translating for his grandmother, a pilot
|
||||
trainee, a Busan street vendor, an international robotics team captain, a stuttering presenter, a drill
|
||||
instructor, a mother reading the family chat aloud, a tech reviewer) and more numbers in every form
|
||||
(`caps_num.py`: 5 / 15 / 40 / 60 / 80 cm, 1.2 m ("1미터 20", "백이십 센티", "a meter twenty"), 1.8 m, angles 10 / 25 / 75 / 100 /
|
||||
150° for the base and the head; intents ending in `_num`). 3355 train / 3363 held cases, 174 train / 222 held
|
||||
dialogues.
|
||||
|
||||
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.
|
||||
|
||||
+225
-20
@@ -6,8 +6,10 @@
|
||||
# case is the same (fast, after a rule change)
|
||||
.venv/bin/python tests/blind_check.py train --rules # no LLM: what the rules leave is "llm?"
|
||||
.venv/bin/python tests/blind_check.py train --limit 20 # the first 20 cases (dialogues) of each set
|
||||
.venv/bin/python tests/blind_check.py held --round r6 --sample 100 # 100 cases per file, seeded (the same each run)
|
||||
.venv/bin/python tests/blind_check.py held # held-out: only scored, never read to fix from
|
||||
.venv/bin/python tests/blind_check.py train --round r2 # round 2 (tests/blind/r2/train) -> blind_r2_train.*
|
||||
.venv/bin/python tests/blind_check.py train --rules --tag a3 # -> blind_train_a3.* (the shared files untouched)
|
||||
|
||||
-> logs/blind_<split>.md / .json (blind_r2_<split>.* with --round r2; a run of some sets keeps the others' saved
|
||||
rows). Verdicts per case (per scored turn in the dialogue sets): right; wrong; motion (a motion not asked for, the worst wrong); llm? (left to the LLM in
|
||||
@@ -54,11 +56,12 @@ from unittest import mock
|
||||
|
||||
import numpy as np
|
||||
|
||||
from assistant import brain, chain, detour, lumi, seeing, steps, voice_words
|
||||
from assistant import battery, brain, chain, detour, lumi, seeing, steps, voice_words
|
||||
from audio import ears, sing
|
||||
from tests import command_check, company_check, conversation_check, dialogue_check, song_check
|
||||
from tests.blind.maps import MAPS
|
||||
from vision import scene
|
||||
from robot import head as robot_head
|
||||
from vision import pointing, scene
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
DEFAULT_MARKERS = MAPS["office"] # cases that name no place
|
||||
@@ -69,7 +72,22 @@ SETS = ["commands_go", "commands_move", "commands_turn", "commands_look", "comma
|
||||
"commands_reach", "commands_give", "commands_take", "commands_put", "commands_bring", "commands_follow",
|
||||
"commands_stop", "commands_status", "commands_chain", "commands_detour", "speed_short", "commands_sing",
|
||||
"commands_missions", "seeing_dialogues", "followup_dialogues", "dialogues_mixed", "unknowns", "silence_noise",
|
||||
"hearing"] # commands_chain, commands_detour, speed_short, dialogues_mixed: round r2 only
|
||||
"hearing", "questions_world", "memory_dialogues", "commands_come", "commands_hand", "commands_point",
|
||||
"commands_voice", "commands_waist", "commands_more", "closing_context"]
|
||||
# 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)
|
||||
|
||||
|
||||
def base(name):
|
||||
"""The set a file's name belongs to: "commands_go_b" / "seeing_dialogues_2" -> "commands_go" / "seeing_dialogues"."""
|
||||
m = re.fullmatch(r"(.+?)_(?:[a-z]|\d+)", name)
|
||||
return m.group(1) if m and m.group(1) in SETS else name
|
||||
|
||||
|
||||
def ordered(names):
|
||||
"""Set names in SETS order, then the rest (growth files next to their set)."""
|
||||
return sorted(names, key=lambda n: (SETS.index(base(n)) if base(n) in SETS else len(SETS), n))
|
||||
|
||||
|
||||
def marks_of(c):
|
||||
@@ -125,7 +143,16 @@ def _person(p):
|
||||
return {"camera": "head", "box": [0, 0, 1, 1], "distance_m": p["dist_m"], "bearing_deg": b, "position_mm": None,
|
||||
"facing": True, "raised": raised, "pointing": None, "gesture": "hand_raised" if raised else None,
|
||||
"clothes": {"upper": p.get("top"), "lower": p.get("bottom"), "feet": None},
|
||||
"hands": {"left": hand("left"), "right": hand("right")}, "seen": 17, "where": scene.where(b)}
|
||||
"hands": {"left": hand("left"), "right": hand("right")}, "seen": 17, "where": scene.where(b),
|
||||
"posture": p.get("posture"), "_scene": p, # _scene: the r6 fields (hair, glasses ...) for the fake VLM
|
||||
"looks": seeing.scene_looks(_looks_fields(p))} # what seeing reads instead of asking the VLM (A6)
|
||||
|
||||
|
||||
def _looks_fields(p):
|
||||
"""The r6 person fields in the names seeing.scene_looks reads (hat / bag as "black cap", the pattern, the bottoms)."""
|
||||
said = lambda x: f"{x.get('colour') or ''} {x['kind']}".strip() if isinstance(x, dict) else x
|
||||
return dict(p, pattern=p.get("top_pattern"), bottom_type=p.get("bottom_kind"), hat=said(p.get("hat")),
|
||||
bag=said(p.get("bag")))
|
||||
|
||||
|
||||
def _persons(frames=None):
|
||||
@@ -137,7 +164,50 @@ 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.ask_vlm = lambda *a, **k: None # "what am I wearing?" asks the picture model: no picture here
|
||||
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|바지|청바지|치마|반바지"),
|
||||
("posture", r"sit|stand|crouch|squat|앉|서 ?있|쪼그"), ("action", r"doing|하고 있|뭐 해|뭐해")]
|
||||
|
||||
|
||||
def _vlm_said(p, field, lang):
|
||||
"""One fact of the r6 scene person as the picture model would say it, or None when the scene leaves it open."""
|
||||
ko = lang == "ko"
|
||||
v = p.get(field)
|
||||
if field == "glasses":
|
||||
return None if v is None else ("선글라스를 쓰고 있어요." if ko else "You are wearing sunglasses.") if v == "sunglasses" \
|
||||
else ("안경을 쓰고 있어요." if ko else "You are wearing glasses.") if v else \
|
||||
("안경은 안 쓰고 있어요." if ko else "You are not wearing glasses.")
|
||||
if field in ("hat", "bag"):
|
||||
if field not in p:
|
||||
return None
|
||||
if not v:
|
||||
return {"hat": ("모자는 안 쓰고 있어요.", "You are not wearing a hat."),
|
||||
"bag": ("가방은 없어요.", "You have no bag.")}[field][0 if ko else 1]
|
||||
return f"{v.get('colour') or ''} {v['kind']}을(를) {'쓰고' if field == 'hat' else '메고'} 있어요." if ko else \
|
||||
f"You have a {v.get('colour') or ''} {v['kind']}.".replace(" ", " ")
|
||||
if field == "hair":
|
||||
return None if not v else (f"머리는 {v.get('colour') or ''} {v.get('length') or ''}이에요." if ko else
|
||||
f"You have {v.get('length') or ''} {v.get('colour') or ''} hair.".replace(" ", " "))
|
||||
if v is None:
|
||||
return None
|
||||
return {"top_pattern": f"The top is {v}.", "bottom_kind": f"You are wearing {v}.", "posture": f"You are {v}.",
|
||||
"action": f"You are {v}."}[field]
|
||||
|
||||
|
||||
def _fake_vlm(question, lang="en", frames=None):
|
||||
"""vision.scene.ask_vlm on the r6 scenes: what the picture model would say of the person in front (the speaker A),
|
||||
from the scene's fields; the fields the question names, else all of them; None when nobody is in view."""
|
||||
ps = _persons()
|
||||
if not ps:
|
||||
return None
|
||||
p = ps[0].get("_scene") or {}
|
||||
fields = [f for f, rx in VLM_ASKED if re.search(rx, question or "", re.I)] or [f for f, _ in VLM_ASKED]
|
||||
said = [x for x in (_vlm_said(p, f, lang) for f in fields) if x]
|
||||
return " ".join(said) or None
|
||||
|
||||
|
||||
scene.ask_vlm = _fake_vlm # "am I wearing glasses?" asks the picture model: answered from the scene
|
||||
|
||||
|
||||
def fresh_seeing():
|
||||
@@ -271,6 +341,9 @@ def score_commands(c, old, use_llm):
|
||||
else:
|
||||
got = "llm?"
|
||||
STUCK["now"] = None
|
||||
if got != "stop" and pointing.asked(text) == "there":
|
||||
got = "point" # lumi.pointed_drive, right after a stop
|
||||
got = at_limit(got, c.get("at_limit"))
|
||||
if got == "llm?":
|
||||
v = "llm?"
|
||||
else:
|
||||
@@ -292,6 +365,27 @@ def score_commands(c, old, use_llm):
|
||||
+ (f", parts {c['parts']}" if c.get("parts") else "") + f") {first[:70]!r}", raw=raw, first=first)
|
||||
|
||||
|
||||
LIMIT_AT = {"head_left": (brain.HEAD_YAW[1], None, None), "head_right": (-brain.HEAD_YAW[1], None, None),
|
||||
"head_up": (None, brain.HEAD_PITCH[1], None), "head_down": (None, brain.HEAD_PITCH[0], None),
|
||||
"lift_top": (None, None, robot_head.LIFT_MAX_MM), "lift_bottom": (None, None, 0.0)}
|
||||
|
||||
|
||||
def at_limit(got, where):
|
||||
"""commands_more (r6) "at_limit": the head or the lift already at that end; lumi.look / lumi.lift then move
|
||||
nothing and say so (LIMIT_SAY): "limit"."""
|
||||
if not where or not re.match(r"action:(?:look|lift) ", got):
|
||||
return got
|
||||
yaw, pitch, mm = LIMIT_AT[where]
|
||||
a, target = got.removeprefix("action:").split(" ", 1)
|
||||
if a == "look":
|
||||
y0, p0 = 0.0 if yaw is None else yaw, robot_head.HEAD_REST_PITCH if pitch is None else pitch
|
||||
y1, p1, limited = brain.head_goal(target, y0, p0, lumi.LOOK)
|
||||
still = abs(y1 - y0) < 1 and abs(p1 - p0) < 1 # a number past the range, cut to where it is
|
||||
return "limit" if limited in ("left", "right", "up", "down") or limited and still else got
|
||||
limited = brain.lift_goal(target, 50.0 if mm is None else mm, robot_head.LIFT_MAX_MM)[1]
|
||||
return "limit" if limited in ("up", "down") else got
|
||||
|
||||
|
||||
def score_sing(c, old, use_llm):
|
||||
text, expect, before = c
|
||||
lang = "ko" if brain.HANGUL.search(text) else "en"
|
||||
@@ -320,6 +414,24 @@ def score_sing(c, old, use_llm):
|
||||
return row(KEYS["commands_sing"](c), v, by, f"{text!r} -> {got} (want {expect}) [{by}] {first[:70]!r}", raw=raw, first=first)
|
||||
|
||||
|
||||
def same_steps(want, got):
|
||||
"""The steps as written, or more exact where the notation has no word for it: a bare "place" read with the table
|
||||
said ("put it on the table"), a "receive ... wait" read as the receive (it waits for the hand-over anyway)."""
|
||||
if got == want:
|
||||
return True
|
||||
if not got or len(got) != len(want):
|
||||
return False
|
||||
for w, g in zip(want, got):
|
||||
w, g = dict(w), dict(g)
|
||||
if w.get("do") == "place" and w.get("on") is None:
|
||||
w.pop("on", None), g.pop("on", None)
|
||||
if w.get("do") == "receive":
|
||||
w.pop("wait_s", None), g.pop("wait_s", None)
|
||||
if w != g:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def score_missions(c, old, use_llm):
|
||||
text, case = c
|
||||
mk, want = marks_of(case), case["steps"]
|
||||
@@ -330,7 +442,7 @@ def score_missions(c, old, use_llm):
|
||||
refused = bool(steps.check(got, False, mk)) if got and not unread else True
|
||||
if want.strip() == "?":
|
||||
v = "right" if unread or refused else "motion"
|
||||
elif not unread and got == [short(s.strip()) for s in want.split(" | ")]:
|
||||
elif not unread and same_steps([short(s.strip()) for s in want.split(" | ")], got):
|
||||
v = "right"
|
||||
elif unread and not use_llm and by == "rules" and len(steps._split(steps._norm(steps._cut_says(text)[0], mk))) >= 2:
|
||||
v = "llm?" # the LLM pass would read it
|
||||
@@ -340,6 +452,9 @@ def score_missions(c, old, use_llm):
|
||||
got=json.loads(json.dumps(got)), unread=unread)
|
||||
|
||||
|
||||
FORGOT = set(__import__("assistant.memory", fromlist=["FORGOT"]).FORGOT.values())
|
||||
|
||||
|
||||
def score_dialogue(d, old, use_llm, judge=False):
|
||||
"""seeing_dialogues, followup_dialogues, dialogues_mixed: one Brain for the dialogue; setup turns put into the
|
||||
history as said; back-channels (scored False) answered, not judged; a turn's scene (if any) is what the cameras
|
||||
@@ -372,6 +487,8 @@ def score_dialogue(d, old, use_llm, judge=False):
|
||||
continue
|
||||
if r.startswith("action:give") or r.startswith("action:place"):
|
||||
state = "idle" # handed over / put down: the hand is empty now
|
||||
if r == "none" and reply in FORGOT:
|
||||
r = "forget" # memory_dialogues: the talks deleted and said so
|
||||
if not scored:
|
||||
rows.append(row(key, "-", by, "", route=r, reply=reply))
|
||||
continue
|
||||
@@ -420,6 +537,47 @@ def score_unknowns(c, old, use_llm):
|
||||
f"-> [{r}] {reply[:140]!r} {probs}", route=r, reply=reply)
|
||||
|
||||
|
||||
def score_questions(c, old, use_llm):
|
||||
"""questions_world (r6): the way lumi.answer() goes: abilities / battery (fixed_answer), lumi.route (weather, search,
|
||||
seeing, status ...), quick_answers, then the LLM. expect quick: answered without the LLM (the LLM's answer is wrong
|
||||
even when right: not at once); knowledge / unknown: must / must_not on whatever answered, a lookup is wrong;
|
||||
lookup:weather: the weather lookup; lookup:news / lookup:web: the web search."""
|
||||
from assistant import abilities, quick_answers
|
||||
text, mk = c["text"], DEFAULT_MARKERS
|
||||
lang = c["lang"] if c["lang"] in ("en", "ko") else "ko" if brain.HANGUL.search(text) else "en"
|
||||
brain.FORCED_LANG["lang"] = lang
|
||||
SCENE["now"] = None
|
||||
fresh_seeing()
|
||||
b, key = brain.Brain(), text
|
||||
got = abilities.answer(text, lang, "") or (("battery", battery.answer(text, lang)) if battery.asked(text) else None)
|
||||
if got:
|
||||
r, reply, by = "quick", got[1], "rules"
|
||||
elif old and old["by"] == "llm":
|
||||
r, reply, by = old["out"]["route"], old["out"]["reply"], "llm"
|
||||
else:
|
||||
r, reply, by = turn_route(b, text, lang, mk, "idle", use_llm=False)
|
||||
if r == "llm?":
|
||||
say = quick_answers.answer(text, lang, ())
|
||||
if say:
|
||||
r, reply, by = "quick", say, "rules"
|
||||
elif use_llm:
|
||||
r, reply, by = turn_route(b, text, lang, mk, "idle", use_llm=True)
|
||||
want = c["expect"]
|
||||
looked = r in ("weather", "search", "search(unsure)")
|
||||
if r == "llm?":
|
||||
v, probs = ("wrong", ["left to the LLM, not at once"]) if want == "quick" else ("llm?", [])
|
||||
elif want.startswith("lookup:"):
|
||||
ok = r == "weather" if want == "lookup:weather" else r in ("search", "search(unsure)")
|
||||
probs = [] if ok else [f"want {want}"]
|
||||
v = "right" if ok else "motion" if MOTION.match(r) else "wrong"
|
||||
else:
|
||||
probs = company_check.problems(c, lang, reply) if not looked else [f"looked up ({r})"]
|
||||
if want == "quick" and by == "llm":
|
||||
probs.append("by the LLM, not at once")
|
||||
v = "right" if not probs else "motion" if MOTION.match(r) else "wrong"
|
||||
return row(key, v, by, f"[{c['q']}, {want}] {text!r} -> [{r}] {reply[:140]!r} {probs}", route=r, reply=reply)
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def heard_as(text, speech_s):
|
||||
"""ears.transcribe on a stand-in: whisper wrote `text` (sure of it), the VAD found speech_s s of speech."""
|
||||
@@ -536,10 +694,13 @@ KEYS = {"commands": lambda c: f"{c['text']}|{c['state']}|{c['before']}",
|
||||
"commands_sing": lambda c: f"{c[0]}|{tuple(c[2]) if c[2] else None}",
|
||||
"commands_missions": lambda c: c[0],
|
||||
"unknowns": lambda c: f"{c['text']}|{c['ctx']}|{c['people_in_view']}",
|
||||
"silence_noise": lambda c: f"{c['heard']}|{json.dumps(c['ctx'], sort_keys=True)}"}
|
||||
"silence_noise": lambda c: f"{c['heard']}|{json.dumps(c['ctx'], sort_keys=True)}",
|
||||
"questions_world": lambda c: c["text"]}
|
||||
SCORERS = {"commands_sing": score_sing, "commands_missions": score_missions, "seeing_dialogues": score_dialogue,
|
||||
"followup_dialogues": lambda d, old, use_llm: score_dialogue(d, old, use_llm, judge=True),
|
||||
"dialogues_mixed": score_dialogue, "unknowns": score_unknowns, "silence_noise": score_silence}
|
||||
"dialogues_mixed": score_dialogue, "unknowns": score_unknowns, "silence_noise": score_silence,
|
||||
"questions_world": score_questions,
|
||||
"memory_dialogues": lambda d, old, use_llm: importlib.import_module("tests.memory_check").score_memory(d, old, use_llm)}
|
||||
|
||||
|
||||
def load(split, name):
|
||||
@@ -549,13 +710,18 @@ def load(split, name):
|
||||
return list(cases.items()) if isinstance(cases, dict) else cases
|
||||
|
||||
|
||||
def run_set(split, name, old_rows, use_llm, cached, limit):
|
||||
cases = load(split, name)[:limit]
|
||||
def run_set(split, name, old_rows, use_llm, cached, limit, sample=None):
|
||||
cases = load(split, name)
|
||||
if sample and len(cases) > sample: # the same N cases every run (seeded by the set's name)
|
||||
import random
|
||||
cases = random.Random(name).sample(cases, sample)
|
||||
cases = cases[:limit]
|
||||
old_rows = old_rows if cached else []
|
||||
name = base(name)
|
||||
if name == "hearing":
|
||||
return score_hearing(cases, old_rows, use_llm)
|
||||
fn = SCORERS.get(name, score_commands)
|
||||
dialogue = "dialogues" in name
|
||||
dialogue = "dialogues" in name or bool(cases) and isinstance(cases[0], dict) and "turns" in cases[0]
|
||||
fn = SCORERS.get(name, score_dialogue if dialogue else score_commands) # closing_context: a dialogue set
|
||||
if dialogue: # saved rows of each dialogue, in order
|
||||
old = collections.defaultdict(dict)
|
||||
for r in old_rows:
|
||||
@@ -576,6 +742,7 @@ def run_set(split, name, old_rows, use_llm, cached, limit):
|
||||
except Exception as e: # noqa: BLE001 - a crash fails that case
|
||||
rows.append(row(str(c)[:200], "error", "-", f"{str(c)[:150]} -> {e!r}"))
|
||||
for r in rows[n:]:
|
||||
r["lang"] = lang_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
|
||||
@@ -584,6 +751,39 @@ def run_set(split, name, old_rows, use_llm, cached, limit):
|
||||
KINDS = ["right", "wrong", "motion", "llm?", "error"]
|
||||
|
||||
|
||||
def lang_of(c, r):
|
||||
"""en / ko / mix of a case (its "lang"), of a dialogue turn (dialogue_check.turn_lang), or by its letters."""
|
||||
if isinstance(c, dict) and "turns" in c:
|
||||
j = int(r["key"].split("|", 1)[0]) - 1 if r["key"][:1].isdigit() else -1
|
||||
return dialogue_check.turn_lang(c["turns"][j]) if 0 <= j < len(c["turns"]) else c.get("lang", "?")
|
||||
case = c if isinstance(c, dict) else c[1] if len(c) > 1 and isinstance(c[1], dict) else {}
|
||||
text = case.get("text") or case.get("heard") or (c[0] if isinstance(c, (list, tuple)) else "")
|
||||
if case.get("lang"):
|
||||
return case["lang"]
|
||||
ko, en = bool(brain.HANGUL.search(text or "")), bool(re.search(r"[A-Za-z]{3,}", text or ""))
|
||||
return "mix" if ko and en else "ko" if ko else "en"
|
||||
|
||||
|
||||
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 "-"
|
||||
|
||||
|
||||
def by_lang(saved):
|
||||
"""Lines of a table: right / cases per language, per set and in all."""
|
||||
lines = ["", "By language (right / cases, motions in brackets):", "", "| set | en | ko | mix |", "|---|---|---|---|"]
|
||||
tot = collections.defaultdict(collections.Counter)
|
||||
for name in ordered(saved):
|
||||
c = collections.defaultdict(collections.Counter)
|
||||
for r in saved[name]["rows"]:
|
||||
if r["verdict"] != "-":
|
||||
for x in (c[r.get("lang", "?")], tot[r.get("lang", "?")]):
|
||||
x[r["verdict"]] += 1
|
||||
lines.append(f"| {name} | {cell(c['en'])} | {cell(c['ko'])} | {cell(c['mix'])} |")
|
||||
lines.append(f"| ALL | {cell(tot['en'])} | {cell(tot['ko'])} | {cell(tot['mix'])} |")
|
||||
return lines
|
||||
|
||||
|
||||
def report(split, saved, secs):
|
||||
lines = [f"# Blind sets, {split} ({time.strftime('%Y-%m-%d %H:%M')}, model {brain.MODEL}, this run {secs:.0f} s)", "",
|
||||
"right / wrong / motion (a motion not asked for: the worst) / llm? (left to the LLM, --rules run) / error. "
|
||||
@@ -591,7 +791,7 @@ def report(split, saved, secs):
|
||||
"| set | run | cases | right | % | wrong | motion | llm? | error | by LLM |",
|
||||
"|---|---|---|---|---|---|---|---|---|---|"]
|
||||
tot = collections.Counter()
|
||||
for name in [n for n in SETS if n in saved]:
|
||||
for name in ordered(saved):
|
||||
rows = [r for r in saved[name]["rows"] if r["verdict"] != "-"]
|
||||
c = collections.Counter(r["verdict"] for r in rows)
|
||||
tot.update(c)
|
||||
@@ -601,7 +801,8 @@ 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']} | |")
|
||||
for name in [n for n in SETS if n in saved]:
|
||||
lines += by_lang(saved)
|
||||
for name in ordered(saved):
|
||||
rows = saved[name]["rows"]
|
||||
dl = {}
|
||||
for r in rows:
|
||||
@@ -613,7 +814,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]))
|
||||
print("\n".join(lines[:len(saved) + 7] + by_lang(saved)))
|
||||
|
||||
|
||||
def main(args):
|
||||
@@ -623,11 +824,15 @@ def main(args):
|
||||
split = args[0]
|
||||
use_llm, cached = "--rules" not in args, "--cached" in args
|
||||
limit = int(args[args.index("--limit") + 1]) if "--limit" in args else None
|
||||
sample = int(args[args.index("--sample") + 1]) if "--sample" in args else None
|
||||
rnd = args[args.index("--round") + 1] if "--round" in args else ""
|
||||
names = [a for a in args[1:] if not a.startswith("-") and not a.isdigit() and a != rnd]
|
||||
own = args[args.index("--tag") + 1] if "--tag" in args else None
|
||||
names = [a for a in args[1:] if not a.startswith("-") and not a.isdigit() and a not in (rnd, own)]
|
||||
folder, tag = (f"{rnd}.{split}", f"{rnd}_{split}") if rnd else (split, split)
|
||||
todo = [n for n in SETS if (not names or any(n == a or n.startswith(a) for a in names)) and
|
||||
(ROOT / "tests" / "blind" / folder.replace(".", "/") / f"{n}.py").exists()]
|
||||
if "--tag" in args: # own report files (logs/blind_<tag>.*): a --rules run
|
||||
tag += "_" + args[args.index("--tag") + 1] # leaves the shared ones' LLM rows for --cached alone
|
||||
files = [f.stem for f in (ROOT / "tests" / "blind" / folder.replace(".", "/")).glob("*.py") if f.stem != "__init__"]
|
||||
todo = [n for n in ordered(files) if not names or any(n == a or n.startswith(a) or base(n) == a for a in names)]
|
||||
if not use_llm: # the mission reader's LLM pass only with the LLM
|
||||
steps._ollama = lambda *a: (_ for _ in ()).throw(command_check.NoLLM())
|
||||
from assistant import knowledge # the whole index read now (dialogue_check does so too)
|
||||
@@ -639,9 +844,9 @@ def main(args):
|
||||
for name in todo:
|
||||
t1 = time.time()
|
||||
print(f"{name} ...", flush=True)
|
||||
rows = run_set(folder, name, saved.get(name, {}).get("rows", []), use_llm, cached, limit)
|
||||
rows = run_set(folder, name, saved.get(name, {}).get("rows", []), use_llm, cached, limit, sample)
|
||||
saved[name] = {"when": time.strftime("%m-%d %H:%M") + (" rules" if not use_llm else "") +
|
||||
(f" first {limit}" if limit else ""), "rows": rows}
|
||||
(f" first {limit}" if limit else "") + (f" sample {sample}" if sample else ""), "rows": rows}
|
||||
c = collections.Counter(r["verdict"] for r in rows if r["verdict"] != "-")
|
||||
print(f"{name}: " + ", ".join(f"{k} {c[k]}" for k in KINDS if c[k]) + f" ({time.time() - t1:.0f} s)", flush=True)
|
||||
path.write_text(json.dumps(saved, ensure_ascii=False, indent=0))
|
||||
|
||||
@@ -35,7 +35,8 @@ def route(lang, ctx, said):
|
||||
first = next(gen, "")
|
||||
secs = time.time() - t
|
||||
reply = " ".join([first] + list(gen))
|
||||
if head["action"] == "end" and (fate != "close" or lumi.kept_goodbye(reply)): # as lumi.answer
|
||||
if head["action"] == "end" and (fate != "close" or lumi.kept_goodbye(reply)) or \
|
||||
head["action"] == "none" and fate == "close" and lumi.kept_goodbye(reply): # as lumi.answer
|
||||
return "end", secs, reply
|
||||
return ("wait" if fate == "close" else "on"), secs, reply
|
||||
|
||||
|
||||
@@ -114,8 +114,8 @@ def llm_route(action, target, words, text, about, lang, repeating=False):
|
||||
return action, "" # lumi.answer() closes the stream and looks it up
|
||||
if action == "unclear":
|
||||
return action, " ".join(words)
|
||||
if lumi.talk_fate(text) == "close" and (action == "none" or action == "end" and not lumi.kept_goodbye(" ".join(words))):
|
||||
return "chat", " ".join(words) # "thanks" taken as heard: silence ends the talk
|
||||
if lumi.talk_fate(text) == "close" and action in ("none", "end"): # "thanks": it ends when Lumi's words took leave,
|
||||
return ("action:end" if lumi.kept_goodbye(" ".join(words)) else "chat"), " ".join(words) # else silence ends it
|
||||
if action in ("none", "sing") and not repeating and lumi.look_up_unsure(about, words[0] if words else "", text):
|
||||
return "search(unsure)", " ".join(words)
|
||||
return ("none" if action == "none" else f"action:{action} {target}".strip()), " ".join(words)
|
||||
|
||||
@@ -111,6 +111,8 @@ def action_ok(expect, got):
|
||||
"""expect: 'none', 'search', 'go_to p3', 'end', ... alternatives split by ' | '."""
|
||||
for alt in expect.split(" | "):
|
||||
alt = alt.strip()
|
||||
if alt == got:
|
||||
return True # "forget", "point", "limit" ... as said
|
||||
if got == "none" and refused(alt):
|
||||
return True # the reason the fingers can't take it
|
||||
if alt == "none" and got in ("none", "chat", "status"):
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
"""Long talks (10-18 turns) on world topics with nested follow-ups on Lumi's own last answer ("why?", "when?", "and
|
||||
then?", "really?", "what do you mean?", "왜?", "진짜?", "그게 무슨 말이야?", "그럼 그건?"), thanks / okay in the middle
|
||||
that do not end the talk, and a real ending. English, Korean (반말 / 해요체 / 하십시오체, dialect) and mixed; Korean
|
||||
replies must be polite. Format of tests/dialogues.py. Run (no file of the checkers changed):
|
||||
|
||||
.venv/bin/python tests/dialogues_world.py [only] # through tests/followup_check.main -> logs/a4/world_check.*
|
||||
|
||||
Written by A4 (night 2) as its own cases, not a blind set: facts in "must" are settled general knowledge.
|
||||
"""
|
||||
import sys
|
||||
|
||||
from tests.dialogues import T, D, YES, KO
|
||||
|
||||
NOT_HEARD = r"didn't catch|did not catch|say (it|that) again|could you repeat|what do you mean\?|무슨 말씀이신지|다시 (한 ?번 )?말씀"
|
||||
OFFER = r"how can I help|무엇을 도와 ?드릴까|anything else I can"
|
||||
RUDE = r"(?<![가-힣])(?:했어|있어|없어|거야|이야|맞아|그래|몰라|알았어)[.!?]?$" # 반말 endings in a reply
|
||||
FU = "answers the follow-up about its own last answer, same topic, no 'say it again', no topic change"
|
||||
N = [NOT_HEARD, OFFER]
|
||||
NK = [NOT_HEARD, OFFER, RUDE]
|
||||
|
||||
DIALOGUES_WORLD = [
|
||||
D("student", "world_space", "en",
|
||||
T("Why is the sky blue?", must=[r"scatter|blue|light|wavelength"], no=N, check="explains light scattering"),
|
||||
T("Why does blue scatter more?", must=[r"short|wavelength|wave|small"], no=N, check="shorter wavelengths scatter more; " + FU),
|
||||
T("Then why are sunsets red?", must=[r"red|longer|more air|farther|through"], no=N, check="light travels through more air at sunset; " + FU),
|
||||
T("Oh I see.", no=N, check="a short acknowledgement, the talk goes on"),
|
||||
T("How far is the Moon?", must=[r"384|380|thousand"], no=N, check="about 384,000 km"),
|
||||
T("Really?", must=[r"384|380|yes"], no=N, check="confirms the same distance"),
|
||||
T("Does it change?", must=[r"orbit|oval|elliptic|varies|363|405|yes"], no=N, check="the orbit is an ellipse, the distance varies; " + FU),
|
||||
T("Why?", must=[r"orbit|oval|ellip|circle"], no=N, check="the orbit is not a perfect circle; " + FU),
|
||||
T("Thanks. And what's the biggest planet?", must=[r"Jupiter"], no=N, check="Jupiter; the thanks does not end the talk"),
|
||||
T("How big?", must=[r"eleven|11|thousand|1,?300|times"], no=N, check="about 11 times Earth's width; " + FU),
|
||||
T("What do you mean?", must=[r"wide|diameter|across|Earth|times|fit"], no=N, check="explains the comparison with Earth; " + FU),
|
||||
T("Cool, thanks, that's all!", "end")),
|
||||
D("office worker", "world_history_ko", "ko",
|
||||
T("세종대왕이 누구예요?", must=[r"조선|왕|한글"], no=NK, check="조선의 왕, 한글을 만든 분"),
|
||||
T("왜 한글을 만들었어?", must=[r"백성|어려|한자|쉽"], no=NK, check="한자가 어려워 백성이 쉽게 쓰도록; " + FU),
|
||||
T("진짜?", must=[r"네|맞|정말|백성|한자"], no=NK, check="같은 이유를 다시 확인"),
|
||||
T("언제?", must=[r"1443|1446|15세기|1400"], no=NK, check="1443년에 만들고 1446년에 반포; " + FU),
|
||||
T("그게 무슨 말이야?", must=[r"만들|반포|알리|발표|공포|3년"], no=NK, check="만든 해와 널리 알린 해의 차이를 설명; " + FU),
|
||||
T("아 그렇구나.", no=NK, check="짧게 받고 대화가 이어짐"),
|
||||
T("그럼 그 다음 왕은?", must=[r"문종"], no=NK, check="문종; " + FU),
|
||||
T("고마워요. 근데 한국전쟁은 언제였어요?", must=[r"1950|1953"], no=NK, check="1950–1953; 고마워요가 대화를 끝내지 않음"),
|
||||
T("끝난 거야?", must=[r"정전|휴전|평화|조약|공식"], no=NK, check="정전(휴전)으로 멈췄고 평화협정은 없음; " + FU),
|
||||
T("그게 무슨 뜻이에요?", must=[r"멈췄|멈춘|끝나지|조약|협정|공식"], no=NK, check="싸움은 멈췄지만 전쟁을 공식적으로 끝내는 조약은 없다는 뜻; " + FU),
|
||||
T("알겠습니다. 감사합니다, 이만 가 보겠습니다.", "end")),
|
||||
D("traveller", "world_places_mixed", "en",
|
||||
T("What's the capital of Australia?", must=[r"Canberra"], no=N, check="Canberra"),
|
||||
T("Not Sydney?", must=[r"Sydney|Canberra|no|compromise|Melbourne"], no=N, check="no, Sydney is the biggest city; Canberra was chosen as a compromise; " + FU),
|
||||
T("Why?", must=[r"Sydney|Melbourne|compromise|rival|between"], no=N, check="compromise between Sydney and Melbourne; " + FU),
|
||||
T("When did that happen?", must=[r"19\d\d|1908|1913|1927|early 20"], no=N, check="early 20th century (chosen 1908, parliament 1927); " + FU),
|
||||
T("And the capital of Japan?", must=[r"Tokyo|도쿄"], no=N, check="Tokyo"),
|
||||
T("언제부터요?", must=[r"1868|메이지|19세기|교토"], no=NK, rl="ko", check="1868년부터, 그 전엔 교토; " + FU),
|
||||
T("그 전에는?", must=[r"교토|Kyoto"], no=NK, rl="ko", check="교토; " + FU),
|
||||
T("Okay.", no=N, check="a short acknowledgement; no goodbye"),
|
||||
T("How high is Mount Everest?", must=[r"8,?8[48]\d|8848|8849"], no=N, check="8,849 m"),
|
||||
T("Is it still growing?", must=[r"yes|millimet|mm|India|plate|grow"], no=N, check="yes, a few mm a year, plates pushing; " + FU),
|
||||
T("How come?", must=[r"India|plate|push|collid|tecton"], no=N, check="the Indian plate pushes into Asia; " + FU),
|
||||
T("Thanks a lot, bye!", "end")),
|
||||
D("parent", "world_animals_ko_casual", "ko",
|
||||
T("고양이는 왜 그르렁거려?", must=[r"기분|편안|진정|좋을|아플"], no=NK, check="기분이 좋을 때, 또는 스스로 진정하려고"),
|
||||
T("아플 때도?", must=[r"네|진정|회복|아플|편하"], no=NK, check="네, 아프거나 무서울 때도 진정하려고; " + FU),
|
||||
T("왜?", must=[r"진정|회복|편|안정|진동|통증"], no=NK, check="스스로 안정하고 회복을 도울 수 있어서; " + FU),
|
||||
T("헐 대박", no=NK, check="짧고 자연스러운 반응"),
|
||||
T("치타는 얼마나 빨라?", must=[r"100|110|120|시속"], no=NK, check="시속 100km 넘게"),
|
||||
T("얼마나 오래?", must=[r"짧|몇백|수백|초|미터|잠깐"], no=NK, check="짧게만, 몇백 미터; " + FU),
|
||||
T("그럼 그 다음엔?", must=[r"쉬|숨|지쳐|휴식|체온|열"], no=NK, check="달린 뒤엔 쉬어야 함; " + FU),
|
||||
T("진짜?", must=[r"네|맞|정말|쉬|열|체온"], no=NK, check="같은 점을 다시 확인"),
|
||||
T("고마워", no=NK, check="짧게 천만에요; 대화를 끝내라는 말 아님"),
|
||||
T("판다는 뭐 먹어?", must=[r"대나무"], no=NK, check="대나무"),
|
||||
T("그것만?", must=[r"거의|대부분|대나무|가끔|조금"], no=NK, check="거의 대나무만; " + FU),
|
||||
T("알겠어, 이제 됐어. 잘 있어!", "end")),
|
||||
D("engineer", "world_tech", "en",
|
||||
T("What is a black hole?", must=[r"gravity|light|escape"], no=N, check="gravity so strong light can't escape"),
|
||||
T("Then how do we see them?", must=[r"gas|stars?|orbit|around|picture|image|shadow|2019"], no=N, check="by gas and stars around them, the 2019 picture; " + FU),
|
||||
T("When was that picture?", must=[r"2019"], no=N, check="2019; " + FU),
|
||||
T("Who took it?", must=[r"Event Horizon|telescope|EHT|astronomers"], no=N, check="the Event Horizon Telescope team; " + FU),
|
||||
T("fr?", must=[r"yes|really|2019|Event Horizon|telescope"], no=N, check="confirms the same fact"),
|
||||
T("Nice. What's the speed of light?", must=[r"300|299|thousand"], no=N, check="about 300,000 km/s"),
|
||||
T("Can anything go faster?", must=[r"no|nothing|not"], no=N, check="no, nothing with mass; " + FU),
|
||||
T("Why not?", must=[r"mass|energy|infinite|relativity|Einstein"], no=N, check="it would take infinite energy / relativity; " + FU),
|
||||
T("Says who?", must=[r"Einstein|relativity|experiment|physic"], no=N, check="Einstein's relativity, tested by experiments; " + FU),
|
||||
T("Okay, got it, thanks. One more: what is AI?", must=[r"learn|data|software|computer|intelligen"], no=N, check="what AI is; the thanks does not end the talk"),
|
||||
T("Like you?", must=[r"yes|I |my "], no=N, check="yes, it uses AI itself; " + FU),
|
||||
T("That's everything, thanks.", "end")),
|
||||
D("grandfather", "world_food_formal", "ko",
|
||||
T("김치는 왜 발효시킵니까?", must=[r"보관|겨울|오래|맛|유산균"], no=NK, check="겨울 동안 오래 보관하고 맛이 생겨서"),
|
||||
T("얼마나 오래 갑니까?", must=[r"몇 ?달|개월|오래|냉장"], no=NK, check="냉장고에서 몇 달; " + FU),
|
||||
T("그럼 그건 어떻게 됩니까?", must=[r"시|신맛|찌개|익"], no=NK, check="오래되면 시어지고 찌개에 좋음; " + FU),
|
||||
T("그렇군요.", no=NK, check="짧게 받음"),
|
||||
T("커피는 몸에 나쁩니까?", must=[r"적당|네 ?잔|4 ?잔|괜찮"], no=NK, check="적당히는 괜찮음, 하루 네 잔쯤"),
|
||||
T("왜 네 잔입니까?", must=[r"카페인|400"], no=NK, check="카페인 400mg 한도; " + FU),
|
||||
T("확실합니까?", must=[r"네|400|카페인|보건|권장"], no=NK, check="같은 근거로 확인"),
|
||||
T("감사합니다. 그런데 하루에 물은 얼마나 마셔야 합니까?", must=[r"1\.5|2 ?리터|두 ?리터|리터"], no=NK, check="1.5–2리터; 감사합니다가 대화를 끝내지 않음"),
|
||||
T("커피도 칩니까?", must=[r"네|대부분|수분|포함|쳐"], no=NK, check="대부분 수분으로 침; " + FU),
|
||||
T("잘 알겠습니다. 수고하세요.", "end")),
|
||||
D("teenager", "world_sports_slang", "en",
|
||||
T("how long is a marathon", must=[r"42"], no=N, check="42.195 km"),
|
||||
T("why such a weird number", must=[r"1908|London|Windsor|royal|Olympic"], no=N, check="the 1908 London course; " + FU),
|
||||
T("no way", must=[r"yes|really|true|1908|London"], no=N, check="confirms the same fact"),
|
||||
T("who has won the most world cups", must=[r"Brazil"], no=N, check="Brazil"),
|
||||
T("how many", must=[r"five|5"], no=N, check="five; " + FU),
|
||||
T("when was the last one", must=[r"2002"], no=N, check="2002; " + FU),
|
||||
T("against who", must=[r"Germany"], no=N, check="Germany; " + FU),
|
||||
T("lol ok", no=N, check="a short natural reply; no goodbye"),
|
||||
T("is taekwondo in the olympics", must=[r"yes|2000|Sydney"], no=N, check="yes, since 2000"),
|
||||
T("and before that?", must=[r"demonstrat|1988|1992|Seoul"], no=N, check="demonstration sport 1988 and 1992; " + FU),
|
||||
T("ok cool, gotta run, bye", "end")),
|
||||
D("student", "world_science_ko_mixed", "ko",
|
||||
T("바다는 왜 짜요?", must=[r"강|소금|광물|증발|바위"], no=NK, check="강이 소금기를 실어 오고 물만 증발"),
|
||||
T("그럼 강은 왜 안 짜?", must=[r"흘러|바뀌|쌓이|조금|흐르"], no=NK, check="강물은 계속 흘러 소금이 쌓이지 않음; " + FU),
|
||||
T("why 그래요?", must=[r"흘러|바다|쌓|증발|빠져|흐르"], no=NK, rl="ko", check="같은 이유를 이어서 설명; " + FU),
|
||||
T("오 신기하네요", no=NK, check="짧은 반응"),
|
||||
T("사람 뼈는 몇 개예요?", must=[r"206"], no=NK, check="206개"),
|
||||
T("아기는?", must=[r"300|270|더 많|많아"], no=NK, check="300개 가까이; " + FU),
|
||||
T("왜 줄어?", must=[r"붙|합쳐|자라"], no=NK, check="자라면서 뼈가 붙어서; " + FU),
|
||||
T("진짜요?", must=[r"네|정말|붙|맞"], no=NK, check="같은 점 확인"),
|
||||
T("단풍은 왜 들어요?", must=[r"엽록소|초록|색소|분해"], no=NK, check="엽록소가 분해되어 다른 색이 보임"),
|
||||
T("왜 분해돼요?", must=[r"짧|추워|겨울|낮|에너지"], no=NK, check="날이 짧고 추워지면 나무가 겨울 준비; " + FU),
|
||||
T("오케이 땡큐, 다음에 또 올게요!", "end")),
|
||||
D("visitor", "world_economy_dialect", "ko",
|
||||
T("인플레이션이 뭐꼬?", must=[r"물가|오르|돈"], no=NK, check="물가가 계속 올라 돈의 가치가 떨어지는 것"),
|
||||
T("와 생기노?", must=[r"수요|사려는|비용|에너지|돈|많아"], no=NK, check="수요가 많거나 비용이 오를 때; " + FU),
|
||||
T("그기 나쁜 기가?", must=[r"조금|적당|2 ?%|2퍼|높으면|저축|월급"], no=NK, check="조금은 정상, 높으면 저축과 월급에 나쁨; " + FU),
|
||||
T("부산 인구 얼마나 되노?", must=[r"330|340|만"], no=NK, check="약 330만"),
|
||||
T("와 그래 많노?", must=[r"두 ?번째|2번째|서울 다음|큰 도시|항구"], no=NK, check="서울 다음으로 큰 도시; " + FU),
|
||||
T("고맙데이. 근데 서울은?", must=[r"9\d\d ?만|천만|1,?000만|940|950"], no=NK, check="약 940만; 고맙데이가 끝이 아님"),
|
||||
T("많은 기가?", must=[r"네|많|다섯|5분의|5명|절반"], no=NK, check="네, 다섯 명 중 한 명쯤; " + FU),
|
||||
T("알겠다, 수고하이소.", "end")),
|
||||
D("researcher", "world_people_en", "en",
|
||||
T("Who was the first person on the Moon?", must=[r"Armstrong"], no=N, check="Neil Armstrong"),
|
||||
T("When?", must=[r"1969"], no=N, check="20 July 1969; " + FU),
|
||||
T("Who was with him?", must=[r"Aldrin|Collins"], no=N, check="Buzz Aldrin, Michael Collins in orbit; " + FU),
|
||||
T("And then?", must=[r"return|back|Earth|splash|Pacific|came home|walk|flag|samples"], no=N, check="what came next in that story; " + FU),
|
||||
T("Interesting.", no=N, check="short reply; talk goes on"),
|
||||
T("Who painted the Mona Lisa?", must=[r"Leonardo|da Vinci"], no=N, check="Leonardo da Vinci"),
|
||||
T("Where is it now?", must=[r"Louvre|Paris"], no=N, check="the Louvre; " + FU),
|
||||
T("Why is it so famous?", must=[r"smile|style|stolen|theft|1911|technique|mystery"], no=N, check="its style and smile, the 1911 theft; " + FU),
|
||||
T("Stolen?", must=[r"1911|stolen|theft|Peruggia|yes"], no=N, check="yes, stolen in 1911 and found two years later; " + FU),
|
||||
T("By whom?", must=[r"Peruggia|worker|Italian|handyman|employee"], no=N, check="Vincenzo Peruggia, a museum worker; " + FU),
|
||||
T("Thanks, I think I'm good.", "end")),
|
||||
]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from tests import followup_check as fc
|
||||
from tests import dialogue_check as dc
|
||||
fc.DIALOGUES = DIALOGUES_WORLD
|
||||
(dc.ROOT / "logs" / "a4").mkdir(exist_ok=True)
|
||||
dc.OUT_JSON, dc.OUT_MD = dc.ROOT / "logs" / "a4" / "world_check.json", dc.ROOT / "logs" / "a4" / "world_check.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)
|
||||
@@ -0,0 +1,75 @@
|
||||
"""The owner's arm and hand meanings (2026-10-23 night) through the voice / Command box route (command_check.rules =
|
||||
lumi.route without the LLM): every handshake = wave, "give me your hand" / 손 줘 = reach, "give me it" / 줘 while
|
||||
holding = give; the known faults of that day; negations, later times and remarks never move. No robot.
|
||||
|
||||
.venv/bin/python tests/test_arm_words.py
|
||||
"""
|
||||
from assistant import brain
|
||||
from tests import command_check
|
||||
|
||||
M = ["p1", "p2", "p3", "home", "dock2"]
|
||||
CASES = [ # (text, state, route)
|
||||
("shake hand", "idle", "action:wave"), ("shake hands", "idle", "action:wave"), ("let's shake hands", "idle", "action:wave"),
|
||||
("can you shake hand", "idle", "action:wave"), ("shake", "idle", "action:wave"), ("wave", "idle", "action:wave"),
|
||||
("wave your hand", "idle", "action:wave"), ("악수하자", "idle", "action:wave"), ("악수해요", "idle", "action:wave"),
|
||||
("악수 한번 해요", "idle", "action:wave"), ("빠빠이 해 줘", "idle", "action:wave"),
|
||||
("give me your hand", "idle", "action:arm reach"), ("give me a hand", "idle", "action:arm reach"),
|
||||
("손 줘", "idle", "action:arm reach"), ("손 내밀어", "idle", "action:arm reach"),
|
||||
("give me it", "holding", "give"), ("줘", "holding", "give"), ("이리 줘", "holding", "give"),
|
||||
("줘. 빨리.", "holding", "give"), ("들고 있는 거 나 주쇼", "holding", "give"), ("제가 가져갈게요", "holding", "give"),
|
||||
("이제 내려놔도 돼", "holding", "place"), ("루미야 이제 내려놔도 돼", "holding", "place"),
|
||||
("팔 접어, 아니 뻗어!", "idle", "action:arm reach"), ("reach out, no wait, fold it", "idle", "action:arm fold"),
|
||||
("손 내밀어, 아니 접어, 아니 그냥 내밀어", "idle", "action:arm reach"),
|
||||
("take this cup", "idle", "receive cup"), ("녹색 물병 집어 줘", "idle", "action:pick green bottle"),
|
||||
("원래 자리에 좀 갖다 놔 줘", "holding", "action:put back"),
|
||||
# no motion
|
||||
("don't shake hands", "idle", None), ("악수하지 마", "idle", None), ("팔 접지 말라니까", "idle", None),
|
||||
("빨간 사과 잡지 말라니까", "idle", None), ("작은 테이블에 놓지 말라니까", "holding", None),
|
||||
("자, 악수하자... 됐다 마", "idle", None), ("arm 뻗어 해 주라... 됐어, forget it", "idle", None),
|
||||
("쉬는 시간 끝나고 팔 쭉 뻗어", "idle", None), ("다음 주에 사과 좀 들어 줘", "idle", None),
|
||||
("아까는 팔 원래대로 돌리는 거 안 하더라", "idle", None), ("you better not pass it over", "holding", None),
|
||||
("watch, it's going to hand it to me", "holding", None), ("give me five!", "holding", None),
|
||||
("don't drop it in my hand", "holding", None), ("thanks, I'll take it from here", "idle", None),
|
||||
("김 대리 녹색 잔 좀 들어", "idle", None), ("wave 파마 어때?", "idle", None),
|
||||
("팔 혹시 집어넣어 줄 수 있어요, 아니 어이 손 좀 내밀어 줘라", "idle", "action:arm reach"),
|
||||
# 23:30-00:00
|
||||
("open your claw please", "holding", "refuse"), ("손을 펴 주십시오", "holding", "refuse"),
|
||||
("그리퍼 열어 줘", "holding", "refuse"), ("you think you could give it here?", "holding", "give"),
|
||||
("저 주면 안 돼?", "holding", "give"), ("루미야이리주세요", "holding", "give"), ("내 송에 올려 주라", "holding", "give"),
|
||||
("있던 곳에 도로 놔 줘", "holding", "action:put back"), ("robot, return the cup!", "holding", "action:put back"),
|
||||
("에구 손 도", "idle", "action:arm reach"), ("팔 피 주쇼", "idle", "action:arm reach"),
|
||||
("저한테 송 주십시오", "idle", "action:arm reach"), ("루미야 기본 pose 로 해 주세요", "idle", "action:arm fold"),
|
||||
("손 얼른 내려 줘", "idle", "action:arm fold"), ("look at me, no, just wave", "idle", "action:wave"),
|
||||
("take the cup, sorry I mean the white bottle", "idle", "action:pick white bottle"),
|
||||
("take the white cup, wait, the apple", "idle", "action:pick apple"),
|
||||
("테이블에 있는 오렌지 집으시오", "idle", "action:pick orange"), ("문 열어 줘", "idle", None), ("컵 들어 있어", "idle", None),
|
||||
# 00:00-00:15
|
||||
("있잖아 악수 한번 할까요?", "idle", "action:wave"), ("would it be possible to wave at me?", "idle", "action:wave"),
|
||||
("손 흔들어 주면 안 돼?", "idle", "action:wave"), ("do you know how to wave?", "idle", None), ("Jake, wave to the robot", "idle", None),
|
||||
("p2에서 green apple bring 해", "idle", "action:fetch"), ("손가락 한번 모아 봐", "idle", "action:arm close"),
|
||||
('"give it to me" is a nice English phrase', "holding", None), ("몸 5센티만 내려 주세요", "holding", "action:lift"),
|
||||
("테이블에 놔 줄래? 영상 찍고 있어", "holding", "place"), ("it's my birthday, put that back where you found it!", "holding", "action:put back"),
|
||||
("Lumi buddy, any chance you could pick up the apple?", "idle", "action:pick apple"),
|
||||
]
|
||||
MOVES = ("action:", "give", "place", "receive", "mission", "chain")
|
||||
|
||||
bad = []
|
||||
for text, state, want in CASES:
|
||||
try:
|
||||
got = command_check.rules(text, state, M, brain.Brain())
|
||||
except command_check.NoLLM:
|
||||
got = None
|
||||
got = got if got not in ("llm?",) else None
|
||||
if want is None:
|
||||
if got and got.startswith(MOVES):
|
||||
bad.append((text, state, got, "no motion"))
|
||||
elif not (got or "").startswith(want):
|
||||
bad.append((text, state, got, want))
|
||||
for text in ("again", "one more time please", "한 번 더", "또 해 줘"): # right after a wave: the wave again
|
||||
b = brain.Brain()
|
||||
b.history.append(("wave", "ACTION: wave -"))
|
||||
got = command_check.rules(text, "idle", M, b)
|
||||
if got != "action:wave":
|
||||
bad.append((text, "after a wave", got, "action:wave"))
|
||||
assert not bad, "\n".join(map(str, bad))
|
||||
print(f"arm words ok ({len(CASES)} cases)")
|
||||
+1
-1
@@ -46,7 +46,7 @@ print("chain plan ok")
|
||||
done, said = [], []
|
||||
fake = types.SimpleNamespace(
|
||||
chain_stop=threading.Event(), markers=M, modes=types.SimpleNamespace(patrol=True, drive=True),
|
||||
quick_command=lambda w: done.append(("quick", w)), answer=lambda w, part=False: done.append(("talk", w)),
|
||||
quick_command=lambda w, rule=None: done.append(("quick", w)), answer=lambda w, part=False: done.append(("talk", w)),
|
||||
fetch_say=lambda en, ko: said.append(en), chain_wait=lambda: None, base_off=lambda *a, **k: False,
|
||||
stay=lambda: None)
|
||||
fetch.check_hand = lambda: False
|
||||
|
||||
@@ -32,7 +32,7 @@ CASES = {
|
||||
# talk
|
||||
"I'll come back later": None, "come back tomorrow": None, "she will come back": None, "I'll be right back": None,
|
||||
"when will you come back?": None, "don't come back": None, "나중에 돌아올게": None, "내일 돌아와": None,
|
||||
"언니가 돌아와": None, "my friend will return soon": None, "return the cup": None,
|
||||
"언니가 돌아와": None, "my friend will return soon": None, "return the cup": ("put", "back"),
|
||||
# bare "go back" stays a short drive back (docs/17 reads it as unclear in a mission)
|
||||
"go back": ("move", "back 1"),
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ SENTENCES = [
|
||||
# talk, questions, refusals
|
||||
"what time is it?", "오늘 날씨 어때?", "hello", "what's your name?", "go to p12", "dance", "go to p5 and dance",
|
||||
"루미야 너 월급 받아?",
|
||||
# read by the intent bank or the chain's per-part reading (no keyword rule), answered out loud
|
||||
"왼쪽 쳐다봐", "오른쪽을 보십시오", "시선 좀 돌려 줘", "고개 숙이고 몸 좀 내려", "so glance to your right and then look up",
|
||||
"나 쳐다보고 follow me", "speak louder", "목소리 좀 줄여 줘", "더", "one more time", "what do you see?", "what are you doing?",
|
||||
]
|
||||
|
||||
# ---------- voice: Lumi.answer with every handler recorded, nothing moves, no LLM ----------
|
||||
@@ -49,8 +52,8 @@ def steps_of(rule): # what the mission runner
|
||||
}.get(a, lambda: None)()
|
||||
|
||||
|
||||
def quick(text):
|
||||
rule = brain.intent(text, M)
|
||||
def quick(text, rule=None):
|
||||
rule = rule or brain.intent(text, M)
|
||||
if not rule or rule[0] not in lumi.QUICK_RULES:
|
||||
return False
|
||||
if rule[0] == "fetch":
|
||||
@@ -114,9 +117,11 @@ def box(text):
|
||||
a = r["action"]
|
||||
if a == "steps":
|
||||
return ("steps", r["steps"])
|
||||
if a == "command" and r.get("talk"):
|
||||
return ("talk",) # answered out loud by the assistant, as by voice
|
||||
if a == "command":
|
||||
return ("chain", r["parts"]) if "parts" in r else ("stop",) if r["sentence"] == "Stop." else \
|
||||
("command", brain.intent(r["text"], M)[0])
|
||||
("command", r["rule"][0]) if "rule" in r else ("command", None)
|
||||
if a == "fetch":
|
||||
return ("fetch",)
|
||||
return ("talk",)
|
||||
|
||||
@@ -266,7 +266,7 @@ assert server.task_parse(server.ParseBody(text="go to p1, never mind"))["problem
|
||||
r = server.task_parse(server.ParseBody(text="let's go p1 point and go p8 point"))
|
||||
assert r["action"] == "steps" and r["steps"] == [{"do": "go", "to": "p1"}, {"do": "go", "to": "p8"}], r
|
||||
r = server.task_parse(server.ParseBody(text="go from p1 to p8 and dance"))
|
||||
assert r["action"] is None and r["task"] is None and r["read_by"] == "rules", r # no object named: never a fetch
|
||||
assert r["action"] != "fetch" and r.get("task") is None and r["read_by"] == "rules", r # no object named: never a fetch
|
||||
two = [{**cups[0], "x": -100.0, "y": 600.0, "width_mm": 80.0}, {**cups[0], "x": 120.0, "y": 650.0, "width_mm": 66.0}]
|
||||
find = lambda **t: fetch._find({"object": "cup", "colour": None, **t}, two)
|
||||
assert find() == two[0] and find(prefer="small") == two[1] and find(prefer="big") == two[0]
|
||||
|
||||
@@ -168,4 +168,39 @@ if __name__ == "__main__":
|
||||
assert b._after({"action": "none", "target": ""}, "Thanks, see you tomorrow!")["action"] == "none"
|
||||
b.history = [("다음 주 월요일 어때요?", "다음 주 월요일은 10월 26일이에요.")]
|
||||
assert b.weather_on("날씨 어때요?") == web.asked_day("다음 주 월요일")
|
||||
# thanks / okay in context: a goodbye ends at once, a closing word is read with the talk (LLM), more words go on
|
||||
for t in ("Okay, I gotta run. Thanks!", "catch you later", "그만 물어볼게요. 잘 있어요.", "잘 있어, 담에 봐",
|
||||
"I'll let you go now", "고마워요, 또 뵐게요", "Thanks, I'm heading out."):
|
||||
assert lumi.talk_fate(t) == "end", t
|
||||
for t in ("Okay thanks.", "Thanks!", "고마워요.", "됐어요.", "Nah, I'm good.", "I'm all set, thanks.", "아뇨, 없어요.",
|
||||
"That's plenty, thank you.", "이제 충분해요.", "오케이 땡큐"):
|
||||
assert lumi.talk_fate(t) == "close", t
|
||||
for t in ("Thanks. Wait, one more thing.", "Thanks! And where is p3?", "고마워요. 근데 몇 살이에요?", "Oh I see.",
|
||||
"아 그렇구나.", "I'm good, how are you?", "하나만 더 물어볼게요", "물 없어요?", "Okay cool, thanks. Can you turn around?"):
|
||||
assert lumi.talk_fate(t) == "talk", t
|
||||
assert lumi.kept_goodbye("You're welcome! Have a great night.") and not lumi.kept_goodbye("You're welcome!")
|
||||
# the model's motion only for a direct order now: never for a remark, a plan, a report or a condition
|
||||
for t in ("우리 회의실 들렀다가 p3 가자", "Don't look up.", "점심 먹고 나서 p3로 가", "Let's go to the cafe after this.",
|
||||
"아까 뒤로 가더라", "엄마가 오른쪽으로 가래", "I should turn around and leave.", "Turn left and you'll see the toilet.",
|
||||
"Look, it's moving!", "Go on, tell me more.", "Go to gate one? nah, stay here", "give me a sec", "내 말 따라 해",
|
||||
"나 이제 무대 쪽으로 가려고.", "If I wave, follow me.", "회의 끝나면 여기로 와"):
|
||||
assert not brain.llm_ordered(t), t
|
||||
for t in ("look up", "come here please", "follow me", "따라와", "give me your hand", "손 줘", "lift up 3 cm if you don't mind",
|
||||
"왼쪽으로 돌아", "wave at me", "p1로 가 줘"):
|
||||
assert brain.llm_ordered(t), t
|
||||
# "ACTION: none -" then "ACTION: sing -" (or a sentence first): the second line is the action, never said aloud
|
||||
from unittest import mock
|
||||
from assistant import llm_direct
|
||||
for out in ("ACTION: none -\nACTION: sing -\nOkay!", "Okay!\nACTION: sing -\nHere it comes."):
|
||||
with mock.patch.object(llm_direct, "stream", lambda m, *a, o=out, **k: (o[i:i + 3] for i in range(0, len(o), 3))):
|
||||
b = brain.Brain()
|
||||
b.history = [("Can you sing?", "ACTION: none -\nYes! Shall I sing one for you?")]
|
||||
got = list(b.respond_stream("Sure, go ahead.", ["home"], now="You are not doing any task."))
|
||||
assert got[0]["action"] == "sing" and not any("ACTION" in s for s in got[1:]), (out, got)
|
||||
# a short follow-up gets follow-up examples; a new question does not
|
||||
h = [("How fast are you?", "ACTION: none -\nNormally 0.6 metres a second.")]
|
||||
for t in ("why?", "왜요?", "and then?", "진짜?", "그게 무슨 말이야?", "그럼 그건?", "언제?", "Who was he?"):
|
||||
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
|
||||
print("followup ok")
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
"""Head / lift / base wordings and limits, without the robot (head.status / moveto faked, nothing moves).
|
||||
|
||||
.venv/bin/python tests/test_motion_words.py
|
||||
"""
|
||||
import types
|
||||
|
||||
from assistant import brain, lumi
|
||||
from robot import head
|
||||
|
||||
# ---------- at an axis end: said plainly, nothing moves (HANDOFF 16.2) ----------
|
||||
lo, hi = brain.HEAD_PITCH
|
||||
assert brain.head_goal("down", 0, lo)[2] == "down"
|
||||
assert brain.head_goal("down", 0, lo - 0.003)[2] == "down" # the pitch reads -5.003 at its stop
|
||||
assert brain.head_goal("down small", 0, lo)[2] == "down" # "more" after "look down"
|
||||
assert brain.head_goal("up small", 0, hi)[2] == "up"
|
||||
assert brain.head_goal("left small", brain.HEAD_YAW[1], 0)[2] == "left"
|
||||
assert brain.head_goal("right", -brain.HEAD_YAW[1], 0)[2] == "right"
|
||||
assert brain.head_goal("down", 0, lo + 2)[2] is None # the last two degrees still move
|
||||
assert brain.head_goal("center", 0, lo)[2] is None
|
||||
assert brain.head_goal("up 50", 0, 0)[2] == "pitch" # a number past the range: the range said
|
||||
assert brain.lift_goal("down", 0) == (0.0, "down")
|
||||
assert brain.lift_goal("down small", 0.4) == (0.0, "down")
|
||||
assert brain.lift_goal("up small", 105, 105) == (105, "up")
|
||||
assert brain.lift_goal("up 50", 80) == (105.0, True)
|
||||
assert brain.lift_goal("down small", 10) == (0.0, False)
|
||||
for k in ("left", "right", "up", "down", "lift_up", "lift_down", "lift", "yaw", "pitch"):
|
||||
en, ko = lumi.LIMIT_SAY[k]
|
||||
assert en and ko and "okay" not in en.lower()
|
||||
|
||||
# Lumi.look / Lumi.lift with a fake body: at the end nothing is sent and the LIMIT_SAY key comes back
|
||||
moved = []
|
||||
real = head.status, head.moveto
|
||||
fake = types.SimpleNamespace(looked_at=0)
|
||||
try:
|
||||
head.moveto = lambda *a, **k: moved.append(a)
|
||||
head.status = lambda: [0.0, 0.0, 0.0, lo]
|
||||
assert lumi.Lumi.look(fake, "down") == "down" and lumi.Lumi.look(fake, "down small") == "down"
|
||||
assert lumi.Lumi.lift(fake, "down") == "lift_down" and lumi.Lumi.lift(fake, "down small") == "lift_down"
|
||||
head.status = lambda: [head.LIFT_MAX_MM, 0.0, 0.0, hi]
|
||||
assert lumi.Lumi.look(fake, "up small") == "up" and lumi.Lumi.lift(fake, "up") == "lift_up"
|
||||
assert not moved, moved
|
||||
finally:
|
||||
head.status, head.moveto = real
|
||||
|
||||
# ---------- stop: a sentence that only says stop, also after calls and tags; not talk about stopping ----------
|
||||
from assistant import chain, driving
|
||||
OFFICE = ["p1", "p2", "p3", "home", "exit", "dock2"]
|
||||
for t in ("hi Lumi, stop, okay?", "enough already", "that's enough", "stahp", "루미야, 그만해 줄래?", "멈쳐", "고마 서라",
|
||||
"stay here", "거기 그대로 있어", "stop", "멈춰", "루미야 그만해", "Lumi, stop moving"):
|
||||
assert lumi.stop_order(t, OFFICE), t
|
||||
for t in ("stop-motion videos are fun", "I wish time would stop", "회사 그만뒀어", "민수야 그만해", "엄마 그만 찍어",
|
||||
"we should stop for coffee", "Jake, stop touching the robot!", "when people come, you stop",
|
||||
"yo why'd you freeze lol", "is there a bus stop near here?"):
|
||||
assert not lumi.stop_order(t, OFFICE), t
|
||||
|
||||
# ---------- chains: parts read by the bank / Korean -고 forms; no chain from talk about the past or a relative ----------
|
||||
def kinds(t, mk=OFFICE):
|
||||
p = chain.plan(t, mk, lumi.NOT_A_STEP)
|
||||
return [(k, w[0] if k == "quick" else None) for k, _, w in p] if p else None
|
||||
assert kinds("고개 숙이고 몸 좀 내려") == [("quick", "look"), ("quick", "lift")]
|
||||
assert kinds("나 쳐다보고 follow me") == [("quick", "look"), ("quick", "follow")]
|
||||
assert kinds("I want you to tell me how old you are, and wave hello") == [("talk", None), ("quick", "wave")]
|
||||
assert kinds("you go home and also what time is it") == [("quick", "go_to"), ("talk", None)]
|
||||
assert kinds("왼쪽으로 도시고 손 인사 해 주세요.") == [("quick", "turn"), ("quick", "wave")]
|
||||
for t in ("go ahead and turn right, okay?", "Hey, can you look over to the right, where the door is?",
|
||||
"so you got shorter, didn't you?", "You went to gate 1 earlier, right?", "go dock two you, yes?",
|
||||
"come here, I need help"):
|
||||
assert kinds(t) is None, t
|
||||
|
||||
# ---------- driving: a bare way right after a look, "again" forms after a move / turn ----------
|
||||
look, turn, move = ("look", "right small"), ("turn", "right 90"), ("move", "forward 1", True)
|
||||
assert driving.read(brain._norm("왼쪽"), look) == ("look", "left")
|
||||
assert driving.read(brain._norm("Down a little."), look) == ("look", "down small")
|
||||
assert driving.read(brain._norm("왼쪽"), None) is None # no look before: not a head move
|
||||
for t in ("다시", "한 번만 더.", "또 해!", "루미, 한번 더!"):
|
||||
assert driving.read(brain._norm(t), turn) == turn, t
|
||||
assert driving.read(brain._norm("again again!"), move) == move
|
||||
assert driving.talking([("sing", "ACTION: sing x")]) and not driving.talking([("t", "ACTION: turn left 90")])
|
||||
|
||||
# ---------- places said other ways (place_words) ----------
|
||||
EXPO = ["home", "dock2", "booth_A", "booth_B", "booth_3", "entrance", "stage", "coffee_corner", "info_desk"]
|
||||
CONF = ["home", "dock2", "Main_Stage", "Booth_12", "Registration", "포토존", "라운지", "Coffee_Bar", "Exit_B"]
|
||||
KOREAN = ["home", "커피코너", "부스3", "입구", "무대", "안내데스크", "휴게실", "회의실"]
|
||||
for t, mk, want in (("Go to booth bee.", EXPO, "booth_B"), ("에이 부스로 가 줘", EXPO, "booth_A"),
|
||||
("인포 대스크로 가 줘", EXPO, "info_desk"), ("레지스트레이션으로 가 줘", CONF, "Registration"),
|
||||
("부스 십이로 가 줘", CONF, "Booth_12"), ("출구 B로 가 봐", CONF, "Exit_B"),
|
||||
("삼 번 부스로 가", KOREAN, "부스3"), ("go to the information desk", KOREAN, "안내데스크"),
|
||||
("roll over to the coffee corner", KOREAN, "커피코너"), ("Would you mind heading to dock 2?", EXPO, "dock2")):
|
||||
assert [m for m in mk if brain.named_place(t, m, mk)] == [want], (t, want)
|
||||
assert not [m for m in EXPO if brain.named_place("go to the booth", m, EXPO)] # which booth: asked
|
||||
assert brain.intent("go to the stage... wait, not the stage, the entrance", KOREAN) is None
|
||||
|
||||
# ---------- "go where I point" in many wordings (vision/pointing.asked); not a place, a negation, later ----------
|
||||
from vision import pointing
|
||||
for t in ("저기로 가", "저쪽으로 가 주십시오", "내 손가락 방향으로 가 줘", "루미야 저기 저쪽으로 가 줘 봐", "go there 해 줘",
|
||||
"could you go to where my finger points?", "hmm, how about you drive to where I'm pointing?",
|
||||
"please go stand over there", "저기 가서 서 있어 줄래? 응?", "robot, go over there, will ya?"):
|
||||
assert pointing.asked(t) == "there", t
|
||||
for t in ("저쪽으로 가지 마", "don't go to where my finger points", "go there tomorrow", "오 분 있다가 저리로 가",
|
||||
"p3로 가", "go to the stage", "저기 가면 화장실 있어요"):
|
||||
assert pointing.asked(t) != "there", t
|
||||
assert brain.intent("hey, please you move over there", OFFICE) is None # not the 1 m back-off
|
||||
|
||||
print("motion words ok")
|
||||
@@ -20,6 +20,11 @@ KIND = { # words (no talk before) -> kind
|
||||
"are you a robot?": "robot", "감정 있어요?": "robot",
|
||||
"hello": "hello", "안녕하세요": "hello", "hi lumi": "hello",
|
||||
"how much do you weigh?": "weight", "how fast can you go?": "speed",
|
||||
"what time is it?": "time_now", "지금 몇 시야?": "time_now", "오늘 며칠이에요?": "date_today",
|
||||
"what day is it today?": "date_today", "오늘 무슨 요일이야?": "date_today",
|
||||
"are you a Korean robot?": "country", "어느 나라 로봇이에요?": "country", "what computer do you use?": "computer",
|
||||
"관절이 몇 개예요?": "dof", "음성 인식 뭐 써요?": "stt", "how fast do you answer?": "reply_time",
|
||||
"where are you used?": "used_where", "인터넷 써요?": "internet",
|
||||
}
|
||||
IN_TALK = { # words after TALK -> kind or None
|
||||
"how old are you?": "age", "who made you?": "maker", "what's your name?": "name",
|
||||
@@ -32,10 +37,13 @@ NEVER = [ # no talk before: never a quick answer
|
||||
"come here", "follow me", "wave at me", "sing a song", "이리 와", "손 흔들어 줘", "노래 불러 줘",
|
||||
"how many employees does Cutshion have?", "직원이 몇 명이에요?", "how much do you cost?", "가격이 얼마예요?",
|
||||
"how long does charging take?", "충전 얼마나 걸려요?", "how old is Cutshion?", "who is the CEO?", "대표가 누구예요?",
|
||||
"what's the weather?", "what time is it?", "thanks", "고마워요", "okay", "bye",
|
||||
"what's the weather?", "what time does the show start?", "몇 시에 끝나요?", "thanks", "고마워요", "okay", "bye",
|
||||
"goodbye", "May I ask you something?",
|
||||
"what's your name and how old are you?", "who made you? and why?", "how much can you lift?",
|
||||
"what can you do?", "how much battery is left?", "who made your arm?", "너 얼마야?", "얼마나 무거운 거 들 수 있어?",
|
||||
"로봇 미국 회사 맞아요?",
|
||||
"when is your birthday?", "생일이 언제예요?", "완충까지 몇 시간이에요?", "how slow can you drive?", "what are you doing?",
|
||||
"너 자카 로봇이야?", "can you hear me?", "키 줄여 줘", "Price of the ice cream robot?",
|
||||
]
|
||||
FACT = {"chatgpt": r"\bno\b|아니", "name": r"lumi|루미", "who": r"lumi|루미", "age": r"\b2\b|two|두 살", "maker": r"cutshion|쿳션",
|
||||
"height": r"146", "battery_life": r"10", "languages": r"english|영어", "model": r"gemma|젬마",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""The live sequence of 2026-10-23 15:21-15:23, replayed with fakes: "give me a hand" / handshake words with an empty
|
||||
hand are arm reach (the rules, not the LLM's "I can't shake hands"), and a reach whose body move hangs ends at once on
|
||||
"""The live sequence of 2026-10-23 15:21-15:23, replayed with fakes: "give me a hand" / "손 줘" with an empty hand
|
||||
are arm reach (handshake words are a wave) (the rules, not the LLM's "I can't shake hands"), and a reach whose body move hangs ends at once on
|
||||
STOP, so the next "give me your hand" starts instead of "I'm busy with another task". And 2026-10-23 17:40-17:43:
|
||||
"close your hand" on nothing is not holding (the camera saw the person's hand by the held-out arm), "there is nothing
|
||||
in your hand" checks the hand again, and "okay, thank you" / a timeout folds the held-out arm. No robot.
|
||||
@@ -16,13 +16,16 @@ from tasks import fetch
|
||||
|
||||
MARKERS = ["home", "p1"]
|
||||
REACH = ["Let's give me a hand.", "Let's give me your hand.", "Give me your hand.", "give me a hand", "손 줘",
|
||||
"손 내밀어", "루미야 손 줘", "Lumi, 손 줘", "hand 줘", "손 좀 줘", "shake hands with me", "let's shake hands",
|
||||
"shake my hand", "give me a handshake", "악수하자", "악수해 줘", "나랑 악수할래?"]
|
||||
"손 내밀어", "루미야 손 줘", "Lumi, 손 줘", "hand 줘", "손 좀 줘"]
|
||||
WAVE = ["shake hands with me", "let's shake hands", "shake my hand", "shake hand", "can you shake hand", "shake",
|
||||
"give me a handshake", "악수하자", "악수해 줘", "악수해요", "악수 한번 해요", "나랑 악수할래?"] # owner 2026-10-23: a wave
|
||||
NOT_REACH = ["give me a hand with this", "can you lend me a hand?", "give me a hand to lift this", "I shook hands with him",
|
||||
"don't shake hands", "악수하지 마", "어제 악수했어", "the handshake was nice", "give me a break"]
|
||||
|
||||
bad = [(t, brain.intent(t, MARKERS)) for t in REACH if brain.intent(t, MARKERS) != ("arm", "reach")]
|
||||
bad += [(t, brain.intent(t, MARKERS)) for t in NOT_REACH if brain.intent(t, MARKERS) == ("arm", "reach")]
|
||||
bad += [(t, brain.intent(t, MARKERS)) for t in WAVE if brain.intent(t, MARKERS) != ("wave", "")]
|
||||
bad += [(t, brain.intent(t, MARKERS)) for t in NOT_REACH if brain.intent(t, MARKERS) == ("wave", "")]
|
||||
bad += [(t, "held rule") for t in REACH if brain.hand_request(t, False, None, MARKERS)] # empty hand: never a give
|
||||
assert not bad, bad
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ L.skill_busy = lambda: False
|
||||
FAKED = ("start_trip", "move_by", "come_to", "follow_me", "fetch_request", "object_task", "arm_pose", "lift", "look",
|
||||
"come_back", "receive_from_hand")
|
||||
for name in FAKED:
|
||||
setattr(L, name, lambda *a, _n=name, **k: moved.append(_n) or _n != "look") # look: True would be "past range"
|
||||
setattr(L, name, lambda *a, _n=name, **k: moved.append(_n) or _n not in ("look", "lift")) # look / lift: a LIMIT_SAY key
|
||||
L.wave = lambda *a, **k: None # quick_command starts it in a thread
|
||||
|
||||
BASE = {"go to p3": "go_to", "p3로 가": "go_to", "follow me": "follow", "따라와": "follow", "come here": "come",
|
||||
|
||||
Reference in New Issue
Block a user