From 38546b0ca3e8f018da031efdfa451308144ddcb3 Mon Sep 17 00:00:00 2001 From: Cutshion Date: Mon, 26 Oct 2026 05:43:03 +0900 Subject: [PATCH] Improve command understanding with bigger wording banks; tested Co-Authored-By: Claude Opus 5.5 --- api/server.py | 25 +- assistant/action_examples.py | 54 +++ assistant/bank_words/__init__.py | 46 +++ assistant/bank_words/arm.py | 306 ++++++++++++++++ assistant/bank_words/korean.py | 116 ++++++ assistant/bank_words/motion.py | 364 ++++++++++++++++++ assistant/bank_words/questions.py | 451 +++++++++++++++++++++++ assistant/brain.py | 587 ++++++++++++++++++++++++------ assistant/chain.py | 52 ++- assistant/driving.py | 73 +++- assistant/intent_bank.py | 136 ++++--- assistant/interrupt_examples.py | 9 + assistant/lumi.py | 188 ++++++++-- assistant/place_words.py | 95 +++++ assistant/quick_answers.py | 128 +++++-- assistant/steps.py | 3 +- assistant/talk_examples.py | 520 ++++++++++++++++++++++++++ assistant/voice_words.py | 28 ++ tests/bank_check.py | 11 + tests/blind/README.md | 202 ++++++++++ tests/blind_check.py | 245 ++++++++++++- tests/closing_check.py | 3 +- tests/conversation_check.py | 4 +- tests/dialogue_check.py | 2 + tests/dialogues_world.py | 152 ++++++++ tests/test_arm_words.py | 75 ++++ tests/test_chain.py | 2 +- tests/test_come_back.py | 2 +- tests/test_command_box.py | 11 +- tests/test_fetch_place.py | 2 +- tests/test_followup.py | 35 ++ tests/test_motion_words.py | 104 ++++++ tests/test_quick_answers.py | 10 +- tests/test_reach_live.py | 11 +- tests/test_switches.py | 2 +- vision/pointing.py | 37 ++ 36 files changed, 3820 insertions(+), 271 deletions(-) create mode 100644 assistant/bank_words/__init__.py create mode 100644 assistant/bank_words/arm.py create mode 100644 assistant/bank_words/korean.py create mode 100644 assistant/bank_words/motion.py create mode 100644 assistant/bank_words/questions.py create mode 100644 assistant/place_words.py create mode 100644 tests/dialogues_world.py create mode 100644 tests/test_arm_words.py create mode 100644 tests/test_motion_words.py diff --git a/api/server.py b/api/server.py index 4317e6d..8f42b2e 100644 --- a/api/server.py +++ b/api/server.py @@ -1007,6 +1007,12 @@ def _talk(sentence, problems=(), kind="talk"): return {"action": None, "task": None, "talk": kind, "sentence": sentence, "problems": list(problems), "read_by": "rules"} +def _answer(text, sentence, kind="talk", read_by="rules"): + """What voice answers out loud (a question, seeing, the status, a song, a voice setting, "more" / "again" with + the assistant's own last command): Start hands the words to the assistant, as if heard (/tasks/command).""" + return {"action": "command", "text": text, "talk": kind, "sentence": sentence, "problems": [], "read_by": read_by} + + def _rule_steps(rule): """A keyword command that the mission runner does the same way as voice: its steps, else None (look, lift, wave, come, follow, quiet need the assistant: /tasks/command).""" @@ -1035,7 +1041,7 @@ def _said(kind, words, what): a, t = what return {"look": f"look {t}", "lift": f"lift {t}", "wave": "wave", "come": "come to you", "come_back": "go back", "follow": "follow you", "go_to": f"go to {brain.place_said(t)}", "arm": f"arm {t}", - "quiet": "be quiet"}.get(a, f"{a} {t}".strip()) + "quiet": "be quiet", "waist": f"turn my waist {t}"}.get(a, f"{a} {t}".strip()) @app.post("/tasks/parse", tags=["tasks"], summary="A typed command (English or Korean) read exactly as by voice " @@ -1052,11 +1058,19 @@ def task_parse(body: ParseBody): return _held_parse(body, markers) if held else _talk("–") if lumi.FOREIGN_SCRIPT.search(text): return _talk("–", ["Please write the command in English or Korean."]) + from assistant import voice_words + voice = voice_words.read(text, "") # Lumi.voice_setting comes first, as by voice + if voice: + return _answer(text, {("volume", 1): "Speak louder.", ("volume", -1): "Speak quieter.", + ("speed", 1): "Speak faster.", ("speed", -1): "Speak slower."}.get(voice, "Voice setting."), + "voice") fixed = brain.self_correct(text, markers) # "go to start, no, end": as by voice (lumi.answer) if not fixed: return _talk("–", ["Which one did you mean? Please write it again." if fixed is None else "Taken back: nothing to do."]) body = body.model_copy(update={"text": fixed}) drive = driving.read(brain._norm(fixed), None, False) # lumi.drive_words: speed, a distance asked or refused + if drive == ("ask", ""): # "more", "again", "한 번 더": the assistant's last command + return _answer(fixed, "Again.", "again") if drive and drive[0] in ("refuse", "ask"): d, _, n = drive[1].partition(" ") return _talk(driving.say_refused(d, float(n), "en") if drive[0] == "refuse" else driving.say_ask(drive[1], "en")) @@ -1102,7 +1116,7 @@ def task_parse(body: ParseBody): if kind == "quick" and data[0] == "put": return _held_parse(body, markers) if held else _talk("–", ["My hand is empty, I'm not holding anything."]) if kind == "quick" and data[0] in ("weather", "search"): - return _talk("–", kind="lookup") + return _answer(fixed, "Look it up and answer.", "lookup") if kind == "quick": if held and data[0] == "go_to": return _held_parse(body, markers) # holding: a carry there @@ -1111,7 +1125,7 @@ def task_parse(body: ParseBody): return {"action": "steps", "steps": got, "lang": lang, "sender": None, "read_by": "rules", **_steps_said(got, markers)} return {"action": "command", "text": fixed, "sentence": _said("quick", fixed, data).capitalize() + ".", - "problems": [], "read_by": "rules", "base": data[0] in lumi.BASE_ACTIONS} + "problems": [], "read_by": "rules", "base": data[0] in lumi.BASE_ACTIONS, "rule": list(data)} problem = brain.place_problem(fixed, markers) if problem: # quick_command says it: "I don't have a place called p12" return _talk(problem[0], kind="refuse") @@ -1132,8 +1146,9 @@ def task_parse(body: ParseBody): if rule[0] in ("look", "lift", "wave", "come", "follow", "come_back", "quiet"): return {"action": "command", "text": fixed, "sentence": first or "–", "problems": [], "read_by": "llm", "base": rule[0] in lumi.BASE_ACTIONS} - return {**_talk(first or "–"), "read_by": "llm"} - return _talk("–", kind=kind or "talk") + return _answer(fixed, first or "Answer.", "talk", "llm") + return _answer(fixed, {"seeing": "Say what I see.", "status": "Say what I'm doing.", "end": "Say goodbye.", + "sing": "Sing.", "correction": "Correct the last command."}.get(kind, "Answer."), kind or "talk") def _fetch_parse(body, markers): diff --git a/assistant/action_examples.py b/assistant/action_examples.py index fcc15a2..689a521 100644 --- a/assistant/action_examples.py +++ b/assistant/action_examples.py @@ -50,6 +50,16 @@ _BANK = { ("Okay, now wave at me.", "wave", "Sure, here's a wave!"), ("Follow me, I'll show you the booth.", "follow", "Okay, I'll follow you."), ("Raise yourself up a bit.", "lift up small", "Okay, going up a little."), + ("Let's go to the cafe after this.", "none", "Sounds good, enjoy the coffee!"), + ("I should turn around and go back to my booth.", "none", "Okay, good luck at your booth."), + ("Turn left and you'll see the restrooms.", "none", "Thanks, good to know."), + ("Look, it's moving its head!", "none", "Yes, I can turn my head."), + ("Go on, tell me more.", "none", "Sure, what would you like to know more about?"), + ("Go to p2, never mind, stay here.", "none", "Okay, I'll stay here."), + ("Give me a second to think.", "none", "Take your time."), + ("I'm going to look up the address later.", "none", "Good idea."), + ("After lunch, come to the stage.", "none", "Okay, tell me after lunch and I'll come."), + ("Once the show starts, wave at everyone.", "none", "Sure, tell me when it starts."), ], "ko": [ ("왼쪽으로 돌아.", "turn left 90", "네, 왼쪽으로 돌게요."), @@ -77,6 +87,50 @@ _BANK = { ("이리 와 주세요.", "come", "네, 갈게요."), ("나 따라와.", "follow", "네, 따라갈게요."), ("손 흔들어 주실래요?", "wave", "네, 손 흔들게요!"), + ("점심 먹고 나서 p3로 가.", "none", "네, 점심 드시고 말씀해 주세요."), + ("우리 회의실 들렀다가 무대 가자.", "none", "좋아요, 재미있게 구경하세요."), + ("엄마가 오른쪽으로 가래.", "none", "그럼 오른쪽으로 가시면 되겠네요."), + ("저 로봇은 아까 앞으로 가던데.", "none", "다른 로봇도 바쁜가 봐요."), + ("나 내 말 따라 해 봐.", "none", "네, 말씀해 주시면 따라 말해 볼게요."), + ("회의 끝나고 나서 홈으로 가.", "none", "네, 회의 끝나면 말씀해 주세요."), + ("쇼 시작하면 손 흔들어 주세요.", "none", "네, 시작할 때 말씀해 주세요."), + ("p1로 가, 아니 됐어, 그냥 있어.", "none", "네, 여기 있을게요."), + ("잠깐만 시간 좀 줘.", "none", "네, 천천히 하세요."), + ("돌아서 가면 화장실이 있다고 하더라고요.", "none", "그렇군요, 가 보세요."), + ], + }, + "closing": { # thanks / okay / that's it: the end only when the visitor is done; a question or a task goes on + "en": [ + ("Thanks, that's all I needed.", "end", "Glad I could help. Enjoy your visit!"), + ("Okay, thank you, I'll be going now.", "end", "Take care, see you around!"), + ("Thanks! And where can I charge my phone?", "none", "I'm not sure about that here; a staff member can tell you."), + ("Thanks. So how heavy are you?", "none", "About 96 kg in all."), + ("Okay thanks, now turn left.", "turn left 90", "Okay, turning left."), + ("Thanks, one more question.", "none", "Sure, go ahead."), + ("Thank you so much for the cup!", "none", "You're welcome, enjoy it."), + ("Thanks for bringing it.", "none", "My pleasure."), + ("Okay, got it.", "none", "Great."), + ("Okay.", "none", "Alright."), + ("Nah, I'm good. Thanks!", "end", "Okay, have a nice day!"), + ("That's everything, thanks Lumi.", "end", "You're welcome. Bye for now!"), + ("Thanks, that was interesting. Why is it so slow, though?", "none", "I drive among people, so I keep it slow to be safe."), + ("Thanks for the answer, I'll ask my friend now.", "none", "Sure, take your time."), + ], + "ko": [ + ("고마워, 이제 됐어.", "end", "네, 즐거운 시간 보내세요!"), + ("감사합니다. 이만 가 보겠습니다.", "end", "네, 안녕히 가세요!"), + ("고마워요. 근데 화장실은 어디예요?", "none", "그건 잘 모르겠어요. 직원분께 여쭤봐 주세요."), + ("고마워. 그럼 몇 살이야?", "none", "저는 두 살이에요."), + ("알겠어, 고마워. 이제 왼쪽으로 돌아.", "turn left 90", "네, 왼쪽으로 돌게요."), + ("감사합니다. 하나만 더 여쭤봐도 됩니까?", "none", "네, 물어보세요."), + ("컵 갖다줘서 고마워요!", "none", "천만에요, 맛있게 드세요."), + ("알겠어요.", "none", "네, 좋아요."), + ("오케이.", "none", "좋아요."), + ("아뇨, 없어요. 감사합니다.", "end", "네, 좋은 하루 보내세요!"), + ("됐어요, 궁금한 거 다 물어봤어요.", "end", "네, 반가웠어요. 안녕히 가세요!"), + ("고마워. 근데 왜 그렇게 느려?", "none", "사람들 사이를 다니니까 안전하려고 천천히 다녀요."), + ("고마워요, 친구 데려올게요.", "none", "네, 기다릴게요."), + ("됐어, 그만 물어볼게. 잘 있어.", "end", "네, 안녕히 가세요!"), ], }, "amount_direction": { diff --git a/assistant/bank_words/__init__.py b/assistant/bank_words/__init__.py new file mode 100644 index 0000000..bbe7729 --- /dev/null +++ b/assistant/bank_words/__init__.py @@ -0,0 +1,46 @@ +"""Wordings for the fast lane, one module per field (arm, motion, korean, questions ...), so each can grow apart. + +A module here may hold: + INTENT = {"look": [...], "no": [...]} # added to assistant/intent_bank.KINDS (same kinds, + # same / slots) + QUICK = {"name": [...], "no": [...]} # more wordings for assistant/quick_answers kinds + QUICK_KINDS = {"kind": ([wordings], {"en": [...], "ko": [...]})} # new quick-answer kinds with their answers +""" +import importlib +import pkgutil + + +def modules(): + return [importlib.import_module(f"{__name__}.{m.name}") for m in sorted(pkgutil.iter_modules(__path__), key=lambda m: m.name)] + + +def merged(attr): + """{kind: [wordings]} of every module's `attr`, in module order.""" + out = {} + for m in modules(): + for kind, texts in getattr(m, attr, {}).items(): + out.setdefault(kind, []).extend(texts) + return out + + +def vectors(texts, cache): + """Embeddings of `texts` (assistant/knowledge.embed); kept per text in `cache` (.npz), so only new wordings are + embedded when a bank grows. Written atomically: several processes may build at once.""" + import os + import numpy as np + from assistant import knowledge + known = {} + try: + z = np.load(cache) + if "texts" in z: + known = dict(zip(z["texts"].tolist(), z["vecs"])) + except (OSError, ValueError, KeyError): + pass + new = sorted({t for t in texts if t not in known}) + if new: + known.update(zip(new, knowledge.embed(new))) + keep = sorted(set(texts) | set(new)) + tmp = f"{cache}.{os.getpid()}.npz" + np.savez(tmp, texts=np.array(keep), vecs=np.array([known[t] for t in keep])) + os.replace(tmp, cache) + return np.array([known[t] for t in texts]) diff --git a/assistant/bank_words/arm.py b/assistant/bank_words/arm.py new file mode 100644 index 0000000..472bf82 --- /dev/null +++ b/assistant/bank_words/arm.py @@ -0,0 +1,306 @@ +"""Arm and hand wordings for the intent bank (assistant/intent_bank.py kinds): wave (every handshake form too, the +owner's meaning), arm_reach (hold the arm out: "give me your hand", "손 줘", "손 내밀어"), arm_fold (back to look), +arm_open / arm_close (the gripper), pick, fetch, and the hand's put / receive / give (the bank does not act on these +three: they keep their wordings apart from the others), plus "no": talk about the arm and hand that asks nothing. + +Korean is written as stems x endings (반말 / 해요체 / 하십시오체 / 주세요 / 줄래 / dialect), English as phrases. +""" + + +def _ko(stems, ends): + return [f"{s}{e}" for s in stems for e in ends] + + +def _en(cores): + return [f.format(c) for c in cores for f in FRAMES] + + +FRAMES = ["{}", "please {}", "{} please", "could you {}", "would you please {}", "can you {}", "will you {}", + "you think you could {}", "be a dear and {}", "do me a favour and {}", "i want you to {}", "i need you to {}", + "i'd like you to {}", "how about you {}", "why don't you {}", "mind if i ask you to {}", "i order you to {}", + "{} now", "{} for me", "{} real quick", "just {}", "{}, okay", "come on, {}", "you {} please", "kindly {}"] + + +ASK = ["", " 줘", " 봐", " 줘 봐", " 주세요", " 줘요", " 봐요", " 보세요", " 줄래?", " 줄래요?", " 주실래요?", " 주십시오", + " 주시겠어요?", " 주시겠습니까?", " 주라", " 주게", " 보게", " 주이소", " 보이소", " 봐유", " 줘유", " 줘용", " 주세용", + " 줄 수 있어?", " 주실 수 있어요?", " 주면 좋겠어", " 주시면 감사하겠습니다", " 주시오", " 보거라", " 주렴"] +ASK += [" 주셨으면 해요", " 주셨으면 좋겠어요", " 주면 좋겠어요", " 주시겠소", " 주소", " 도", " 주이소예", " 조", " 주랑께", + " 주드라고", " 줘라", " 주라잉", " 줘 봐라", " 보소", " 봐라", " 줄래 응", " 주세요 제발", " 좀 해 줘"] +ASK_SHORT = ["", " 줘", " 봐", " 주세요", " 줘요", " 줄래?", " 주실래요?", " 주십시오", " 주라", " 주게", " 주이소", " 줘유"] + +# ---------- wave: a wave of the hand, and every handshake wording (owner 2026-10-23: a handshake is a wave) ---------- +WAVE = [ + # handshakes, English (native, non-native, kids, slang) + "shake hand", "shake hands", "shake my hand", "shake hands with me", "let's shake hands", "let's shake hand", + "can you shake hand", "can you shake hands with me", "could you shake my hand", "would you shake my hand", + "will you shake hands with me", "shake", "shake shake", "shake please", "shake hand please", "shake hands please", + "give me a handshake", "handshake please", "handshake", "do a handshake", "let's do a handshake", + "how about a handshake", "gimme a handshake", "you shake hand me", "you shake my hand please", "robot shake hand", "shake hand with me please", + "shaking hands please", "do shake hand", "make handshake", "hand shake please", "handshake me", "shakey shakey", + "shake hans", "shake hend", "shaek hands", "sheik hands", "shake handz", "you hand shake hello please", + "hand shake hello", "a handshake would be nice", "i'd love a handshake", "nice to meet you, shake hands", + "let's shake hands, nice to meet you", # wave, English + "wave", "wave your hand", "wave hand", "wave at me", "wave to me", "wave at us", "wave to us", "wave hello", + "wave goodbye", "wave bye", "wave bye bye", "wave hi", "wave to the camera", "wave to the crowd", + "wave to everybody", "wave to everyone here", "wave to my friends", "wave to my daughter", "wave to the kids", + "wave to the audience", "wave back", "wave back at me", "wave back at us", "wave at the people", "wave a little", + "wave your arm", "wave your arm at me", "wave your hand at us", "wave your hand hello", "do the wave", + "do your wave", "do a little wave", "do a big wave", "a big wave please", "big wave", "little wave", + "give a wave", "give us a wave", "give me a wave", "give them a wave", "give everyone a wave", "give a big wave", + "give a little wave", "give a friendly wave", "send a wave", "throw a wave", "wave for us", "wave for the photo", + "wave for the picture", "wave for my mom", "say hi with your hand", "say hello with your hand", + "say bye with your hand", "say goodbye with your hand", "say hi with a wave", "greet us with a wave", + "greet me with your hand", "greet them with a wave", "hello with your hand", "bye bye with your hand", + "hand wave", "hand wave please", "a hand wave please", "do hand wave", "you wave hand", "you wave me", + "you wave to me please", "robot wave", "robot wave hand", "robot wave me", "wave me", "wave me please", + "wave you hand", "wave you hand please", "wave ur hand", "please wave hand", "please you wave", "plese wave", + "plz wave", "wave plz", "wave pls", "wavey wave", "wave wave", "wave wave wave", "wayve", "wayve please", + "weave", "weave your hand", "waive", "waive at me", "wav", "wav hand", "wave yur hand", "wabe", "wave your han", + "would you mind waving", "would you mind waving at us", "would you mind waving to the crowd", + "mind waving to us", "how about waving to us", "i'd love it if you waved at us", "i'd like you to wave", + "it'd be nice if you waved", "it would be great if you waved at us", "i want you to wave", "i want to see you wave", + "i wanna see you wave", "let me see you wave", "show me a wave", "show me your wave", "show us how you wave", + "can i get a wave", "can we get a wave", "could we get a wave from you", "how about a wave", "a wave, please", + "one wave please", "wave once", "wave one time", "please wave once", "start waving", "go ahead and wave", + "go on, wave", "come on, wave", "come on, wave at us", "just wave", "only wave", "just wave at me", "you can wave now", + "now wave", "wave now", "wave please", "please wave", "kindly wave", "could you wave", "can you wave", + "will you wave", "would you wave", "would you wave at us please", "could you please wave", "can you please wave", + "can you wave at me", "can you wave your hand", "could you wave your hand", "could you, uh, wave", "um, wave", + "so, could you wave", "hi hi wave", "bye bye wave", "wave bye-bye", "wave goodbye to them", + "wave hello to the guests", "wave to the visitors", "wave at the kids", "wave at the camera", + # Korean wave and handshake (stems x endings) + *_ko(["손 흔들어", "손 좀 흔들어", "손 한번 흔들어", "손 한 번 흔들어", "손 흔들어서 인사해", "손 인사 해", "손으로 인사해", + "팔 흔들어", "바이바이 해", "빠이빠이 해", "손 흔들면서 인사해", "손을 흔들어", "손 크게 흔들어", "손 살짝 흔들어", + "안녕 손 흔들어", "손 흔들어서 안녕 해", "손으로 안녕 해", "손으로 바이바이 해", "웨이브 해", "wave 해", "악수 해", + "악수 한번 해", "악수 한 번 해", "나랑 악수 해", "저랑 악수 해", "악수 좀 해", "손 흔들어 인사해"], ASK), + "악수하자", "악수해", "악수해요", "악수 한번 해요", "악수 한번 하자", "악수 하자", "우리 악수하자", "나랑 악수하자", + "저랑 악수해요", "악수할래?", "악수할래요?", "악수하실래요?", "악수합시다", "악수하시죠", "악수하세요", "악수하십시오", + "악수 좀 해요", "악수 한 번만 해 줘", "악수 한 번 해 주세요", "반가워 악수하자", "반가워요 악수해요", "악수 ㄱㄱ", + "악수 고고", "악수 플리즈", "핸드셰이크 해 줘", "쉐이크 핸드", "셰이크 핸드 해 줘", "shake hand 해 줘", "handshake 해 줘", + "악수해 주이소", "악수 한번 해 보이소", "악수하자잉", "악수해 봐유", "악쑤하자", "악수하쟈", "악수 해조", + "손 흔들어", "흔들어 봐", "손 흔드러", "손 흔더러 줘", "손 흔들어조", "손 흔들어 쥬", "손 흔들어 주라잉", "손 흔들어 보랑께", + "손 흔들어 주소", "손 흔들어 도", "손 쫌 흔들어 봐", "손 흔들어 주실 수 있나요?", "손 흔들어 주시면 좋겠어요", + "빠빠이 해 줘", "빠빠이 해", "빠이빠이 해 줘요", "안녕 해 줘 손으로", "손 흔들어서 인사해 주세요", + "카메라 보고 손 흔들어", "카메라 보고 wave", "camera 보고 wave", "사진 찍게 손 흔들어 줘", "애들한테 손 흔들어 줘", + "할머니한테 손 흔들어 드려", "손님들한테 손 흔들어 주세요", "저희한테 손 흔들어 주세요", "우리한테 손 흔들어 줘", + "관객들한테 손 흔들어 주세요", "손 한번 흔들어 주십시오", "손 흔들어 주시겠습니까?", "손 인사 부탁해요", "손 인사 부탁합니다", + "웨이브 웨이브", "웨이브", "웨이브 해 봐", "웨이브 한번 해 줘", "wave 좀 해 줘", "wave 해 주세요", "hand wave 해 줘", + "손 wave 해", "wave hand 해 줘", "hi 해 손으로", "bye 해 손으로", "손으로 hi 해 줘", "손 흔들어 please", "please 손 흔들어", + "손 좀 흔들어 줄래", "손 흔들어 줘 빨리", "얼른 손 흔들어", "빨리 손 흔들어 봐", "손 흔들어 봐 어서", +] + +# ---------- arm_reach: the arm held out to the person ("give me your hand", "손 줘", "손 내밀어") ---------- +ARM_REACH = [ + "give me your hand", "give me a hand", "give me hand", "give me ur hand", "gimme your hand", "gimme a hand", + "gimme hand", "give your hand", "give your hand to me", "give hand", "give hand please", "you give hand", + "you give me hand", "you give me your hand please", "you can give hand", "can you give me your hand", + "could you give me your hand", "may i have your hand", "can i have your hand", "can i see your hand, hold it out", + "lend me your hand", "hand please", "your hand please", "your hand, please", "hand, please", + "reach out", "reach out your hand", "reach out your arm", "reach out to me", "reach out please", "reach your arm out", + "reach your hand out", "reach toward me", "reach towards me", "reach for me", "reach for my hand", "reach forward", + "reach out a bit", "reach out real quick", "reach out, lumi", "reach", "reach arm", "reach your arm", + "hold out your hand", "hold out your arm", "hold your hand out", "hold your arm out", "hold out your gripper", + "hold it out", "hold out your hand to me", "hold your hand out to me", + "stretch your arm", "stretch out your arm", "stretch out your hand", "stretch your arm out", "stretch out", + "stretch your hand forward", "stretch your arm forward", "stretch arm", "extend your arm", "extend your hand", + "extend your arm forward", "extend the arm", "extend arm", "put your hand out", "put your arm out", + "put your hand forward", "put your arm forward", "stick your arm out", "stick your hand out", "push your arm out", + "push your arm forward", "move your arm forward", "move your hand forward", "bring your hand forward", + "bring your hand over to me", "bring your arm to me", "arm out", "arm out please", "arm forward", "arm to me", + "hand out", "hand out please", "hand forward", "hand to me", "offer me your hand", "offer your hand", + "show me your hand", "let me see your hand", "lemme see your hand", "show your hand", "show me your arm", + "straighten your arm", "straighten your arm out", "make your arm straight", "arm straight", "long arm please", + "i want see you reach arm", "i want to see you reach out", "show me you reach out", "can you reach out", + "could you reach out your arm", "would you reach out your hand", "would you mind reaching out", + "mind holding out your hand", "how about holding your hand out", "it'd be nice if you held out your hand", + "reech out", "rich out", "reach owt", "reach aut", "rieach out", "hold owt your hand", "giv me your hand", + "give mi your hand", "give me you hand", "gib me your hand", "hand pls", "arm out pls", + # Korean + *_ko(["손 내밀어", "손 좀 내밀어", "손 앞으로 내밀어", "손 쭉 내밀어", "손 뻗어", "손 좀 뻗어", "손 앞으로 뻗어", + "팔 뻗어", "팔 좀 뻗어", "팔 쭉 뻗어", "팔 앞으로 뻗어", "팔 내밀어", "팔 좀 내밀어", "팔 앞으로 내밀어", "팔 펴", + "팔 쭉 펴", "팔 좀 펴", "팔 앞으로 쭉 펴", "팔을 뻗어", "손을 내밀어", "손을 앞으로 내밀어", "팔 길게 뻗어", + "손 이쪽으로 내밀어", "나한테 손 내밀어", "저한테 손 내밀어", "손 나한테 뻗어", "팔 나한테 뻗어"], ASK), + *_ko(["손 줘", "손 좀 줘", "손 이리 줘", "나한테 손 줘", "저한테 손 줘", "손 내놔"], ["", " 봐", "요", " 봐요"]), + "손 주세요", "손 좀 주세요", "손 이리 주세요", "저한테 손 주세요", "손 주실래요?", "손 줄래?", "손 주라", "손 주게", + "손 주이소", "손 줘유", "손 주십시오", "손 좀 주실래요?", "손 이리", "손 내밀기", "손 내밀어 봐 어서", + "루미야 손 줘", "로봇아 손 줘", "hand 줘", "hand 줘 봐", "hand 좀 줘", "hand 내밀어", "hand 좀 내밀어 줘", "팔 reach 해 줘", "reach out 해 줘", + "reach out 해", "reach 해 줘", "팔 extend 해 줘", "arm 뻗어", "arm 뻗어 줘", "arm out 해 줘", "arm 펴 줘", "팔 out", + "손 reach", "팔 reach", "give me hand 해 줘", "hand out 해 줘", "손 앞으로", "팔 앞으로", "팔 쭉", "팔 뻐더", + "팔 버더", "팔 뻗어조", "손 내미러", "손 내밀어조", "팔 뻐더 줘", "손 내밀어 주이소", "팔 뻗어 보이소", "팔 쭉 뻗어 보게", + "팔 좀 뻗어 봐유", "손 쫌 내밀어 봐", "손 내밀어 주랑께", "팔 뻗쳐 봐", "팔 쭉 내밀어 보거라", + "야 봐봐, 루미야 팔 뻗어 줘", "봐봐 루미야 손 내밀어", "얘들아 봐 루미야 손 줘", +] + +# ---------- arm_fold: the arm back to its look pose ---------- +ARM_FOLD = [ + "fold your arm", "fold the arm", "fold arm", "fold it", "fold it back", "fold your arm back", "fold your arm up", + "fold up your arm", "fold your arm now", "fold your arm please", "you can fold your arm", "you can fold it now", + "put your arm down", "put the arm down", "put your arm away", "put your arm back", "put arm back", + "put your hand down", "put your hand away", "put your hand back", "take your arm back", "take your hand back", + "take back your arm", "take your arm away", "pull your arm back", "pull your arm in", "pull your hand back", + "pull back your arm", "pull it back", "draw your arm back", "draw back your arm", "bring your arm back", + "bring your arm in", "bring the arm home", "bring the arm back", "arm back", "arm back home", "arm back please", + "arm back in", "arm in", "arm down", "arm down please", "arm home", "arm away", "arm rest", "arm go back", + "arm back home if you don't mind", "your arm, put back", "you close arm please, put back", "close arm", + "retract your arm", "retract the arm", "retract arm", "tuck your arm in", "tuck it in", "tuck your arm away", + "lower your arm", "lower the arm", "lower your hand", "drop your arm", "rest your arm", "relax your arm", + "back to your look pose", "back to look position", "look pose", "go back to your look pose", "arm to look pose", + "return your arm", "return the arm", "reset your arm", "reset the arm", "arm to home position", + "okay, put your arm down", "okay arm back", "thanks, arm back", "that's enough, fold your arm", + "you can put your arm down now", "you can take your hand back", "you can lower your arm now", + "fold your arm, it's in the way", "fold you arm", "fold yor arm", "fould your arm", "fold ur arm", "arm fold", + "arm fold please", "arm close", "arm close please", "you fold arm", "put back arm", + # Korean + *_ko(["팔 접어", "팔 좀 접어", "팔 다시 접어", "팔 거둬", "팔 좀 거둬", "팔 내려", "팔 좀 내려", "팔 넣어", "팔 다시 넣어", + "팔 원위치 해", "팔 원래대로 해", "팔 제자리로 해", "손 내려", "손 거둬", "손 접어", "손 다시 넣어", "손 넣어", + "팔 치워", "손 치워", "팔 원래 자리로 해", "팔 원위치로 돌려", "팔 돌려놔", "팔 접고 있어"], ASK_SHORT), + "팔 접으세요", "팔 접으십시오", "팔 거두세요", "팔 거두십시오", "팔 내리세요", "팔 내리십시오", "팔 내려놓으세요", + "팔 원위치", "팔 원래대로", "팔 제자리로", "팔 제자리", "이제 접어", "접어", "접어 줘", "접어 주세요", "넣어", "됐어 넣어", + "이제 팔 접어도 돼", "팔 접어도 돼", "팔 내려도 돼", "이제 팔 내려", "고마워 팔 접어", "됐어 팔 내려", "팔 쉬어", "팔 쉬어도 돼", + "arm 접어", "arm 접어 줘", "arm 내려", "arm down 해", "팔 down", "팔 fold", "팔 fold 해 줘", "fold arm 해 줘", + "팔 내려 please", "팔 접어조", "팔 저버", "팔 거더", "팔 내려조", "팔 접어 보이소", "팔 접어 부러", "팔 접어 봐유", + "얘 로봇아 arm 접어 줘", "루미야, arm 접어 줘", "팔 걷어", "팔 오므려", "팔 모아", "팔 다시 가져가", +] + +# ---------- arm_open / arm_close: the gripper (with nothing held: the hand reader refuses an open while holding) ---------- +ARM_OPEN = [ + "open your hand", "open hand", "open the hand", "open your fingers", "open the gripper", "open your gripper", + "open gripper", "open your claw", "open up your hand", "open up", "open your hand wide", "spread your fingers", + "unclench your hand", "unclench", "hand open", "hand open please", "fingers open", "gripper open", + "release your grip", "loosen your grip", "relax your fingers", "open your hand please", "please open your hand", + "can you open your hand", "could you open your gripper", "show me an open hand", "you open hand", "opn your hand", + "open you hand", "open ur hand", + *_ko(["손 펴", "손 좀 펴", "손 벌려", "손 좀 벌려", "손가락 펴", "손 열어", "그리퍼 열어", "그리퍼 좀 열어", "집게 열어", + "집게 벌려", "손 쫙 펴", "손바닥 펴", "손 활짝 펴"], ASK_SHORT), + "손 펴세요", "손 펴십시오", "손 오픈", "그리퍼 오픈", "손 open", "hand 펴", "gripper open 해", "open 해 손", "손 펴조", +] +ARM_CLOSE = [ + "close your hand", "close hand", "close the hand", "close your fingers", "close the gripper", "close your gripper", + "close gripper", "close your claw", "make a fist", "clench your hand", "clench your fist", "squeeze your fingers", + "shut your hand", "hand closed", "hand close please", "fingers close", "gripper close", "close your hand please", + "please close your hand", "can you close your hand", "could you close your gripper", "show me a fist", + "you close hand", "clos your hand", "close you hand", "close ur hand", + *_ko(["손 쥐어", "손 꽉 쥐어", "주먹 쥐어", "주먹 꽉 쥐어", "손 오므려", "손가락 오므려", "손 닫아", "그리퍼 닫아", + "그리퍼 좀 닫아", "집게 닫아", "집게 오므려"], ASK_SHORT), + "손 쥐세요", "주먹 쥐십시오", "손 클로즈", "그리퍼 클로즈", "손 close", "gripper close 해", "주먹 쥐어조", +] + +# ---------- pick: an object from the table in front ---------- +PICK = [ + "pick up the ", "pick the up", "pick up that ", "pick up a ", "pick up", "pick up ", + "take the ", "take that ", "grab the ", "grab that ", "grab a ", "get the ", + "lift the ", "lift up the ", "snag the ", "nab the ", "seize the ", + "go on, pick up the ", "go ahead, pick up the ", "now pick up the ", "okay pick up the ", + "it would be great if you picked up the ", "i'd be grateful if you picked up the ", + "i'd like you to pick up the ", "i want you to grab the ", "would you mind picking up the ", + "could you please pick up the ", "can you grab the for me", "please pick up the ", + "show me you can pick up the ", "let me see you pick up the ", "can i see you pick up the ", + "reach for the and pick it up", "reach for the ", "grab the on the table", + "pick up the on the table", "pick the off the table", "take the off the table", + "you take ", "you pick ", "you pick up please", "you grab ", "you can take the ", + "you peek up the ", "peek up the ", "pik up the ", "pick op the ", "pickup the ", + "pick upp the ", "grap the ", "grabb the ", "take da ", "pick up da ", "pic up the ", + *_ko([" 집어", " 좀 집어", " 하나 집어", " 들어", " 좀 들어", " 잡아", " 좀 잡아", + " 집어 올려", " 들어 올려", "그 집어", "저 집어", "저기 집어", "테이블 위에 집어", + " 손으로 집어", " 쥐어"], ASK_SHORT), + " 집으세요", " 집으십시오", " 잡으세요", " 집어 볼래?", " pick 해 줘", " pick up 해", + " 픽업 해 줘", " 픽 해 줘", " grab 해", " take 해", " 그랩 해", "grab 해 ", " 집어조", + " 지버", " 잡아조", "봐봐, 루미야 집어 봐", " 집어 보이소", " 집어 부러", " 집어 봐유", +] + +# ---------- fetch: bring an object (from a place) ---------- +FETCH = [ + "bring me the ", "bring the to me", "bring the here", "bring me a ", "bring over the ", + "fetch the ", "fetch me the ", "get me the ", "go get the ", "go and get the ", + "go fetch the ", "grab me the ", "carry the to me", "deliver the to me", + "bring me the from ", "get the from ", "fetch the from ", + "go get the at ", "go to and bring me the ", "bring the from to me", + "the at , bring it to me", "there's a at , bring it here", " from , please bring", + "from the , bring to me", "i need the from ", "i'd like the from ", + "could you get me the from ", "can you bring the from ", "you go , bring me", + "bring me from ", "fech the from ", "brin me the from ", + *_ko(["에서 가져와", "에서 좀 가져와", "에서 가져다", "에 있는 가져와", + "에서 갖다", "에서 가지고 와", " 가져와", " 가져다", " 갖다", + " 좀 갖다", "나한테 가져다", "에 있는 나한테 가져다"], ASK_SHORT), + "에서 좀 가지고 오십시오", "에서 가져오십시오", "에서 가져오세요", + "에서 브링 해 줘", "에서 bring 해 줘", "에서 가 온나", "에서 갖다 주이소", + "에 있는데 그것 좀 갖다 줘", "에 있어, 가져와", "에서 챙겨 와", +] + +# ---------- the hand's (not acted on by the bank: brain.hand_request reads them) ---------- +PUT = [ + "put it down", "put it down here", "set it down", "place it down", "put it on the table", "place it on the table", + "put the cup on the table", "you can put it down now", "put it back", "put it back where it was", + "내려놔", "내려놔 줘", "내려놔 주세요", "이제 내려놔도 돼", "내려놓아도 돼요", "테이블에 놔", "테이블 위에 놔 주세요", + "제자리에 놔", "원래 자리에 놔 주세요", "여기 내려놔", "내려나", "내려나 줘", "내려 놔 줘요", "놔 둬", +] +RECEIVE = [ + "take this", "take this from me", "hold this", "here, take it", "here you go", "take it from my hand", + "can you take this off my hands", "here, you take, is for you", "i'll give you this", "catch this", + "이거 받아", "이거 받아 줘", "이거 들고 있어", "이거 가져", "이거 잠깐 들어 줄래?", "이거 take 해 줘", "이거 hold 해 줘", + "take this 해 줘", "제 손에 있는 거 가져가세요", "이거 드릴게요", +] +GIVE = [ + "give it to me", "give me that", "give me it", "give it", "hand it over", "hand it to me", "pass it to me", + "could i please have the cup", "i'd appreciate it if you passed it to me", "hand the cup down to me", + "i'll grab it from you", "let me have it", "gimme that", "give it here", + "줘", "그거 줘", "이리 줘", "나 줘", "저 주세요", "줘 봐", "그거 저 주시면 돼요", "그거 나 주면 돼", "제가 받을게요", + "이리 주세요", "그거 이리 줘", "줘 빨리", "빨리 줘", "얼른 줘", "그거 넘겨", "건네줘", "그거 저한테 주세요", "give me 해 줘", +] + +# ---------- no: talk about the arm and hand, negations, past, remarks, someone else's hand ---------- +NO = [ + "the wave was nice", "i saw you wave", "you waved so nicely", "that was a cute wave", "you wave like my grandpa", + "my daughter waved at you", "the kids waved at you", "a big wave hit the beach", "radio waves can't hurt you", + "there's a heat wave this week", "microwave the food", "wave pool", "new wave music", "a wave of visitors", + "the handshake was nice", "i shook hands with him", "we shook hands yesterday", "nice handshake", + "your hand looks strong", "your hand is cold", "is your hand a gripper", "how strong is your hand", + "how long is your arm", "your arm is long", "your arm moves smoothly", "the arm looks cool", + "nice arm", "cool hand", "what a nice gripper", "my hand hurts", "i hurt my arm", "wash your hands", + "did you wash your hands", "raise your hand if you have a question", "hands up everyone", "everyone wave to the robot", + "kids, wave to the robot", "wave back at it, mina", "can i wave at you", "can i shake your hand later", + "give me a hand with this box", "can you lend me a hand", "i need a hand", "give me a break", "give me a second", + "give me a minute", "give me a call", "give me a hint", "give me five minutes", "give me some space", + "hold on", "hold on a second", "hang on", "hold that thought", "on the other hand", "hand in hand", "second hand", + "i have my hands full", "it's out of my hands", "hands down the best", "pick a number", "pick your favourite", + "pick a song", "take a picture", "take a break", "take care", "take your time", "take it easy", "get some rest", + "bring it on", "fold the laundry", "the cup is red", "i like that cup", "the bottle is empty", "my cup is here", + "손 씻었어?", "손 예쁘다", "손이 예쁘네", "손 차가워?", "손 따뜻해?", "팔 길다", "팔 진짜 길다", "팔 멋있다", "손 힘 세?", + "아까 손 흔드는 거 봤어", "손 흔드는 거 귀엽다", "손 흔드는 로봇이네", "웨이브 멋있다", "어제 악수했어", "악수 좋았어", + "애들이 손 흔들었어", "와 아까 로봇이 손 흔들었어", "손 흔드는 게 참 신통하네", "손 흔드는 거 좀 어색하지 않아?", + "민수야 로봇한테 손 흔들어", "얘들아 로봇한테 손 흔들어", "지호야 손 흔들어 봐", "동생아 로봇한테 손 흔들어 봐", + "할머니 손 흔들어 주세요 사진 찍을게요", "손 들어 보세요 여러분", "질문 있으면 손 들어", "손 들고 질문하세요", + "손 잡고 가자", "손 시려", "손 아파", "팔 아파", "팔이 저려", "손이 모자라", "손이 많이 가", "손 좀 빌려줘", + "일손이 부족해", "손 놓고 있어", "손 떼", "손대지 마", "만지지 마", "손 씻고 올게", "손 닦아", "팔짱 껴", + "컵 예쁘다", "컵 몇 개 들 수 있어?", "사과 좋아해", "바나나 맛있어", "그 컵 내 거야", "물병 비었어", + "커피 한 잔 줘", "물 한 잔 줘", "아메리카노 한 잔 주세요", "시간 좀 줘", "기회 줘", "힌트 줘", "잠깐 시간 줘", + "문 열어 줘", "문 열어", "문 좀 열어 주세요", "창문 열어", "뚜껑 열어 줘", "병 열어 줘", "마음을 열어 봐", "문 닫아 줘", + "창문 닫아", "뚜껑 닫아 줘", "open the door", "close the door", "open the window", "open the box", "open the bottle", + "open the lid", "close the window", "가위바위보", "주먹 인사", "fist bump", "high five", "하이파이브", + "전화 줘", "연락 줘", "문자 줘", "답 줘", "대답 좀 해 줘", "칭찬 좀 해 줘", "사인 해 줘", "사진 찍어 줘", +] + +WAVE += _en(["wave", "wave your hand", "wave at us", "wave hello", "wave goodbye", "wave us off", "wave one more time", + "shake hands", "shake my hand", "shake hands with me", "give us a wave", "say hi with your hand", + "say hello with your arm", "greet us with a wave", "wave to the camera"]) +ARM_REACH += _en(["reach out", "reach out your arm", "hold out your hand", "give me your hand", "give me a hand", + "stretch out your arm", "put your hand out", "extend your arm", "reach toward me", "hold your arm out"]) +ARM_FOLD += _en(["fold your arm", "put your arm down", "pull your arm back", "take your hand back", "bring your arm back", + "go back to your look pose", "lower your arm", "tuck your arm in", "put your hand down"]) +ARM_OPEN += _en(["open your hand", "open the gripper", "open your fingers", "spread your fingers"]) +ARM_CLOSE += _en(["close your hand", "close the gripper", "close your fingers", "make a fist"]) +PICK += _en(["pick up the ", "grab the ", "take the from the table", "lift the "]) +FETCH += _en(["bring me the ", "fetch the ", "get me the from ", "go get the at "]) + +WHO_KO = ["할머니한테", "할아버지한테", "애들한테", "아이들한테", "손님들한테", "관객들한테", "우리 딸한테", "우리 아들한테", "손주한테", + "카메라 보고", "저기 사람들한테", "친구들한테"] +WAVE += _ko([f"{w} 손 흔들어" for w in WHO_KO] + [f"{w} 손으로 인사해" for w in WHO_KO], ASK_SHORT) +WAVE += [f"wave to {w}" for w in ("my grandma", "my grandpa", "the kids", "my son", "my daughter", "the visitors", + "the people over there", "the camera", "my friends", "the audience")] +ARM_REACH += _ko(["할머니한테 손 내밀어", "애들한테 손 내밀어", "손님한테 손 내밀어", "저 사람한테 팔 뻗어", "이쪽으로 손 내밀어", + "손 좀 이리 내밀어", "핸드 줘", "핸드 내밀어"], ASK_SHORT) +ARM_FOLD += _ko(["팔 기본 자세로 해", "팔 기본 위치로 돌려", "손 이제 내려", "손 얼른 거둬", "팔 원래 자리로 돌려", "arm 접어", + "arm 내려", "hand back 해"], ASK_SHORT) + +INTENT = {"wave": WAVE, "arm_reach": ARM_REACH, "arm_fold": ARM_FOLD, "arm_open": ARM_OPEN, "arm_close": ARM_CLOSE, + "pick": PICK, "fetch": FETCH, "put": PUT, "receive": RECEIVE, "give": GIVE, "no": NO} diff --git a/assistant/bank_words/korean.py b/assistant/bank_words/korean.py new file mode 100644 index 0000000..ff19a65 --- /dev/null +++ b/assistant/bank_words/korean.py @@ -0,0 +1,116 @@ +"""Korean wordings for the fast lane: the words people use for each thing Lumi does, beyond what the base bank has. + +Endings need no list here: wording.ko_plain reads every speech level and dialect ending as the plain 반말 one before +the bank compares ("가세요", "가십시오", "가 주실래요?", "가이소", "가랑께" -> "가" / "가 줘"), and the bank stores its +wordings the same way. What is listed is the rest: other verbs and nouns (일로 와, 졸졸 따라와, 좌회전, 고개 숙여), +dialect words (일루, 이짝, 쪼매, 가온나), Konglish both ways, spacing slips and whisper's spellings, 그거 / 이거 / 저기. +""" + + +def _v(cores, tails=("", " 줘", " 봐")): + """Each plain core with the request tails people add, and written without spaces (a frequent slip).""" + out = [] + for c in cores: + for t in tails: + out.append(c + t) + if " " in c: + out.append(c.replace(" ", "")) + return list(dict.fromkeys(out)) + + +INTENT = { + "go_to": _v(["로 가", " 쪽으로 가", "까지 가", "에 가", "로 이동해", "로 출발해", + "로 무브", "로 고", "까지 드라이브 해", "로 가 보자", " 가자 루미", + " 쪽으로 이동", "로 퍼뜩 가", "로 언능 가", "로 싸게 가", "로 가 보그라", + " 그짝으로 가", "로 빨랑 가", "로 직진", "로 향해", " 방향으로 가", + "저기 로 가", "로 좀 가", "로 가 봐라", "로 무빙 해", "로 move 해", + "로 go 해", "로 이동 좀", "로 가 주라", " 가 봐"], ("", " 줘")), + "come": _v(["이리 와", "일로 와", "일루 와", "요리 와", "이짝으로 와", "이쪽으로 와", "여기로 와", "여기 와", "가까이 와", + "나한테 와", "내 쪽으로 와", "내 앞으로 와", "내 앞에 와", "코앞까지 와", "쪼매 가까이 와", "좀 더 가까이 와", + "이리 컴", "컴 히어", "여기 컴", "come 해", "이리 와 봐라", "가까이 다가와", "나한테 다가와", "이리 다가와", + "내 옆으로 와", "저한테 와", "여기까지 와", "이 앞까지 와", "가차이 와", "이리 오니라", "이리 와 봐잉"], + ("", " 줘", " 봐")), + "follow": _v(["따라와", "나 따라와", "날 따라와", "졸졸 따라와", "쫄래쫄래 따라와", "뒤따라와", "따라붙어", "내 뒤에 붙어", + "내 뒤 따라와", "나 가는 데 따라와", "내가 가는 대로 따라와", "내 뒤로 따라와", "나 쫓아와", "날 쫓아와", + "나랑 같이 다니자", "나랑 같이 걸어", "팔로우 미", "팔로잉 해", "팔로우 해", "follow 해", "날 따라다녀", + "나만 따라와", "놓치지 말고 따라와", "바짝 따라와", "뒤에서 따라와", "옆에서 같이 가", "따라 와", + "따라오너라", "저 따라와", "제 뒤를 따라와", "제 뒤로 따라와"], ("", " 줘", " 봐")), + "come_back": _v(["돌아와", "다시 돌아와", "제자리로 와", "원래 자리로 돌아와", "아까 자리로 돌아와", "컴백 해", "복귀해", + "다시 와", "도로 와", "원위치로 와", "아까 있던 데로 돌아가", "원래 있던 곳으로 돌아가", "원래 자리로 돌아가", + "처음 자리로 돌아가", "출발한 곳으로 돌아와", "출발한 데로 돌아가", "원위치로 가", "원래 자리로 가", + "아까 자리로 가", "제자리로 돌아가"], ("", " 줘")), + "move": _v(["앞으로 가", "앞으로 와", "앞으로 조금 가", "살짝 앞으로", "쪼끔 앞으로", "조금만 앞으로", "전진해", "전진", + "뒤로 가", "뒤로 물러나", "한 발짝 뒤로", "한 걸음 뒤로", "살짝 뒤로", "조금만 뒤로", "후진해", "후진", "빠꾸 해", + "뒤로 빠져", "백 해", "왼쪽으로 가", "왼쪽으로 조금 가", "왼쪽으로 비켜", "오른쪽으로 가", "오른쪽으로 비켜", + "오른쪽으로 살짝 가", "옆으로 살짝 왼쪽", "1 meter 앞으로 가", "앞으로 1 meter", "뒤로 1 meter 가", + "1 meter 뒤로", "왼쪽으로 1 meter", "오른쪽으로 1 meter 가", "고 포워드", "무브 백", "포워드로 가", + "앞으로 쪼매 가", "뒤로 쪼매 가", "앞으로 한 발짝", "뒤로 두 발짝"], ("", " 줘")), + "turn": _v(["좌회전", "좌회전 해", "우회전", "우회전 해", "왼쪽으로 돌아", "오른쪽으로 돌아", "왼쪽으로 몸 돌려", + "오른쪽으로 몸 돌려", "뒤로 돌아", "유턴", "유턴 해", "반 바퀴 돌아", "한 바퀴 돌아", "방향 바꿔", + "반대로 돌아", "좌향좌", "우향우", "뒤로 돌아서", "왼쪽으로 틀어", "오른쪽으로 틀어", "왼쪽으로 꺾어", + "오른쪽으로 꺾어", "90 degrees 왼쪽으로 돌아", "오른쪽으로 90 degrees 돌아", "턴 레프트", "턴 라이트", + "레프트 턴", "라이트 턴", "왼쪽으로 회전", "오른쪽으로 회전", "몸 왼쪽으로 돌려", "몸 오른쪽으로 돌려", + "u턴 해", "왼쪽 돌아", "오른쪽 돌아"], ("", " 줘")), + "look": _v(["위 봐", "위쪽 봐", "하늘 봐", "천장 봐", "고개 들어", "고개 올려", "고개 쳐들어", "고개 숙여", "고개 내려", + "아래 봐", "밑에 봐", "바닥 봐", "땅 봐", "발밑 봐", "왼쪽 봐", "왼짝 봐", "왼편 봐", "오른쪽 봐", "오른짝 봐", + "오른편 봐", "날 봐", "나 봐", "나 쳐다봐", "날 쳐다봐", "이쪽 봐", "여기 봐", "여 봐라", "앞에 봐", "정면 봐", + "앞을 봐", "고개 원위치", "고개 똑바로", "고개 원래대로", "고개 왼쪽으로 돌려", "고개 오른쪽으로 돌려", + "고개 좌로", "고개 우로", "딴 데 봐", "다른 데 봐", "시선 돌려", "눈 마주쳐", "눈 맞춰", "내 눈 봐", + "내 얼굴 봐", "룩 업", "룩 다운", "룩 레프트", "룩 라이트", "룩 앳 미", "위로 고개", "아래로 고개", + "고개 살짝 왼쪽", "고개 살짝 오른쪽", "고개 살짝 들어", "고개 살짝 숙여", "얼굴 들어", "얼굴 이쪽으로"], + ("", " 줘", " 봐")), + "lift": _v(["몸 올려", "몸 위로", "키 높여", "키 키워", "키 커져", "몸 높여", "몸 낮춰", "몸 내려", "키 낮춰", "키 줄여", + "작아져", "리프트 올려", "리프트 내려", "리프트 업", "리프트 다운", "상체 올려", "상체 내려", "높이 올라가", + "업 해", "다운 해", "몸 쭉 올려", "몸 쭉 내려", "키 좀 커져", "몸 낮게", "몸 높게", "키 높게", "키 낮게", + "아래로 내려가", "위로 올라가", "몸 늘려", "몸 위로 늘려", "키 늘려", "높아져", "낮아져", "좀 더 높아져", + "좀 더 낮아져", "몸통 올려", "몸통 내려", "키 올려", "키 내려", "몸 쭉 늘려"], ("", " 줘", " 봐")), + "wave": _v(["손 흔들어", "손 좀 흔들어", "손 한번 흔들어", "팔 흔들어", "손 인사 해", "손으로 인사해", "반갑다고 손 흔들어", + "손 들어 흔들어", "손짓 해", "웨이브 해", "손 웨이브", "핸드 웨이브", "하이 해 손으로", "헬로 해 손으로", + "악수하자", "악수해", "악수 한번 해", "악수 해", "악수", "손 흔들어 인사", "인사 손으로 해", + "애들한테 손 흔들어", "손님들한테 손 흔들어", "사람들한테 손 흔들어", "우리한테 손 흔들어", "손흔들어", + "손 흔드러", "손 흔들어조", "손 흔들어 봐라", "손 함 흔들어"], ("", " 줘", " 봐")), + "arm_reach": _v(["손 줘", "손 내밀어", "팔 내밀어", "팔 뻗어", "팔 쭉 뻗어", "손 앞으로 내밀어", "팔 앞으로 뻗어", "손 이리 줘", + "손 좀 줘", "손 내놔", "팔 앞으로", "손 앞으로", "팔 쭉 내밀어", "팔 길게 뻗어", "핸드 줘", "손 내밀어 봐라", + "팔 쭉", "손 쭉 내밀어"], ("", " 줘", " 봐")), + "arm_fold": _v(["팔 접어", "팔 내려", "팔 거둬", "팔 넣어", "팔 집어넣어", "팔 원위치", "손 내려", "팔 원래대로", "팔 치워", + "팔 정리해", "팔 거둬들여", "팔 모아"], ("", " 줘")), + "arm_open": _v(["손 펴", "손 벌려", "손가락 펴", "그리퍼 열어", "집게 열어", "손 열어", "그리퍼 오픈", "핸드 오픈", "손 쫙 펴"], + ("", " 줘")), + "arm_close": _v(["손 쥐어", "주먹 쥐어", "손 오므려", "그리퍼 닫아", "집게 닫아", "손 닫아", "그리퍼 클로즈", "핸드 클로즈", + "손 꽉 쥐어"], ("", " 줘")), + "pick": _v([" 집어", " 잡아", " 들어", " 집어 들어", " 픽업 해", " 좀 들어", "그 집어", + "저 잡아", " 집어 올려", " 손으로 잡아", " 그랩 해", " 픽 해", " 들어 올려", + " 쥐어", "앞에 있는 집어", " 하나 집어"], ("", " 봐")), + "fetch": _v([" 가져와", " 갖다 줘", " 좀 가지고 와", " 챙겨 와", " 갖고 와", " 가온나", + " 가져와 봐라", " 브링 해", " 좀 가져다 줘", "나한테 가져와", " 여기로 가져와", + " 이리 가져와", " 퍼뜩 가져와"], ("",)), + "no": [ + # remarks, stories and questions about Lumi in Korean: nobody asked it to move + "손 흔드는 거 봐", "따라오는 거 신기하다", "얘 고개 돌리는 거 봐", "아까 손 흔들던데", "저 로봇 따라온다", + "로봇이 손 흔들어 주더라", "우리 애가 손 흔들었어", "손 흔드는 게 귀엽네", "고개 숙이는 거 웃기다", + "팔 뻗는 거 무섭다", "따라오면 어떡해", "왜 따라와", "왜 손 흔들어", "왜 이리 와", "어디 가", "어디로 가", + "뭐 하노", "뭐 하는 거야", "뭐 해", "뭐 하냐", "머 하노", "어데 가노", "어디 가노", "니 뭐 하노", "뭐 하고 있어", + "손 흔들 줄 알아", "따라올 수 있어", "팔 뻗을 수 있어", "고개 돌릴 수 있어", "리프트 있어", + "가지 마", "오지 마", "따라오지 마", "손 흔들지 마", "고개 돌리지 마", "가지 마라", "오지 마이소", "따라오지 마라", + "하지 마", "하지 말라고", "됐어", "됐다", "그만해", "필요 없어", "안 해도 돼", "괜찮아 안 해도 돼", + "이따가 따라와", "나중에 손 흔들어", "밥 먹고 가자", "우리 커피 마시러 가자", "우리 저기 가 볼까", + "엄마 저기 가자", "아빠 이리 와", "얘들아 이리 와", "민수야 따라와", "여보 이리 와 봐", "애들아 손 흔들어", + "손 씻어", "손 줘 봐 강아지야", "손 이리 줘 봐 아가", "고개 들어 봐 아들", "팔 내밀어 봐 주사 맞게", + ], +} + +QUICK = { + "name": ["이름이 뭐꼬", "니 이름이 뭐고", "이름이 뭐여", "이름이 뭐당가", "이름 뭐예요", "이름이 머예요", "성함이 어떻게 되십니까", + "이름 좀 알려 줘", "이름 알려 주세요", "네임 뭐야", "너 이름 뭐니", "이름이 어떻게 되니", "로봇 이름이 뭐야"], + "who": ["니 누꼬", "니 누고", "누구여", "너 누구냐", "당신 누구요", "니는 뭐꼬", "넌 뭐니", "너는 뭐 하는 로봇이야", + "무슨 로봇이에요", "이 로봇 뭐예요", "이 로봇은 뭐 하는 로봇입니까", "자기소개 좀 해 봐", "자기소개 부탁해요"], + "age": ["몇 살이고", "니 몇 살이고", "몇 살이여", "몇 살이당가", "나이가 몇이에요", "몇 살 먹었어", "올해 몇 살이야", + "언제 태어났어요", "몇 년생이야", "몇 살인데", "나이 좀 알려 줘", "연세가 어떻게 되십니까"], + "maker": ["누가 만들었노", "누가 만들었는교", "누가 맹글었어", "어데서 만들었노", "어디 회사 거예요", "어느 회사 거야", + "만든 회사가 어디야", "제조사가 어디예요", "니 어디서 왔노", "누가 개발했습니까", "만든 데가 어디예요"], + "height": ["키가 몇이고", "키 몇이여", "키가 얼마나 되노", "키 몇 센티야", "신장이 어떻게 돼요", "키 얼마예요"], + "weight": ["몇 키로고", "무게 몇이야", "몇 킬로그램이에요", "무게가 얼마나 나가요", "얼마나 나가요 무게"], + "hello": ["안녕하시오", "안녕하신교", "반갑데이", "반갑습니다", "하이요", "헬로우", "안녕 루미", "루미 하이", "방가방가", + "안냥", "하이루"], + "how_are_you": ["잘 지냈나", "별일 없제", "기분 어떠세요", "컨디션 어때", "잘 있었어"], +} diff --git a/assistant/bank_words/motion.py b/assistant/bank_words/motion.py new file mode 100644 index 0000000..ae24987 --- /dev/null +++ b/assistant/bank_words/motion.py @@ -0,0 +1,364 @@ +"""Head, lift and base wordings for the intent bank (assistant/intent_bank.py): look, lift, turn, move, go_to, come, +follow, come_back, and the "no" kind for words that sound like them but ask nothing. + +The bank only picks the kind; the slot (which way, how far, which place) is read from the words by intent_bank._slot, +so every wording here says its way with the plain words that reader knows. Amounts are written the way the bank +compares them (intent_bank.core): "90 degrees", "1 meter"; a marker as . + +Lists are built from parts (verbs x ways x endings) and cut to a fixed, spread subset (_pick), so a new verb or +ending reaches every way without writing each sentence out. +""" +import zlib + + +def _pick(texts, keep): + """A fixed subset of about `keep` (0..1) of `texts`, spread over them (the same every run), without repeats.""" + out = [] + for t in dict.fromkeys(texts): + if keep >= 1 or zlib.crc32(t.encode()) % 1000 < keep * 1000: + out.append(t) + return out + + +def _x(*parts): + """Every join of one choice from each part (a part is a list of strings), spaces tidied.""" + out = [""] + for p in parts: + out = [f"{a} {b}" for a in out for b in p] + return [" ".join(t.split()) for t in out] + + +EN_FRAMES = ["{}", "{} please", "please {}", "can you {}", "could you {} please", "would you {}", "will you {}", + "i want you to {}", "i need you to {}", "{} for me", "go ahead and {}", "lumi, {}", "hey lumi, {}", + "{} now", "can you {} for me", "would you mind if you {}", "just {}", "{} real quick", "{}, okay?", + "yo, {}", "{} pls", "you {}"] + + +def _en(bases, keep, hand=()): + """A share of the built `bases`, a smaller share of them in EN_FRAMES, and every `hand` written wording.""" + return list(hand) + _pick(bases, max(keep * 4, 0.25)) + _pick([f.format(b) for b in list(bases) + list(hand) + for f in EN_FRAMES[1:]], keep) + + +# ---------------- look: the head ---------------- +_EN_LOOK_VERB = ["look", "glance", "peek", "take a look", "have a look", "turn your head", "move your head", + "swing your head", "point your head", "turn your eyes", "cast your eyes", "check"] +_EN_LOOK_WAY = {d: [f"{d}", f"to the {d}", f"to your {d}", f"at the {d}", f"at the {d} side", f"over to the {d}", + f"toward the {d}", f"towards your {d}", f"the {d} side", f"over {d}", f"{d} side"] + for d in ("left", "right")} +_EN_LOOK_WAY["up"] = ["up", "upward", "upwards", "up high", "up at the ceiling", "at the ceiling", "at the sky", + "up there", "higher"] +_EN_LOOK_WAY["down"] = ["down", "downward", "downwards", "down low", "at the floor", "at the ground", "at your feet", + "down at the floor", "lower"] +_EN_LOOK = [f"{v} {w}" for v in _EN_LOOK_VERB for ws in _EN_LOOK_WAY.values() for w in ws + if not (v == "check" and w in ("up", "down", "higher", "lower"))] +_EN_LOOK += [f"{s} the {d} side" for s in ("see", "check out", "watch", "scan", "eye") for d in ("left", "right")] +_EN_LOOK += [f"{v} {w}" for v in ("look", "glance", "turn your head", "face", "eyes") + for w in ("straight", "straight ahead", "ahead", "forward", "front", "to the front", "at the front", + "front again", "forward again", "to the center", "back to the middle", "back to center")] +_EN_LOOK += [f"{v} {w}" for v in ("look", "glance", "turn your head", "eyes", "look over") + for w in ("at me", "this way", "over here", "my way", "toward me", "towards me", "at my face", + "at us", "here")] +_EN_LOOK_HAND = ["eyes on me", "eyes over here", "eyes front", "eyes up", "eyes down", "eyes left", "eyes right", + "chin up", "chin down", "head up", "head down", "head left", "head right", "nose up", "look alive, eyes up", + "look left a bit more", "look right a little more", "look further left", "look further right", + "look a little higher", "look a little lower", "look up a tad", "look down a touch", + "look 90 degrees to the left", "look 90 degrees right", "turn your head 90 degrees to the left", + "turn your head 90 degrees right", "look left 90 degrees", "look up 90 degrees", "tilt your head up", + "tilt your head down", "tilt up a bit", "tilt down a little", "tip your head up", "tip your head back", + "bow your head", "nod down", "drop your head", "raise your chin", "lower your gaze", "raise your gaze", + "lift your eyes", "lift your head up", "put your head down", "put your head up", "look lefft", "look rite", + "look leff", "look rigt", "look dawn", "look upp", "luk left", "luk right", "luk up", "luk down", + "look at mee", "look at mi", "lok left", "lok right", "look write side", "look left side", + "look right side", "look up side", "look down side", "you look left", "you look right", "you look up", + "you look down", "you look me", "robot look left", "robot look up", "look to left", "look to right", + "look on the left", "look on the right", "look in the left", "look at left", "look at right", + "look at up", "look at down", "look the front", "look at front", "see the front", "see left", "see right", + "see up", "see down", "watch the left", "watch the right"] +_KO_LOOK_WAY = ["왼쪽", "오른쪽", "왼편", "오른편", "좌측", "우측", "위", "위쪽", "아래", "아래쪽", "밑", "천장", "바닥", + "땅", "하늘", "정면", "앞", "나", "저", "날", "절", "여기", "이쪽", "레프트", "라이트"] +_KO_PART = {"나": ["", "를", "좀"], "저": ["", "를", "좀"], "날": [""], "절": [""], "여기": ["", "좀"], "이쪽": ["", "을", "으로"]} +_KO_LOOK_VERB = ["봐", "봐 줘", "봐 봐", "봐요", "봐 주세요", "봐 줄래", "봐 줄래요", "봐 주실래요", "봐 주시겠어요", + "보세요", "보십시오", "보시오", "보시게", "보거라", "봐라", "보자", "볼래", "볼래요", "봐 주십시오", + "쳐다봐", "쳐다봐 줘", "쳐다보세요", "쳐다봐 주세요", "쳐다보십시오", "쳐다볼래", "바라봐", "바라봐 줘", + "바라보세요", "바라봐 주세요", "바라보십시오", "봐 보이소", "보이소", "봐 주라", "봐 줘요", "봐줘", + "봐주세요", "쳐다봐줘", "보셈", "봐바", "바바", "봐 주면 좋겠어", "봐 주시면 좋겠어요", "봐 주시기 바랍니다", + "look", "look 해", "look 해 줘", "좀 봐", "좀 봐 줘", "좀 봐 주세요", "한번 봐", "한번 봐 줘", "한번 보세요"] +_KO_LOOK = [] +for _w in _KO_LOOK_WAY: + _side = _w[-1] in "쪽편측" + for _p in _KO_PART.get(_w, ["", "을" if _w[-1] in "쪽편측면앞밑땅장닥늘" else "를"] + ([] if _side else ["쪽", "쪽을"]) + + ["으로" if _w[-1] in "쪽편측면앞밑땅장닥늘" else "로"]): + for _v in _KO_LOOK_VERB: + _KO_LOOK.append(f"{_w}{_p} {_v}") +_KO_LOOK += [f"{h} {w}" for h in ("고개", "고개를", "고개 좀", "머리", "머리를", "얼굴", "얼굴을", "시선", "시선을", "눈") + for w in ("왼쪽으로 돌려", "오른쪽으로 돌려", "왼쪽으로 돌려 줘", "오른쪽으로 돌려 주세요", "들어", "들어 줘", "들어 봐", + "들어 주세요", "드세요", "드십시오", "숙여", "숙여 줘", "숙여 봐", "숙여 주세요", "숙이세요", "숙이십시오", + "올려", "올려 줘", "올려 주세요", "내려", "내려 줘", "내려 주세요", "위로", "아래로", "위로 들어", + "아래로 내려", "정면으로", "정면으로 돌려", "앞으로 돌려 줘", "원위치", "원위치 해 줘", "원래대로 해 줘", + "똑바로 해", "똑바로 해 주세요", "왼쪽으로 돌려 주십시오", "오른쪽으로 돌려 봐", "up", "down", "left", + "right", "up 해 줘", "down 해 줘", "좌측으로 돌려", "우측으로 돌려")] +_KO_LOOK += [f"{w} {v}" for w in ("왼쪽 좀", "오른쪽 좀", "위쪽 좀", "아래쪽 좀", "왼쪽으로 좀", "오른쪽으로 좀", "왼쪽 더", + "오른쪽 더", "위 더", "아래 더", "좀 더 왼쪽", "좀 더 오른쪽", "조금 더 위", "조금 더 아래", + "살짝 왼쪽", "살짝 오른쪽", "살짝 위", "살짝 아래", "왼쪽으로 90 degrees", "오른쪽으로 90 degrees", + "위로 90 degrees", "아래로 90 degrees") + for v in ("봐", "봐 줘", "봐 주세요", "쳐다봐", "보세요", "보십시오")] +_KO_LOOK += [f"{a} {b}" for a in ("시선", "시선 좀", "눈", "눈길", "고개") for b in ("돌려", "돌려 줘", "돌려 주세요", "딴 데로 돌려", + "다른 데로 돌려 줘", "피해 줘")] + \ + [f"{a} {b}" for a in ("딴 데", "다른 데", "딴 곳", "다른 곳", "다른 쪽", "딴 데를", "다른 곳을") for b in ("봐", "봐 줘", "봐 주세요", "보세요", "쳐다봐")] +_MIX_LOOK = [f"{a} {b}" for a in ("left", "right", "up", "down", "front", "왼쪽", "오른쪽", "위", "아래", "정면", "나", "여기") + for b in ("봐", "봐 줘", "봐 주세요", "look", "look 해", "look 해 줘", "쳐다봐", "보세요", "좀 봐", "look please")] + \ + [f"look {a}" for a in ("왼쪽", "오른쪽", "위", "아래", "정면", "나", "여기", "위로", "아래로", "왼쪽으로", "오른쪽으로")] + \ + [f"고개 {a}" for a in ("left", "right", "up", "down", "left 해 줘", "right 해 줘", "up 해", "down 해", "turn 해 줘")] + \ + ["eyes 여기", "eyes on 나", "head up 해 줘", "head down 해 줘", "레프트 봐", "라이트 봐", "레프트 쪽 봐", "라이트 쪽 봐 줘", + "업 봐", "다운 봐", "룩 레프트", "룩 라이트", "룩 업", "룩 다운", "룩 앳 미", "look at 나", "look at 저", "나 좀 look"] + +# ---------------- lift: Lumi's own height ---------------- +_EN_LIFT = _x(["raise yourself", "lift yourself", "raise yourself up", "lift yourself up", "raise your body", + "lift your body", "raise your torso", "lift your torso", "get taller", "grow taller", "make yourself taller", + "stand taller", "stretch up", "go up", "move up", "rise up", "come up", "get higher", "go higher", + "raise your height", "increase your height", "make you taller", "lift up", "elevate yourself", + "lower yourself", "lower yourself down", "lower your body", "lower your torso", "get shorter", + "get smaller", "make yourself shorter", "make yourself smaller", "shrink", "shrink down", "go down", + "move down", "come down", "sink down", "get lower", "go lower", "lower your height", + "decrease your height", "make you shorter", "lift down", "squat down", "crouch down", "drop down"], + ["", "a bit", "a little", "a little bit", "slightly", "1 meter", "by 1 meter", "some more", "a tad", + "all the way", "a notch"]) +_KO_LIFT = _x(["", "좀", "조금", "살짝", "1 meter", "1 meter만", "조금만", "좀 더", "더", "약간", "끝까지"], + ["키", "키를", "몸", "몸을", "높이", "높이를", "리프트", "리프트를", "상체", "상체를", "몸통", "몸통을", "키 좀", + "몸 좀", "자세", "자세를"], + ["올려", "올려 줘", "올려 주세요", "올려 줄래", "올려 주실래요", "올리세요", "올리십시오", "올려 주십시오", + "높여", "높여 줘", "높여 주세요", "높이세요", "높여 주십시오", "키워", "키워 줘", "키워 주세요", + "내려", "내려 줘", "내려 주세요", "내리세요", "내려 주십시오", "낮춰", "낮춰 줘", "낮춰 주세요", + "낮추세요", "낮춰 주십시오", "낮추십시오", "줄여", "줄여 줘", "줄여 주세요", "up", "down", "up 해 줘", + "down 해 줘", "업", "다운", "올려 보이소", "내려 보이소", "낮춰 봐", "높여 봐"]) +_KO_LIFT += _x(["", "좀", "조금", "살짝", "더", "좀 더", "조금만"], + ["커져", "커져 봐", "커져 줘", "커지세요", "커져 주세요", "커지십시오", "작아져", "작아져 봐", "작아져 줘", + "작아지세요", "작아져 주세요", "작아지십시오", "높아져", "높아져 봐", "낮아져", "낮아져 봐", "낮아져 주세요", + "위로 올라가", "위로 올라가 줘", "위로 올라가 주세요", "아래로 내려가", "아래로 내려가 줘", "아래로 내려가 주세요", + "올라가 봐", "내려가 봐", "몸 위로", "몸 아래로", "키 크게", "키 작게", "키 높게", "키 낮게", "쭉 올라가", + "쭉 내려가"]) +_MIX_LIFT = [f"{a} {b}" for a in ("body", "lift", "height", "키", "몸", "리프트", "몸을", "키를") + for b in ("up", "down", "올려", "내려", "up 해 줘", "down 해 줘", "올려 줘", "내려 줘", "높여", "낮춰", + "좀 up", "좀 down", "up please", "down please")] + \ + ["you make body high", "you make body low", "you body up", "you body down", "body go up", "body go down", + "make tall", "make short", "you be tall", "you be short", "taller 해 줘", "shorter 해 줘", "키 taller", + "lift up 해 줘", "lift down 해 줘", "리프트 업", "리프트 다운", "몸 업", "몸 다운", "키 업", "키 다운"] + +# ---------------- turn: the base on the spot ---------------- +_EN_TURN = _x(["turn", "rotate", "spin", "pivot", "swivel", "turn yourself", "turn your body", "rotate yourself", + "rotate your body", "spin yourself", "make a turn", "do a turn", "swing", "turn your whole body"], + ["left", "right", "to the left", "to the right", "to your left", "to your right", "leftward", + "rightward", "towards the left", "towards the right"], + ["", "90 degrees", "by 90 degrees", "a bit", "a little"]) +_EN_TURN += _x(["turn", "rotate", "spin", "pivot", "turn yourself", "rotate yourself"], + ["90 degrees left", "90 degrees right", "90 degrees to the left", "90 degrees to the right", + "90 degrees to your left", "90 degrees to your right", "left 90 degrees", "right 90 degrees"]) +_EN_TURN_HAND = ["turn around", "turn yourself around", "turn back around", "spin around", "spin round", "about face", + "do an about face", "do a u-turn", "make a u-turn", "u-turn", "face the other way", "face the opposite way", + "turn the other way", "turn to face the other way", "turn your back", "rotate 90 degrees", "spin 90 degrees", + "do a 180", "do a ninety to the left", "do a ninety to the right", "hang a left", "hang a right", + "take a left", "take a right", "make a left", "make a right", "left turn", "right turn", "turn lef", + "turn rite", "tern left", "tern right", "trun left", "trun right", "you turn left", "you turn right", + "robot turn left", "body turn left", "body turn right", "spin all the way around", "do a full circle", + "do a full spin", "spin a full circle", "turn all the way around", "do a 360", "turn 360 degrees", + "face left", "face right", "face to the left", "face to the right", "face your left", "face your right", + "face left, robot", "face right please", "turn and face left", "turn and face right", + "turn your body to face right", "turn to face the left"] +_KO_TURN = _x(["왼쪽으로", "오른쪽으로", "좌측으로", "우측으로", "왼편으로", "오른편으로", "왼쪽으로 90 degrees", + "오른쪽으로 90 degrees", "왼쪽으로 좀", "오른쪽으로 좀", "왼쪽으로 살짝", "오른쪽으로 살짝", "왼쪽", "오른쪽", + "90 degrees 왼쪽으로", "90 degrees 오른쪽으로"], + ["돌아", "돌아 줘", "돌아 봐", "돌아요", "돌아 주세요", "돌아 줄래", "돌아 주실래요", "도세요", "도십시오", + "돌아 주십시오", "회전해", "회전해 줘", "회전해 주세요", "회전하세요", "회전하십시오", "회전", "몸 돌려", + "몸 돌려 줘", "몸을 돌려 주세요", "몸을 돌리십시오", "방향 바꿔", "방향 바꿔 줘", "방향을 바꿔 주세요", + "방향 바꾸세요", "방향 틀어", "방향 틀어 줘", "틀어", "틀어 줘", "꺾어", "꺾어 줘", "돌아 보이소", "돌아라", + "돌아서", "돌아서 줘", "turn", "turn 해", "turn 해 줘", "턴", "턴 해 줘", "돌아조", "도라"]) +_KO_TURN += ["뒤로 돌아", "뒤로 돌아 줘", "뒤로 돌아 주세요", "뒤로 도세요", "뒤로 도십시오", "뒤돌아", "뒤돌아 줘", + "뒤돌아 주세요", "뒤돌아서", "돌아서", "돌아서 주세요", "반대로 돌아", "반대쪽으로 돌아", "반대 방향으로 돌아 줘", + "반대쪽으로 방향 바꿔", "유턴", "유턴해", "유턴 해 줘", "유턴하세요", "한 바퀴 돌아", "한 바퀴 돌아 줘", + "한 바퀴 돌아 주세요", "제자리에서 한 바퀴 돌아", "빙글 돌아", "한 바퀴 빙 돌아", "좌회전", "우회전", "좌회전해", + "우회전해", "좌회전 해 주세요", "우회전 해 주세요", "턴 레프트", "턴 라이트", "레프트로 돌아", "라이트로 돌아", + "left로 돌아", "right로 돌아", "left 턴", "right 턴", "turn left 해 줘", "turn right 해 줘"] + +# ---------------- move: a short straight drive ---------------- +_EN_MOVE = _x(["move", "go", "drive", "roll", "step", "scoot", "shift", "slide", "inch", "get", "come", "head"], + ["forward", "forwards", "ahead", "back", "backward", "backwards", "to the left", "to the right", + "to your left", "to your right", "left", "right", "straight ahead"], + ["", "a bit", "a little", "a little bit", "1 meter", "by 1 meter", "a few steps", "one step", "two steps", + "a tiny bit", "slightly"]) +_EN_MOVE = [t for t in _EN_MOVE if t not in ("go ahead", "go straight ahead", "head forward") and not t.startswith(("come left", "come right", "come to the", "come to your", "head left", + "head right", "get left", "get right", "head back", "get back", + "go back", "come back", "head to the", "head to your"))] +_EN_MOVE += _x(["move", "go", "drive", "roll"], ["1 meter forward", "1 meter back", "1 meter backward", + "1 meter to the left", "1 meter to the right", "1 meter ahead", + "1 meter left", "1 meter right"]) +_EN_MOVE_HAND = ["back up", "back up a bit", "back up a little", "back up 1 meter", "back off a bit", "reverse a bit", + "reverse 1 meter", "step back a little", "take a step back", "take a step forward", "take two steps back", + "take one step to the left", "take one step to the right", "scooch over to the left", "scooch to the right", + "move over to the left a bit", "move over to the right a bit", "give me some room, back up", + "make some room, move back", "you move forward", "you go back 1 meter", "you move left", "robot go forward", + "go straight a bit", "go straight 1 meter", "move straight ahead 1 meter", "move fwd", "move forword", + "moov back", "bak up", "go bakwards", "mov left", "mov right"] +_KO_MOVE = _x(["앞으로", "뒤로", "왼쪽으로", "오른쪽으로", "좌측으로", "우측으로", "앞쪽으로", "뒤쪽으로"], + ["", "좀", "조금", "조금만", "살짝", "1 meter", "1 meter만", "한 걸음", "두 걸음", "반 걸음", "한 발짝", + "약간", "쪼끔"], + ["가", "가 줘", "가 봐", "가요", "가 주세요", "가세요", "가십시오", "가 주십시오", "가 줄래", "가 주실래요", + "이동해", "이동해 줘", "이동해 주세요", "이동하세요", "이동하십시오", "이동해 주십시오", "움직여", + "움직여 줘", "움직여 주세요", "움직이세요", "와", "와 줘", "와 주세요", "가라", "가 보이소", "가이소", + "go", "go 해", "move", "move 해 줘", "가조", "가 쥬"]) +_KO_MOVE += _x(["뒤로", "좀", "조금", "뒤로 좀", "뒤로 조금", "뒤로 1 meter"], + ["물러나", "물러나 줘", "물러나 주세요", "물러서", "물러서 주세요", "물러나십시오", "빠져", "빠져 줘", + "빠져 주세요", "후진해", "후진해 줘", "후진해 주세요", "후진하십시오", "비켜", "비켜 줘", "비켜 주세요"]) +_KO_MOVE += _x(["왼쪽으로", "오른쪽으로", "옆으로"], ["비켜", "비켜 줘", "비켜 주세요", "비키세요", "비켜 주십시오"]) +_KO_MOVE = [t for t in _KO_MOVE if not t.startswith("옆으로")] +_MIX_MOVE = [f"{a} {b}" for a in ("forward로", "back으로", "left로", "right로", "forward", "back", "앞으로", "뒤로", + "왼쪽으로", "오른쪽으로") + for b in ("가", "가 줘", "이동", "이동해 줘", "move", "move 해", "go", "go 해 줘", "1 meter 가", "좀 가")] + \ + ["back 해", "back 해 줘", "back up 해 줘", "후진 please", "앞으로 move please", "move forward 해 줘", + "move back 해 줘", "move left 해 줘", "move right 해 줘", "포워드", "포워드로 가", "백으로 가", "백 해 줘"] + +# ---------------- go_to: a marker on the map ---------------- +_EN_GO = _x(["go", "head", "drive", "move", "walk", "roll", "get", "make your way", "proceed", "travel", "hurry", + "navigate", "go on over", "head on over", "get yourself", "take yourself", "run", "go straight", "zip"], + ["to ", "over to ", "on to ", "to now", "to right now", + "to please", "to for me", "to real quick", "back to "]) +_EN_GO += _x([""], ["please", "now", "go", "go now", "let's go", "lumi", "right now", "next", "is where you go", + "is your next stop", "go there", "head there", "move there"]) +_EN_GO_HAND = ["to please", "to , now", "off to ", "off you go to ", "next stop, ", + "your next stop is ", "can you get to ", "could you head to ", "would you go to ", + "please head to now", "i need you at now", "go to . right now, not later", + "go to , right now", "go to immediately", "go to asap", "go to quick", + "go to , yes, now", "go to the ", "go to point", "go to point ", + "go to marker ", "drive to the marker", "you go ", "you go to ", + "robot go ", "go please", "go too ", "go two ", "goto ", + "go to da ", "go now", "move to spot", "please you go ", "you go", + " go please", " you go", "go stand at ", "go wait at ", "go and stay at ", + "go to and wait there", "can you take me to ", "show me the way to ", + "guide me to ", "lead me to ", "lead the way to ", "take me to please"] +_KO_GO = _x(["로", "으로", "에", "까지", " 쪽으로", " 앞으로", "", + "로 좀", "까지 좀", "로 얼른", "로 빨리", "로 지금", "로 당장"], + ["가", "가 줘", "가 봐", "가요", "가 주세요", "가세요", "가십시오", "가 주십시오", "가 줄래", "가 줄래요", + "가 주실래요", "가 주시겠어요", "가 주시겠습니까", "가 줄 수 있어", "가 줄 수 있어요", "가 주실 수 있나요", + "이동해", "이동해 줘", "이동해 주세요", "이동하세요", "이동하십시오", "이동해 주십시오", "이동", "이동 부탁해", + "이동 부탁드려요", "이동 부탁드립니다", "가 주라", "가라", "가거라", "가자", "갑시다", "가시죠", "가 보이소", + "가이소", "가 보소", "가 보랑께", "가 봐라", "가 주면 좋겠어", "가 주시면 좋겠어요", "가 주시면 감사하겠습니다", + "가 줬으면 좋겠어", "출발", "출발해", "출발해 줘", "출발하세요", "출발하십시오", "go", "go 해", "go 해 줘", + "move", "move 해 줘", "고", "고고", "가조", "가 쥬", "가셈", "가 줘요", "가 주쇼", "가 주이소"]) +_KO_GO = [t for t in _KO_GO if not (t.startswith(" ") and t.split(" ", 1)[1] in ("고", "move"))] +_KO_GO += ["로 안내해 줘", "로 안내해 주세요", "까지 안내해 주십시오", "로 데려다 줘", + "로 나 데려다 줘", "로 저 데려다 주세요", "로 가자고", "로 가라고", " 가야 돼", + "로 가야 해", "로 가야 돼요", "로 가 볼까", "로 가 볼래", " 쪽으로 가 볼래요", + "지금 로 가", "당장 로 가", "얼른 로 가 줘", "빨리 로 이동해", "루미 로 가", + "로 이동 바랍니다", "로 가 주시기 바랍니다", "로 가 주셨으면 해요", "까지 가 볼래", + "로 가 주라 마", "로 퍼뜩 가", "로 언능 가", "로 싸게 가", "로 가랑께"] + +# ---------------- come / follow / come_back ---------------- +_EN_COME = _en(["come here", "come over here", "come to me", "come closer", "come over", "come this way", + "get over here", "come on over", "come on over here", "come near me", "come up to me", "come by me", + "come towards me", "approach me", "move closer to me", "roll over here", "drive over to me", + "come to where i am", "come to my side", "come stand by me", "come a bit closer", "come right here", + "come to me now", "over here", "come over to me", "come here to me", "come here quickly"], 0.35) +_KO_COME = _x(["이리", "이리로", "일로", "일루", "여기로", "여기", "이쪽으로", "나한테", "저한테", "제게", "내 쪽으로", + "제 쪽으로", "내 옆으로", "제 옆으로", "가까이", "좀 더 가까이", "이리 좀", "여기로 좀", "이쪽으로 좀", + "가까이 좀", "여기까지"], + ["와", "와 줘", "와 봐", "와요", "와 주세요", "오세요", "오십시오", "와 주십시오", "와 줄래", "와 줄래요", + "와 주실래요", "와 주시겠어요", "와라", "오너라", "와 보이소", "오이소", "온나", "와 주라", "와 봐요", + "와 줘요", "오셈", "와조", "come", "come 해", "와 please"]) +_EN_FOLLOW = _en(["follow me", "come with me", "come along with me", "walk with me", "tag along", "tag along with me", + "stay with me", "keep up with me", "stick with me", "stay behind me", "walk behind me", + "follow behind me", "follow my lead", "keep following me", "follow me around", "go where i go", + "come after me", "follow us", "come with us", "walk alongside me", "stay close to me", + "keep close behind me", "shadow me", "follow along", "follow me this way", "follow me over there", + "accompany me", "escort me"], 0.4) +_KO_FOLLOW = _x(["", "나", "날", "나를", "저", "저를", "절", "우리", "뒤에서", "천천히", "잘", "계속", "얼른", "나 좀", + "저 좀", "제 뒤를"], + ["따라와", "따라와 줘", "따라와 봐", "따라와요", "따라와 주세요", "따라오세요", "따라오십시오", + "따라와 주십시오", "따라올래", "따라올래요", "따라와 주실래요", "따라와 주시겠어요", "따라와라", + "따라오너라", "따라온나", "따라오이소", "따라오소", "따라와 보이소", "따라다녀", "따라다녀 줘", + "따라다니세요", "쫓아와", "쫓아와 줘", "follow 해", "follow 해 줘", "팔로우 해", "팔로우 해 줘", + "따라와조", "따라 와", "따라 오세요"]) +_KO_FOLLOW += _x(["", "나랑", "저랑", "저와", "나하고", "우리"], + ["같이 가자", "같이 가", "같이 가요", "같이 가 줘", "같이 가 주세요", "같이 가시죠", "같이 걸어", + "같이 걸어요", "같이 걸어가자", "함께 가자", "함께 가요", "함께 가시죠", "함께 걸어요"]) +_EN_BACK = _en(["come back", "come back to your spot", "go back to where you were", "go back to your spot", + "return to your spot", "return to where you were", "return to your starting point", + "go back to the start", "go back to where you started", "head back to where you were", + "back to where you were", "back to your spot", "go back where you came from", "return to your place", + "get back to your spot", "go back to your old spot", "come back to where you started"], 0.4) +_KO_BACK = _x(["", "다시", "원래 자리로", "제자리로", "아까 그 자리로", "아까 있던 데로", "처음 자리로", "원래 있던 곳으로", + "원래 위치로", "출발한 곳으로", "있던 자리로"], + ["돌아와", "돌아와 줘", "돌아와 봐", "돌아와요", "돌아와 주세요", "돌아오세요", "돌아오십시오", + "돌아와 주십시오", "돌아가", "돌아가 줘", "돌아가 주세요", "돌아가세요", "돌아가십시오", "복귀해", + "복귀해 주세요", "복귀하십시오", "돌아온나", "돌아오이소", "come back 해 줘", "도라와"]) +_KO_BACK = [t for t in _KO_BACK if not (t.startswith("다시 돌아가") or t in ("돌아가", "돌아가 줘", "돌아가 주세요", + "돌아가세요", "돌아가십시오"))] + +# ---------------- no: sounds like a motion, asks for none ---------------- +_NO = [ + # looks / seeing / talk about looks + "you look tired", "you look great today", "you look cute", "you look happy", "looks good to me", "that looks nice", + "the booth on the left looks nice", "it looks like rain", "look who's here", "look, it's not a big deal", + "look, i'm just saying hi", "i'm looking forward to the talk", "i looked everywhere", "i'll look it up later", + "look it up later", "look before you leap", "look both ways before crossing", "he looks down on robots", + "she turned her head left", "my mom is on the left", "the restroom is on the right", "the exit is up ahead", + "what's on your left?", "what's on your right?", "can you see what's on your right?", "what do you see on the left?", + "what's above you?", "what's behind you?", "where are you looking?", "why are you looking at me?", + "did you just look at me?", "how far can your head turn?", "can your head turn all the way around?", + "can you turn your head?", "how high can you go?", "how tall are you?", "how tall can you get?", + "how far can you drive?", "how fast can you move?", "can you move?", "do you have wheels?", "can you walk?", + "왼쪽에 뭐 있어?", "오른쪽에 뭐가 보여?", "오른쪽에 뭐 있는지 보여?", "위에 뭐 있어?", "뒤에 뭐 있어?", "뭐 보고 있어?", + "어디 보고 있어?", "왜 나 쳐다봐?", "고개 몇 도까지 돌아가?", "고개 얼마나 돌아가?", "키가 몇이야?", "키 커 보인다", + "너 키 크다", "몸 괜찮아?", "높이가 얼마야?", "얼마나 빨리 움직여?", "바퀴 있어?", "걸을 수 있어?", "오늘 멋져 보여", + "피곤해 보여", "이 부스 괜찮아 보이네", "화장실은 오른쪽에 있어요", "출구는 왼쪽이에요", "엄마 이거 봐", "여기 봐 봐 엄마", + # someone else, later, past, quoting + "kids, look at the robot", "mina, look up, there's a balloon", "he said look left and you'll see the booth", + "so when i say now, look left", "look left later, when the guests arrive", "after the speech, look at the audience", + "i turned left at the corner", "turn left at the corner to find the restroom", "go straight and turn right for the exit", + "we went back home", "back in my day", "i'll be back", "i'm going to the stage later", "i'll go to the booth later", + "where is the stage?", "is the stage far?", "how do i get to the stage?", "which way is the exit?", + "저 왼쪽으로 갈게요", "제가 뒤로 좀 갈게요", "제가 거기로 갈게요", "음, 저 포토 존으로 갈게요", "우리 이제 집에 가자", + "나 먼저 갈게", "이따가 갈게", "다음에 또 올게", "화장실 어디예요?", "무대는 어디야?", "출구까지 멀어?", + "어떻게 가요?", "모퉁이에서 왼쪽으로 도세요", "직진하다가 오른쪽으로 꺾으면 돼요", "엘리베이터 타고 올라가세요", + # other senses of the verbs + "take the lift to the second floor", "where's the lift?", "lift는 어디 있어요?", "엘리베이터 어디야?", + "turn the music up", "turn up the volume", "turn down the music", "turn it down", "turn off the light", + "follow the signs", "follow up later", "i follow you on instagram", "follow us on instagram", + "come on!", "come on, really?", "oh come on", "come back later", "come again?", "how come?", + "move on to the next topic", "let's move on", "i'm moving to busan next month", "that movie moved me", + "go ahead and tell me", "go on, tell me more", "how's it going?", "what's going on?", "the show must go on", + "stand up for yourself", "cheer up", "hurry up and answer", "turn the page", "it's your turn", "whose turn is it?", + "go around", "go around it", "go round", "walk around", "look around", "go around the booth", "돌아다녀", "둘러봐", + "go ahead", "go ahead, tell me", "go ahead and ask", "go ahead, i'm listening", "go on then", + "음악 좀 올려 줘", "볼륨 올려", "소리 키워", "소리 좀 줄여", "목소리 키워 줘", "불 꺼 줘", "인스타 팔로우 해 주세요", + "다음 주제로 넘어가자", "부산으로 이사 가요", "이야기 계속해", "잘 지내?", "무슨 일이야?", "네 차례야", + # ability and conditions + "can you look up?", "are you able to look up at the ceiling?", "is it possible for you to turn around?", + "do you know how to follow people?", "can you follow people?", "can you come to me if i call?", + "if i call you, come here", "when i wave, come to me", "when the show starts, go to the stage", + "after lunch go to the booth", "if someone comes, look at them", "고개 돌릴 수 있어?", "따라올 수 있어?", + "부르면 와 줄 수 있어?", "나중에 무대로 가", "이따가 나 봐", "신호 주면 위 봐", "근데 나중에 왼쪽 봐", + "쇼 시작하면 무대로 가", "밥 먹고 나서 부스로 가", + # the person's own body, reported speech + "can you lift me up?", "lift me up", "pick me up", "carry me", "can you carry me?", "lift my bag", "나 들어 올려 줘", + "나 안아 줘", "나 업어 줘", "저 좀 들어 주세요", "루미가 로 간대", "로 간대", "로 간다고 했어", + "루미가 로 간다고 했어요", "로봇이 로 간대요", "lumi is going to ", "lumi said it's going to ", + "the robot is going to ", "he's going to ", "they went to ", + "로봇이 따라온대", "루미가 우리 따라온대", "루미가 돌아온대", "the robot will follow us", "lumi is coming back", +] + +INTENT = { + "look": _en(_EN_LOOK, 0.05, _EN_LOOK_HAND) + _pick(_KO_LOOK, 0.1) + _MIX_LOOK, + "lift": _en(_EN_LIFT, 0.04) + _pick(_KO_LIFT, 0.1) + _MIX_LIFT, + "turn": _en(_EN_TURN, 0.04, _EN_TURN_HAND) + _pick(_KO_TURN, 0.5), + "move": _en(_EN_MOVE, 0.02, _EN_MOVE_HAND) + _pick(_KO_MOVE, 0.06) + _MIX_MOVE, + "go_to": _en(_EN_GO, 0.06, _EN_GO_HAND) + _pick(_KO_GO, 0.15), + "come": _EN_COME + _pick(_KO_COME, 0.3), + "follow": _EN_FOLLOW + _pick(_KO_FOLLOW, 0.3), + "come_back": _EN_BACK + _pick(_KO_BACK, 0.5), + "no": _NO, +} + +if __name__ == "__main__": + for k, v in INTENT.items(): + print(f"{k:10} {len(v)}") + print("total", sum(map(len, INTENT.values()))) diff --git a/assistant/bank_words/questions.py b/assistant/bank_words/questions.py new file mode 100644 index 0000000..6bdbe4a --- /dev/null +++ b/assistant/bank_words/questions.py @@ -0,0 +1,451 @@ +"""Questions about Lumi for assistant/quick_answers.py: more wordings of its kinds (QUICK), a few new kinds with +their answers (QUICK_KINDS) and more "no" wordings (things that sound alike but are not about Lumi itself). +English, Korean (반말 / 해요체 / 하십시오체, dialect, Konglish, whisper slips) and mixed. Every answer is a fact of +knowledge/lumi_about_en.md; keep them in step. +""" + + +def _ko(stems, ends): + """Every stem with every ending: _ko(["이름이 뭐"], ["야", "예요"]) -> ["이름이 뭐야", "이름이 뭐예요"].""" + return [s + e for s in stems for e in ends] + + +QUICK = { + "name": [ + "what's your name again", "could you tell me your name", "what name do you go by", "what do people call you", + "what are you named", "what is ur name", "whats your name robot", "robot what is your name", "your name is", + "name?", "what's the name of this robot", "what's this robot called", "what is this robot called", + "what do we call you", "how should i call you", "what should we call you", "do you have a name robot", + "have you got a name", "tell me your name please", "can i know your name", "may i ask your name", + "what's ur name", "wats ur name", "what your name", "what's you name", "what is you name", "whats yor name", + "what's your nam", "lumi is that your name", "is your name lumi", "are you lumi", "is this lumi", + "your name please robot", "hey robot what's your name", "name of the robot", + "니 이름", "네 이름", "너 이름", "너의 이름은", "너 이름은 뭐야", "니 이름은 뭐니", + "이름이 뭐니", "이름이 뭐냐", "이름이 뭐임", "이름이 뭐여", "이름 뭐임", "이름 머야", "이름 모야", "이름 뭐예요", + "이름이 뭐에요", "이름이 무엇입니까", "이름이 무엇인가요", "이름이 어떻게 되세요", "이름이 어떻게 되니", "이름이 어떻게 돼", + "이름이 어떻게 되십니까", "존함이 어떻게 되세요", "이름 좀 알려 줘", "이름 좀 알려 주세요", "이름 알려 줄래", "이름 말해 줘", + "이름 말해 주세요", "이름 좀 가르쳐 줘", "이름을 알려 주시겠어요", "이름이 있어", "이름 있니", "이름이 있나요", + "로봇 이름이 뭐야", "로봇 이름이 뭐예요", "이 로봇 이름 뭐야", "로봇아 이름이 뭐야", "로봇 이름 알려 주세요", + "얘 이름이 뭐야", "얘는 이름이 뭐예요", "쟤 이름이 뭐야", "이 친구 이름이 뭐예요", "이 아이 이름은 뭐예요", + "뭐라고 불러", "뭐라고 불러야 돼", "뭐라고 부르면 될까요", "어떻게 부르면 돼요", "널 뭐라고 부르면 돼", + "이름이 뭐라꼬", "이름이 뭐꼬", "니 이름 뭐꼬", "이름이 뭐시여", "이름이 뭣이여", "이름이 뭐래요", "이름이 뭐라고요", + "이름이 뭐라고", "니 이름이 뭐고", "니 이름 뭐라카노", "이름이 뭐당가", "이름이 뭐요", + "루미가 네 이름이야", "네 이름이 루미야", "너 루미야", "루미 맞아요", "니가 루미야", + "what's your 이름", "your name이 뭐야", "너 name이 뭐야", "네임이 뭐예요", "니 네임 뭐야", "name 알려 줘", + "이름 what", "what is 너의 이름", + ], + "name_meaning": [ + "what does the name lumi mean", "why lumi", "why are you named lumi", "why is your name lumi", + "where does your name come from", "how did you get your name", "who gave you your name", "who named you", + "what's the meaning of lumi", "what is the meaning behind your name", "is lumi a word", "does lumi mean anything", + "lumi means what", "what does lumi stand for", "where did the name lumi come from", "why did they call you lumi", + "루미 뜻이 뭐예요", "루미는 무슨 뜻이야", "루미가 무슨 의미예요", "루미 의미가 뭐야", "이름 뜻이 뭐야", "이름 뜻이 뭐예요", + "이름에 무슨 뜻이 있어요", "이름이 무슨 의미예요", "왜 루미라고 지었어요", "왜 이름이 루미야", "루미라는 이름은 왜 지었어요", + "이름은 누가 지었어", "이름은 누가 지어 줬어요", "이름 누가 지어 줬어", "루미는 무슨 말이에요", "루미 어디서 나온 이름이야", + "루미가 뭔 뜻이고", "루미 뜻이 뭐꼬", "루미 meaning이 뭐야", "lumi 무슨 뜻이야", "루미 무슨 뜻", + ], + "who": [ + "who are you exactly", "who are you robot", "and who are you", "tell me who you are", "say who you are", + "can you introduce yourself", "could you introduce yourself", "please introduce yourself", "introduce yourself please", + "introduce yourself to us", "give us an introduction", "tell us about yourself", "say something about yourself", + "what are you supposed to be", "what kind of machine are you", "what type of robot are you", "what sort of robot are you", + "what kind of robot is this", "what's this machine", "what is this machine", "what robot is this", "who is this", + "what is this robot for", "what is your purpose", "what's your role here", "what is your role", "why are you here", + "what's your job here", "who r you", "who are yu", "who ar you", "hu are you", "who are you lumi", + "누구니", "누구세요", "누구십니까", "누구신가요", "너는 누구야", "넌 누구야", "당신 누구예요", "넌 뭐니", "너는 뭐야", + "너 정체가 뭐야", "정체가 뭐예요", "넌 정체가 뭐니", "무슨 로봇이에요", "무슨 로봇이야", "어떤 로봇이야", "어떤 로봇입니까", + "이 로봇 뭐야", "이 로봇은 뭐예요", "이건 무슨 로봇이에요", "이 로봇은 무슨 로봇이에요", "이거 무슨 로봇이야", "얘는 뭐야", + "얘 뭐예요", "얘는 무슨 로봇이에요", "로봇이 뭐 하는 거예요", "넌 뭐 하는 로봇이니", "넌 여기서 뭐 해", "여기서 뭐 하는 거야", + "자기소개", "자기소개 해 주세요", "자기소개 좀 해 줘", "자기소개 부탁해요", "자기소개 부탁합니다", "자기소개 해 주실래요", + "자기소개 해 줄래", "소개 좀 해 주세요", "너 소개 좀 해 줘", "너에 대해 알려 줘", "너에 대해 말해 줘", "본인 소개 해 주세요", + "자기 소개 좀 해 보세요", "니 소개 좀 해 봐라", "니는 누고", "누꼬", "니 뭐꼬", "너 뭐여", "너 누구여", "뉘시오", + "who are you 루미", "너 who야", "self introduction 해 줘", "자기소개 please", "introduce 해 줘", "너 뭐 하는 robot이야", + ], + "age": [ + "how old are you lumi", "what age are you", "how old r you", "how old are u", "how old ru", "hao old are you", + "how ole are you", "how old are you now", "how old are you robot", "how old is the robot", "what's the robot's age", + "how many years have you been around", "how long have you existed", "when were you created", "when were you first made", + "when did you come out", "when were you manufactured", "what year were you made", "what year were you born", + "are you a new robot", "are you a new model", "you're how old", + "age?", "how young are you", + "몇 살", "몇 살이니", "몇 살이냐", "몇 살임", "몇 살이에요", "몇 살이세요", "몇 살입니까", "몇 살인가요", "몇 살이야 너", + "너 몇 살이니", "너는 몇 살이야", "니 몇 살이야", "네 나이가 몇이야", "나이가 몇이에요", "나이가 어떻게 되니", "나이가 어떻게 돼", + "나이 어떻게 되세요", "나이가 몇 살이에요", "나이 몇이야", "나이 알려 줘", "나이가 궁금해요", "올해 몇 살이야", "올해 몇 살이에요", + "태어난 지 얼마나 됐어", "태어난 지 얼마나 됐어요", "언제 태어났어요", "언제 태어났니", + "만들어진 지 얼마나 됐어", "만들어진 지 얼마나 됐어요", "만든 지 몇 년 됐어요", "언제 만들어졌니", "언제 만들어졌습니까", + "몇 년생이야", "몇 년생이에요", "몇 년 됐어", "몇 년 된 로봇이에요", "이 로봇 몇 년 됐어요", "로봇 나이가 몇이에요", + "멫 살이고", "몇 살이고", "몇 살이여", "몇 살이당가", "몇 살이유", "몇 살이오", "니 몇 살이가", "나이가 우째 되노", + "how old 이야", "너 몇 years old야", "age 몇이야", "몇 살 how old", "너 나이 how many", + ], + "maker": [ + "who made this robot", "who built this robot", "who created this robot", "who developed this robot", + "who's your developer", "who is your developer", "who are your developers", "who's your manufacturer", + "who manufactured you", "who makes you", "who produced you", "who invented you", "who is your creator", + "who's behind you", "which company developed you", "which company created you", "what company created you", + "what company developed you", "which company are you from", "what company do you belong to", "made by which company", + "where were you made", "where were you built", "where were you developed", "where are you made", "where did you come from", + "who made u", "who mad u", "who maid you", "hoo made you", "who build you", "who maked you", "who made ya", + "누가 만들었니", "누가 만들었냐", "누가 만들었습니까", "누가 만든 거야", "누가 만든 거예요", "누가 만든 로봇이에요", + "누가 너를 만들었어", "누가 너를 만들었어요", "너는 누가 만들었니", "넌 누가 만들었어", "누가 개발했어", "누가 개발했니", + "누가 개발했습니까", "누가 개발한 로봇이에요", "개발자가 누구야", "개발자가 누구예요", "개발사가 어디예요", "개발사가 어디야", + "제조사가 어디야", "제조사는 어디예요", "제조사가 어디입니까", "만든 회사가 어디야", "만든 회사가 어디예요", "만든 회사 어디", + "어느 회사 거야", "어느 회사 거예요", "어디 회사 거야", "어디 회사 거예요", "어디 제품이야", "어디 제품이에요", "어디 꺼야", + "어느 회사 제품이에요", "어느 회사에서 개발했어요", "어디서 개발했어", "어디서 개발했어요", "어디서 만든 거야", "어디서 만들었니", + "어디서 만들어졌어요", "너 어느 회사 소속이에요", "넌 어디 소속이니", "어디 소속이에요", "누구 거야", "주인이 누구야", + "누가 만들었노", "누가 맹글었어", "누가 만들었드나", "누가 만들었당가", "누가 만들었슈", "누가 만들었소", "누가 맹근 거여", + "누가 만들었는교", "어데서 만들었노", "어데 회사고", + "who made 너", "who developed 너", "누가 만들었어 who", "maker가 누구야", "제조사 who", "누가 develop 했어", + "어느 company야", "company 어디야", "너 어느 company에서 만들었어", "made in 어디야", + ], + "height": [ + "how tall are you lumi", "how tall r you", "how tall are u", "how tal are you", "hou tall are you", "what is your height", + "what's your height in cm", "what is your height in centimeters", "how many centimeters tall are you", + "how many cm are you", "how high is this robot", "how tall is the robot", "what's the robot's height", + "how big are you", "are you tall", "how tall do you get", "what's your size", "how tall exactly are you", + "키 몇", "키 몇이야", "키 몇이니", "키 몇이에요", "키가 몇이니", "키가 몇이세요", "키가 몇입니까", + "키가 얼마나 되니", "키가 어떻게 돼", "키가 어떻게 돼요", "키가 어떻게 되세요", "키 몇 센티야", "키 몇 센티니", "키가 몇 센티예요", + "키가 몇 센티미터예요", "키가 몇 cm예요", "키 몇 cm야", "몇 센티야", "몇 센티예요", "키 얼마나 돼", "키 얼마나 돼요", + "키가 얼마나 커", "키가 얼마나 커요", "신장이 몇이에요", "너 키가 몇이야", "니 키 몇이고", "니 키가 얼마고", "키가 우째 되노", + "키 몇이여", "키가 몇이당가", "로봇 키가 몇이야", "이 로봇 키는 몇이에요", "키 알려 줘", "키 알려 주세요", + "how tall 이야", "키 how tall", "your height 몇이야", "너 height가 얼마야", "키 몇 centi야", + ], + "weight": [ + "how heavy are you lumi", "what do you weigh", "how much do you weight", "how many kilos are you", + "how many kg do you weigh", "how many kilograms do you weigh", "what's your weight in kg", "how heavy is the robot", + "how much does this robot weigh", "how much does the robot weigh", "how heavy r you", "are you very heavy", + "몸무게 몇이야", "몸무게가 몇이에요", "몸무게 얼마나 돼요", "몸무게가 어떻게 되세요", "무게가 몇이야", + "무게가 몇이에요", "무게 몇 킬로예요", "몇 킬로그램이에요", "몇 kg이에요", "몇 키로야", "몇 키로나 나가", "무게 얼마나 나가", + "무게가 얼마나 나가요", "너 무거워", "무거워요", "많이 무거워요", "무게가 어떻게 돼요", "이 로봇 무게가 몇이에요", + "로봇 무게 몇 킬로예요", "몇 키로고", "무게가 우째 되노", "몇 키로여", "your weight 몇이야", "너 몇 kg이야", "weight가 얼마야", + ], + "battery_life": [ + "how long does the battery last", "how long does your battery last on a charge", "how many hours can you run", + "how many hours can you work", "how long can you operate", "how long can you keep going", "how long do you run for", + "what's your battery life like", "what is your battery life", "how long is your battery life", "battery life", + "how long can you stay on", "how long can you run without charging", "how long until you need charging", + "how long until your battery dies", "how long do your batteries last", "how many hours on one charge", + "how long can you last", "how long can you work for", "does your battery last long", + "배터리 몇 시간 가요", "배터리 몇 시간 쓸 수 있어", "배터리 몇 시간 써요", "배터리가 얼마나 가요", "배터리가 얼마나 오래 가요", + "배터리 얼마나 오래 가", "배터리 지속 시간이 몇 시간이에요", "배터리 몇 시간 버텨요", "한 번 충전으로 얼마나 가요", + "한 번 충전으로 몇 시간 가", "충전하면 몇 시간 가", "충전하면 얼마나 써요", "완충하면 몇 시간 가요", "완충하면 얼마나 가", + "몇 시간 동안 움직일 수 있어요", "몇 시간 동안 일할 수 있어", "몇 시간 일해요", "하루 종일 일할 수 있어요", "얼마나 오래 일할 수 있어요", + "배터리 몇 시간이에요", "배터리 사용 시간이 얼마예요", "배터리 몇 시간 가노", "배터리 얼마나 가노", "배터리 몇 시간 가유", + "battery 몇 시간 가", "배터리 life가 얼마야", "battery 얼마나 가요", "배터리 how long", + ], + "languages": [ + "which languages can you speak", "what languages do you know", "do you know english", "do you know korean", + "do you know chinese", "can you understand korean", "can you understand chinese", "can you understand spanish", + "do you speak spanish", "do you speak french", "do you speak german", "can you speak russian", "do you speak uzbek", + "can you talk in korean", "can you talk in english", "speak english", "english ok", "do you understand korean", + "is english okay", "can i talk to you in english", "can i speak korean to you", "what languages can you understand", + "how many languages can you speak", "are you multilingual", "can you speak japanese", + "영어 할 수 있어", "영어 할 수 있어요", "영어 할 줄 아세요", "영어 돼", "영어 돼요", "영어 가능해요", "영어 알아들어", + "영어도 할 줄 알아", "한국어 알아", "한국어 알아들어요", "한국말 할 줄 알아", "한국말 잘해요", "중국어 돼", "중국어 할 줄 알아", + "일본어 돼요", "일본어 할 줄 아세요", "스페인어 할 수 있어요", "러시아어 해요", "몇 개 국어 할 수 있어", "몇 개 국어 가능해요", + "몇 개 언어 할 수 있어요", "무슨 말 할 줄 알아", "무슨 언어로 말해요", "어떤 언어로 말할 수 있어요", "어떤 말을 알아들어요", + "외국어 해요", "외국어 할 수 있어요", "다른 나라 말도 해요", "영어로 말해도 돼요", "영어로 해도 알아들어", "영어 할 줄 아나", + "영어 하나", "영어 할 줄 아노", "영어 되나", "영어 할 줄 아는교", + "can you speak 한국어", "do you speak 한국말", "english 돼", "english 할 수 있어요", "korean 할 줄 알아", "japanese 할 줄 알아", + "영어 speak 할 수 있어", "korean 돼요", + ], + "chatgpt": [ + "are you based on chatgpt", "are you built on chatgpt", "do you run on chatgpt", "do you run on gpt", + "is chatgpt inside you", "are you openai", "do you use openai", "are you made by openai", "are you gpt", + "are you gpt 4", "is this gpt", "are you connected to chatgpt", + "is your brain chatgpt", "chatgpt?", "are you like chatgpt", + "너 지피티야", "지피티야", "챗지피티예요", "챗GPT예요", "챗GPT야", "챗GPT 기반이야", "챗지피티 기반이에요", "GPT 써요", + "지피티 써", "오픈AI 거야", "오픈AI 써요", "챗GPT랑 연결돼 있어요", + "너 chatgpt야", "chatgpt 써요", "gpt야 너", "너 openai야", + ], + "model": [ + "what ai model are you using", "what ai model do you use", "which ai model are you", "which llm do you use", + "what llm are you", "what language model runs you", "what language model do you use", "what is your ai", + "which ai do you use", "what ai runs you", "what software is your brain", "what model are you", "what model runs you", + "which ai are you based on", "what ai is inside you", "what large language model do you use", "are you gemma", + "do you use gemma", "what powers your answers", "what's your language model", + "어떤 AI 모델 써", "어떤 AI 써요", "무슨 AI야", "너 무슨 AI야", "무슨 AI 모델이에요", "무슨 언어 모델이야", "언어 모델 뭐 써요", + "인공지능 모델이 뭐예요", "인공지능은 뭐 써요", "어떤 인공지능이에요", "무슨 인공지능 써", "LLM 뭐 써요", "엘엘엠 뭐 써", + "어떤 모델이야", "무슨 모델 써", "젬마 써요", "두뇌가 뭐예요", "무슨 AI 쓰노", + "what ai model 써", "ai model 뭐야", "어떤 llm 써", "무슨 ai model이야", "너 model이 뭐야", "너 brain이 뭐야", + ], + "robot": [ + "are you a real robot", "are you human or robot", "are you a human", "are you human or machine", "are you a living thing", + "are you a living being", "is someone inside you", "is there a human inside", "is a person controlling you", + "is someone remote controlling you", "who is controlling you", "is somebody driving you", "can you feel emotions", + "can you feel anything", "do you feel things", "do you feel pain", "do you have a heart", "do you have a soul", + "are you sentient", "are you self aware", "are you artificial intelligence", "are you an ai robot", "are you just a machine", + "are you a computer", "are you a toy", "are you real or fake", "r u a robot", "are u human", "are you a person or a robot", + "너 사람이니", "사람이에요", "사람이세요", "사람이야 로봇이야", "로봇이야 사람이야", "진짜 로봇이야", "진짜 로봇이니", + "너 진짜 로봇이야", "로봇 맞아", "로봇 맞아요", "로봇이니", "로봇입니까", "살아 있어요", "살아 있니", "살아 있는 거야", + "생명체야", "생물이에요", "안에 사람이 있어", "사람이 안에 있어요", "누가 조종하는 거야", "누가 조종하고 있어요", "원격 조종이에요", + "누가 움직이는 거예요", "감정이 있니", "감정을 느껴", "감정 느껴요", "기분을 느껴요", "아픔을 느껴요", "마음이 있어요", + "영혼이 있어", "의식이 있니", "너 AI야", "AI예요", "인공지능이에요", "인공지능 로봇이야", "기계야", "너 기계니", "장난감이야", + "사람이가", "사람이가 로봇이가", "로봇이가", "살아 있나", "니 사람이가", "사람이여", "감정 있나", + "너 robot이야", "너 human이야", "are you 사람", "너 진짜 robot이야", "feelings 있어", "emotion 있어요", "너 real robot이야", + ], + "speed": [ + "how fast can you drive", "how quickly can you move", "what is your maximum speed", "what's your speed limit", + "how fast do you drive", "how fast can you run", "how fast can you roll", "what speed do you go", "are you fast", + "how fast r u", "how fast are u", "how many meters per second can you go", "how many km per hour can you go", + "얼마나 빨리 달려", "얼마나 빨리 움직여요", "얼마나 빨라", "얼마나 빠르니", "속도가 얼마나 돼요", "속도는 얼마예요", "속도 몇이야", + "최고 속도가 얼마예요", "최대 속도는 몇이에요", "제일 빠르면 얼마나 가요", "빨리 갈 수 있어요", "빨라요", "시속 몇 킬로예요", + "초속 몇 미터예요", "얼마나 빨리 가노", "속도 얼마나 나오노", "your speed 얼마야", "너 max speed가 몇이야", "speed 얼마나 돼요", + ], + "hello": [ + "hello there", "hi lumi", "hey lumi", "hello hello", "hi hi", "hey hey", "heya", "hey robot", "hi robot", + "good morning lumi", "good evening lumi", "good afternoon lumi", "morning", "evening", "greetings", "hello everyone", + "nice to meet you lumi", "pleased to meet you", "glad to meet you", "hellooo", "hii", "heyy", "hullo", "hello?", + "안녕 루미", "안녕 루미야", "루미 안녕", "안녕", "안녕하세요 루미", "안녕하세요 루미 씨", "안녕하신가요", "안녕하십니까 루미", + "하이 루미야", "하이루", "하이요", "헬로 루미", "헬로우", "방가방가", "반갑다", "반갑습니다", "반가워 루미", "만나서 반가워", + "처음 뵙겠습니다 루미", "좋은 아침", "좋은 아침이야", "좋은 아침입니다", "좋은 저녁이에요", "굿모닝", "굿모닝 루미", "안냥", + "안녕하쇼", "안녕하능교", "안녕하셨어요", "어서 와", "여어", "hello 루미", "hi 루미야", "루미 hi", "안녕 hello", + ], + "how_are_you": [ + "how are you lumi", "how are you doing today", "how's your day", "how's your day going", "how is your day", + "are you doing well", "are you doing ok", "you okay", "you alright", "how do you feel today", "how are things", + "how have you been lumi", "what's up lumi", "how you doing", "how r u", "how are u", "hows it going", + "잘 지냈어", "잘 지냈니", "잘 지냈습니까", "잘 지내요", "잘 지내니", "잘 있었어", "잘 있었어요", "오늘 어때", "오늘 어때요", + "오늘 하루 어때요", "오늘 기분이 어때", "기분이 어때", "기분 좋아", "기분 어때요", "컨디션 어때", "컨디션 어때요", "괜찮니", + "별일 없어", "요즘 어떻게 지내", "요즘 어때요", "잘 지내고 있어요", "오늘 컨디션 괜찮아요", "잘 지냈나", "잘 있었나", + "how are you 루미", "컨디션 how", "how are you 오늘", "기분 how", + ], + "no": [ + # weight, height, age, maker, speed of other things: the LLM or a lookup + "how heavy is the ice cream robot", "how heavy is the candy ball robot", "how much does the barista robot weigh", + "how tall is the ice cream robot", "how big is the ice cream robot", "how fast is the ice cream robot", + "how fast is the candy ball robot", "how tall is the eiffel tower", "how tall is lotte tower", "how old is taylor swift", + "how old is the president", "how old is the ceo", "who made the iphone", "who invented the telephone", + "who made jaka robots", "what is jaka", "who made your camera", "who made your computer", "who made your wheels", + "how heavy is your gripper", "how heavy is your head", "how fast is your arm", "how old is your arm", + "how fast can a car go", "how heavy is an elephant", "how tall is son heung-min", "what's the name of this event", + "what's the name of this building", "what is the name of the ceo", "what's the name of the company", + "아이스크림 로봇 무게가 얼마예요", "아이스크림 로봇 얼마나 빨라요", "캔디볼 로봇 몇 초 걸려요", "에펠탑 높이가 얼마야", + "손흥민 키가 몇이야", "손흥민 몇 살이야", "아이폰 누가 만들었어", "대표 나이가 몇이에요", "대표님 이름이 뭐예요", + "이 건물 이름이 뭐예요", "이 행사 이름 뭐야", "회사 이름이 뭐예요", "그리퍼 누가 만들었어요", "카메라 누가 만들었어", + # the visitor about themselves + "what's my name", "do you know my name", "guess my name", "how old do you think i am", "guess how old i am", + "how tall do you think i am", "내 이름 뭐게", "내 이름 알아", "내가 몇 살 같아", "나 몇 살로 보여", "제 이름 아세요", + # questions that are not facts of Lumi + "what is your favorite color", "what's your favourite food", "do you like music", "do you like me", + "are you tired", "are you hungry", "are you happy", "are you bored", "are you sleepy", "do you sleep", + "where are we", "where am i", "where is the toilet", "what do you think about ai", "will robots take over the world", + "좋아하는 색이 뭐야", "좋아하는 음식 뭐예요", "음악 좋아해", "피곤해", "배고파", "행복해", "심심해", "잠 자", "여기 어디야", + "화장실 어디예요", "로봇이 세상을 지배할까", "battery level", "your battery level", "how much battery do you have", + "배터리 얼마나 남았어", "배터리 몇 프로야", + "emergency stop", "stop now", "stop", "멈춰", "그만", + # what Lumi is doing now (status), what it can do (abilities), slow speed, charging time: not these kinds + "what are you doing", "what are you doing now", "what are you doing robot", "what are you up to", "지금 뭐 해", + "뭐 하고 있어", "지금 뭐 하는 중이에요", "로봇아 지금 뭐 해", "뭐 할 줄 알아", "뭘 할 줄 아니", "뭐 할 수 있어요", + "how slow can you drive", "how slow can you go", "what's your slowest speed", "가장 느리게 가면 얼마야", "얼마나 천천히 갈 수 있어", + "완충하는 데 얼마나 걸려", "완충까지 몇 시간이에요", "how long does a full charge take", "how long to fully charge", + # a request and a question together: the rules or the LLM + "컵 주고 이름 알려 줘", "이리 오고 이름 말해 줘", "손 흔들고 이름 알려 주세요", "give me the cup and tell me your name", + "come here and tell me how old you are", "따라오고 나이 알려 줘", + # Cutshion and its people, not Lumi: the company notes + "who is cutshion's ceo", "when was cutshion founded", "where is cutshion", "what does cutshion make", "cutshion phone number", + "how do i contact cutshion", "쿳션 대표가 누구야", "쿳션 언제 생겼어요", "쿳션 어디 있어요", "쿳션 연락처 알려 줘", + "how old is cutshion", "쿳션 몇 년 됐어요", "is cutshion korean", "쿳션은 한국 회사예요", + "company make which robot", "what robots does the company make", "which robots does cutshion make", + "what does your company make", "회사는 어떤 로봇 만들어", "회사에서 무슨 로봇 만들어요", "쿳션은 뭐 만들어요", + # the birthday is not known (the age is) + "when is your birthday", "when's your birthday", "what's your birthday", "what day were you born", "생일이 언제야", + "생일이 언제예요", "생일 언제야", "너 birthday 언제야", "생일이 며칠이에요", + # a greeting with a question after it: the question decides + "안녕 루미 상 받은 거 있어", "안녕 루미 쿳션이 뭐야", "안녕하세요 화장실 어디예요", "안녕 루미 날씨 어때", + "안녕 오늘 뭐 해", + # not known: the battery's lifetime in years, being another company's robot + "battery 수명 몇 년이에요", "배터리 수명이 몇 년이에요", "배터리 몇 년 써요", "배터리 교체 주기가 어떻게 돼요", + "how many years does the battery last", "when does the battery need replacing", "너 자카 로봇이야", "자카 거야", + "jaka에서 만들었어", "are you a jaka robot", "are you made by jaka", "너 중국 회사 로봇 맞지", "hi lumi what is cutshion", "hello where is the toilet", "hi what's the weather", + "hey lumi did cutshion win any awards", "hello can you help me", "안녕하세요 질문 있어요", "hi i have a question", + ], +} + +# new kinds: (wordings, {"en": [answers], "ko": [answers]}) +QUICK_KINDS = { + "internet": ([ + "do you use the internet", "are you connected to the internet", "are you online", "do you need the internet", + "do you use the cloud", "are you using the cloud", "do you need the cloud", "do you work without internet", + "can you work offline", "can you go on the internet", "can you search the internet", "can you look things up online", + "인터넷 써요", "인터넷 연결돼 있어", "인터넷 돼요", "인터넷 없이도 돼요", "인터넷 검색할 수 있어요", "인터넷에 연결돼 있어요", + "클라우드 써요", "클라우드로 돌아가요", "클라우드 연결돼 있어", "오프라인으로도 돼요", "cloud 써요", "internet 돼요", + "인터넷으로 찾아볼 수 있어", "온라인이야", + ], {"en": ["I think on my own computer, without the cloud. I use the internet only to look up the weather, the news and other facts.", + "My language model runs on the robot itself. The internet I use only for lookups: the weather, news and facts from Wikipedia and Google News."], + "ko": ["저는 클라우드 없이 제 컴퓨터에서 생각해요. 인터넷은 날씨, 뉴스, 그 밖의 정보를 찾아볼 때만 써요.", + "제 언어 모델은 로봇 안에서 돌아가요. 인터넷은 날씨나 뉴스, 위키백과 같은 정보를 찾을 때만 써요."]}), + "country": ([ + "what country are you from", "which country are you from", "which country made you", "what country made you", + "are you from korea", "are you korean", "are you a korean robot", "are you made in korea", "were you made in korea", + "are you from china", "are you chinese", "are you a chinese robot", "are you made in china", "are you japanese", + "are you american", "is this robot korean", "where is this robot from", "what nationality are you", + "어느 나라에서 왔어", "어느 나라에서 왔어요", "어느 나라 로봇이야", "어느 나라 로봇이에요", "어느 나라에서 만들었어요", + "어느 나라 거예요", "어느 나라 제품이에요", "한국 로봇이야", "한국 로봇이에요", "한국에서 만들었어요", "국산이에요", "국산 로봇이야", + "중국 로봇이야", "중국 로봇이에요", "중국산이에요", "중국에서 만들었어요", "일본 로봇이에요", "미국 로봇이야", "국적이 어디예요", + "너 한국인이야", "메이드 인 코리아예요", "made in korea야", "너 korean robot이야", "너 어느 나라 robot이야", "중국 꺼야", + ], {"en": ["I'm from Korea: Cutshion Company in Seoul developed me.", + "I'm a Korean robot. Cutshion Company, a robot company in Seoul, developed me."], + "ko": ["저는 한국에서 왔어요. 서울에 있는 쿳션이 저를 개발했어요.", + "저는 한국 로봇이에요. 서울의 로봇 회사 쿳션이 개발했어요."]}), + "computer": ([ + "what computer do you use", "what computer do you have", "what's your computer", "what computer runs you", + "what hardware do you run on", "what processor do you have", "what chip do you use", "what gpu do you have", + "which computer is inside you", "what is your cpu", "do you use nvidia", "are you running on a jetson", + "what's inside you", "what kind of computer are you", "how powerful is your computer", "how much memory do you have", + "무슨 컴퓨터 써요", "어떤 컴퓨터 써", "컴퓨터 뭐 써요", "컴퓨터가 뭐예요", "어떤 컴퓨터가 들어 있어요", "무슨 칩 써요", + "GPU 뭐 써요", "그래픽카드 뭐야", "프로세서가 뭐예요", "엔비디아 써요", "젯슨이에요", "안에 뭐가 들어 있어요", + "메모리 얼마예요", "컴퓨터 성능이 어때요", "무슨 하드웨어로 돌아가요", "너 computer 뭐 써", "무슨 gpu야", "hardware 뭐 써요", + ], {"en": ["My computer is an NVIDIA Jetson AGX Thor, with a Blackwell graphics processor, 14 cores and 122 GB of memory.", + "An NVIDIA Jetson AGX Thor with 122 GB of memory. It runs my speech recognition, my language model and my cameras, all on the robot."], + "ko": ["제 컴퓨터는 엔비디아 젯슨 AGX 토르예요. 블랙웰 그래픽 프로세서, 코어 14개, 메모리 122GB가 있어요.", + "엔비디아 젯슨 AGX 토르예요. 메모리는 122GB이고, 음성 인식, 언어 모델, 카메라를 모두 로봇 안에서 돌려요."]}), + "dof": ([ + "how many joints do you have", "how many degrees of freedom do you have", "how many dof do you have", + "how many axes do you have", "how many motors do you have", "how many joints does your arm have", + "how many axes does your arm have", "how many parts can you move", + "관절이 몇 개야", "관절이 몇 개예요", "자유도가 몇이에요", "몇 자유도예요", "몇 축이에요", "팔이 몇 축이야", "팔 관절 몇 개예요", + "모터가 몇 개예요", "몸에서 움직이는 데가 어디예요", "너 dof 몇이야", "joint 몇 개야", "몇 축 로봇이에요", + ], {"en": ["I have 12 degrees of freedom: the lift, the waist, two head joints, six arm joints and two drive wheels.", + "Twelve in all: my arm has six joints, my head two, then my waist, my lift and my two wheels."], + "ko": ["자유도는 모두 12개예요. 리프트, 허리, 머리 관절 두 개, 팔 관절 여섯 개, 바퀴 두 개예요.", + "모두 12축이에요. 팔이 6축, 머리가 2축이고, 허리, 리프트, 바퀴 두 개가 있어요."]}), + "estop": ([ + "where is your emergency stop", "where's your emergency stop button", "where is the stop button", "how do i stop you", + "how can i stop you in an emergency", "do you have an emergency stop", "is there an emergency button", + "what if something goes wrong how do i stop you", "where is the red button", "how do we stop the robot", + "비상 정지 버튼 어디 있어요", "비상 정지 버튼이 어디야", "비상 버튼 어디 있어", "정지 버튼이 어디예요", "빨간 버튼 어디 있어요", + "어떻게 멈춰요", "위험할 때 어떻게 멈춰", "비상시에 어떻게 세워요", "비상 정지 있어요", "emergency stop 어디 있어요", + "e-stop 버튼 어디야", "비상 스톱 어디예요", + ], {"en": ["There are red emergency stop buttons on my body and in my base. Pressing one stops my arm and my lift at once.", + "Press one of my red emergency stop buttons, on my body or in my base: my arm and lift stop at once. You can also just say \"stop\"."], + "ko": ["제 몸과 베이스에 빨간 비상 정지 버튼이 있어요. 누르면 팔과 리프트가 바로 멈춰요.", + "몸이나 베이스에 있는 빨간 비상 정지 버튼을 누르시면 팔과 리프트가 바로 멈춰요. \"멈춰\"라고 말씀하셔도 돼요."]}), +} + +# slips, dialect and short forms heard in the blind rounds (the same meanings, other words) +_MORE = { + "name": [ + "wat is ur naem", "whats yer name", "what's yer name", "you name what", "your name what", "what name do they give you", + "what name did they give you", "got a name", "got a name buddy", "what are they calling you", "name pls", + "이름이 뭐라 카노", "이름이 뭐라카노", "이름 머라 카노", "니 이름 뭐라꼬", "이름이 뭐임 너", "이름이 뭐지", "얘 이름이 뭐지", + "이름 뭐니 너", "이림이 뭐야", "일므이 뭐야", "이름이 머예요", "너 name 뭐야", "your name 알려 줘", + ], + "who": [ + "you are what thing", "what thing are you", "what's your deal what are you", "so what are you", "what are you anyway", + "넌 머야", "너 머야", "넌 머니", "너는 머임", "이건 뭐 하는 로봇이여", "뭐 하는 애니", "넌 무슨 로봇이고", + ], + "age": [ + "how old r u robot", "how many years old r u", "are you a baby robot", "are you a young robot", + "몇쌀이야", "몇 쌀이야", "멷 살이야", "몇 살 잡수셨어요", "연세가 어떻게 되십니까", "춘추가 어떻게 되세요", "나이가 몇 살이고", + "몇 살인데", "나이 좀 알려 줘", "너 나이 몇", "how old 너는", + ], + "maker": [ + "who made you robot", "who built you robot", "who's the maker of this robot", "which company makes you", + "어디서 만든 로봇입니까", "어디서 만든 로봇이에요", "어디서 만든 로봇이야", "이거 어디 회사 기고", "어데 회사 로봇이고", + "이거 누가 만들었노", "이 로봇 누가 만든 거예요", "어느 회사가 만들었어", "어디 거야 이 로봇", "who made 이 로봇", + ], + "height": [ + "키가 몃이야", "키가 몇이예요", "키 몇 쎈치야", "키 몇 센치야", "키 몇 센치예요", "높이가 얼마예요", "높이가 몇이에요", + "로봇 높이가 어떻게 돼요", "키 몇 미터야", "몇 미터예요 키가", "how high r you", "what's your height robot", + ], + "weight": [ + "몇 키로나 나가노", "몇 키로 나가", "몇 킬로나 나가요", "무게 머야", "무게가 머예요", "무게 얼마야 너", "중량이 얼마예요", + "몇 kg 나가요", "how heavy r u", "how many kilos do you weigh", "what's your weight robot", + ], + "speed": [ + "how fast are you robot", "how fast do you go", "how quick are you", "얼마나 빨리 다녀", "빠르기가 어때요", "속도 머야", + "몇 키로로 가요", "시속 몇이야", + ], + "battery_life": [ + "does your battery run out quickly", "how long do you keep going", "how long can you keep going on one charge", + "충전하면 얼마나 씁니까", "충전하면 얼마나 써", "사용 시간이 어떻게 돼요", "사용 시간이 얼마예요", "연속으로 얼마나 움직일 수 있어요", + "연속 사용 시간이 얼마예요", "한 번 충전에 몇 시간이나 버팁니까", "한 번 충전에 몇 시간 버텨요", "너 battery 얼마나 가", + "배터리 얼마나 가요 하루 종일 가요", "배터리 다 닳으려면 얼마나 걸려", "배터리 얼마나 오래 써요", + ], + "languages": [ + "can i talk to you in german", "can i speak to you in japanese", "do you understand every language", + "한국어 알아들어요", "한국말 알아들어", "한국어 알아듣니", "영어 돼요 너", "영어 되나", "사투리도 알아듣나", "사투리 알아들어요", + "외국말도 알아들어", "중국말 할 줄 아나", + ], + "model": [ + "do you use gemini", "are you gemini", "do you use llama", "are you claude", "is your ai from google", + "AI 뭐 들어 있어", "어떤 AI가 들어 있어요", "대화는 어떤 AI가 해", "대화는 무슨 AI로 해요", "무슨 AI로 대답해요", + "AI 뭐 써", "어떤 AI 들어가 있어", + ], + "robot": [ + "do you get sad", "do you get angry", "do you get lonely", "you have feeling", "you have feelings", "do you dream", + "can you dream", "꿈 꿔", "꿈 꿔요", "꿈을 꿔", "로봇도 감정이 있어요", "로봇도 감정 있어", "슬퍼할 줄 알아", "화낼 줄 알아", + "외로움 느껴", "너 살아 있어", "살아 있는 거 맞아", "생각할 줄 알아", + ], + "no": [ + "몇 년도에 세웠어", "언제 세웠어요", "언제 설립했어", "설립 연도가 언제예요", "회사 언제 세워졌어요", + "요즘 무슨 일 있어", "요즘 경제가 어때요", "요즘 경제 어때", "경기가 어때요", "요즘 뉴스 뭐 있어", + "how heavy can you lift", "can i lift you", "내가 너 들 수 있어", "are you taller than me", "are you taller than my dad", + "could you beat me in a race", "나랑 달리기 하면 누가 이겨", "who is faster you or me", + "로봇은 어디서 만들어요", "로봇은 어디서 만들어", "where are the robots made", "where is the factory", "공장이 어디예요", + "쿳션 공장 어디 있어요", "where does cutshion build its robots", + ], +} +for _k, _v in _MORE.items(): + QUICK.setdefault(_k, []).extend(_v) + +QUICK_KINDS["used_where"] = ([ + "where are you used", "where can you be used", "where do you work", "what places are you made for", + "what were you made for", "what were you built for", "who are you made for", "where would you be useful", + "어디에 쓰여요", "어디서 쓰는 로봇이에요", "어떤 데서 쓰라고 만들었어", "어디에 쓰려고 만들었어요", "어디서 일해요", + "어떤 곳에서 써요", "무슨 용도로 만들었어요", "용도가 뭐예요", "어디에 쓸 수 있어", "너 용도가 뭐야", "어디서 쓰는 거야", +], {"en": ["I'm made for shops, hotels, schools, labs and exhibitions.", + "Places like shops, hotels, schools, research labs and exhibitions, where I greet, guide and help people."], + "ko": ["저는 상점, 호텔, 학교, 연구실, 전시회에서 쓸 수 있게 만들어졌어요.", + "상점, 호텔, 학교, 연구실, 전시회 같은 곳에서 사람들을 맞이하고 안내하고 도와요."]}) + +QUICK_KINDS["stt"] = ([ + "how do you understand speech", "how do you understand what i say", "what speech recognition do you use", + "what do you use for speech recognition", "how do you hear words", "what turns my voice into text", + "do you use whisper", "what's your speech to text", "how do you recognise speech", + "말 알아듣는 건 뭘로 해요", "말은 어떻게 알아들어요", "음성 인식 뭐 써요", "음성 인식은 뭘로 해", "음성 인식 엔진이 뭐예요", + "말을 어떻게 알아듣니", "목소리를 어떻게 글로 바꿔요", "위스퍼 써요", "speech recognition 뭐 써요", "STT 뭐 써", +], {"en": ["I turn speech into text with Whisper, the large-v3-turbo model, running on my own computer.", + "With Whisper: it runs right here on my NVIDIA computer and writes down what you say."], + "ko": ["말소리는 위스퍼(Whisper) large-v3-turbo 모델로 글자로 바꿔요. 제 컴퓨터에서 직접 돌아가요.", + "위스퍼라는 음성 인식 모델로 알아들어요. 제 엔비디아 컴퓨터에서 돌아가요."]}) +QUICK_KINDS["reply_time"] = ([ + "how fast do you answer", "how quickly can you respond", "how quickly do you reply", "how long do you take to answer", + "how fast do you respond to a question", "how long until you answer", "what's your response time", + "얼마나 빨리 대답해요", "대답하는 데 얼마나 걸려요", "대답 속도가 어때요", "답하는 데 몇 초 걸려", "반응 속도가 얼마예요", + "말하면 얼마 만에 대답해요", "response time 얼마야", +], {"en": ["My first words come about two seconds after a question.", + "About two seconds: that's when my first words come after you ask."], + "ko": ["질문하시고 약 2초 뒤에 첫마디가 나와요.", "대답은 질문 후 약 2초 안에 시작해요."]}) +QUICK["no"] += [ + "몇 센티 오차예요", "오차가 몇 센티야", "위치 오차가 얼마예요", "how accurate is your position", "how precise is your map position", + "how accurate is your arm", "팔 정확도가 얼마예요", "반복 정밀도가 얼마예요", "what's your repeatability", +] +QUICK_KINDS["tts"] = ([ + "what text to speech do you use", "what text-to-speech do you use", "what's your tts", "how do you speak", + "how do you make your voice", "what voice engine do you use", "where does your voice come from", "what makes your voice", + "목소리는 뭘로 내요", "음성 합성 뭐 써요", "TTS 뭐 써", "목소리 어떻게 만들어요", "말소리는 어떻게 내요", "너 목소리 뭐야", +], {"en": ["I speak with a text-to-speech engine called Supertonic, through my speaker.", + "My voice comes from Supertonic, a text-to-speech engine running on my own computer."], + "ko": ["슈퍼토닉(Supertonic)이라는 TTS로 목소리를 내요.", "제 목소리는 슈퍼토닉이라는 음성 합성 엔진으로 만들어요."]}) +QUICK_KINDS["mics"] = ([ + "how do you hear me", "what do you hear with", "how many microphones do you have", "do you have microphones", + "where are your microphones", "how far can you hear", "can you tell where a voice comes from", + "소리는 무엇으로 들으십니까", "소리는 뭘로 들어요", "마이크 몇 개예요", "마이크 있어요", "마이크가 어디 있어", "얼마나 멀리서 들려요", + "귀가 어디야", "어떻게 들어요", "소리 어떻게 들어", +], {"en": ["I hear with a ring of six microphones in my head, from about 3 to 5 metres away, and I can tell where a voice comes from.", + "Six microphones in my head: they hear people 3 to 5 metres away and tell me which direction a voice comes from."], + "ko": ["머리에 있는 마이크 6개로 들어요. 3에서 5미터 거리까지 듣고, 목소리가 어느 쪽에서 오는지도 알 수 있어요.", + "머리에 마이크가 6개 있어요. 3~5미터 떨어진 목소리를 듣고 방향도 알아요."]}) +QUICK["no"] += ["can you hear me", "do you hear me", "들려", "내 말 들려요", "제 말 들리세요", "hello can you hear me", + "are you listening", "듣고 있어"] +QUICK["no"] += [ + # orders that sound like these questions: the rules or the LLM, never a fact + "키 줄여 줘", "키 다운 해 줘", "키 업 해 줘", "키를 올려 보시오", "키 좀 높여 줘", "키 올려", "키 내려", "키 낮춰 줘", "키 키워 줘", + "robot stretch up tall", "robot more tall please", "grow taller", "get taller", "be shorter", "stretch up", + "몸 올려요 로봇", "몸 내려요 로봇", "몸 올려", "몸 내려", "손 좀 내밀어 주세요", "손 내밀어", "손 줘", + "hey robot wave like a person", "wave like a human", "hello robot follow follow", "hi lumi follow me", "hello lumi come here", + "안녕 루미 이리 와", "루미야 루미야 그만해요", "그만해요", "그만해", "기분이 다운됐어", "나 기분 안 좋아", + "how much longer will you wait", "how long are you waiting", "how long will you wait", "what's the job", "what's your task now", + "introduce yourself then turn to your left", "자기소개하고 왼쪽 봐", "고개 숙이고 이름 알려 줘", "오른쪽 보고 나이 말해 줘", +] diff --git a/assistant/brain.py b/assistant/brain.py index e0c3ec0..e8b1d27 100644 --- a/assistant/brain.py +++ b/assistant/brain.py @@ -21,6 +21,8 @@ import urllib.request from assistant import driving from assistant import knowledge from assistant import llm_direct +from assistant import memory +from assistant import place_words from assistant import wording from assistant import web from audio import sing # its words only (no sound on import) @@ -33,7 +35,7 @@ MIN_SCORE = 0.42 # chunks below this similarity are not given to t NOTES_K = 3 # note chunks given with each question NOTES_K_COMPANY = 5 # ... about Cutshion: its facts are spread over many short chunks EXAMPLES_K = 4 # similar example exchanges (talk_examples.py) shown with each question -HISTORY_TURNS = 4 # previous question/answer pairs kept for follow-up questions +HISTORY_TURNS = 6 # previous question/answer pairs kept (6 to 11, see window): long talks return to earlier topics FAREWELL_RECENT = 8 # goodbyes said lately that the next goodbye must not repeat FAREWELL_RETRY_T = 0.9 # LLM temperature for a second try when a goodbye starts like a recent one @@ -102,6 +104,12 @@ Rules: unclear. "Say it again" / "다시 한 번만요" means repeat your previous answer; "and in Korean?" / "영어로는요?" means your previous answer in that language. Never answer a follow-up with a list of what you can do. +- The same on any topic (history, science, places, people, food, sports), as deep as the talk goes: each follow-up + is about the thing your last answer named ("why?" its reason, "when?" / "where?" / "who?" about it, "and then?" / + "그래서?" / "그 다음엔?" what happened next, "what do you mean?" / "그게 무슨 말이야?" the same point said more simply, + "그럼 그건?" the thing just named): answer it at once from what you know, in one or two sentences, never a search + for settled general knowledge, never a new topic. "Back to X" / "아까 X 얘기 다시" returns to what you said about X + earlier in this talk. "You said something else before" / "아까는 다르게 말했잖아" when you did not: keep your fact. - Resolve a fragment from the turn before, as a person would: "and tomorrow?" / "그럼 내일은?" after the weather asks tomorrow's weather; "what about Japan?" / "일본은?" asks the same question about Japan; "and the arm?" / "팔은요?" after "how tall are you?" asks the same thing (its size: reach 58 cm) about the arm; "which one?" after "my @@ -236,8 +244,9 @@ RESPONSE_SCHEMA = { COMPANY_TALK = re.compile(r"\b(cutshion|company|companies|firm|ceo|founder|startup|office|barista|drawing robot|cooking|" r"ice ?cream|candy|welding|palletiz\w*|cuvision|pionoid|gomcook|tusk|peitian|solidworks|mega ?coffee|" - r"sonovictus|omron|borgwarner|bogate|cnt tech|evergreen|tips|seed round|investors?)\b|" - r"메가커피|소노빅터스|오므론|투자|창업|교육청|" + r"sonovictus|omron|borgwarner|bogate|cnt tech|evergreen|tips|seed round|investors?|" + r"buy|buying|purchase|dealers?|distributors?|employees|hiring)\b|" + r"메가커피|소노빅터스|오므론|투자|창업|교육청|구매|구입|사고 ?싶|대리점|직원 ?수|채용|" r"쿳션|회사|대표|스타트업|사무실|본사|바리스타|드로잉|조리|아이스크림|캔디|용접|팔레타이징|큐비전|곰쿡", re.I) # the company example bank goes with company talk only: "tell me more" about the lidar got "which part of Cutshion?" @@ -260,8 +269,47 @@ def _examples(text, k=None, on_task=False): return "" lines = "\n".join(f"- \"{ex[2]}\" -> " + (f"ACTION: {ex[4]} | " if len(ex) > 4 else "") + f"\"{ex[3]}\"" for ex in picked) - return ("Examples of how you answered similar words before (an ACTION shown is how such words are meant; the " - f"words are for tone only: answer what is asked now, in your own words):\n{lines}\n\n") + return (f"Similar words answered before (for tone; an ACTION shows how such words are meant; answer what is asked " + f"now in your own words):\n{lines}\n\n") + + +def _notes(hits): + """The note chunks for the prompt. A chunk that goes on a section repeats the section's lead ("How fast I move: My + base drives ... … I can climb"): left out when a chunk of that section is shown already (fewer tokens).""" + out, heads = [], set() + for _, src, t in hits: + head, sep, rest = t.partition(": ") + if sep and " … " in rest and head in heads: + t = f"{head}: …{rest.split(' … ', 1)[1]}" + heads.add(head) + out.append(f"[{src}]\n{t}") + return "\n\n".join(out) or "(no matching notes)" + + +SAID_BEFORE = re.compile(r"\byou said\b|\bearlier you\b|\byou told me\b|아까는|아까 .*(?:라며|했잖|말했)|전에는 .*(?:라며|했잖)", re.I) + # the visitor holds Lumi's own answer against it: the fact stays +FOLLOW_EXAMPLES_K = 2 # follow-up examples (talk_examples.FOLLOWUPS) shown with a short follow-up + + +def _follow_examples(text, history): + """For a short follow-up on the last answer ("why?", "and then?", "진짜?", "그게 무슨 말이야?"): two small talks + where such words were answered about the answer before them, so the model keeps the topic and answers at once.""" + asked = bool(history) and history[-1][1].rstrip().endswith("?") and confirm_answer(text) is not None # "네" to + if not history or len(text.split()) > 7 or is_backchannel(text) and not ABOUT_ANSWER.match(text) and not asked: + return "" # "더 알려 드릴까요?": do what was offered + if not (asked or ABOUT_ANSWER.match(text) or AND_ALSO.match(text) or FOLLOW_UP.search(text) or SAID_BEFORE.search(text) or + SHORT_Q.search(text) and len(text.split()) <= FRAGMENT_WORDS and not re.search(r"\d", text) and + not ABOUT_YOU.search(text) and (NAMED_BEFORE.search(text) or REFERS_BACK.search(text) or + len(text.strip(" ?!.~")) <= (6 if HANGUL.search(text) else 10))): + return "" # "where is p3?", "세종대왕이 누구예요?" are new questions + from assistant import talk_examples + q, a = history[-1] + a = " ".join(ln for ln in a.splitlines() if not re.match(r"\s*\**ACTION", ln)).strip() + if not a: + return "" + picked = talk_examples.pick_followup(text, q, a, "ko" if language(text) == "Korean" else "en", k=FOLLOW_EXAMPLES_K) + lines = "\n".join(f'- after "{e[1]}" -> "{e[2]}": "{e[3]}" -> "{e[4]}"' for e in picked) + return f"A short follow-up asks about your last answer: answer it at once, same topic, e.g.:\n{lines}\n\n" def _chat(messages, fmt=None, temperature=0.3): @@ -361,7 +409,7 @@ Short Korean commands are commands: "컵 가져다 줘" -> fetch cup, "컵 옮 the opposite move. - A condition or a later time is no order now ("when I say go, go to p1", "after the talk, come here", "if I wave, follow me", "내가 가라고 하면 가", "나중에 와"): none, say you'll do it when they ask. In "go to p1, no, p2" / - "p1로 가, 아니 p2로" the last one counts. A handshake ("shake hands with me", "악수하자") is arm reach, as are "give me your hand" / "give me a hand" / "손 줘". + "p1로 가, 아니 p2로" the last one counts. A handshake ("shake hand(s)", "let's shake hands", "악수하자") is wave; "give me your hand" / "give me a hand" / "손 줘" / "손 내밀어" are arm reach. - unclear: you did not understand what the visitor said or wants: ask them to repeat. - none: only talk. For weather and search only write the action line; the answer is made after the lookup. @@ -419,7 +467,8 @@ NUMBER_WORDS = {"one": "1", "two": "2", "three": "3", "four": "4", "five": "5", OBJECTS = {"cup": "cup", "mug": "cup", "glass": "cup", "tumbler": "cup", "bottle": "bottle", "apple": "apple", "orange": "orange", "banana": "banana", "컵": "cup", "잔": "cup", "병": "bottle", "사과": "apple", "오렌지": "orange", "바나나": "banana", "머그컵": "cup", "머그": "cup", "텀블러": "cup", "종이컵": "cup", "물병": "bottle", - "페트병": "bottle", "ball": "sports ball", "tennis ball": "sports ball", "baseball": "sports ball", "공": "sports ball", + "페트병": "bottle", "water bottle": "bottle", "plastic bottle": "bottle", "paper cup": "cup", "coffee cup": "cup", + "coffee mug": "cup", "ball": "sports ball", "tennis ball": "sports ball", "baseball": "sports ball", "공": "sports ball", "테니스공": "sports ball", "야구공": "sports ball", "wine glass": "wine glass", "와인잔": "wine glass", "vase": "vase", "꽃병": "vase", "bowl": "bowl", "그릇": "bowl", "carrot": "carrot", "당근": "carrot", "phone": "cell phone", "cell phone": "cell phone", "mobile phone": "cell phone", "smartphone": "cell phone", @@ -443,12 +492,17 @@ COLOURS = {"white": "white", "red": "red", "blue": "blue", "green": "green", "ye "노란": "yellow", "검은": "black", "까만": "black", "주황": "orange", "주황색": "orange", "빨간색": "red", "파란색": "blue", "노란색": "yellow", "초록색": "green", "검은색": "black", "까만색": "black", "하얀색": "white", "흰색": "white", "grey": "grey", "gray": "grey", "purple": "purple", "pink": "pink", "회색": "grey", - "보라": "purple", "보라색": "purple", "분홍": "pink", "분홍색": "pink", "핑크": "pink"} # -> the names + "보라": "purple", "보라색": "purple", "분홍": "pink", "분홍색": "pink", "핑크": "pink", + "녹색": "green", "빨강색": "red", "빨강": "red", "파랑색": "blue", "파랑": "blue", "노랑색": "yellow", "노랑": "yellow", + "검정색": "black", "검정": "black", "레드": "red", "블루": "blue", "그린": "green", "옐로우": "yellow", "옐로": "yellow", + "화이트": "white", "블랙": "black"} # -> the names # objects.colour_name gives (fetch.COLOURS, tests/test_fetch_place.py) _OBJ = "|".join(rf"(? "left" | "left 30" | "up small" | "me" | "center"; None for "look up the news".""" + t = re.sub(r"^\W*(?:right|alright|all right|okay|ok)\s*[,.!]\s*", "", t) # "right, look at the floor": okay if re.search(r"\blook up\b\s+(?!(?:a |please|lumi|slightly|again|at|to|\d|now|and|then|too|more)\b)[a-z]", t): return None if re.search(r"\b(?:straight|ahead|forward|center|centre|front)\b|정면|가운데|원위치|원래대로|제자리|(?:^|\s)앞(?:을|으로|쪽)?\s*(?:좀\s*)?(?:봐|보)", t): @@ -494,7 +549,9 @@ def head_target(t): side = "right" if re.search(r"\bright\b|오른쪽", t) else "left" # "over your right shoulder"; left when none return f"{side} {HEAD_YAW[1]:g}" for d, words in (("left", r"\bleft\b|왼쪽"), ("right", r"\bright\b|오른쪽"), - ("up", r"\bup\b|\braise\b|\blift\b|위|들어|올려"), ("down", r"\bdown\b|\blower\b|\bdrop\b|아래|밑|숙여|내려")): + ("up", r"\bup\b|\braise\b|\blift\b|\bceiling\b|\bsky\b|위|들어|올려|천장|하늘"), + ("down", r"\bdown\b|\blower\b|\bdrop\b|\b(?:my |your |the )?(?:feet|shoes?|floor|ground)\b|아래|밑|숙여|내려|" + r"바닥|발(?:을|밑|끝)?\s*(?:좀\s*)?봐|신발")): if re.search(words, t): deg = re.search(r"(\d+)\s*(?:degrees?|도)?", t) # a bare number on the head is degrees return f"{d} {deg.group(1)}" if deg else (f"{d} small" if SMALL.search(t) or MORE.search(t) else d) @@ -515,7 +572,8 @@ def lift_target(t): def head_goal(target, yaw, pitch, look=None, yaw_max=HEAD_YAW[1], pitch_range=HEAD_PITCH): """A look target and the head's yaw / pitch now -> (yaw, pitch, limited): limited is "yaw" / "pitch" when a - number asked for was past the head's range and was cut to it. look: {direction: (yaw, pitch)} for the plain + number asked for was past the head's range and was cut to it, or the direction ("down") when the head already + stands at that end and nothing would move (said plainly, never "okay"). look: {direction: (yaw, pitch)} for the plain words (lumi.LOOK); +yaw = left, +pitch = up.""" look = look or {"left": (40, None), "right": (-40, None), "center": (0, head_hw.HEAD_REST_PITCH), "up": (None, 20), "down": (None, -5)} d, _, n = target.partition(" ") @@ -537,16 +595,23 @@ def head_goal(target, yaw, pitch, look=None, yaw_max=HEAD_YAW[1], pitch_range=HE new = (yaw, pitch + sign * HEAD_SMALL_DEG * 2 / 3) y, p = max(-yaw_max, min(yaw_max, new[0])), max(pitch_range[0], min(pitch_range[1], new[1])) limited = "yaw" if n not in ("", "small") and y != new[0] else "pitch" if n not in ("", "small") and p != new[1] else None + end = {"left": y >= yaw_max - 0.5, "right": y <= -yaw_max + 0.5, "up": p >= pitch_range[1] - 0.5, + "down": p <= pitch_range[0] + 0.5}.get(d) + if end and abs((y - yaw) if d in ("left", "right") else (p - pitch)) < 0.5: + limited = d # already at that end ("more" too): nothing would move return y, p, limited def lift_goal(target, mm, top=105.0): """A lift target and the lift now (mm) -> (mm, limited): "up" is the top, "down" 0, a number or "small" moves - from where it is; limited is True when a number asked for was cut to 0..top.""" + from where it is; limited is True when a number asked for was cut to 0..top, "up" / "down" when the lift already + stands at that end and nothing would move.""" d, _, n = target.partition(" ") sign = -1 if d == "down" else 1 want = (top if sign > 0 else 0.0) if not n else mm + sign * (LIFT_SMALL_MM if n == "small" else float(n)) got = max(0.0, min(top, want)) + if abs(got - mm) < 1.0 and (got >= top - 1.0 if sign > 0 else got <= 1.0): + return got, d if d in ("up", "down") else "up" # already at that end ("more" too): nothing would move return got, bool(n and n != "small" and got != want) @@ -558,21 +623,37 @@ PUT_BACK = ( # the held thing back where it was picked: "put the banana back w r"|\b(?:put|set|place|return|leave|bring)\b.*\bwhere (?:it was|you (?:found|got|picked|took) it)\b" r"|\breturn (?:it|that|this|the (?:\w+ )?\w+) to (?:where|its place)" r"|^\W*(?:(?:please|now|okay|ok|lumi|robot)\W+)*back (?:to )?where (?:it was|you (?:found|got|picked|took) it)" - r"|(?:제자리|원래 ?(?:자리|위치|있던 ?(?:자리|곳|데))|원위치)\s*(?:에|로|에다)?\W*(?:(?:갖다|도로|다시|좀|그냥)\s*)*(?:놓|둬|놔|두)") + r"|(?:제자리|원래 ?(?:자리|위치|있던 ?(?:자리|곳|데))|있던 ?(?:자리|곳|데)|원위치)\s*(?:에|로|에다)?\W*(?:(?:갖다|도로|다시|좀|그냥)\s*)*(?:놓|둬|놔|두)" + r"|\breturn (?:it|that|this|the (?:\w+ )?\w+) to (?:its|the|your) (?:spot|place)\b|\bputt (?:it|that|this) back\b" + r"|^\W*(?:(?:robot|lumi|please|now|okay|ok)\W+)*return (?:it|that|this|the (?:\w+ )?\w+)\W*$|(?:원래 ?자리|제자리)\s*(?:로\s*)?back\b|\breturn\s*해") INTENTS = [ # (action, pattern) checked in order on what the visitor said ("quiet", r"\b(be quiet|keep quiet|quiet please|stop talking|shut up|silence|be silent|stop greeting)\b|조용히|그만 말|" r"시끄러워|말하지 마|인사 ?(그만|하지 ?마)"), - ("look_away", r"\b(?:look away|look somewhere else|look elsewhere|look the other way|stop (?:looking|staring) at me|" + ("look_away", r"\b(?:look away|look somewhere else|look elsewhere|look the other way|stop (?:looking|staring)(?: at me)?|" + r"stop watching me|quit watching me|" r"(?:don'?t|do not|please don'?t) (?:look|stare) at me|quit (?:staring|looking))\b|(?:쳐다|바라)보지 ?마|" - r"그만 ?(?:좀 ?)?(?:쳐다|바라)(?:봐|보세요)|" + r"그만 ?(?:좀 ?)?(?:쳐다|바라)(?:봐|보세요|보십시오|봐요|봐 ?줘|봐 ?주세요)|" + r"(?:날|나를?|저를?|절)\s*(?:좀\s*)?그만\s*(?:봐|보세요|봐요|쳐다봐)|" r"(?:날|나를?|저를?|절)\s*(?:좀\s*)?(?:보지|쳐다보지) ?마|다른 ?(?:데|곳|쪽)(?:을|를)? ?(?:좀 )?봐"), ("stop", r"\b(stop|halt|freeze|don'?t move)\b|멈춰|정지|그만 ?가|거기 ?서(?=[\s!.~,]*$)|스톱|움직이지 ?마|^\s*(서[\s,!.]*){2,}$"), + ("waist", r"\b(?:turn|rotate|twist|swivel|swing|move|bring|point|face|put)\b[^.?!]{0,25}\b(?:your |the )?(?:waist|upper body|" + r"torso|hips?)\b|\b(?:waist|upper body|torso)\b[^.?!]{0,20}\b(?:left|right|front|forward|center|centre|straight|back|" + r"\d+)|(?:허리|상체|몸통|윗몸)(?:를|을|만|좀|\s)*[^.?!]{0,15}(?:돌려|돌리|틀어|비틀|돌아|원위치|정면|가운데|앞으로|원래대로)|" + r"\bwaist\b\s*(?:left|right|turn|돌려|왼쪽|오른쪽)|(?:왼쪽|오른쪽)으?로?\s*(?:허리|상체)|" + r"\b(?:turn|swivel|twist|rotate) your (?:body|trunk)\b[^.?!]{0,30}\bwithout (?:driving|moving (?:your )?(?:base|wheels))|" + r"\b(?:turn|swivel|twist|rotate) your trunk\b|허리(?:를)? ?(?:좀 ?)?(?:펴|곧게)|\btorso\b.{0,6}(?:정면|front)"), + # ^ the waist (upper body) only, never the base: "turn your waist left", "허리 왼쪽으로 돌려", "상체 정면으로" ("follow", r"\b(?:follow|following|come with|come along with|come together with|walk with|tag along with)\s+(?:me|us)\b(?!\s+(?:on|at)\b)|" # not "follow - r"\bcome along\b|(? 0 and m.group(1) not in NOT_NAME and vowel_end == (m.group(2) == "야") and \ - (vowel_end or c in NAME_END_A) and not re.match(r"루미", m.group(1)): + (vowel_end or c in NAME_END_A) and not re.match(r"[루누류무]미|루[비니]|로봇", m.group(1)): # "누미야": Lumi misheard return True m = ASIDE_KO.search(text) if m and not m.group("name") and "인사" in m.group(0) and re.search(r"손|흔들", text): @@ -787,8 +911,21 @@ CANT_GO = re.compile(r"\b(?:stairs|upstairs|downstairs|staircase|steps up|escala NEGATED = re.compile( # "could you not look left", "왼쪽으로 돌면 안 돼", "컵 안 가져와도 돼", "my car can't turn left" r"\b(?:could|would|can|will) you not\b|\b(?:shouldn'?t|should not|mustn'?t)\b|" r"\bno (?:wave|waving|follow|following|turn|turning|move|moving|look|looking|go|going|come|coming|lift|reach|touch|pick)\b|" - r"지 ?(?:마시게|마시오|마십시오|말라고|말게|말아요|말아)|" - r"면 ?안 ?(?:돼|되)|(?:^|\s)안 \S+도 ?(?:돼|되)|지 ?않아도", re.I) + r"지 ?(?:마시게|마시오|마십시오|말라\S*|말랬\S*|말란\S*|말게|말아요|말아)|" + r"(? "point 5" asks = re.search(r"^\s*(how(?! about (?:you|we) (?!\w+ing\b)\w)|why(?! don'?t you\b)|what if)\b|\b(how do you|how can you|can you carry|are you able)\b|" r"\b(can|could) you (pick( up)?|lift|hold|grab|take) (a|an|any)\b|" # "can you pick up a bottle?" @@ -1014,6 +1183,26 @@ def intent(text, markers=()): return None # "pick up the cup, then look at the door": one part of two if action == "stop" and (STOP_TALK.search(t) or "?" in t and not STOP_ASK.match(CALLING.sub("", t)) or asks): return None # "where's your emergency stop?", "how do I stop you?" + if action in ("go_point", "go_home") and markers and \ + re.search(r"\b(?:not|no|wait|sorry|i mean|instead|actually|rather)\b|아니|말고|잠깐", t) and \ + sum(bool(named_place(text, mk, markers)) for mk in markers) > 1: + return None # "go to the stage... wait, not the stage, the entrance": which? + if action == "waist": + if asks or visitor or "?" in t and not re.search(r"\b(?:can|could|would|will) (?:you|u)\b|줄래|주실래|줄 ?수|주시겠|" + r"있겠니|주겠니", t) or \ + re.search(r"\b(?:don'?t|do not|never|no need to)\b|[가-힣]지 ?마(?:세요|요|라)?(?![가-힣])", t): + return None # "how far can your waist turn?", "don't turn your waist" + if re.search(r"\b(?:front|forward|center|centre|straight|middle|back to (?:the )?front)\b|정면|가운데|원위치|원래대로|" + r"앞(?:으로|쪽)|펴|곧게", t): + return ("waist", "center") + side = re.findall(r"\bleft\b|\bright\b|왼쪽|오른쪽|좌측|우측", t) + if len(set(side)) != 1: + return None # which way? the LLM asks + side = "left" if side[0] in ("left", "왼쪽", "좌측") else "right" + deg = re.search(r"(\d+)\s*(?:degrees?|도|°)", t) + ko = not deg and re.search(rf"(? "팔 뻗어", "reach out, + no, fold it" -> "fold your arm"; None when the right part is no arm move.""" + bare = re.sub(r"^(?:(?:그냥|just|then|좀)\s+)+", "", right.strip(" ,.!?")) + noun = "손" if re.search(r"손|\bhand\b", left) and not re.search(r"팔|\barm\b", left) else "팔" + for c in (bare, f"{noun} {bare}", re.sub(r"\b(?:it|that)\b", "your arm", bare)): + if (intent(c, markers) or ("",))[0] in ("arm", "wave"): + return c + return None + + +POLITE_END = re.compile(r"(?:[\s,.;!?]+(?:부탁(?: 좀)? (?:할게요|해요|합니다|드려요|드릴게요)|응\??|한 번만|제발|please|" + r"thank you|thanks|sweetie|dear|okay\??))+\W*$", re.I) def self_correct(text, markers=()): @@ -1214,10 +1462,11 @@ def self_correct(text, markers=()): "" when the command was taken back ("go to the stage, never mind", "스테이지로 가, 아니 됐어"); None when a correction is there but can't be read for sure (Lumi asks again, nothing moves); the text itself otherwise.""" from assistant import steps - if re.search(r"\b(?:say|tell|announce)\b|말해|전해|[\"“”]", text, re.I) or \ - re.search(r"\b(?:stop|halt|freeze|don'?t move)\b|멈춰|정지|그만|스톱|움직이지 ?마|거기 ?서", text, re.I): + if re.search(r"\b(?:say|tell|announce)\b|말해|(? 0 and t[:m.start()].strip(" ,.;!?")), None) if not m: return _recase(t, text) if _ else text left, right, said = t[:m.start()].strip(" ,.;!?"), t[m.end():].strip(" ,.;!?"), m.group(0) + right = re.sub(r"^(?:(?:just|only|simply|그냥|걍)\s+)+", "", right) # "look at me, no, just wave" if not _reads(left, markers) and not {"distance", "angle", "direction"} & set(_fix_kinds(left, markers)): right = re.sub(r"[\s,]*(?:sorry|my bad|미안(?:해요?)?|죄송해요)\W*$", "", right) # "…, sorry": politeness if _STRONG_NO.search(said) and right and not FIX_CANCEL.match(right) and _reads(right, markers) and \ not FIX.search(right): t = right # "give it to— no, just put it down": the cut-off part dropped continue + if _STRONG_NO.search(said) and intent(t, markers) is not None: + return None # "팔 혹시 집어넣어 줄 수 있어요, 아니 어이 손 좀 내밀어 줘라": + # a motion corrected by words not read: asked, never both done return _recase(t, text) if _ else text # "I like apples, no, I love them": talk, not a command if not right or FIX_CANCEL.match(right): if right or _STRONG_NO.search(said): @@ -1260,7 +1514,10 @@ def self_correct(text, markers=()): new, clauses = None, steps._split(left) def instead(): # the last clause of the left part replaced by the right one - keep = left[:left.rfind(clauses[-1])].strip(" ,.;!?") if len(clauses) > 1 else "" + cl = list(clauses) + while len(cl) > 1 and not _reads(cl[-1], markers): + cl.pop() # "팔 접어 주십시오, 손님들 보시게, 아 잘못 말했다, 손 내밀어": the arm part + keep = left[:left.rfind(cl[-1])].strip(" ,.;!?") if len(cl) > 1 else "" keep = re.sub(r"\s*(?:\band then|\bthen|\band|\bafter that|그리고|다음에)$", "", keep) return f"{keep}, {first}" if keep else first if rk and tail and set(rk) >= set(_fix_kinds(clauses[-1], markers)) and _reads(first, markers): @@ -1269,7 +1526,8 @@ def self_correct(text, markers=()): x = nums[-1] # "turn left 45 degrees, no, 30": the number fixed = left[:x.start()] + first + left[x.end():] new = fixed if _reads(fixed, markers) else None - elif rk and (set(rk) <= set(lk) or set(rk) == {"colour"} and "object" in lk): + elif rk and (set(rk) <= set(lk) or set(rk) <= {"colour", "object"} and "object" in lk): # "the cup, sorry I + # mean the white bottle" fixed = left for kind in sorted(rk, key=lambda k: -lk[k][-1].start() if k in lk else 0): if kind in lk: @@ -1286,6 +1544,14 @@ def self_correct(text, markers=()): new = next((c for c in ([] if said_again else [f"{fixed} {tail}"]) + [fixed] if _reads(c, markers)), None) if new is None and _reads(first, markers) and not set(rk) & set(_fix_kinds(clauses[-1], markers)): new = instead() # another command ("go to the stage, no, come here") + if new is None and (intent(clauses[-1], markers) or ("",))[0] in ("arm", "wave"): + new = _arm_fix(clauses[-1], first, markers) # "팔 접어, 아니 뻗어", "reach out, no wait, fold it" + new = new and instead().replace(first, new) + if new is None and HANGUL.search(first) and len(first.split()) == 1 and _reads(clauses[-1], markers): + words = clauses[-1].split() # "키 낮춰 봐, 아 아니 높여": the noun said again + new = next((c for c in (f"{w} {first}" for w in reversed(words[:-1]) if HANGUL.search(w) and + not re.search(r"(?:야|아|씨|님)$", w)) if _reads(c, markers)), None) + new = new and instead().replace(first, new) if new is None: return None t = f"{new}, {rest[0]}" if rest else new @@ -1302,7 +1568,8 @@ def _recase(t, text): _HERE = r"here|me|여기|이쪽|나한테|저한테|나에게|저에게" _HOME = r"home|charger|charging station|dock|충전기|충전소" _TABLE = r"table|테이블|책상|탁자" -_PLACE_WORD = rf"(?:point|marker|포인트)\s*(\d+)|(? 'go to the stage': fillers inside the words and the word said twice around them.""" - t = re.sub(r" {2,}", " ", FILLER_IN.sub(" ", t)).strip() + t = re.sub(r" {2,}", " ", FILLER_IN.sub(" ", wording.now_not_later(t))).strip() # "now, not later": no later time return re.sub(r"\b(the|a|to) \1\b", r"\1", t) @@ -1320,9 +1587,12 @@ def _norm(text, markers=()): map's markers "table front" -> "table_front").""" t = re.sub(r"\bhalf (?:a |an )?(cm|centimet(?:er|re)s?|mm|millimet(?:er|re)s?)\b|(? "1 of them" t = re.sub(rf"\b{word}\b", digit, t) + t = re.sub(r"(? 1: + kept = [x for x in parts if not CONTEXT_CLAUSE.match(x)] + t = " ".join(kept) if kept else t + t = CONTEXT_LEAD.sub("", t) + t = HAND_FRAME.sub("", t) or t + return t.strip() or text or "" + + +def hand_text(text): + """The words as the hand reader reads them: a polite frame cut ("you think you could give it here?" -> "give it + here?"), a visitor's aside cut ("나한테 그거 전해 주세요, 애들이 좋아해요"), whisper's 나 for 놔, a missing space before + 줘 ("루미야이리주세요", "나주십시오").""" + t = re.sub(r"^(\W*(?:루미야|로봇아|루미 ?씨))(?=[가-힣])", r"\1 ", text or "") # "루미야이리주세요" + t = HAND_FRAME.sub("", CALLING.sub("", t).strip()) or t + parts = re.split(r"(?<=[,.!?])\s+", t) + if len(parts) > 1: + kept = [x for x in parts if not CONTEXT_CLAUSE.match(x)] + t = " ".join(kept) if kept else t + t = CONTEXT_LEAD.sub("", t) + t = re.sub(r"^\W*(?:(?:go on then|go on|come on|okay then|alright then|do it|ok robot|okay robot)\W+)+", "", t, flags=re.I) + t = re.sub(r"(?= MIN_SCORE] - notes = "\n\n".join(f"[{src}]\n{t}" for _, src, t in hits) or "(no matching notes)" + notes = _notes(hits) lang = reply_language(text) # the long fixed part comes first and stays the same from turn to turn, so the runner keeps it cached (else ~3 s # more per turn); the time goes into the last message. What Lumi does now stays here: in the last message it @@ -2301,9 +2669,11 @@ class Brain: messages = [{"role": "system", "content": system}] for q, a in self.window(): messages += [{"role": "user", "content": q}, {"role": "assistant", "content": a}] - messages.append({"role": "user", "content": f"Reference notes:\n{notes}\n\n{_examples(about, on_task=bool(now) and 'not doing any task' not in now)}" - f"Now it is {now_line()}." + - f"\n\nVisitor: {text}\n\n" + self._fragment_hint(text) + + follow = _follow_examples(text, self.history) # with them, fewer plain examples (a shorter prompt) + messages.append({"role": "user", "content": f"Reference notes:\n{notes}\n\n{_examples(about, k=2 if follow else None, on_task=bool(now) and 'not doing any task' not in now)}" + f"{follow}" + f"Now it is {now_line()}.\n\n" + memory.turn_lines(self, text) + + f"Visitor: {text}\n\n" + self._fragment_hint(text) + f"(Reply in {lang}.)"}) buf, full, header, said, muted = "", "", None, [], False stream, retried = _stream(messages), False @@ -2317,6 +2687,13 @@ class Brain: first, rest = buf.split("\n", 1) if NONE_LINE.match(first) and len(rest.lstrip()) < LOOKUP_PEEK and "\n" not in rest.lstrip(): continue # the next line may be "search ..." (26b, now and then) + if re.match(r"\s*\**ACTION\**\s*:", rest) and (NONE_LINE.match(first) or + not re.match(r"\s*\**ACTION", first)): + if "\n" not in rest.lstrip(): # "ACTION: none -" or "Okay!" and then "ACTION: sing -": + continue # the second line is the action, never said aloud + said_first = "" if re.match(r"\s*\**ACTION", first) else first + first, rest = rest.lstrip().split("\n", 1) + rest = f"{said_first} {rest}".strip() buf = rest if NONE_LINE.match(first) and LOOKUP_ACTION.match(rest.lstrip()): first = re.search(r"search|weather", rest).group(0) # read as the action, never said @@ -2410,7 +2787,8 @@ class Brain: f"that question for it, not other facts about it.)\n") if last and ABOUT_ANSWER.match(text): # "why?", "how do you know?", "진짜?" after a refusal too return (f"(This asks about your answer \"{last[:FRAGMENT_CHARS * 2]}\": its reason or how you know it; " - f"a \"really?\" is answered \"Yes,\" with that same fact said again (the same number or name), no new fact.)\n") + f"a \"really?\" / \"sure?\" is answered \"Yes,\" with that answer's own facts said again (its numbers, names or the " + f"things it listed, never just \"that\" / \"those\"), no new fact.)\n") if not last or len(text.split()) > FRAGMENT_WORDS or not SHORT_Q.search(text) or is_backchannel(text) \ or ABOUT_YOU.search(text) or OWN_TOPIC.search(text): return "" @@ -2524,9 +2902,11 @@ class Brain: def topic(self, text): """What the words are about: a short follow-up ("tell me more", "can they see in the dark?") goes with the previous question, for the notes, the examples and the lookup decision.""" - if self.history and (len(text.split()) <= 4 or FOLLOW_UP.search(text) or REFERS_BACK.search(text)): + if self.history and (len(text.split()) <= 4 and not (OWN_SUBJECT.search(text) and not NAMED_BEFORE.search(text)) + or FOLLOW_UP.search(text) or + REFERS_BACK.search(text)): return " ".join([q for q, _ in self.history[-2:]] + [text]) # "which ones?" then "can they...?" - return text + return text # "세종대왕이 누구예요?", "Who was Sejong?": a topic of its own def window(self): """The turns given to the model: the last HISTORY_TURNS to 2 * HISTORY_TURNS - 1, the first one kept until the @@ -2764,10 +3144,11 @@ class Brain: costs its own last message, also after a lookup, a farewell, a mission read-back or a picture used the runner's one slot (else ~3.5 s more).""" system = self.last_system = getattr(self, "last_system", None) or route_system(markers, now) # respond_from too - turns = [{"role": r, "content": c} for q, a in self.history[-HISTORY_TURNS:] for r, c in (("user", q), ("assistant", a))] + turns = [{"role": r, "content": c} for q, a in self.window() for r, c in (("user", q), ("assistant", a))] # as respond_stream llm_direct.prefill([{"role": "system", "content": system}] + turns, MODEL) def reset(self): + memory.talk_over(self.history) # the talk that ends is kept (only in the live assistant) self.history = [] self.last_lookup = None self.weather_at = "" diff --git a/assistant/chain.py b/assistant/chain.py index de28260..e72f465 100644 --- a/assistant/chain.py +++ b/assistant/chain.py @@ -13,31 +13,56 @@ from assistant import brain, steps QUICK = {"look", "lift", "wave", "arm", "go_to", "come", "come_back", "follow", "move", "turn", "pick", "put", "move_object"} DRIVES = {"go_to", "come", "come_back", "follow", "move", "turn"} # after a failed step these depend on where Lumi is -_KO_ORDER = {"보": "봐", "흔들": "흔들어", "돌": "돌아", "올리": "올려", "내리": "내려", "높이": "높여", "낮추": "낮춰", - "들": "들어"} # "나 보고 ..." -> "나 봐", "고개 들고 ..." -> "고개 들어" -ASK = re.compile(r"\?\s*$|^\W*(?:what|what'?s|where|when|who|why|how|which|is|are|do|does|did|tell me|explain|describe)\b|" - r"몇 ?시|몇|뭐|무엇|어때|알려|언제|어디|누구|왜|얼마|날씨|설명해|말해 ?줘|얘기해", re.I) +_KO_ORDER = {"보": "봐", "흔들": "흔들어", "흔드": "흔들어", "돌": "돌아", "도": "돌아", "올리": "올려", "내리": "내려", + "높이": "높여", "낮추": "낮춰", "들": "들어", "드": "들어", "숙이": "숙여", "커지": "커져", "작아지": "작아져", + "낮아지": "낮아져", "높아지": "높아져", "돌리": "돌려", "오": "와", "따라오": "따라와", "가": "가"} +# "나 보고 ..." -> "나 봐", "고개 들고 ..." -> "고개 들어", "저를 보시고 ..." -> "저를 봐", "왼쪽으로 도시고" -> "왼쪽으로 돌아" +_KO_AND = re.compile(r"(" + "|".join(sorted(_KO_ORDER, key=len, reverse=True)) + r")(?:시)?고$") +ASK = re.compile(r"\?\s*$|^\W*(?:(?:also|and|then|so|ok|okay|robot|please|first|now|plus|oh|ah|um|uh|lumi)\W+)*" + r"(?:(?:what|where|when|who|why|how|which)(?:'s|'re|\s+(?:is|are|was|were|do|does|did|can|could|will|" + r"would|should|time|day|date|year|old|much|many|far|long|about|kind|your|you|made|built|created|" + r"invented|owns|makes)\b)|why\b|is|are|do|does|did|tell me|explain|describe)\b|" + r"\b(?:tell|telling) (?:me|us)\b|\bintroduce yourself\b|\b(?:say|tell me) your name\b|" + r"몇 ?시|몇|뭐|무엇|어때|알려|언제|어디|누구|왜|얼마|날씨|설명해|말해 ?줘|말하|얘기해|소개", re.I) _SPLIT = re.compile(steps._SPLIT.pattern, re.I) FETCHING = re.compile(r"\b(?:bring|fetch|deliver|carry)\b|가져|갖다", re.I) # a part that carries something somewhere _FILL = re.compile(rf"(?:{steps._FILL}|루미야?|lumi|hey|do me a favou?r|부탁(?:해|해요|할게)?|dear|sir|ma'?am|madam|buddy|" - r"my friend|robot|로봇아?|선생님?)", re.I) + r"my friend|robot|로봇아?|선생님?|yo|bro|dude|okay lumi|ok lumi|robot please|루미 ?씨|로봇 양반|여보세요|" + r"go ahead|okay\?|ok\?|right\?|thanks|thank you|yes|yeah|yep|yes\?|네|응|그래|will ya|will you|won'?t you|" + r"can\?|can|do it|do it now|just do it|alright\?|please\?|혹시|아 뭐라 그래야 되지|뭐라 그래야 되지|뭐더라|" + r"(?:아\s*)?영어로 ?뭐더라|(?:아\s*)?뭐라고 ?하지|" + r"(?:거기서?\s*)?(?:서|가만히)\s*있(?:어|게|으세요|으십시오)\s*(?:줄래|줄 ?수 ?있어요?|주실래요|주세요|줘|줘잉|주라|" + r"주면 ?안 ?될까요?|주면 ?좋겠어요?|주실 ?수 ?있어요?|주십시오|주이소)?|" + r"(?:거기서?\s*)?기다려\s*(?:줄래|주세요|줘)?)", re.I) # tags, hesitations, "...가서 서 있어 줄래?" +RELATIVE = re.compile(r"^\W*(?:where|which|who|that|when)\s+(?:the|my|your|his|her|our|their|a|an|this|that|these|those|" + r"people|everyone|it|he|she|they|we|i)\b", re.I) # "look right, where the door is": no question +PAST = re.compile(r"\byou (?:got|went|were|did|turned|looked|moved|came|said|told)\b|\b(?:earlier|before|yesterday)\b", re.I) +BANK_KINDS = {"look", "lift", "turn", "move", "come", "come_back", "follow", "wave", "arm", "go_to"} # a part the + # keyword rules miss, read by the intent bank (same slot rules) +CHAIN_ONLY = {"look", "lift", "wave", "come", "come_back", "follow"} # a part that is no mission step: with one in it, + # a sentence the mission reader reads whole is still a chain def _rule(words, markers): """brain.intent of a part, also of a Korean -고 form ("나 보고" read as "나 봐").""" rule = brain.intent(words, markers) - if not rule: - ko = re.sub(r"(보|흔들|돌|올리|내리|높이|낮추|들)고$", lambda m: _KO_ORDER[m.group(1)], words) - rule = brain.intent(ko, markers) if ko != words else None + ko = _KO_AND.sub(lambda m: _KO_ORDER[m.group(1)], words.strip()) + if not rule and ko != words.strip(): + rule = brain.intent(ko, markers) m = not rule and re.fullmatch(r"(?:(나|저|날|나를|저를)\s+)?([a-z][a-z ]*?)\s*(?:하고|해|해요|해 ?줘)?", words.strip()) if m: # Konglish: "나 look 하고" -> "look at me", "wave 해" -> "wave" en = m.group(2) + ((" at me" if m.group(2) == "look" else " me") if m.group(1) else "") rule = brain.intent(en, markers) + if not rule and len(words.split()) > 1 or not rule and re.search(r"[가-힣]", words): + from assistant import intent_bank # "glance to your right", "고개 숙이고": the bank, by meaning + got = intent_bank.read(ko, markers) + rule = got if got and got[0] in BANK_KINDS else None return rule def parts(text): """The sentence cut at and / then / 그리고 / -고 / -서, messages to say kept whole, fillers and the name dropped.""" + text = re.sub(r"(? data/intent_bank.npz .venv/bin/python assistant/intent_bank.py "say hi with your arm" # what the bank reads, with the closest wordings """ -import hashlib import pathlib import random import re @@ -25,8 +24,10 @@ ROOT = pathlib.Path(__file__).resolve().parents[1] CACHE = ROOT / "data" / "intent_bank.npz" SIM_MIN = 0.84 # the closest wording must be at least this similar (bge-m3 cosine) ... MARGIN = 0.04 # ... and this much closer than the closest wording of any other kind (the "no" kind too) +MARGIN_WORDS = 0.015 # ... or this much, when the other kind is another motion whose words are not there ("턴 left + # 해 줘": turn, a move's slot finds no drive in it) and the closest kind's words are AGREE_K = 2 # ... and the K closest wordings all of that kind -MIN_CHARS = 4 # shorter words ("go", "가") are the rules' or the LLM's +MIN_CHARS = 4 # shorter words ("go", "가") are the rules' or the LLM's (a Hangul syllable counts as 2) MAX_WORDS = 16 # a longer sentence is a story or several requests: the LLM reads it FILLS = 3 # place / object fills made of each template (the same every run) @@ -50,7 +51,7 @@ WONDER = re.compile(r"\bi wonder\b|\bwonder(?:ing)? (?:if|whether|how)\b|\bi bet # "can it wave? I wonder", "does it follow people?", "이거 손 흔들 수 있나?", "얘 따라오나 봐" NOT_TO_LUMI = re.compile( r"\bshall we\b|\bwe(?:'re| are) (?:heading|going|off|gonna)\b|\bwe (?:should|could|can|will|might|must|need to)\b|\bwe'll\b|" - r"\byou and (?:i|me)\b|\bmy plan\b|\bour plan\b|우리.*(?:자|까|래|기로)\s*[??.!~]*$|" # plans between people + r"\byou and (?:i|me)\b|\bmy plan\b|\bour plan\b|우리(?!.*악수).*(?:자|까|래|기로)\s*[??.!~]*$|" # plans between people r"\bimagine\b|\bsuppose\b|\bwhat if\b|\bwould you ever\b|\bif you were\b|\bpretend\b|\bhypothetical|" r"만약|[가-힣](?:라면|다면)|어떨까|겠다\s*[!.~]*$|" # hypotheticals r"\battention\b|\bladies and gentlemen\b|\b(?:visitors|guests|attendees|passengers)(?: are)? (?:please|should|must|may|" @@ -62,7 +63,9 @@ NOT_TO_LUMI = re.compile( QUESTION = re.compile(r"^\W*(?:(?:hey|so|um+|uh+|lumi|okay|ok)\W+)*(?:what|where|why|how|when|who|whose|which|is|are|was|" r"were|do(?=\s+(?:you|i|we|they|robots?)\b)|does|did|have|has|had|should|shall i|may i|can i|could i)\b(?! about\b)|" r"어디|뭐|무엇|왜|언제|누구|어떻게|몇|어느|무슨|어떤|얼마|[가-힣]까\s*[??]+\s*$|봤(?:어|니|나|냐|어요|습니까)|본 ?적|" - r"\bhave you (?:been|gone|ever)\b|(?:어|아|해|여)도 ?(?:돼|되|될까|괜찮)", re.I) + r"\bhave you (?:been|gone|ever)\b|(?:어|아|해|여)도 ?(?:돼|되|될까|괜찮)|" + r"알려 ?(?:줘|주|줄)|설명해|가르쳐|말해 ?(?:줘|봐|주)|\btell me\b|\bexplain\b|\bdescribe\b|" + r"정확도|얼마나|을매나|속도", re.I) # "팔 정확도 알려 줘": a question, no motion OTHER_SENSE = re.compile(r"instagram|insta\b|\bsns\b|\baccount\b|\bsubscribe\b|인스타|계정|채널|구독|팔로우 ?해 ?주세요|" r"따라 ?(?:해|하|말|불러)|\brepeat after\b|\bcopy me\b|\bdo what i do\b|\b(?:lend|give) me a hand\b|" r"\bneed a hand\b|\bhand it to\b|가는 ?길|길 ?(?:좀 )?알려|\bhow (?:do i|to) get\b|\bdirections?\b|\bthe way to\b|" @@ -71,8 +74,8 @@ REPEAT = re.compile(r"^\W*(?:(?:\w+\W+){0,2})?(?:again|one more time|once more|d r"^\W*(?:[가-힣]+\s+)?(?:한 ?번(?:만)? 더|다시|또)\s*(?:해|해 ?줘|해 ?봐|해 ?주세요|하자)?\W*$", re.I) # "again", "한 번만 더 해 줘": what again is the history's (driving.read, the LLM) SEVERAL = re.compile(r"\b(? / slots filled (FILLS each, a fixed seed).""" + """[(text, kind)]: the bank with its / slots filled (FILLS each, a fixed seed), Korean endings as + plain() reads them (wording.ko_plain: "가 주세요" is stored as "가 줘"), each once.""" + from assistant import wording out = [] for kind, texts in KINDS.items(): for t in texts: for a in _fill(t, "", PLACE_EN, PLACE_KO): - out += [(b, kind) for b in _fill(a, "", OBJ_EN, OBJ_KO)] - return out + out += [(wording.ko_plain(b), kind) for b in _fill(a, "", OBJ_EN, OBJ_KO)] + return list(dict.fromkeys(out)) _bank = None def _load(): - """(vectors, kinds) of the bank: from data/intent_bank.npz when it holds these very wordings, else embedded now.""" + """(vectors, kinds) of the bank; embeddings kept per wording in the cache (bank_words.vectors).""" global _bank if _bank is None: - from assistant import knowledge + from assistant import bank_words ex = examples() - texts = [t for t, _ in ex] - key = hashlib.sha1("\n".join(f"{t}\t{k}" for t, k in ex).encode()).hexdigest() - if CACHE.exists(): - z = np.load(CACHE) - if str(z["key"]) == key: - _bank = (z["vecs"], z["kinds"]) - return _bank - vecs = knowledge.embed(texts) - kinds = np.array([k for _, k in ex]) - np.savez(CACHE, vecs=vecs, kinds=kinds, key=key) - _bank = (vecs, kinds) + _bank = (bank_words.vectors([t for t, _ in ex], CACHE), np.array([k for _, k in ex])) return _bank @@ -711,7 +715,8 @@ SLANG = [(re.compile(rf"(? MAX_WORDS: + if len(t) + len(re.findall(r"[가-힣]", t)) < MIN_CHARS or len(t.split()) > MAX_WORDS: # a Hangul syllable counts twice return "length" for name, rx in (("negation", NEGATION), ("later", LATER), ("ability", ABILITY), ("question", QUESTION), ("self", SELF_TALK), ("several", SEVERAL), ("hand", HAND_WORDS), ("other sense", OTHER_SENSE), @@ -742,6 +748,8 @@ def guarded(text): return "later" if past_ko(t): return "past" + if told_ko(t): + return "told" if re.match(r"^\W*야\s", t): return "someone else" # "야 커피코너에서 컵 좀 가져와": a friend called (야 루미 is cut before) name = NAME_CALL.match(t) @@ -765,7 +773,7 @@ def nearest(text, k=5): TAIL = re.compile(r"(?:[\s,.!?~]+(?:please|thanks|thank you|for me|now|right now|real quick|real fast|if you can|lumi|okay|" r"yo|my friend|you|thank|" - r"고마워|고마워요|감사합니다|감사해요|부탁해|부탁해요|부탁합니다|루미야|제발))+[\s,.!?~]*$", re.I) + r"고마워|고마워요|감사합니다|감사해요|부탁해|부탁해요|부탁합니다|루미야|제발|허허|하하|헤헤|호호|ㅎㅎ+|ㅋㅋ+))+[\s,.!?~]*$", re.I) CANON_PLACE = "p3" # a named marker is embedded as this one: the bank's wordings know it, any map's names work @@ -798,21 +806,42 @@ def kind_of(text, markers=()): except OSError as e: # no embedding server: the LLM decides print(f"intent bank: {e}") return None - sims = vecs @ q - kinds = np.where(kinds == "fetch", "pick", kinds) # pick or fetch: one kind here, the words decide (_slot) - order = np.argsort(-sims)[:AGREE_K] - best = kinds[order[0]] - if best not in ACTS or sims[order[0]] < SIM_MIN or any(kinds[i] != best for i in order): + best, top, margin, agree, second = _top(vecs @ q, _codes()) + if best not in ACTS or top < SIM_MIN or not agree or margin < MARGIN_WORDS: return None - if sims[order[0]] - sims[kinds != best].max() < MARGIN: - return None - return str(best) + return best if margin >= MARGIN else (best, second) # close to another motion: the words decide (read) + + +_kind_codes = None + + +def _codes(): + """(names, int code per bank row): kinds compared as numbers, fetch read as pick (the words decide, _slot).""" + global _kind_codes + if _kind_codes is None: + kinds = np.where(_load()[1] == "fetch", "pick", _load()[1]) + names, codes = np.unique(kinds, return_inverse=True) + _kind_codes = ([str(n) for n in names], codes) + return _kind_codes + + +def _top(sims, named, k=AGREE_K): + """(kind of the closest row, its similarity, its lead over the closest row of any other kind, whether the k + closest rows are all of that kind, that other kind): one pass over the bank, no sort of it.""" + names, codes = named + top = np.argpartition(sims, -k)[-k:] + top = top[np.argsort(-sims[top])] + best = codes[top[0]] + others = np.where(codes != best, sims, -1.0) + second = int(np.argmax(others)) + return (names[best], float(sims[top[0]]), float(sims[top[0]] - others[second]), bool((codes[top] == best).all()), + names[codes[second]]) # ---------- slots: what the words themselves say ---------- DIR = {"forward": r"\b(?:forward|forwards|forword|ahead|straight)\b|\bto the front\b|앞으로|앞쪽|^\s*앞|forward로", "back": r"\b(?:back|backward|backwards|reverse|bak)\b|뒤로|후진|뒤쪽|물러", - "left": r"\bleft|\blef\b|왼쪽|왼편|좌측", "right": r"\bright\b|\brite\b|오른쪽|오른편|우측"} + "left": r"\bleft|\blef\b|왼쪽|왼편|좌측|좌회전|(?:^|\s)좌로|좌향", "right": r"\bright\b|\brite\b|오른쪽|오른편|우측|우회전|(?:^|\s)우로|우향"} CARRY = (r"\b(?:bring(?! yourself)|fetch|deliver|carry)\b|\bget me\b|\b(?:to|for) me\b(?=.*\b(?:bring|get|fetch|hand|pass)\b)|" @@ -823,14 +852,14 @@ LIFT_SAID_MAX_M = 0.3 # m; a longer lift amount said is no lift request ("grow LIFT_BODY = (r"\b(?:yourself|your (?:body|torso|upper body)|body|make you|taller|shorter|smaller|small|tall|high|lift|rise|grow|" r"shrink|come down|go up|go down|move up|move down|raise up|lower down|come up|sink down|elevate|squat|height|" r"stretch up|drop down|going down|going up)\b|위로|아래로|낮아|높아|" - r"키|몸|리프트|상체|높게|낮게|높이|커져|작아져|올라|내려가|업\b|다운") + r"키|몸|리프트|상체|높게|낮게|높이|커져|작아져|올라|내려가|업\b|다운|늘려") MOVE_VERB = (r"\b(?:move|go|step|back up|backup|scoot|slide|shift|drive|roll|reverse|inch|come|forward|backward|ahead|" r"moov|moove|bak)|가|이동|물러|비켜|후진|와|빠져|걸음|발짝|move|back|go") # a bare "왼쪽으로" may be a look -LOOK_DIR = {"left": r"\bleft|왼|레프트", "right": r"\bright|\brite\b|오른|라이트", +LOOK_DIR = {"left": r"\bleft|왼|레프트|(?:^|\s)좌로|좌측", "right": r"\bright|\brite\b|오른|라이트|(?:^|\s)우로|우측", "up": r"\bup|\bupward|\bceiling|\bsky\b|\bhigher\b|천장|하늘|(? {CACHE}") else: from tests.conversation_check import markers as _markers for said in sys.argv[1:]: - print(said, "| guard:", guarded(said), "| kind:", kind_of(said), "| read:", read(said, _markers())) + print(said, "| guard:", guarded(said), "| kind:", kind_of(plain(said)), "| read:", read(said, _markers())) for s, k, w in nearest(said)[0]: print(f" {s:.3f} {k:10} {w}") diff --git a/assistant/interrupt_examples.py b/assistant/interrupt_examples.py index 988e9f3..caca701 100644 --- a/assistant/interrupt_examples.py +++ b/assistant/interrupt_examples.py @@ -356,6 +356,15 @@ EXAMPLES = [ (J_SAFE, "stranger", "okay", "safety_stop", "I'll wait until someone says go on."), (KJ_SAFE, "stranger", "알았어", "safety_stop", "가도 된다고 하실 때까지 기다릴게요."), (J_STOP, "stranger", "go to p6", "answer", "I'm going to p6 already, to bring this cup to James." + GO), + # ---- thanks in the middle: an end only when nothing else is asked ---- + (J_STOP, "stranger", "thanks! and where are you going?", "answer", J_TASK + GO), + (J_STOP, "stranger", "thank you, what's that you're holding?", "answer", "It's a cup for James at p6." + GO), + (J_STOP, "stranger", "thanks, that's all", "resume", BYE), + (J_STOP, "stranger", "okay thanks", "resume", BYE), + (KJ_STOP, "stranger", "고마워요, 근데 어디 가요?", "answer", KJ_TASK + KGO), + (KJ_STOP, "stranger", "감사합니다. 그 컵은 누구 겁니까?", "answer", "제임스 님 컵입니다." + KGO), + (KJ_STOP, "stranger", "고마워, 이제 됐어", "resume", KBYE), + (KJ_STOP, "stranger", "알겠어요, 고마워요", "resume", KBYE), ] diff --git a/assistant/lumi.py b/assistant/lumi.py index f54e304..aeb64ac 100644 --- a/assistant/lumi.py +++ b/assistant/lumi.py @@ -96,6 +96,7 @@ from manipulation import wave as wave_mod from assistant import web from assistant import fetch_dialog from assistant import seeing +from assistant import memory from assistant.brain import Brain NEAR_MIN, NEAR_MAX = 0.5, 1.2 # m, greeting zone @@ -155,8 +156,9 @@ ELSEWHERE = re.compile(r"(으로|로)\s*(가져|갖다)|\b(to the|instead|over t GIVE_ME = re.compile(r"\b(give|hand|mine|for me|to me|i'?ll take it|i will take it|i can take it)\b|주세요|줘|내 거|" r"제 거|제가 받을게|받을게", re.I) MOVING_ACTIONS = {"go_to", "come", "come_back", "follow", "move", "turn", "arm", "pick", "put", "move_object", "fetch", "give", "place", "wave", - "lift"} -BASE_ACTIONS = {"go_to", "come", "come_back", "follow", "move", "turn"} # need the base: Patrol on + "lift", "waist"} +BASE_ACTIONS = {"go_to", "come", "come_back", "follow", "move", "turn", "waist"} # need Patrol on (the base, the waist) +WAIST_STEP_DEG = 30.0 # deg; "turn your waist left" with no amount: this far from where it is (estimate) DRIVE_STEPS = {"go", "move", "turn"} # mission steps that drive FIX_SAY = (("Okay.", "네."), # a command taken back in the same sentence ("Sorry, which one did you mean? Please say it again.", "죄송해요, 어느 쪽 말씀이세요? 다시 한 번 말씀해 주세요.")) @@ -186,7 +188,16 @@ LIMIT_SAY = {"yaw": (f"I can turn my head up to {head.AXIS_LIMITS[2][1]:g} degre "pitch": (f"I can tilt my head from {-head.PITCH_RANGE[0]:g} degrees down to {head.PITCH_RANGE[1]:g} degrees up.", f"고개는 아래로 {-head.PITCH_RANGE[0]:g}도, 위로 {head.PITCH_RANGE[1]:g}도까지 움직여요."), "lift": (f"For now I can raise my body only up to {head.LIFT_MAX_MM:g} millimetres.", - f"지금은 몸을 {head.LIFT_MAX_MM:g}밀리미터까지만 올릴 수 있어요.")} # a number asked for was past the range + f"지금은 몸을 {head.LIFT_MAX_MM:g}밀리미터까지만 올릴 수 있어요."), # a number asked for was past the range + "left": ("I'm already turned as far left as I can go.", "고개를 더 이상 왼쪽으로 돌릴 수 없어요."), + "right": ("I'm already turned as far right as I can go.", "고개를 더 이상 오른쪽으로 돌릴 수 없어요."), + "up": ("I'm already looking as far up as I can.", "고개를 더 이상 들 수 없어요."), + "down": ("I'm already looking as far down as I can.", "고개를 더 이상 숙일 수 없어요."), + "lift_up": ("I'm already as tall as I can go.", "더 이상 올라갈 수 없어요."), + "lift_down": ("I'm already as low as I can go.", "더 이상 내려갈 수 없어요."), + "waist_left": ("My waist is already turned as far left as it goes.", "허리를 더 이상 왼쪽으로 돌릴 수 없어요."), + "waist_right": ("My waist is already turned as far right as it goes.", "허리를 더 이상 오른쪽으로 돌릴 수 없어요.")} + # the head or the lift already at that end ("more" / "again" too): nothing moved, said plainly DONE_TALK = re.compile(r"\b(bye+|goodbye|see you|never ?mind|nothing|that'?s (all|it)|no thanks|thanks|thank you|" r"okay|ok|fine|alright|cool|whatever)\b|안녕히|잘 ?가|됐어|괜찮아|아니야|고마워|감사|그래|네|수고|알았어|" r"그게 ?다|빠이|바이|나중에|안녕\s*[.!]?$", re.I) @@ -218,12 +229,12 @@ EMPTY_HAND = re.compile(r"\b(give|hand|pass) (it|that|this)( (over|back|here))?( r"\bcan i have (it|that|this)\b|(그거|이거|그것|그걸|이걸)\s*(이제|이리|좀|빨리)?\s*(나|저)?(한테|에게)?\s*" r"(줘|주세요|건네)|" r"\b(put|place|set) (it|that|this) (down|on the table)\b|(그거|그것|이거|그걸|이걸)\s*(나한테|저한테|나|저)?\s*" - r"(줘|주세요|건네)|들고 ?있는 ?(거|것)을?\s*(나|저)?(한테|에게)?\s*(줘|주세요)|^\s*건네\s*(줘|주세요)|테이블에\s*(놔|놓아|둬)|내려\s*(놔|놓아)", re.I) + r"(줘|주세요|건네)|(?:들고 ?있는|손에 ?(?:든|있는)|쥐고 ?있는|잡고 ?있는) ?(?:거|것|\S+)(?:을|를)?\s*(?:좀\s*)?(?:나|저)?(?:한테|에게)?\s*(?:좀\s*)?(?:줘|주|줄|도(?=\W*$)|건네|넘겨|내놔)|^\s*건네\s*(줘|주세요)|테이블에\s*(놔|놓아|둬)|내려\s*(놔|놓아)", re.I) EMPTY_HAND_SAY = {"en": "I'm not holding anything right now.", "ko": "지금은 손에 아무것도 들고 있지 않아요."} ASK_PREFIX = re.compile(r"\b(do|did) you (know|happen to know)\b|\b(can|could) you (tell|find out|look up|check)( me)?\b|" r"아세요|알아요|알아\?", re.I) # "do you know who won?" is not about Lumi ASKS_MORE = re.compile(r"\?|\b(but|can|could|what|how|where|why|when|who|one more)\b|근데|그런데|뭐|어떻게|어디|언제|누구|하나만 더|" - r"물어볼게|물어봐도", re.I) + r"(? " RELEASE = re.compile(r"^\s*(?:(?:ok(?:ay)?|alright|lumi|루미야?)[\s,.!]+)?(?:you can go(?: now)?|take care|가 ?보세요|가세요|가도 ?돼요?)" r"[\s.!~]*$", re.I) # said alone: the visitor lets Lumi go THANKS = re.compile(r"\bthank(?:s| you)\b|\bthanx\b|\bcheers\b|고마워|고맙|감사|땡큐", re.I) -DONE_WORDS = re.compile(r"\bthat'?s (?:it|all|enough|everything)\b|\bno,? thanks?\b|\bnothing(?: else)?\b|\benough\b|됐어|됐습니다|" +DONE_WORDS = re.compile(r"\bthat'?s (?:it|all|enough|everything|plenty)\b|\bno,? thanks?\b|\bnothing(?: else)?\b|\benough\b|됐어|됐습니다|" + r"\bi'?m (?:good|all set|fine|done)\W*(?:thanks?\W*)?(?:robot|lumi)?\W*$|^\W*(?:nah|nope),? (?:i'?m )?(?:good|fine)\W*$|" + r"충분해|충분합니다|^\W*(?:아뇨|아니요|아니)?\W*없어요?\W*$|(?:^|[\s,.])(?:더 )?없(?:어|어요|습니다)(?=[\s,.!~]|$|고마|감사)|" + r"괜찮(?:아|아요|습니다)(?=[\s,.!~]|$)|그거면 (?:돼|됐|충분)|\ball good\b|\bi'?m good\b|\bthat helped\b|" r"그만", re.I) # "that's it", "됐어요": maybe done; the LLM decides with the talk before HI_ANNYEONG = re.compile(r"(? {mm:.0f} mm") threading.Thread(target=lambda: safe(lambda: head.moveto([mm, cur[1], cur[2], cur[3]], LIFT_VEL)), daemon=True).start() return limited + def waist(self, target): + """'left', 'right 45', 'center': the waist (upper body: the arm and both cameras turn with it, the base stays), + from where it is, the front being where measure-axis was run (fetch._waist_turn); +deg = left. The move is + fetch._waist_to (cut to the waist's range, refused when the arm's sweep is not clear), in a thread. Returns + "waist_left" / "waist_right" when the waist already stands at that end (nothing moves), else None.""" + from tasks import fetch + cur = safe(head.status) + if cur is None: + return None + lo, hi = head.AXIS_LIMITS[1] + front = cur[1] - (safe(fetch._waist_turn, default=0.0) or 0.0) # the waist angle at the front + d, _, n = target.partition(" ") + if d == "center": + goal = front + else: + goal = max(lo, min(hi, cur[1] + (1 if d == "left" else -1) * (float(n) if n else WAIST_STEP_DEG))) + if abs(goal - cur[1]) < 1.0: + log(f" waist {target}: already at {cur[1]:.0f} deg, the end") + return f"waist_{d}" + self.stay() + + def run(): + if safe(fetch._waist_to, goal - front, default=False) is False: + self.fetch_say("Sorry, something is in my arm's way, so I didn't turn.", + "죄송해요, 팔 쪽에 뭔가 있어서 돌지 않았어요.") + log(f" waist {cur[1]:.0f} -> {goal:.0f} deg") + threading.Thread(target=run, daemon=True).start() + return None + def move_by(self, action, target): """'move forward 1' / 'move left 0.5' / 'turn around 180' / 'turn left 90', relative to where Lumi stands. Left / right are a normal base move to a map point, so obstacles are avoided; forward and back are a straight @@ -1031,7 +1086,7 @@ class Lumi: elif got[0] in ("look", "lift"): # "one more" / "더" after a look or a lift: further that way hist.append((text, f"ACTION: {got[0]} {got[1]}")) log(f" action {got[0]} {got[1]} (again)") - limited = self.look(got[1]) if got[0] == "look" else "lift" if self.lift(got[1]) else None + limited = self.look(got[1]) if got[0] == "look" else self.lift(got[1]) say = LIMIT_SAY[limited][lang != "en"] if limited else "Okay." if lang == "en" else "네." elif got[0] == "refuse": d, n = got[1].split() @@ -1494,7 +1549,7 @@ class Lumi: if kind == "talk": self.answer(words, part=True) elif kind == "quick": - self.quick_command(words) + self.quick_command(words, what) # chain.plan's reading ("나 보고", the bank's) else: if {st["do"] for st in what} & DRIVE_STEPS and (self.base_off("go_to") or not self.modes.drive): failed = True @@ -2113,7 +2168,8 @@ class Lumi: def warm_llm(self): """brain.warm in the background (markers and the task state are read there, listening starts at once).""" - threading.Thread(target=lambda: safe(lambda: self.brain.warm(self.markers, self.now_doing()[0])), daemon=True).start() + threading.Thread(target=lambda: safe(lambda: self.brain.warm(self.markers, self.now_doing()[0] + memory.arm_line())), + daemon=True).start() def talk_turn(self): """Listen once; answer if something was said. Returns True if the visitor spoke.""" @@ -2407,9 +2463,10 @@ class Lumi: mouth.say(f"Okay, I'm going to {name}." if en else f"네, {name}로 갈게요.") self.keep_listening() - def quick_command(self, text): - """A command the keyword rules recognise for sure: confirm with a ready phrase and act, no LLM wait.""" - rule = brain_mod.intent(text, self.markers) + def quick_command(self, text, rule=None): + """A command the keyword rules recognise for sure: confirm with a ready phrase and act, no LLM wait. rule: + route's / chain.plan's reading when it has one (the intent bank's, a Korean -고 part), else brain.intent.""" + rule = tuple(rule) if rule else brain_mod.intent(text, self.markers) if not rule and brain_mod.place_problem(text, self.markers): agv.known_markers(fresh=True) # not on the list: the map may have just changed rule = brain_mod.intent(text, self.markers) @@ -2455,11 +2512,15 @@ class Lumi: return True if action == "lift": limited = self.lift(target) - mouth.say(LIMIT_SAY["lift"][0 if en else 1] if limited else ("Okay." if en else "네.")) + mouth.say(LIMIT_SAY[limited][0 if en else 1] if limited else ("Okay." if en else "네.")) return True if action == "fetch": self.fetch_request(target) return True + if action == "waist": + limited = self.waist(target) + mouth.say(LIMIT_SAY[limited][0 if en else 1] if limited else ("Okay." if en else "네.")) + return True if not self.modes.drive: mouth.say("Sorry, driving is switched off." if en else "죄송해요, 지금은 이동할 수 없어요.") return True @@ -2543,6 +2604,14 @@ class Lumi: mouth.say("Sorry, I only understand English and Korean." if self.lang == "en" else "죄송해요, 영어와 한국어만 이해해요.") self.keep_listening() return + memory.heard(claimed_name(text), self.current) # who this talk is with (assistant/memory.py) + mem = None if self.mission_running() else memory.reply(text, self.lang, history=self.brain.history) # "do you remember ...?" + if mem: # before self_correct: "no" answers "Do you mean ...?" + log(f" memory: {mem}") + self.brain.history.append((text, f"ACTION: none -\n{mem}")) + mouth.say(mem, abort=self.speak_abort) + self.keep_listening() + return fixed = text if self.mission_running() else brain_mod.self_correct(text, self.markers) # "go to start, no, end" if fixed != text: log(f" corrected in the sentence: {fixed!r}") @@ -2578,6 +2647,7 @@ class Lumi: if kind == "seeing": # "do you see a cup?", "what am I holding?" log(f" seeing: {data}") self.brain.history.append((text, f"ACTION: none -\n{data}")) # "and you?" / "why?" next has the turn + memory.note_seen() # what is in view now is kept (48 h), in the background mouth.say(data) self.keep_listening() return @@ -2620,7 +2690,8 @@ class Lumi: if kind == "sing": # "sing a song", "노래 불러 줘", after a song "another one" self.sing_song(text) return - if kind in ("quick", None) and self.quick_command(text): # None: an unknown place is still said here + if kind in ("quick", None) and self.quick_command(text, data if kind == "quick" else None): # None: an + # unknown place is still said here log(f" done at once ({time.time() - t:.1f} s)") return bank = sing.bank_read(text, last) if kind is None else None # a song or the songs by meaning (song_bank.py) @@ -2647,7 +2718,10 @@ class Lumi: self.look_up(text, "search", self.brain.search_query(text), t) return about, repeating = self.brain.topic(text), self.brain.again(text) - gen = self.brain.respond_stream(text, self.markers, now=self.now_doing()[0] + seeing.facts_for(text) + + view = seeing.facts_for(text) + if view: + memory.note_seen() # a camera summary for the LLM: kept too + gen = self.brain.respond_stream(text, self.markers, now=self.now_doing()[0] + memory.arm_line() + view + battery.fact_for(text)) head_ = next(gen) log(f" action {head_['action']} {head_['target']} ({time.time() - t:.1f} s)") @@ -2699,7 +2773,14 @@ class Lumi: self.keep_listening() return if head_["action"] not in ("none", "end"): - self.act(head_["action"], head_["target"]) + limited = self.act(head_["action"], head_["target"]) + if head_["action"] in ("look", "lift") and limited in LIMIT_SAY: # at its end: said so, not the model's + gen.close() # "okay" + said = LIMIT_SAY[limited][self.lang != "en"] + mouth.say(said) + keep_said(self.brain, text, said) + self.keep_listening() + return first = next(gen, None) log(f" first sentence after {time.time() - t:.1f} s") promise = brain_mod.promised(first) if head_["action"] == "none" and \ @@ -2729,6 +2810,8 @@ class Lumi: log(f"lumi ({time.time() - t:.1f} s, voice after {mouth.last_voice - t:.1f} s): {said}") if head_["action"] == "end" and fate == "close" and not kept_goodbye(said): head_["action"] = "none" # "Okay, thanks." -> "You're welcome.": no goodbye said + elif head_["action"] == "none" and fate == "close" and kept_goodbye(said): + head_["action"] = "end" # "thanks, that's all" -> "Have a great day!": it took leave if head_["action"] in ("end", "go_to"): self.current, self.voice_until = None, 0.0 # stay quiet with this person until a new visit elif self.current is None: @@ -3130,6 +3213,10 @@ class Lumi: "talking with one person in view")) if self.vision: self.vision.start() + memory.start(idle=lambda: self.current is None and time.time() - getattr(self, "last_activity", 0.0) > 20, + after=self.warm_llm) # talks kept from now on; summed up while nobody talks + memory.watch(arm_ok=lambda: not getattr(self, "busy_now", "") and self.doing() is None and + self.fetch_status() != "running", look_held=self.look_held) self.warm_llm() log("ready") self.run_camera() if self.vision else self.run_desk() @@ -3144,7 +3231,28 @@ NOT_STOP = re.compile( # a stop word that orders no stop: negated, about someo r"\b(?:freezes|froze|frozen|freezing)\b|" r"(?:다리|손|심장|시계|컴퓨터|노트북|버스|차|폰|핸드폰|화면|숨|시간|엘리베이터|에스컬레이터)(?:이|가|도|는|은)?\s*(?:\S+\s+){0,2}" r"(?:멈췄|멈춰(?:요|서|버렸|있)|멈춰\.?$|멈추)|(?:멈췄|멈추더라|멈추던데|멈춘다)|" - r"(?:엄마|아빠|선생님|걔|쟤|친구|사람|그 ?분|형|누나|언니|오빠)\S*\s.*라고 ?했", re.I) + r"(?:엄마|아빠|선생님|걔|쟤|친구|사람|그 ?분|형|누나|언니|오빠)\S*\s.*라고 ?했|" + r"\bstop-motion\b|\bone-stop\b|\bwhy(?:'d| did| do| does)? (?:you|it|lumi) (?:freeze|stop|halt)|\b(?:would|should|could|might|will) stop\b|\blet'?s stop (?:at|for|by)\b|" + r"\bstop (?:for|at the|at a) (?:coffee|lunch|a (?:bit|while|break)|the \w+ (?:place|shop|store|cafe))|" + r"\b(?:when|if|once|whenever|after) [^,]{1,40},?\s*(?:you )?stop\b|" + r"그만(?:두|뒀|둘)|그만 ?(?:먹|마시|자|놀|울|웃|싸우|뛰)|" + r"(? how it is said in Korean, and other spellings + "registration": ["레지스트레이션", "레지스트레이숀", "등록"], "gallery": ["갤러리", "겔러리", "갤러리이"], + "information": ["인포메이션", "안내"], "info": ["인포", "information", "인포메이션", "안내"], + "desk": ["데스크", "대스크", "데스끄"], "cafe": ["카페", "카패", "까페", "café"], "coffee": ["커피", "코피"], + "corner": ["코너"], "elevator": ["엘리베이터", "엘레베이터", "엘베"], "lift": ["리프트"], "entrance": ["엔트런스", "입구"], + "exit": ["엑시트", "엑싯", "출구"], "stage": ["스테이지", "무대"], "main": ["메인"], "booth": ["부스", "boot", "bootH"], + "hall": ["홀", "hole", "hol"], "gate": ["게이트", "gait"], "photo": ["포토", "foto", "사진"], "zone": ["존", "zon"], + "lounge": ["라운지", "휴게실"], "lobby": ["로비"], "bar": ["바"], "table": ["테이블", "table"], "front": ["프론트", "프런트", "앞"], + "restroom": ["화장실"], "toilet": ["화장실"], "meeting": ["미팅", "회의"], "room": ["룸", "실"], "shop": ["샵", "숍"], + "gift": ["기프트", "기념품"], "dock": ["도크", "독"], "demo": ["데모"], "lab": ["랩"], "office": ["오피스", "사무실"], +} +KO_EN = { # a Korean word of a name -> how it is said in English + "안내": ["information", "info", "인포", "인포메이션"], "데스크": ["desk", "대스크"], "커피": ["coffee"], "코너": ["corner"], + "포토": ["photo", "foto"], "존": ["zone"], "입구": ["entrance", "엔트런스"], "출구": ["exit", "엑시트"], + "무대": ["stage", "스테이지"], "휴게실": ["lounge", "break room", "rest area", "라운지"], "회의실": ["meeting room", "conference room"], + "화장실": ["restroom", "toilet", "bathroom", "washroom"], "앞": ["front"], "부스": ["booth"], "라운지": ["lounge"], + "기념품점": ["gift shop", "souvenir shop"], "로비": ["lobby"], "카페": ["cafe", "café", "카패"], "갤러리": ["gallery"], +} +LETTER = {"a": ["a", "에이", "ay", "에이에"], "b": ["b", "bee", "be", "비", "삐"], "c": ["c", "see", "sea", "씨"], + "d": ["d", "dee", "디"], "e": ["e", "이"]} +NUM = {1: ["one", "won", "원", "일"], 2: ["two", "투", "이"], 3: ["three", "쓰리", "스리", "삼"], + 4: ["four", "포", "사"], 5: ["five", "파이브", "오"], 6: ["six", "식스", "육"], 7: ["seven", "세븐", "칠"], + 8: ["eight", "에잇", "팔"], 9: ["nine", "나인", "구"], 10: ["ten", "텐", "십"], 11: ["eleven", "십일"], + 12: ["twelve", "트웰브", "십이"], 13: ["thirteen", "십삼"], 14: ["fourteen", "십사"], 15: ["fifteen", "십오"]} +SEP = r"[\s_.-]*(?:(?:번|number|no\.?|넘버)\s*)?" # between the words: "booth 3", "booth_3", "삼 번 부스" + + +def _segments(tok): + """A Korean word cut into the known words of KO_EN ("커피코너" -> 커피, 코너), else the word whole.""" + out, rest = [], tok + while rest: + w = next((k for k in sorted(KO_EN, key=len, reverse=True) if rest.startswith(k)), None) + if not w: + return [tok] + out.append(w) + rest = rest[len(w):] + return out + + +def _alts(tok, alone): + if tok.isdigit(): + return [tok] + NUM.get(int(tok), []) + if tok in LETTER: + return LETTER[tok] if not alone else [tok] + return [tok] + EN_KO.get(tok, []) + KO_EN.get(tok, []) + + +@functools.lru_cache(maxsize=64) +def _patterns(markers): + out = [] + for m in markers: + if re.fullmatch(r"p\d+|home", m.lower()): + continue + toks = [] + for tok in re.findall(r"[a-z]+|\d+|[가-힣]+", m.lower()): + toks += _segments(tok) if re.fullmatch(r"[가-힣]+", tok) else [tok] + if not toks: + continue + parts = ["(?:" + "|".join(sorted({re.escape(a).replace(r"\ ", r"\s?") for a in _alts(t, len(toks) == 1)}, + key=len, reverse=True)) + ")" for t in toks] + orders = [parts] + ([parts[::-1]] if len(parts) == 2 else []) + body = "|".join(SEP.join(p) for p in orders) + out.append((m, re.compile(rf"(? (12, 25) else 0) + words["xmas"] = (datetime.date(y, 12, 25) - datetime.date(lt.tm_year, lt.tm_mon, lt.tm_mday)).days + return line.format(**words) if "{" in line else line NO = [ # the cameras: assistant/seeing.py's or the LLM's @@ -201,23 +251,40 @@ NO = [ "you're cool", "you look cute", "you're so tall", "nice robot", "what a cool robot", "you're amazing", "i like you", "로봇 정말 멋있어요", "귀엽다", "멋있다", "키 크다", "로봇 신기하네요", "너 좋아", "대단하다", # the weather, the time, closings - "what's the weather", "what time is it", "what day is it", "thanks", "thank you", "bye", "okay", "i see", - "날씨 어때", "지금 몇 시야", "고마워", "감사합니다", "잘 가", "알겠어요", "그렇구나", + "what's the weather", "thanks", "thank you", "bye", "okay", "i see", + "날씨 어때", "고마워", "감사합니다", "잘 가", "알겠어요", "그렇구나", ] # never by meaning: the cameras, the visitor about themselves, a doubt or a fragment of the talk before + +from assistant import bank_words # more wordings / kinds: assistant/bank_words/*.py +for _m in bank_words.modules(): + for _k, (_t, _a) in getattr(_m, "QUICK_KINDS", {}).items(): + KINDS.setdefault(_k, ([], _a))[0].extend(_t) +for _k, _t in bank_words.merged("QUICK").items(): + (NO if _k == "no" else KINDS[_k][0]).extend(_t) +_said = {t for texts, _ in KINDS.values() for t in texts} +NO = [t for t in NO if t not in _said] # a wording listed for a kind is that kind's + CAMERA = re.compile(r"\b(?:see|seeing|saw|look(?:s|ing)?|watch|camera|wearing|holding|in front of|behind|colou?r|" - r"recogni[sz]e|remember)\b|보여|보이|보니|봐|봤|입었|들고|색|카메라|앞에|뒤에|알아봐|기억", re.I) -ABOUT_ME = re.compile(r"\b(?:i|i'm|am i|my|me|mine)\b|(?:^|\s)(?:나|내|제|저|난|전)(?:는|가|를|의)?\s", re.I) + r"recogni[sz]e|remember)\b|보여|보이|보니|(? MAX_WORDS: return "length" + if re.search(r"\b(?:good ?bye|bye|see you|farewell)\b|잘 ?가|안녕히|다음에 봐", t, re.I): + return "closing" # "goodbye" is never a hello if CAMERA.search(t): return "camera" if ABOUT_ME.search(t): @@ -266,6 +336,8 @@ def guarded(text, history=()): return "several" if OTHER.search(t): return "other" + if EVENT_TIME.search(t): + return "event time" if history and not NAMES_LUMI.search(t): return "in a talk, not naming Lumi" # "how old?" / "몇 살이에요?" after the company: about that return None @@ -282,10 +354,14 @@ def kind_of(text, history=()): except OSError as e: # no embedding server: the LLM answers print(f"quick answers: {e}") return None - sims = vecs @ q - top = int(np.argmax(sims)) - best = str(kinds[top]) - if best == "no" or sims[top] < SIM_MIN or sims[top] - sims[kinds != best].max() < MARGIN: + from assistant import intent_bank + global _named + if _named is None: + names, codes = np.unique(kinds, return_inverse=True) + _named = ([str(n) for n in names], codes) + best, top, margin, agree, _ = intent_bank._top(vecs @ q, _named, k=AGREE_K) + sure = top >= SIM_MIN and margin >= MARGIN or agree and top >= SIM_AGREE and margin >= MARGIN_AGREE + if best == "no" or not sure: return None if best == "hello" and history: return None # hello in the middle of a talk: the LLM @@ -304,7 +380,7 @@ def answer(text, lang="en", history=()): lines = KINDS[kind][1]["ko" if lang == "ko" else "en"] choices = [x for x in lines if x != _last.get(kind)] or lines _last[kind] = random.choice(choices) - return _last[kind] + return clock_words(_last[kind], lang) if __name__ == "__main__": diff --git a/assistant/steps.py b/assistant/steps.py index d297454..6f9a612 100644 --- a/assistant/steps.py +++ b/assistant/steps.py @@ -850,7 +850,8 @@ def _pieces(c, markers, after): def rules(text, markers=()): """(steps, unread clauses). Steps are merged where two clauses mean one ("look for the table" + "put it there").""" - cut, says = _cut_says(text) + text = re.sub(r"(?<=[가-힣A-Za-z0-9])(으로|로|에)(가서|가고|가면)(?=[가-힣])", r"\1 \2 ", text or "") # written without + cut, says = _cut_says(text) # spaces: "부스A로가서저희" t = _protect_lists(_norm(cut, markers), markers) t = _INTERJECTION.sub("", t) steps, unread = [], [] diff --git a/assistant/talk_examples.py b/assistant/talk_examples.py index ef67a24..cd4b5d4 100644 --- a/assistant/talk_examples.py +++ b/assistant/talk_examples.py @@ -940,12 +940,524 @@ _BANK = { ("무슨 말인지 알아들었어?", "네, 알아들었어요. 재미있는 말이네요."), ], }, + "backchannel": { # the listener reacts or says "understood": a few fitting words, never "you're welcome" + "en": [ + ("Gotcha.", "Great."), + ("Okay.", "Alright."), + ("Wow okay.", "Surprising, right?"), + ("Oh I see.", "Yes, that's how it works."), + ("Cool cool.", "Glad you like it."), + ("Fine.", "Okay."), + ("Huh, interesting.", "It is, isn't it?"), + ("Makes sense.", "Good, glad it's clear."), + ("lol ok", "Ha, okay."), + ("Right on.", "Sure thing."), + ], + "ko": [ + ("아 그렇구나.", "네, 그래요."), + ("오케이.", "네, 좋아요."), + ("헐 대박.", "놀라우시죠?"), + ("오 신기하다.", "신기하죠?"), + ("그렇군요.", "네, 맞아요."), + ("음 알겠어.", "네, 알겠어요."), + ("이해했습니다.", "네, 다행입니다."), + ("오키.", "네, 좋아요."), + ("아하.", "네, 그렇게 돼요."), + ], + }, # end of bank } EXAMPLES = [(cat, lang, said, reply) for cat, langs in _BANK.items() for lang, pairs in langs.items() for said, reply in pairs] +# Follow-ups on Lumi's own last answer, in a talk on any topic: (lang, question before, Lumi's answer, follow-up, reply). +# The reply answers the follow-up about that answer itself (its reason, time, place, person, what it meant, what came +# next, the same point again for "really?"), never changes the topic and never asks what they mean. A nested follow-up +# has the answer before it as its "answer". brain._follow_examples shows the two closest with a short follow-up. +FOLLOWUPS = [ + # ---------- English: the world ---------- + ("en", "Why is the sky blue?", "Sunlight scatters off the air, and blue light scatters the most.", + "Why does blue scatter more?", "Its waves are shorter, and short waves bounce off tiny air molecules much more."), + ("en", "Why is the sky blue?", "Sunlight scatters off the air, and blue light scatters the most.", + "Then why are sunsets red?", "At sunset the light crosses far more air, so the blue is scattered away and the reds reach you."), + ("en", "How far is the Moon?", "About 384,000 kilometres on average.", + "On average?", "Yes, its orbit is an oval, so it goes from about 363,000 to 405,000 kilometres."), + ("en", "What's the biggest planet?", "Jupiter, about eleven times as wide as Earth.", + "Really?", "Yes, Jupiter is about eleven times Earth's width; more than a thousand Earths would fit inside."), + ("en", "Is Pluto a planet?", "Not anymore: since 2006 it's a dwarf planet.", + "Why?", "It hasn't cleared its orbit of other objects, one of the three rules astronomers set that year."), + ("en", "Why isn't Pluto a planet?", "It hasn't cleared its orbit of other objects, one of the rules set in 2006.", + "Who decided that?", "The International Astronomical Union, at its meeting in Prague."), + ("en", "How hot is the Sun?", "About 5,500 degrees Celsius at the surface.", + "And inside?", "The core is around 15 million degrees."), + ("en", "Why do we have seasons?", "Because Earth's axis is tilted about 23 degrees.", + "What do you mean, tilted?", "Earth spins leaning to one side, so for half the year your half faces the Sun more directly: that's summer."), + ("en", "Why do we have seasons?", "Because Earth's axis is tilted about 23 degrees.", + "So it's not about distance?", "No, Earth is actually closest to the Sun in early January, in the northern winter."), + ("en", "What's the speed of light?", "About 300,000 kilometres a second.", + "Can anything go faster?", "Not as far as we know: nothing with mass can even reach it."), + ("en", "What is a black hole?", "A place where gravity is so strong that not even light gets out.", + "Then how do we see them?", "By what's around them: glowing hot gas and stars circling something invisible. In 2019 we even got a picture of one's shadow."), + ("en", "Why is the ocean salty?", "Rivers carry minerals from rocks into the sea, and when water evaporates the salt stays.", + "Then why aren't rivers salty?", "They are, very slightly, but their water keeps flowing and being replaced, so salt never builds up."), + ("en", "How many bones does a person have?", "206 in an adult.", + "And a baby?", "Close to 300; many of them grow together over the years."), + ("en", "Why do leaves turn red in autumn?", "The green chlorophyll breaks down and other colours show.", + "Why does it break down?", "Days get shorter and colder, so the tree stops making it and saves its energy for winter."), + ("en", "Why do we have leap years?", "A year is about 365 and a quarter days, so every four years we add a day.", + "Every four years exactly?", "Almost: years divisible by 100 skip it unless they divide by 400, so 2000 was a leap year and 1900 wasn't."), + ("en", "Why do cats purr?", "Mostly when they're content, but also to calm themselves when hurt or scared.", + "Wait, when they're hurt?", "Yes, purring seems to soothe them, and some scientists think the vibration even helps them heal."), + ("en", "What's the fastest animal?", "The peregrine falcon, over 300 km/h in a dive.", + "And on land?", "The cheetah, around 100 km/h or a bit more in a short sprint."), + ("en", "What's the fastest land animal?", "The cheetah, around 100 km/h in a short sprint.", + "How long can it keep that up?", "Only a few hundred metres; then it has to rest."), + ("en", "How long do elephants live?", "About 60 to 70 years in the wild.", + "Longer than dogs, then.", "Much longer: most dogs live 10 to 13 years."), + ("en", "Where do pandas live?", "In the mountains of central China.", + "What do they eat?", "Almost only bamboo, many kilos of it every day."), + ("en", "Why do onions make you cry?", "Cutting them releases a gas that stings your eyes.", + "How do I stop it?", "Chill the onion first and use a sharp knife: fewer cells break, so less gas."), + ("en", "Why do we yawn?", "Nobody knows for sure; one idea is that it cools the brain.", + "Cools it how?", "The deep breath brings in cooler air, and stretching the jaw moves more blood through the head."), + ("en", "Why do we sleep?", "The body repairs itself and the brain sorts memories while you sleep.", + "How much do I need?", "Most adults need seven to nine hours."), + ("en", "How much water should I drink?", "Roughly 1.5 to 2 litres a day for most adults, more when it's hot.", + "Does coffee count?", "Mostly yes: the water in coffee and tea counts too."), + ("en", "Is coffee bad for you?", "Not in moderation: up to about four cups a day is fine for most adults.", + "Why four?", "That's around 400 mg of caffeine, the limit health agencies give for healthy adults."), + ("en", "What is kimchi?", "Fermented vegetables, usually napa cabbage with chili, garlic and fish sauce.", + "Why ferment it?", "It kept vegetables through the winter, and fermenting gives the sour taste and lots of good bacteria."), + ("en", "Why do Koreans ferment kimchi?", "It kept vegetables through the winter and gives the sour taste.", + "How long does it keep?", "Months in the fridge; it just gets more sour, and old kimchi is great in stew."), + # history and people + ("en", "When did World War Two end?", "In 1945: in May in Europe and in September in Asia.", + "Why two dates?", "Germany surrendered in May; Japan surrendered in August and signed in September."), + ("en", "Who invented the telephone?", "Alexander Graham Bell got the patent in 1876.", + "Got the patent?", "Yes, others like Elisha Gray and Antonio Meucci worked on it too, so who was first is still argued about."), + ("en", "Who was King Sejong?", "The fourth king of Joseon, who created Hangul in 1443.", + "Why did he make it?", "Chinese characters were too hard for ordinary people, so he wanted letters anyone could learn quickly."), + ("en", "Why did King Sejong make Hangul?", "Chinese characters were too hard for ordinary people to learn.", + "How long did it take to learn?", "It was said a wise person could learn it in a morning, and anyone within ten days."), + ("en", "When was the Korean War?", "From 1950 to 1953.", + "Did it end?", "Not officially: the fighting stopped with an armistice in 1953, and no peace treaty was ever signed."), + ("en", "Did the Korean War end?", "The fighting stopped with an armistice in 1953, but no peace treaty was signed.", + "What do you mean?", "The shooting stopped, but the war was never formally closed by a treaty."), + ("en", "Who built the pyramids?", "Egyptian workers, about 4,500 years ago.", + "Not slaves?", "Most historians now think paid workers built them, living in villages near the site."), + ("en", "What happened to the Titanic?", "It hit an iceberg in April 1912 and sank on its first voyage.", + "And then?", "About 1,500 people died, and afterwards ships had to carry enough lifeboats for everyone."), + ("en", "How did the dinosaurs die out?", "An asteroid hit what is now Mexico about 66 million years ago.", + "And then what?", "Dust blocked the sunlight for years, plants died and the big animals starved; small mammals survived."), + ("en", "Who was the first person on the Moon?", "Neil Armstrong.", + "When?", "On 20 July 1969, with Apollo 11."), + ("en", "When did Armstrong walk on the Moon?", "On 20 July 1969, with Apollo 11.", + "Who was with him?", "Buzz Aldrin walked with him; Michael Collins stayed in orbit."), + ("en", "Who painted the Mona Lisa?", "Leonardo da Vinci, in the early 1500s.", + "Where is it now?", "In the Louvre in Paris."), + ("en", "Where is the Mona Lisa?", "In the Louvre in Paris.", + "Why is it so famous?", "Its soft style and smile were new back then, and its theft in 1911 made it world news."), + ("en", "Who wrote Romeo and Juliet?", "William Shakespeare, in the 1590s.", + "Who was he?", "An English playwright and poet from Stratford-upon-Avon, often called the greatest writer in English."), + ("en", "Who founded Apple?", "Steve Jobs, Steve Wozniak and Ronald Wayne, in 1976.", + "Who's Ronald Wayne?", "The third co-founder: he sold his ten percent share after twelve days, for 800 dollars."), + ("en", "Who were the Beatles?", "A band from Liverpool, the best-selling band in history.", + "When?", "In the 1960s: they played together until they split up in 1970."), + # places + ("en", "What's the capital of Australia?", "Canberra.", + "Not Sydney?", "No, Sydney is the biggest city, but Canberra was built as the capital as a compromise between Sydney and Melbourne."), + ("en", "What's the capital of Japan?", "Tokyo.", + "Since when?", "Since 1868; before that, Kyoto was the capital for over a thousand years."), + ("en", "What's the longest river?", "The Nile, about 6,650 km, though some say the Amazon is longer.", + "Why do they disagree?", "It depends on where you say the river starts, and the Amazon's source is hard to pin down."), + ("en", "How high is Mount Everest?", "8,849 metres.", + "Is it still growing?", "Yes, a few millimetres a year, as India keeps pushing into Asia."), + ("en", "How many people live in Seoul?", "About 9.4 million.", + "Is that a lot?", "It is: about one in five South Koreans lives in Seoul, and about half in the whole capital area."), + ("en", "Where is Jeju?", "An island off the south coast of Korea.", + "How do people get there?", "Most fly: Seoul to Jeju is about an hour, one of the busiest air routes in the world."), + ("en", "What's the biggest ocean?", "The Pacific.", + "How big?", "About a third of Earth's surface, bigger than all the land put together."), + ("en", "How long is the Great Wall?", "Over 20,000 kilometres with all its branches.", + "Can you see it from space?", "No, that's a myth: it's far too narrow to see with the naked eye from orbit."), + ("en", "What's the tallest building?", "The Burj Khalifa in Dubai, 828 metres.", + "When was it built?", "It opened in 2010."), + # sports, culture, tech + ("en", "How long is a marathon?", "42.195 kilometres.", + "Why such an odd number?", "At the 1908 London Olympics the course ran from Windsor Castle to the royal box, and that distance stuck."), + ("en", "Who has won the most World Cups?", "Brazil, five times.", + "When was the last one?", "In 2002, beating Germany in the final in Japan."), + ("en", "What is taekwondo?", "A Korean martial art known for high, fast kicks.", + "Is it in the Olympics?", "Yes, it has been an Olympic sport since Sydney 2000."), + ("en", "Is taekwondo in the Olympics?", "Yes, since Sydney 2000.", + "And before that?", "It was a demonstration sport at Seoul 1988 and Barcelona 1992."), + ("en", "What is K-pop?", "Korean pop music, known for its groups, dancing and polished videos.", + "Since when is it big abroad?", "It spread in Asia in the 2000s; Psy's Gangnam Style in 2012 and then BTS made it big worldwide."), + ("en", "What is AI?", "Software that learns from data to understand speech, recognise pictures and so on.", + "Like you?", "Yes, I use AI to understand you and to answer, all on my own computer."), + ("en", "How does Wi-Fi work?", "It sends data over radio waves between your device and a router.", + "What kind of radio waves?", "Mostly at 2.4 and 5 gigahertz, near what a microwave oven uses, but far weaker."), + ("en", "What is inflation?", "Prices rising over time, so money buys less.", + "Why does it happen?", "Usually when people want more than is made, or when costs like energy go up."), + ("en", "What is inflation?", "Prices rising over time, so money buys less.", + "Is it bad?", "A little, around two percent a year, is normal; high inflation eats into savings and wages."), + ("en", "What can robots do in hospitals?", "Deliver medicine, disinfect rooms and help surgeons.", + "For example?", "Surgical robots like the da Vinci system let a surgeon operate through tiny cuts."), + ("en", "How do you say thank you in Japanese?", "Arigatou, or more politely arigatou gozaimasu.", + "And in Chinese?", "Xièxie."), + ("en", "How many letters does Hangul have?", "Twenty-four basic letters.", + "Only?", "Yes, fourteen consonants and ten vowels, combined into a block for each syllable."), + # casual styles, slang, doubt + ("en", "How old is the universe?", "About 13.8 billion years.", + "how do they even know that", "From how fast galaxies move apart and from the oldest light, the glow left over from the Big Bang."), + ("en", "Why do flamingos stand on one leg?", "It probably saves body heat and energy.", + "fr?", "Yes, really: one leg tucked up loses less heat, and they can even doze like that."), + ("en", "What's the hottest pepper?", "Pepper X, rated around 2.7 million Scoville units.", + "no way", "It's true, about 2.7 million: hundreds of times hotter than a jalapeño."), + ("en", "Why is Venus so hot?", "Its thick carbon dioxide air traps the heat.", + "says who?", "Space probes: the Soviet Venera landers measured about 460 degrees at the surface."), + ("en", "Are tomatoes fruit?", "Yes, botanically: they grow from the flower and hold the seeds.", + "meaning?", "To a botanist a fruit is the part with the seeds, so tomatoes count, even though we cook them like vegetables."), + ("en", "Why do ships float?", "They push aside water that weighs as much as they do.", + "how so?", "A hull is mostly air inside, so it can push aside a lot of water before it's heavy enough to sink."), + ("en", "What's the most spoken language?", "English, counting people who learned it; Mandarin has the most native speakers.", + "which one's bigger then?", "Counting everyone, English; counting only native speakers, Mandarin."), + ("en", "Who invented the light bulb?", "Thomas Edison made the first practical one, in 1879.", + "like, the first ever?", "Not the very first: others made glowing bulbs before him, but his lasted long enough to be useful."), + # ---------- English: Lumi itself ---------- + ("en", "Can you climb stairs?", "No, I can't.", + "How come?", "I drive on wheels and have no legs, so stairs stop me."), + ("en", "How long does your battery last?", "About 10 hours on a charge.", + "Why so long?", "I carry a big 24-volt, 45 Ah lithium battery in my base."), + ("en", "Can you go to the kitchen?", "That place isn't on my map.", + "Why not?", "I only drive to places on my map, and the kitchen isn't one of them."), + ("en", "How fast can you go?", "Normally 0.6 metres a second, at most 1.2.", + "Why so slow?", "I drive among people, so I keep it slow to be safe."), + ("en", "Who made you?", "Cutshion Company developed me.", + "Where are they?", "In Seoul."), + ("en", "How tall are you?", "146 cm, up to 186 with the lift.", + "Really? You look shorter.", "Yes, really: 146 cm, and 186 with my lift up."), + ("en", "How much can you carry?", "About 1 kg in my hand.", + "That's it?", "Yes, about 1 kg: my arm carries 2 kg in all, and the gripper takes part of that."), + ("en", "How old are you?", "I'm two years old.", + "Are you sure?", "Yes, I'm two."), + ("en", "Can you see in the dark?", "I'm not sure about that.", + "What do you mean you're not sure?", "Nobody has told me how well my cameras work in the dark, so I won't guess."), + ("en", "Can you wave?", "I won't wave right now: I'm holding a cup.", + "Why not?", "With the cup in my hand, waving could make it fall or spill."), + ("en", "How do you know where you are?", "I compare my lidar with my map.", + "How exact is that?", "To within about 5 centimetres."), + ("en", "What computer do you have?", "An NVIDIA Jetson AGX Thor.", + "Why that one?", "It runs speech recognition, the language model and my cameras all at once, right inside me."), + # ---------- Korean: the world ---------- + ("ko", "하늘은 왜 파래요?", "햇빛이 공기에 부딪혀 흩어지는데, 파란빛이 가장 많이 흩어져서 그래요.", + "왜 파란빛이 더 흩어져?", "파란빛은 파장이 짧아서 작은 공기 분자에 훨씬 잘 부딪히거든요."), + ("ko", "하늘은 왜 파래요?", "햇빛이 공기에 부딪혀 흩어지는데, 파란빛이 가장 많이 흩어져서 그래요.", + "그럼 노을은 왜 빨개?", "해 질 때는 빛이 공기를 훨씬 길게 지나와서, 파란빛은 흩어지고 붉은빛만 남아서 그래요."), + ("ko", "세종대왕이 누구예요?", "조선의 네 번째 왕으로, 1443년에 한글을 만드셨어요.", + "왜 만들었대?", "한자가 너무 어려워서, 백성이 쉽게 배울 수 있는 글자가 필요하다고 생각하셨어요."), + ("ko", "세종대왕은 한글을 왜 만들었어요?", "한자가 너무 어려워서 백성이 쉽게 배울 글자가 필요했어요.", + "진짜?", "네, 훈민정음 서문에도 백성이 쉽게 익혀 편하게 쓰게 하려고 만들었다고 적혀 있어요."), + ("ko", "한국전쟁은 언제였어요?", "1950년부터 1953년까지예요.", + "끝난 거야?", "공식적으로는 아니에요. 1953년 정전협정으로 싸움만 멈췄고 평화협정은 아직 없어요."), + ("ko", "한국전쟁은 끝났어요?", "1953년 정전협정으로 싸움은 멈췄지만 평화협정은 없어요.", + "그게 무슨 말이야?", "싸움은 멈췄지만, 전쟁을 공식적으로 끝내는 조약은 맺지 않았다는 뜻이에요."), + ("ko", "에베레스트는 얼마나 높아요?", "8,849미터예요.", + "지금도 자라?", "네, 인도 쪽 땅이 계속 밀고 올라와서 1년에 몇 밀리미터씩 높아져요."), + ("ko", "호주 수도가 어디야?", "캔버라예요.", + "시드니 아니야?", "아니에요. 시드니가 제일 큰 도시지만, 시드니와 멜버른 사이의 타협으로 캔버라를 수도로 만들었어요."), + ("ko", "김치는 왜 발효시켜요?", "겨울 동안 채소를 오래 보관하려고요. 발효하면서 새콤한 맛도 생겨요.", + "얼마나 오래 가?", "냉장고에서 몇 달은 가요. 점점 시어지는데, 신 김치는 찌개에 좋아요."), + ("ko", "마라톤은 몇 킬로예요?", "42.195킬로미터예요.", + "왜 그렇게 애매해?", "1908년 런던 올림픽 때 윈저성에서 왕실 관람석까지로 코스를 정했는데, 그 거리가 굳어졌어요."), + ("ko", "공룡은 왜 멸종했어요?", "약 6,600만 년 전에 소행성이 지금의 멕시코에 떨어졌어요.", + "그래서?", "먼지가 몇 년 동안 햇빛을 가려서 식물이 죽고, 큰 동물들이 먹을 게 없어졌어요."), + ("ko", "공룡은 소행성이 떨어진 다음 어떻게 됐어요?", "햇빛이 가려져 식물이 죽고 큰 동물들이 굶었어요.", + "그럼 그 다음엔?", "살아남은 작은 포유류가 퍼져 나갔고, 그 후손 중에 사람도 있어요."), + ("ko", "타이타닉은 어떻게 됐어요?", "1912년 4월 첫 항해 중에 빙산에 부딪혀 침몰했어요.", + "그 다음엔요?", "1,500명쯤 목숨을 잃었고, 그 뒤로 배에 모든 사람이 탈 구명보트를 싣도록 규칙이 바뀌었어요."), + ("ko", "고양이는 왜 그르렁거려?", "보통 기분이 좋을 때지만, 아프거나 무서울 때 스스로 진정하려고도 해요.", + "아플 때도?", "네, 그 진동이 고양이를 편하게 해 주고, 회복을 돕는다는 연구도 있어요."), + ("ko", "명왕성은 행성이에요?", "지금은 아니에요. 2006년부터 왜소행성이에요.", + "왜?", "자기 궤도 근처의 다른 천체들을 치우지 못해서, 그해 정한 행성 조건 하나를 못 채웠어요."), + ("ko", "명왕성은 왜 행성이 아니에요?", "궤도 근처의 다른 천체를 치우지 못해서, 2006년에 정한 조건을 못 채웠어요.", + "누가 정했는데?", "국제천문연맹이 체코 프라하 총회에서 정했어요."), + ("ko", "커피 몸에 나빠요?", "적당히 마시면 괜찮아요. 건강한 어른은 하루 네 잔 정도까지 괜찮다고 해요.", + "왜 네 잔이야?", "카페인 400밀리그램쯤인데, 보건 당국이 건강한 어른에게 권하는 한도예요."), + ("ko", "서울 인구가 얼마나 돼요?", "약 940만 명이에요.", + "많은 거야?", "네, 한국 사람 다섯 명 중 한 명쯤이 서울에 살아요."), + ("ko", "달까지 얼마나 멀어요?", "평균 38만 4천 킬로미터쯤이에요.", + "평균이라니?", "달 궤도가 타원이라서 36만 3천에서 40만 5천 킬로미터 사이로 바뀌어요."), + ("ko", "빛은 얼마나 빨라?", "1초에 약 30만 킬로미터예요.", + "더 빠른 건 없어?", "지금까지 알기로는, 질량이 있는 건 빛의 속도에 닿지도 못해요."), + ("ko", "블랙홀이 뭐예요?", "중력이 너무 세서 빛도 빠져나오지 못하는 곳이에요.", + "그럼 어떻게 봐?", "주변의 뜨거운 가스나 그 둘레를 도는 별을 보고 알아요. 2019년엔 블랙홀 그림자 사진도 찍었어요."), + ("ko", "윤년은 왜 있어요?", "1년이 365일하고 4분의 1일쯤이라서, 4년마다 하루를 더해요.", + "정확히 4년마다?", "거의요. 100으로 나누어지는 해는 빼고, 400으로 나누어지면 다시 넣어요. 그래서 2000년은 윤년, 1900년은 아니었어요."), + ("ko", "바다는 왜 짜?", "강물이 바위의 소금기를 바다로 실어 오고, 물만 증발해서 소금이 남아서요.", + "그럼 강은 왜 안 짜?", "강도 아주 조금 짜지만, 물이 계속 흘러 바뀌어서 소금이 쌓이지 않아요."), + ("ko", "사람 뼈는 몇 개예요?", "어른은 206개예요.", + "아기는?", "300개 가까이 되는데, 자라면서 여러 개가 붙어서 줄어요."), + ("ko", "단풍은 왜 들어요?", "초록색 엽록소가 분해되면서 다른 색이 드러나서요.", + "왜 분해돼?", "날이 짧고 추워지면 나무가 겨울을 나려고 엽록소를 더 만들지 않아서요."), + ("ko", "모나리자는 누가 그렸어요?", "레오나르도 다빈치가 1500년대 초에 그렸어요.", + "지금 어디 있어?", "파리 루브르 박물관에 있어요."), + ("ko", "모나리자는 어디 있어요?", "파리 루브르 박물관에 있어요.", + "왜 그렇게 유명해?", "부드러운 화법과 미소가 그때로선 새로웠고, 1911년 도난 사건으로 세계적인 뉴스가 됐어요."), + ("ko", "인공지능이 뭐예요?", "데이터로 배워서 말을 알아듣거나 그림을 알아보는 소프트웨어예요.", + "너처럼?", "네, 저도 인공지능으로 말씀을 알아듣고 대답해요. 전부 제 안의 컴퓨터에서 돌아가요."), + ("ko", "인플레이션이 뭐야?", "물가가 계속 올라서 같은 돈으로 살 수 있는 게 줄어드는 거예요.", + "왜 생겨?", "보통 사려는 사람이 만들어지는 물건보다 많아지거나, 에너지 같은 비용이 오를 때 생겨요."), + ("ko", "태권도는 올림픽 종목이에요?", "네, 2000년 시드니 올림픽부터 정식 종목이에요.", + "그 전에는?", "1988년 서울 올림픽과 1992년 바르셀로나 올림픽에서는 시범 종목이었어요."), + ("ko", "물 하루에 얼마나 마셔야 돼요?", "보통 어른은 하루 1.5에서 2리터쯤이에요. 더우면 더 마시고요.", + "커피도 쳐줘?", "대부분은요. 커피나 차에 든 물도 수분으로 쳐요."), + ("ko", "잠은 왜 자요?", "자는 동안 몸이 회복되고 뇌가 기억을 정리해요.", + "얼마나 자야 돼?", "어른은 보통 일곱에서 아홉 시간이 필요해요."), + ("ko", "하품은 왜 해요?", "정확히는 아무도 몰라요. 뇌를 식히려는 거라는 설이 있어요.", + "어떻게 식혀?", "숨을 크게 들이쉬면 시원한 공기가 들어오고, 턱이 늘어나면서 피가 더 돌아요."), + ("ko", "BTS는 언제 데뷔했어요?", "2013년에 데뷔했어요.", + "어느 회사야?", "빅히트 엔터테인먼트, 지금의 하이브에서 데뷔했어요."), + ("ko", "케이팝은 언제부터 외국에서 인기 있었어?", "2000년대에 아시아에서 먼저 퍼졌어요.", + "그럼 세계적으로는?", "2012년 싸이의 강남스타일, 그 뒤 BTS 같은 그룹으로 전 세계에서 커졌어요."), + ("ko", "한글 글자는 몇 개예요?", "기본 글자는 자음 열네 개, 모음 열 개, 모두 스물네 개예요.", + "그것밖에 안 돼?", "네, 그걸 모아서 음절마다 한 글자로 써서, 적은 글자로도 다 적을 수 있어요."), + ("ko", "일본 수도가 어디예요?", "도쿄예요.", + "언제부터?", "1868년부터예요. 그 전에는 교토가 천 년 넘게 수도였어요."), + ("ko", "만리장성은 얼마나 길어요?", "모든 갈래를 합치면 2만 킬로미터가 넘어요.", + "우주에서 보여?", "아니요, 그건 잘못 알려진 얘기예요. 폭이 좁아서 맨눈으로는 안 보여요."), + ("ko", "치타는 얼마나 빨라?", "짧게는 시속 100킬로미터 넘게 달려요.", + "얼마나 오래?", "몇백 미터밖에 못 가고, 그 다음엔 쉬어야 해요."), + ("ko", "토마토는 과일이야?", "식물학으로는 과일이에요. 꽃에서 자라고 씨가 들어 있거든요.", + "무슨 뜻이야?", "식물학에서는 씨를 품은 부분을 열매라고 해서, 요리할 땐 채소처럼 써도 과일로 쳐요."), + ("ko", "배는 어떻게 물에 떠요?", "자기 무게만큼의 물을 밀어내서 떠요.", + "어떻게?", "배 안은 거의 공기라서, 가라앉을 만큼 무거워지기 전에 물을 많이 밀어낼 수 있어요."), + # speech levels and dialect + ("ko", "훈민정음은 언제 반포됐습니까?", "1446년에 반포됐습니다.", + "만든 건 언제입니까?", "1443년에 만들고, 3년 뒤에 반포했습니다."), + ("ko", "부산 인구 얼마나 되노?", "약 330만 명이에요.", + "와 그래 많노?", "한국에서 서울 다음으로 큰 도시라서 그래요."), + ("ko", "지구에서 제일 깊은 바다가 어디예요?", "태평양의 마리아나 해구예요.", + "얼마나 깊은데예?", "가장 깊은 곳이 약 1만 1천 미터예요."), + ("ko", "우주는 몇 살이에요?", "약 138억 살이에요.", + "그걸 어떻게 알아?", "은하들이 멀어지는 속도와, 빅뱅 때 남은 가장 오래된 빛을 재서 알아요."), + ("ko", "금성은 왜 그렇게 뜨거워요?", "두꺼운 이산화탄소 대기가 열을 가둬서 그래요.", + "누가 그래?", "옛 소련의 베네라 탐사선이 표면에서 460도쯤을 쟀어요."), + ("ko", "제일 매운 고추가 뭐야?", "페퍼 X예요. 스코빌 지수가 약 270만이에요.", + "실화야?", "네, 실화예요. 할라피뇨보다 수백 배 매워요."), + ("ko", "플라밍고는 왜 한 발로 서?", "체온과 힘을 아끼려는 거라고 봐요.", + "레알?", "네, 정말이에요. 한 발을 품으면 열을 덜 잃고, 그렇게 선 채로 졸기도 해요."), + ("ko", "전구는 누가 발명했어요?", "1879년에 토머스 에디슨이 실용적인 전구를 만들었어요.", + "처음 만든 거야?", "맨 처음은 아니에요. 그 전에도 빛나는 전구는 있었지만, 오래가서 쓸 만한 건 에디슨 것이었어요."), + # mixed + ("ko", "What's the tallest building?", "The Burj Khalifa in Dubai, 828 metres.", + "그거 언제 지었어요?", "2010년에 문을 열었어요."), + ("ko", "김치 영어로 뭐야?", "영어로도 그냥 kimchi라고 해요.", + "why 그냥 kimchi?", "영어에 딱 맞는 말이 없어서, 한국어 이름을 그대로 써요."), + ("ko", "블랙홀 사진 진짜 있어요?", "네, 2019년에 처음 찍었어요.", + "진짜 really?", "네, 정말이에요. 2019년에 사건지평선 망원경으로 블랙홀 그림자를 찍었어요."), + ("ko", "Who invented Hangul?", "King Sejong, in 1443.", + "왜요?", "한자가 너무 어려워서 백성이 쉽게 배울 글자를 만들고 싶으셨어요."), + # ---------- Korean: Lumi itself ---------- + ("ko", "계단 올라갈 수 있어?", "아니요, 못 올라가요.", + "왜?", "저는 바퀴로 다녀서 다리가 없어요. 그래서 계단은 못 가요."), + ("ko", "배터리 얼마나 가요?", "한 번 충전하면 10시간쯤 가요.", + "진짜?", "네, 10시간쯤이요. 24볼트 45암페어시 배터리가 들어 있어요."), + ("ko", "주방으로 갈 수 있어?", "그곳은 제 지도에 없어요.", + "와 모르노?", "저는 지도에 있는 곳으로만 가는데, 주방은 지도에 없어서요."), + ("ko", "키가 몇이야?", "146센티미터예요. 리프트를 올리면 186센티미터까지 돼요.", + "에이, 거짓말", "정말이에요. 146센티미터, 리프트를 올리면 186센티미터예요."), + ("ko", "얼마나 빨라요?", "보통 초속 0.6미터, 최대 1.2미터예요.", + "왜 그렇게 느려?", "사람들 사이를 다니니까 안전하려고 천천히 다녀요."), + ("ko", "누가 만들었어?", "쿳션에서 만들었어요.", + "거기 어디 있는데?", "서울에 있어요."), + ("ko", "손 흔들어 줘", "지금 컵을 들고 있어서 손은 흔들지 않을게요.", + "왜 안 돼?", "컵을 든 채로 흔들면 떨어지거나 쏟아질 수 있어서요."), + ("ko", "몇 킬로까지 들 수 있어요?", "손으로는 1킬로그램쯤이에요.", + "그것밖에?", "네, 1킬로그램쯤이에요. 팔이 그리퍼까지 합쳐 2킬로그램을 드는데, 그리퍼 무게가 빠져서요."), + ("ko", "어두운 데서도 보여요?", "그건 잘 모르겠어요.", + "왜 몰라?", "어두울 때 제 카메라가 얼마나 보이는지 들은 적이 없어서, 짐작으로 말하지 않을게요."), + ("ko", "위치는 어떻게 알아요?", "라이다로 본 것을 지도와 비교해서 알아요.", + "얼마나 정확해?", "5센티미터 안쪽으로 맞아요."), # ---------- more: examples, amounts, chains ---------- + ("en", "What can robots do in factories?", "Weld, paint, pack boxes and move heavy parts.", + "Like what?", "Car factories use robot arms to weld whole car bodies, thousands of welds each."), + ("en", "What are the healthiest foods?", "Vegetables, fruit, beans, whole grains and fish are near the top.", + "Which one is best?", "No single food is best; a mix of them matters more than any one."), + ("en", "How many countries are there?", "195: 193 UN members plus two observers.", + "Which two?", "The Vatican and Palestine."), + ("en", "What's the most expensive spice?", "Saffron.", + "How much?", "Often several thousand dollars a kilo."), + ("en", "Saffron costs thousands a kilo?", "Yes, often several thousand dollars a kilo.", + "Why so expensive?", "Each flower gives only three tiny threads, picked by hand: it takes well over 100,000 flowers for a kilo."), + ("en", "How long does light from the Sun take to reach us?", "About eight minutes.", + "Is that a lot?", "For light it is: it crosses about 150 million kilometres in that time."), + ("en", "Why do we have time zones?", "The Sun is overhead at different times around the world.", + "How many are there?", "About 24 main ones, but with half-hour zones there are close to 40."), + ("en", "What language has the most words?", "English is often named, with hundreds of thousands of words.", + "Why?", "It borrowed from many languages: Latin, French, Norse, Greek and more."), + ("en", "Who discovered penicillin?", "Alexander Fleming, in 1928.", + "How?", "He noticed mould on a forgotten dish had killed the bacteria around it."), + ("en", "Who discovered penicillin?", "Alexander Fleming, in 1928.", + "By accident?", "Yes, mostly: a mould grew on a dish he'd left out, and it killed the bacteria near it."), + ("en", "Why do bees make honey?", "It's their food store for winter.", + "How much does one bee make?", "Only about a twelfth of a teaspoon in its whole life."), + ("en", "Why do bees make honey?", "It's their food store for winter.", + "And then?", "Beekeepers take the extra and leave the bees enough to get through the cold."), + ("en", "How deep is the ocean?", "About 3.7 kilometres on average.", + "And the deepest part?", "The Mariana Trench, about 11 kilometres down."), + ("en", "Why is Mars red?", "Its dust is full of iron oxide, which is rust.", + "Rust?", "Yes, the same reddish compound you see on old iron."), + ("en", "Who invented the internet?", "Many people; its basic rules came from Vint Cerf and Bob Kahn in the 1970s.", + "And the web?", "Tim Berners-Lee invented the World Wide Web in 1989."), + ("en", "Who invented the World Wide Web?", "Tim Berners-Lee, in 1989.", + "Where?", "At CERN, the physics lab near Geneva."), + ("en", "What's the hardest natural material?", "Diamond.", + "Why?", "Its carbon atoms are bonded tightly in all directions."), + ("en", "How old are the oldest trees?", "Some bristlecone pines are over 4,800 years old.", + "Where?", "In the White Mountains of California."), + ("en", "Why do we get goosebumps?", "Tiny muscles pull the hairs up when we're cold or scared.", + "What's the point?", "For furry animals it traps warm air or makes them look bigger; for us it's mostly left over."), + ("en", "What's the smallest country?", "Vatican City.", + "How small?", "About 0.44 square kilometres, smaller than many parks."), + ("en", "How do planes stay up?", "Their wings push air down, and the air pushes the wings up.", + "Even when they're that heavy?", "Yes, at take-off speed the wings move enough air to lift hundreds of tonnes."), + ("en", "Why do we dream?", "Nobody knows for sure; it may help sort memories and feelings.", + "Do animals dream?", "It seems so: dogs and rats show the same sleep stage as our dreaming."), + ("en", "What's the population of Korea?", "About 51 million in South Korea.", + "Is it growing?", "No, it has started to shrink: Korea has one of the lowest birth rates in the world."), + ("en", "Why is Korea's birth rate so low?", "Mostly costs: housing, education and long working hours.", + "Is anything being done?", "The government gives money for children and parental leave, but so far the rate is still very low."), + ("en", "What's the oldest university?", "Al-Qarawiyyin in Morocco, founded in 859, is often called the oldest still running.", + "And in Europe?", "The University of Bologna, from 1088."), + ("en", "What is DNA?", "The molecule that carries the instructions for building a living thing.", + "How long is it?", "Stretched out, the DNA in one of your cells is about two metres long."), + ("en", "What is DNA?", "The molecule that carries the instructions for building a living thing.", + "What do you mean, instructions?", "Its order of four chemical letters spells out how to make every protein your body needs."), + ("en", "How fast does the Earth spin?", "About 1,670 km/h at the equator.", + "Then why don't we feel it?", "Because everything around us, air included, moves with us at the same steady speed."), + # Lumi: nested + ("en", "What can you see?", "I see two people and a table.", + "How do you know?", "From my cameras: they see people and objects up to about 10 metres away."), + ("en", "Why do you only speak two languages?", "I was built to understand English and Korean.", + "Why those two?", "I work in Korea, with visitors from everywhere, so Korean and English cover most people."), + ("en", "How do you understand me?", "I turn your speech into text with Whisper, then a language model answers.", + "Which language model?", "Gemma 4, running on my own computer."), + ("en", "Do you use the internet?", "Only to look things up, like news or the weather.", + "Why not for everything?", "My speech and my answers run on my own computer, so I work without the cloud."), + ("en", "How far can you see?", "About 10 metres with my cameras.", + "And behind you?", "My lidar sees 240 degrees around my base, up to 10 metres."), + # Korean + ("ko", "공장에서 로봇은 뭐 해요?", "용접하고, 칠하고, 상자를 포장하고, 무거운 부품을 옮겨요.", + "예를 들면?", "자동차 공장에선 로봇 팔이 차체 하나에 수천 군데를 용접해요."), + ("ko", "나라가 몇 개예요?", "195개예요. 유엔 회원국 193개에 옵서버 국가 두 곳이에요.", + "그 두 곳은?", "바티칸과 팔레스타인이에요."), + ("ko", "제일 비싼 향신료가 뭐야?", "사프란이에요.", + "얼마나?", "1킬로그램에 몇천 달러씩 하기도 해요."), + ("ko", "사프란은 왜 그렇게 비싸?", "꽃 한 송이에서 실 같은 암술 세 가닥만 손으로 따거든요.", + "그럼 1킬로 만들려면?", "꽃이 10만 송이 넘게 필요해요."), + ("ko", "햇빛이 지구까지 오는 데 얼마나 걸려요?", "8분쯤 걸려요.", + "그게 오래 걸리는 거야?", "빛한테는 먼 길이에요. 그 사이에 1억 5천만 킬로미터를 와요."), + ("ko", "페니실린은 누가 발견했어요?", "1928년에 알렉산더 플레밍이 발견했어요.", + "어떻게?", "깜빡 둔 접시에 핀 곰팡이 주변의 세균이 죽은 걸 보고 알았어요."), + ("ko", "페니실린은 어떻게 발견했어요?", "접시에 핀 곰팡이 주변의 세균이 죽은 걸 보고 알았어요.", + "우연이었어?", "네, 거의 우연이었어요. 치우지 않은 접시에 곰팡이가 자랐거든요."), + ("ko", "꿀벌은 왜 꿀을 만들어요?", "겨울에 먹을 식량을 모아 두려고요.", + "한 마리가 얼마나 만들어?", "평생 동안 티스푼의 12분의 1 정도만 만들어요."), + ("ko", "바다는 얼마나 깊어요?", "평균 3.7킬로미터쯤이에요.", + "제일 깊은 데는?", "마리아나 해구로, 11킬로미터쯤이에요."), + ("ko", "화성은 왜 빨개요?", "흙에 산화철, 그러니까 녹이 많아서요.", + "녹?", "네, 오래된 쇠에 생기는 그 붉은 녹과 같은 성분이에요."), + ("ko", "월드와이드웹은 누가 만들었어요?", "1989년에 팀 버너스리가 만들었어요.", + "어디서?", "제네바 근처의 물리학 연구소 CERN에서요."), + ("ko", "제일 단단한 물질이 뭐야?", "다이아몬드예요.", + "왜?", "탄소 원자들이 모든 방향으로 단단하게 붙어 있어서요."), + ("ko", "소름은 왜 돋아요?", "춥거나 무서울 때 작은 근육이 털을 세워서요.", + "그게 무슨 소용이야?", "털이 많은 동물은 따뜻한 공기를 가두거나 커 보이게 해요. 사람한테는 거의 흔적이에요."), + ("ko", "제일 작은 나라가 어디예요?", "바티칸 시국이에요.", + "얼마나 작아?", "0.44제곱킬로미터쯤이라, 웬만한 공원보다 작아요."), + ("ko", "비행기는 어떻게 떠요?", "날개가 공기를 아래로 밀어서, 그 힘으로 위로 떠요.", + "그렇게 무거운데도?", "네, 이륙 속도에선 날개가 공기를 충분히 밀어서 수백 톤도 들어 올려요."), + ("ko", "꿈은 왜 꿔요?", "정확히는 몰라요. 기억과 감정을 정리하는 거라는 설이 있어요.", + "동물도 꿈 꿔?", "그런 것 같아요. 개나 쥐도 사람이 꿈꿀 때와 같은 잠 단계를 보여요."), + ("ko", "한국 인구는 얼마예요?", "남한은 약 5,100만 명이에요.", + "늘고 있어?", "아니요, 줄기 시작했어요. 출생률이 세계에서 가장 낮은 편이에요."), + ("ko", "한국 출생률은 왜 낮아요?", "집값, 교육비, 긴 근무 시간 같은 부담이 커서요.", + "그럼 그건 어떻게 해?", "정부가 아이 수당과 육아휴직을 늘리고 있지만, 아직은 많이 낮아요."), + ("ko", "DNA가 뭐예요?", "생물을 만드는 설계도를 담은 분자예요.", + "설계도라니?", "네 가지 화학 글자의 순서가 몸에 필요한 단백질을 어떻게 만들지 적고 있다는 뜻이에요."), + ("ko", "지구는 얼마나 빨리 돌아요?", "적도에서 시속 1,670킬로미터쯤이에요.", + "근데 왜 못 느껴?", "공기를 포함해 주변 모든 게 같은 속도로 함께 돌아서요."), + ("ko", "벌은 왜 꿀을 모읍니까?", "겨울을 나기 위한 식량입니다.", + "그 다음에는 어떻게 됩니까?", "양봉가가 남는 꿀을 거두고, 벌이 겨울을 날 만큼은 남겨 둡니다."), + ("ko", "가장 오래된 대학이 어디입니까?", "859년에 세워진 모로코의 알카라윈 대학이 지금도 운영되는 가장 오래된 대학으로 꼽힙니다.", + "유럽에서는요?", "1088년에 세워진 이탈리아 볼로냐 대학입니다."), + ("ko", "시간대는 왜 있어요?", "세계 곳곳마다 해가 머리 위에 오는 시간이 달라서요.", + "몇 개나 돼?", "기본은 24개쯤인데, 30분 단위까지 치면 40개 가까이 돼요."), + ("ko", "비행기 날개는 왜 저렇게 생겼노?", "위가 볼록해서 공기를 아래로 밀어 주기 좋게 생겼어요.", + "그라믄?", "그 힘으로 비행기가 위로 떠요."), + # Lumi, Korean + ("ko", "뭐가 보여?", "사람 두 명이랑 테이블이 보여요.", + "어떻게 알아?", "제 카메라로 봐요. 10미터쯤까지 사람과 물건을 알아볼 수 있어요."), + ("ko", "왜 두 개 언어만 해요?", "영어와 한국어를 알아듣도록 만들어졌어요.", + "왜 그 두 개야?", "한국에서 일하고, 외국 손님도 많아서 그 두 언어면 대부분 이야기할 수 있어요."), + ("ko", "어떻게 내 말을 알아들어?", "위스퍼로 말소리를 글로 바꾸고, 언어 모델이 대답해요.", + "무슨 언어 모델?", "젬마 4예요. 제 안의 컴퓨터에서 돌아가요."), + ("ko", "인터넷 써요?", "뉴스나 날씨 같은 걸 찾아볼 때만 써요.", + "왜 다른 건 안 써?", "말을 알아듣고 대답하는 건 전부 제 컴퓨터에서 해서, 클라우드 없이도 일해요."), + ("ko", "뒤도 보여요?", "라이다로 바닥 근처를 240도까지 봐요.", + "얼마나 멀리?", "10미터쯤까지요."), + ("ko", "충전은 얼마나 걸려요?", "그건 잘 모르겠어요. 직원분께 여쭤봐 주세요.", + "왜 몰라?", "충전 시간은 저에게 알려진 적이 없어서, 짐작으로 말씀드리지 않을게요."), # ---------- a part of the last answer ("the second half?"), a yes / no to Lumi's own question ---------- + ("en", "Why are you called Lumi?", "It comes from Lux, Latin for light.", + "What about the second half?", "That's from mini: small and agile."), + ("en", "Where does the word robot come from?", "From the Czech word robota, forced work, in a 1920 play by Karel Čapek.", + "What was the play called?", "R.U.R., Rossum's Universal Robots."), + ("en", "What does NASA stand for?", "National Aeronautics and Space Administration.", + "And the last part?", "Administration: it's a government agency."), + ("en", "What can you do?", "I talk with you in English and Korean and answer questions. Shall I tell you more?", + "Yes.", "I can also pick things up and bring them to you, go to places on my map, follow you and wave."), + ("en", "Do you know any songs?", "I know four songs. Would you like to hear the titles?", + "Sure.", "BAD, Fantastic Baby, Did I Become the Adult I Dreamed Of, and Love Attack."), + ("en", "Where are you from?", "I was made in Seoul. Have you been to Seoul?", + "No.", "Then I hope you get to visit one day; it's a lively city."), + ("ko", "이름이 왜 루미예요?", "빛을 뜻하는 라틴어 룩스에서 왔어요.", + "그 다음 부분은요?", "뒷부분은 작고 날렵하다는 뜻의 미니에서 왔어요."), + ("ko", "로봇이라는 말은 어디서 왔어요?", "1920년 카렐 차페크의 희곡에서, 강제 노동을 뜻하는 체코어 로보타에서 왔어요.", + "그 희곡 이름은?", "로숨의 유니버설 로봇, R.U.R.이에요."), + ("ko", "뭐 할 수 있어요?", "영어와 한국어로 대화하고 질문에 답해요. 더 알려 드릴까요?", + "네", "물건을 집어서 가져다드리고, 지도에 있는 곳으로 가고, 따라가거나 손을 흔들 수도 있어요."), + ("ko", "노래 알아?", "네 곡을 알아요. 제목 알려 드릴까요?", + "응", "배드, 판타스틱 베이비, 꿈꾸던 어른이 되었나요, 러브 어택이에요."), + ("ko", "어디서 왔어요?", "서울에서 만들어졌어요. 서울에 가 보셨어요?", + "아니요", "언젠가 꼭 가 보세요. 볼 게 많은 도시예요."), + ("ko", "쿳션은 뭐 하는 회사예요?", "바리스타 로봇 같은 서비스 로봇을 만드는 서울의 회사예요. 더 궁금한 거 있으세요?", + "네, 그 다음은요?", "드로잉, 요리, 아이스크림, 용접, 팔레타이징, 교육용 로봇도 만들어요."), # ---------- doubt against its own answer: the fact stays ---------- + ("en", "How long does an octopus live?", "Most octopuses live only one to two years.", + "You said five years before.", "I said one to two years: most octopuses don't live longer than that."), + ("en", "How high is Mount Everest?", "8,849 metres.", + "Earlier you said 9,000.", "It's 8,849 metres, just under nine thousand."), + ("ko", "문어는 얼마나 살아요?", "대부분 1년에서 2년밖에 못 살아요.", + "아까는 5년이라며?", "1년에서 2년이라고 말씀드렸어요. 대부분의 문어는 그보다 오래 못 살아요."), + ("ko", "한글은 언제 만들었어요?", "1443년에 만들었어요.", + "아까는 다르게 말했잖아.", "1443년이 맞아요. 반포는 3년 뒤인 1446년이었어요."), +] + + +def pick_followup(said, before_q, before_a, lang, k=2): + """Up to k FOLLOWUPS closest to this follow-up: the follow-up's own words count most (a "why?" shows a "why?"), + then the talk before it; same language first.""" + s, ctx = _norm(said), _norm(f"{before_q} {before_a}") + ranked = sorted(FOLLOWUPS, key=lambda e: (e[0] != lang, -(0.7 * _score(s, _norm(e[3])) + + 0.3 * _score(ctx, _norm(f"{e[1]} {e[2]}"))))) + out = [] + for ex in ranked: + if all(ex[1] != o[1] for o in out): + out.append(ex) + if len(out) == k: + break + return out + def polite(text): """True when every Korean sentence of `text` ends politely (POLITE_ENDINGS); sentences without Hangul pass. @@ -1028,4 +1540,12 @@ if __name__ == "__main__": assert len(got) == PICK_K, (text, got) assert all(e[1] == lang for e in got), (text, got) assert len({e[3] for e in got}) == PICK_K, (text, got) + assert len(FOLLOWUPS) >= 200, len(FOLLOWUPS) + assert all(lang in ("en", "ko") and q and a and f and r for lang, q, a, f, r in FOLLOWUPS) + rude = [e[4] for e in FOLLOWUPS if e[0] == "ko" and not polite(e[4])] + assert not rude, rude + assert all(re.search("[가-힣]", e[4]) for e in FOLLOWUPS if e[0] == "ko") + assert not any(re.search("[가-힣]", e[4]) for e in FOLLOWUPS if e[0] == "en"), "an English follow-up answered in Korean" + assert pick_followup("why?", "Why is the sky blue?", "Blue light scatters most.", "en")[0][3].lower().startswith("why") + assert pick_followup("진짜?", "키가 몇이야?", "146센티미터예요.", "ko")[0][0] == "ko" print("ok") diff --git a/assistant/voice_words.py b/assistant/voice_words.py index 7f79507..43d45e3 100644 --- a/assistant/voice_words.py +++ b/assistant/voice_words.py @@ -49,6 +49,30 @@ AT_LIMIT = {("volume", 1): ("This is as loud as I can speak.", "이게 제일 ("speed", 1): ("I can't speak any faster than this.", "이보다 더 빨리는 말할 수 없어요.")} +NOT_NOW = re.compile(r"(?:^|\s)(?:쟤|걔|저 사람|그 사람|저분|그분)(?:는|가|도|은)?\s|\b(?:he|she|they|his|her|their)\b|" + r"(?:할|될|볼)걸\W*$|겠지\W*$|\bwhenever\b|끝나(?:고|면)|고 ?나서|(?:다음|후|뒤)에\s", re.I) + # someone else ("쟤 좀 작게 얘기하는 거 못 할걸"), a guess, a rule for later ("whenever I whistle, speed up") + + +def _not_now(t): + """Words that name a voice change but ask none now: a later time / condition, someone else, a take-back.""" + from assistant import brain, intent_bank + if NOT_NOW.search(t) or intent_bank.told_ko(t) or brain.held_back(t) or re.search(r"[\"“”]|라고|래서|하래", t): + return True # a quote: "게임에서 자꾸 말 천천히 하라고 나와" + if intent_bank.NEGATION.search(t) and not re.search(r"\bso (?:fast|loud|quiet|slow)|\btoo\b|너무", t, re.I): + return True # "don't talk louder" (not "don't speak so fast") + if re.search(r"\b(?:are you able|able to|know how to|how (?:do|can|could) you|is it possible|can you even|capable of|" + r"built to|made to|designed to)\b|할 ?줄|줄 ?알|가능(?:해|한|하)|어떻게", t, re.I) or \ + intent_bank.SELF_TALK.search(t) or intent_bank.PAST_EN.search(t) or intent_bank.past_ko(t): + return True # "were you built to ...", "you were too loud yesterday" + name = intent_bank.NAME_CALL.match(t) + if name and name.group(1).lower() not in intent_bank.NOT_A_NAME or brain.to_someone_else(t): + return True # "Jake, talk quieter" + if intent_bank.LATER.search(t) and not re.search(r"\bif you (?:can|could|don'?t mind|please|would)\b|\bso i can\b", t, re.I): + return True # "쉬는 시간 끝나고 목소리 좀 크게 해" + return brain.self_correct(t) == "" # "볼륨 up 해 줄 수 있어, 아 cancel" + + def read(text, last=""): """("volume" | "speed", +1 | -1) when the words ask Lumi to speak louder / quieter / faster / slower, else None. `last` is the assistant's answer just before (brain history): after "ACTION: voice volume +1" a bare "more" / @@ -57,8 +81,12 @@ def read(text, last=""): again = re.match(r"ACTION: voice (volume|speed) ([+-]1)\b", last or "") if again and driving.AGAIN.search(driving.clean(t)): return again.group(1), int(again.group(2)) + if re.search(r"(?:^|\s)(?:키|몸|리프트)(?:를|좀|\s)*(?:크게|작게|높게|낮게)", t): + return None # "키 크게 해 줘": the lift, not the voice if DRIVE.search(t) and not VOICE.search(t) or driving.move(t): return None # "go faster", "천천히 가", "turn it up 30 degrees" + if (LOUDER.search(t) or QUIETER.search(t) or SLOW.search(t) or FAST.search(t)) and _not_now(t): + return None up, down = bool(LOUDER.search(t)), bool(QUIETER.search(t)) if up != down: return "volume", 1 if up else -1 diff --git a/tests/bank_check.py b/tests/bank_check.py index 526a7c1..4538103 100644 --- a/tests/bank_check.py +++ b/tests/bank_check.py @@ -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 diff --git a/tests/blind/README.md b/tests/blind/README.md index e134756..9dc00eb 100644 --- a/tests/blind/README.md +++ b/tests/blind/README.md @@ -131,3 +131,205 @@ are round 4's (with `"crowd"` and `"mix"`). Load them as `tests.blind.r5.held._b.py` … `_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..` (`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: "), 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 (, ) 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 `(?_b.py` holds more cases of the same set written later (never changed once published). +Load them as `tests.blind.r6..`. + +| 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..`. + +| 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 `_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 (`: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 (`: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 " (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. diff --git a/tests/blind_check.py b/tests/blind_check.py index 5fb892e..c58d4eb 100644 --- a/tests/blind_check.py +++ b/tests/blind_check.py @@ -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_.md / .json (blind_r2_.* 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_.*): 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)) diff --git a/tests/closing_check.py b/tests/closing_check.py index 5830fcd..b6aaf0d 100644 --- a/tests/closing_check.py +++ b/tests/closing_check.py @@ -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 diff --git a/tests/conversation_check.py b/tests/conversation_check.py index 764ab39..1de2ce3 100644 --- a/tests/conversation_check.py +++ b/tests/conversation_check.py @@ -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) diff --git a/tests/dialogue_check.py b/tests/dialogue_check.py index 5f47fcd..029614d 100644 --- a/tests/dialogue_check.py +++ b/tests/dialogue_check.py @@ -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"): diff --git a/tests/dialogues_world.py b/tests/dialogues_world.py new file mode 100644 index 0000000..9823e8c --- /dev/null +++ b/tests/dialogues_world.py @@ -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"(? 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|젬마", diff --git a/tests/test_reach_live.py b/tests/test_reach_live.py index 9d6c7fb..8e92bbd 100644 --- a/tests/test_reach_live.py +++ b/tests/test_reach_live.py @@ -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 diff --git a/tests/test_switches.py b/tests/test_switches.py index 6355a95..14c84bb 100644 --- a/tests/test_switches.py +++ b/tests/test_switches.py @@ -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", diff --git a/vision/pointing.py b/vision/pointing.py index 2c2824f..5aaf92c 100644 --- a/vision/pointing.py +++ b/vision/pointing.py @@ -62,10 +62,47 @@ _ASK = [(re.compile(_LEAD + _GO_EN + rf" (?:{w}){_END}", re.I), k) for w, k in ( (re.compile(_LEAD + _GO_EN + rf"\s*(?:{_HERE_KO}){_END}", re.I), "here")] +# the same request in many more wordings (A2, night 2): calls, polite frames and tags around it, "the spot I'm showing +# you", "where my finger points", "내 손가락 방향으로", "저기 저 자리로", Konglish "저기로 go 해 줘", Korean without spaces +_PAD_EN = (r"(?:(?:hey|hi|ok|okay|so|um+|uh+|er+|hmm+|oh|alright|listen|robot|lumi|buddy|bro|now|please|pls|you|young man|" + r"kindly|dear|command:|test one:|quick|excuse me|well|sorry|right|yo|my turn|you mind\?|you mind)[\s,.!:]*)*") +_FRAME_EN = (r"(?:(?:(?:can|could|would|will) (?:you|u)(?: maybe| please| kindly)? |why don'?t you |how about you |i (?:want|need|order) " + r"you to |let'?s see (?:you|u) |be a dear and |would you be so kind as to |mind if i ask you to |try to |" + r"go ahead and |you think you could |maybe |i'?d like you to |would it be possible to |kindly |please |pls |you |" + r"(?:you|u) (?:must|will|can) |let'?s have you |could i ask you to |i'?d love it if you could |if you don'?t mind,? |" + r"i was hoping you could |can |next,? |attention lumi,? |oi |erm,? )*)") +_VERB_EN = r"(?:go|come|move|moov|drive|driive|walk|head|get|roll)(?: over| on over)?(?: and)?(?: stand)?|go stand|stand" +_THERE2_EN = (r"(?:over )?there(?:,? where i(?:'m| am) pointing(?: now)?)?|ovr there|that way|" + r"(?:to|too) (?:that|the|teh) (?:spot|spoot|place|lpace|point)(?: over there)?(?: i(?:'m| am) (?:showing|sowing) (?:you|u)| " + r"i(?:'m| am) pointing(?: at| to)?)?|(?:to |too )?where (?:i|my finger) points?|(?:to |too )?where i(?:'m| am) pointing(?: at| to)?") +_END_EN = (r"(?:[\s,.]*(?:please|pretty p+lease|now|bro|thanks|for us|for me|if you would|will ya|okay|ok|dear|immediately|go|" + r"right now|yeah|there'?s a good robot))*[\s.!?…]*$") +_THERE2_KO = (r"(?:(?:저기 ?)*(?:저기|저쪽|저곳|거기|그쪽|저리|저어기|저 ?자리|그 ?자리)|" + r"(?:제가|내가) ?가리키는 ?(?:곳|데|쪽)|(?:손가락으로 ?)?가리키는 ?(?:곳|데|쪽)|(?:내|제) ?(?:손가락|송가락) ?방향|" + r"point ?한 ?(?:데|곳)|where i point)") +_GO2_KO = (r"(?:(?:좀|얼른|빨리|어서|제발|지금)\s*)*(?:가시죠|가시겠어요|가|이동해|이동|go|move)(?:\s*(?:빨리|얼른|좀))?(?:\s*(?:줘|주세요|주십시오|줘요|줄래요?|주실래요?|줄 ?수 ?있어요?|" + r"주실 ?수 ?있어요?|주시겠습니까|주시겠어요|주면 ?안 ?(?:돼|될까요?)|주셨으면 ?해요|주소|주게|주쇼|주이소|주라|좀|조|" + r"보이소|보랑께|봐|보세요|라|게|도|플리즈|please|요|세요|십시오|시오|해|해 ?줘|해 ?주라|해 ?봐|하세요|해라|좀 ?해 ?줄래|" + r"부탁해요?|가능|볼래|봐 ?봐|서 ?서 ?있(?:어|어라|어요|으세요|으십시오|어 ?줘|어 ?줄래|어 ?주실래요|어 ?주면 좋겠어|어 ?보이소|어 ?주소)|" + r"땡큐|고고|ㄱㄱ|해 ?주실래요|해 ?주면|해 ?주이소|줘잉|주거라|주시지요|도고|주이라|부탁드려요|줘요(?: 네\??)?|" + r"주면 ?좋겠어요?))*") +_ASK += [(re.compile(rf"^{_PAD_EN}{_FRAME_EN}(?:{_VERB_EN}) (?:{_THERE2_EN}){_END_EN}", re.I), "there"), + (re.compile(rf"^{_PAD_EN}(?:that spot,? )?go there{_END_EN}", re.I), "there"), + (re.compile(r"^(?:(?:루미야?|루미 ?씨|루미님|로봇아?|로봇 ?친구야|어이 ?로봇|이봐|보소|얘야?|저기요|음|어+|아|그|저|" + r"그러니까|야|있잖아|근데|에구|hey|lumi)[\s,.~!]*)*" + rf"{_THERE2_KO}\s*(?:으로|로|까지|에)?\s*(?:가서\s*)?{_GO2_KO}" + r"[\s.!?~…]*(?:응\??)?$", re.I), "there"), + (re.compile(rf"^(?:(?:루미야?|루미 ?씨|로봇아?|hey|lumi)[\s,]*)*(?:{_THERE2_KO}|there)\s*(?:으로|로)?\s*go" + r"(?:\s*(?:해|좀|해 ?줘|해 ?주라|해 ?봐|하세요|해라|좀 ?해 ?줄래|부탁해요?))?[\s.!?]*$", re.I), "there"), + (re.compile(rf"^(?:(?:루미야?|루미 ?씨|로봇아?|어\.*|hey|lumi)[\s,]*)*go there\s*(?:해|해 ?줘|해 ?봐|해라|부탁해요?)[\s.!?]*$", re.I), + "there")] + + def asked(text): """"there" for "go there" / "저기로 가" / "come to where I'm pointing", "here" for "come here" / "여기로 와", None for anything else (a longer sentence, a place by name, "put it there").""" t = re.sub(r"\s+", " ", text.strip().lower().replace("’", "'")) + t = re.sub(r"(?