Fix Command box actions while holding, improve side reaches and quick answers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+13
-9
@@ -1097,8 +1097,8 @@ def task_parse(body: ParseBody):
|
|||||||
if hand[0] == "receive" and not held:
|
if hand[0] == "receive" and not held:
|
||||||
got = [{"do": "receive", "object": hand[1], "from_hand": True}]
|
got = [{"do": "receive", "object": hand[1], "from_hand": True}]
|
||||||
return {"action": "steps", "steps": got, "lang": lang, "sender": None, "read_by": "rules", **_steps_said(got, markers)}
|
return {"action": "steps", "steps": got, "lang": lang, "sender": None, "read_by": "rules", **_steps_said(got, markers)}
|
||||||
if hand[0] in ("give", "place"):
|
if hand[0] in ("give", "place"): # voice's reading of the hand (brain.hand_request), not a second one
|
||||||
return _held_parse(body, markers) if held else _talk("–", ["My hand is empty, I'm not holding anything."])
|
return _held_parse(body, markers, hand[0]) if held else _talk("–", ["My hand is empty, I'm not holding anything."])
|
||||||
return _talk(hand[1][0] if hand[0] == "refuse" else "–", kind="refuse")
|
return _talk(hand[1][0] if hand[0] == "refuse" else "–", kind="refuse")
|
||||||
if kind == "mission":
|
if kind == "mission":
|
||||||
got, unread, by = data
|
got, unread, by = data
|
||||||
@@ -1114,13 +1114,16 @@ def task_parse(body: ParseBody):
|
|||||||
if kind == "quick" and data[0] == "fetch":
|
if kind == "quick" and data[0] == "fetch":
|
||||||
return _fetch_parse(body, markers)
|
return _fetch_parse(body, markers)
|
||||||
if kind == "quick" and data[0] == "put":
|
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."])
|
return _held_parse(body, markers, "place") if held else _talk("–", ["My hand is empty, I'm not holding anything."])
|
||||||
if kind == "quick" and data[0] in ("weather", "search"):
|
if kind == "quick" and data[0] in ("weather", "search"):
|
||||||
return _answer(fixed, "Look it up and answer.", "lookup")
|
return _answer(fixed, "Look it up and answer.", "lookup")
|
||||||
if kind == "quick":
|
if kind == "quick":
|
||||||
if held and data[0] == "go_to":
|
if held and data[0] == "go_to":
|
||||||
return _held_parse(body, markers) # holding: a carry there
|
return _held_parse(body, markers) # holding: a carry there
|
||||||
got = _rule_steps(data)
|
got = _rule_steps(data)
|
||||||
|
prefer = data[0] == "pick" and got and brain.pick_prefer(fixed)[0]
|
||||||
|
if prefer:
|
||||||
|
got[0]["prefer"] = prefer # "왼쪽 컵 집어", "the smaller cup": which of several (fetch picks it)
|
||||||
if got:
|
if got:
|
||||||
return {"action": "steps", "steps": got, "lang": lang, "sender": None, "read_by": "rules",
|
return {"action": "steps", "steps": got, "lang": lang, "sender": None, "read_by": "rules",
|
||||||
**_steps_said(got, markers)}
|
**_steps_said(got, markers)}
|
||||||
@@ -1129,9 +1132,9 @@ def task_parse(body: ParseBody):
|
|||||||
problem = brain.place_problem(fixed, markers)
|
problem = brain.place_problem(fixed, markers)
|
||||||
if problem: # quick_command says it: "I don't have a place called p12"
|
if problem: # quick_command says it: "I don't have a place called p12"
|
||||||
return _talk(problem[0], kind="refuse")
|
return _talk(problem[0], kind="refuse")
|
||||||
if held and kind is None and (brain.held_command(fixed) and brain.direct_order(fixed) and not brain.not_an_order(fixed)
|
if held and kind is None and brain.held_carry(fixed, markers) and not brain.ARM_TALK.search(fixed) and \
|
||||||
or brain.held_carry(fixed, markers)): # "p5로 가져가": a carry there
|
not brain.to_someone_else(fixed): # "p5로 가져가": a carry there. Nothing else the rules left is done
|
||||||
return _held_parse(body, markers)
|
return _held_parse(body, markers) # with the hand here: as by voice, the LLM reads it (no motion)
|
||||||
if kind is None and body.llm: # the rules leave it: the LLM, one call, as by voice
|
if kind is None and body.llm: # the rules leave it: the LLM, one call, as by voice
|
||||||
gen = brain.Brain().respond_stream(fixed, markers)
|
gen = brain.Brain().respond_stream(fixed, markers)
|
||||||
head = next(gen)
|
head = next(gen)
|
||||||
@@ -1236,10 +1239,11 @@ def _choices():
|
|||||||
"then": [t for t in fetch.THEN if t]}
|
"then": [t for t in fetch.THEN if t]}
|
||||||
|
|
||||||
|
|
||||||
def _held_parse(body, markers):
|
def _held_parse(body, markers, said=None):
|
||||||
"""A command while something is held: what to do with it, read by the rules only (fast; the object named in it is
|
"""A command while something is held: what to do with it, read by the rules only (fast; the object named in it is
|
||||||
the held one, so "give me the cup" is a give, not a new fetch). A marker named anywhere in the text is where to
|
the held one, so "give me the cup" is a give, not a new fetch). A marker named anywhere in the text is where to
|
||||||
bring it, else the dialog's To; then put it on a table, hand it over or keep holding it."""
|
bring it, else the dialog's To; then put it on a table, hand it over or keep holding it. said: what voice's reader
|
||||||
|
(lumi.route: the hand, the put rule) already made of the words, "give" or "place"."""
|
||||||
from assistant import brain, steps
|
from assistant import brain, steps
|
||||||
from tasks import fetch
|
from tasks import fetch
|
||||||
held, text = fetch.held_name(), brain.give_clause(body.text) # not where the person it is for goes
|
held, text = fetch.held_name(), brain.give_clause(body.text) # not where the person it is for goes
|
||||||
@@ -1251,7 +1255,7 @@ def _held_parse(body, markers):
|
|||||||
named = [p for p in named if isinstance(p, dict)]
|
named = [p for p in named if isinstance(p, dict)]
|
||||||
dest = named[0] if named else (body.dest if body.dest not in (None, "here") else None)
|
dest = named[0] if named else (body.dest if body.dest not in (None, "here") else None)
|
||||||
on = brain.place_on(text) # "on the orange chair": what to put it on
|
on = brain.place_on(text) # "on the orange chair": what to put it on
|
||||||
then = "place" if on else brain.held_command(text) or ("place" if m.get("finish") == "place" else None)
|
then = said or ("place" if on else brain.held_command(text) or ("place" if m.get("finish") == "place" else None))
|
||||||
if then == "give" and named and not re.search(r"\b(give|hand)\b|줘|주세요|건네", t):
|
if then == "give" and named and not re.search(r"\b(give|hand)\b|줘|주세요|건네", t):
|
||||||
then = None # "bring it to p2" is a carry, not a hand-over
|
then = None # "bring it to p2" is a carry, not a hand-over
|
||||||
table = "dining table" if re.search(r"\bdin+(?:n|i)?ing\b|\bdinner table\b", t) else "table" # as it was said
|
table = "dining table" if re.search(r"\bdin+(?:n|i)?ing\b|\bdinner table\b", t) else "table" # as it was said
|
||||||
|
|||||||
@@ -500,5 +500,137 @@ NO += [
|
|||||||
"wave hello to my friend on the phone, no wait, never mind", "pick it up? no, leave it",
|
"wave hello to my friend on the phone, no wait, never mind", "pick it up? no, leave it",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# ---------- a reason before or after the order ("…, my mom wants a picture", "리허설 중이에요, …"), train-set gaps ----------
|
||||||
|
EN_CORE = {
|
||||||
|
"WAVE": ["wave", "say bye with your hand", "shake my hand", "wave at the kids"],
|
||||||
|
"ARM_REACH": ["hold your hand out to me", "give me your hand", "reach out your arm"],
|
||||||
|
"ARM_FOLD": ["put your arm down", "rest your arm", "fold your arm"],
|
||||||
|
"ARM_OPEN": ["open your hand", "hand open"],
|
||||||
|
"ARM_CLOSE": ["close your hand", "make a fist"],
|
||||||
|
"PICK": ["pick up the <obj>", "pick the <obj> up"],
|
||||||
|
}
|
||||||
|
KO_CORE = {
|
||||||
|
"WAVE": ["손 흔들어 줘", "악수해요", "손으로 인사해 줘"],
|
||||||
|
"ARM_REACH": ["손 줘 봐", "팔 뻗어 줘", "손 내밀어 줘"],
|
||||||
|
"ARM_FOLD": ["팔 접어 줘", "손 내려 줘"],
|
||||||
|
"ARM_OPEN": ["손 펴 줘", "그리퍼 열어 줘"],
|
||||||
|
"ARM_CLOSE": ["주먹 꽉 쥐어 줘", "손 쥐어 줘"],
|
||||||
|
"PICK": ["<obj> 집어 줘", "<obj> 잡아 주세요"],
|
||||||
|
}
|
||||||
|
EN_AFTER = ["{}, my mom wants a picture", "{}, we're making a video", "{} for the photo",
|
||||||
|
"{}, it's for a video", "{}, i'm filming"]
|
||||||
|
EN_BEFORE = ["we're filming, {}", "for the video, {}", "ok so my friend dared me, {}", "smile for the camera and {}",
|
||||||
|
"one, two, three, {}", "3, 2, 1, {}", "let's see you {}", "i'd love to see you {}", "i want you {}"]
|
||||||
|
KO_AFTER = ["{}, 사진 찍게", "{}, 애들이 좋아해", "{}, 영상 찍고 있어", "{} 기념으로", "{}, 할머니가 보고 싶대"]
|
||||||
|
KO_BEFORE = ["리허설 중이에요, {}", "촬영 중인데 {}", "녹음 중인데, {}", "하나 둘 셋, {}", "자 이제 {}", "기념 사진 찍을게, {}"]
|
||||||
|
_REASON = {}
|
||||||
|
for k, cores in EN_CORE.items():
|
||||||
|
_REASON[k] = [f.format(c) for c in cores for f in EN_AFTER + EN_BEFORE]
|
||||||
|
for k, cores in KO_CORE.items():
|
||||||
|
_REASON[k] += [f.format(c) for c in cores for f in KO_AFTER + KO_BEFORE]
|
||||||
|
WAVE += _REASON["WAVE"]
|
||||||
|
ARM_REACH += _REASON["ARM_REACH"]
|
||||||
|
ARM_FOLD += _REASON["ARM_FOLD"]
|
||||||
|
ARM_OPEN += _REASON["ARM_OPEN"]
|
||||||
|
ARM_CLOSE += _REASON["ARM_CLOSE"]
|
||||||
|
PICK += _REASON["PICK"]
|
||||||
|
ARM_OPEN += ["let go", "let go now", "okay, let go", "let go of it", "release", "release now", "손 놔", "손 놓아",
|
||||||
|
"그리퍼 놔", "hand open 해 줄래", "손 오픈 해 줄래"]
|
||||||
|
ARM_CLOSE += ["꽉 쥐어", "꽉 쥐어 줘", "꽉 쥐어 주면 좋겠어", "주먹 꽉 쥐어 주게", "손 꽉 쥐시게"]
|
||||||
|
ARM_REACH += ["give me 손", "give me 손 해 줘", "손 give me", "your hand to me, robot", "robot, your hand to me",
|
||||||
|
"손 줘 봐 손", "손 손 줘", "할머니한테 손 줘 봐", "애기한테 손 줘", "손님한테 손 줘 봐요"]
|
||||||
|
WAVE += ["악수하세", "악수하세나", "에구 악수하세", "악수 한번 하세나", "let's see you wave like a queen", "wave like a king",
|
||||||
|
"wave like a princess", "wave like a superstar", "wave like a pro", "핸드 웨이브 해", "손 웨이브"]
|
||||||
|
ARM_FOLD += ["rest your arn", "fold your arn", "put your arn down", "back to look position please",
|
||||||
|
"look position please", "go back to the look position", "팔 룩 포지션"]
|
||||||
|
PICK += ["<obj> 좀 들게", "<obj> 잡게나", "<obj> 들어부러", "<obj> 집어부러", "<obj> 좀 쪼까 집어 줘",
|
||||||
|
"<obj> 집어 주시기 바랍니다", "<obj> 잡아 주시기 바랍니다", "<obj> 들어 주시기 바랍니다", "<obj>좀들어주시기바랍니다",
|
||||||
|
"you have to take the <obj>", "you must pick up the <obj>", "you are can take the <obj>",
|
||||||
|
"i am tourist, please lift the <obj>", "<obj> 픽업해", "<obj> 픽업해 줘요"]
|
||||||
|
FETCH += ["<obj> 브링해 줘", "<obj> 브링해", "<obj> 브링해 주시겠습니까", "<place>에서 <obj> 브링해", "<place>에서 <obj> 브링해 줘",
|
||||||
|
"<obj> 가져와 주시기 바랍니다", "<obj> 갖다 주시기 바랍니다", "<place>에서 <obj> 가져와 주시기 바랍니다",
|
||||||
|
"<place>에서 <obj> 가져와 주시기 부탁드립니다", "<place>에 있는 <obj> 갖다 주시겠어요", "<place>에서 <obj>갖다주게나",
|
||||||
|
"<obj> 갖다 줘 ㅎㅎ", "you bring <obj> please", "you bring <obj> from <place> please"]
|
||||||
|
|
||||||
|
|
||||||
|
# ---------- hard negatives for every capability: negation, past, ability, condition, later, remarks ----------
|
||||||
|
NEG_EN = {"wave": ("wave", "waved", "waving"), "shake hands": ("shake hands", "shook hands", "shaking hands"),
|
||||||
|
"hold out your hand": ("hold out your hand", "held out your hand", "holding out your hand"),
|
||||||
|
"fold your arm": ("fold your arm", "folded your arm", "folding your arm"),
|
||||||
|
"open your hand": ("open your hand", "opened your hand", "opening your hand"),
|
||||||
|
"close your hand": ("close your hand", "closed your hand", "closing your hand"),
|
||||||
|
"pick up the cup": ("pick up the cup", "picked up the cup", "picking up the cup"),
|
||||||
|
"bring me the cup": ("bring me the cup", "brought me the cup", "bringing me the cup")}
|
||||||
|
NEG_KO = {"손 흔들어": ("손 흔들", "손 흔들었", "손 흔드는", "손 흔들"), "악수해": ("악수하", "악수했", "악수하는", "악수할"),
|
||||||
|
"손 내밀어": ("손 내밀", "손 내밀었", "손 내미는", "손 내밀"), "팔 접어": ("팔 접", "팔 접었", "팔 접는", "팔 접을"),
|
||||||
|
"손 펴": ("손 펴", "손 폈", "손 펴는", "손 펼"), "주먹 쥐어": ("주먹 쥐", "주먹 쥐었", "주먹 쥐는", "주먹 쥘"),
|
||||||
|
"컵 집어": ("컵 집", "컵 집었", "컵 집는", "컵 집을"), "컵 가져와": ("컵 가져오", "컵 가져왔", "컵 가져오는", "컵 가져올")}
|
||||||
|
_neg = []
|
||||||
|
for base, past, ing in NEG_EN.values():
|
||||||
|
_neg += [f"don't {base}", f"please don't {base}", f"never {base} again", f"you don't have to {base}", f"no need to {base}",
|
||||||
|
f"you {past} earlier", f"you {past} yesterday", f"did you {base}?", f"can you really {base}?", f"have you ever {past}?",
|
||||||
|
f"if the guests come, {base}", f"{base} when i say so", f"{base} later", f"{base} tomorrow", f"minsu, {base}",
|
||||||
|
f"mom, {base}", f"i saw you {base}", f"stop {ing}", f"i love {ing}", f"{ing} is fun", f"you're good at {ing}",
|
||||||
|
f"why did you {base}?", f"who told you to {base}?", f"robots can {base}", f"i wonder if you can {base}",
|
||||||
|
f"do you know how to {base}?", f"i'd rather you didn't {base}", f"you shouldn't {base} now", f"wait, don't {base}"]
|
||||||
|
for imp, (stem, past, adn, fut) in NEG_KO.items():
|
||||||
|
_neg += [f"{stem}지 마", f"{stem}지 마세요", f"{stem}지 마십시오", f"{stem}지 마시게", f"{stem}지 마이소", f"{stem}지 말아 주세요",
|
||||||
|
f"{past}어?", f"{past}잖아", f"아까 {past}어요", f"어제 {past}습니다", f"{fut} 수 있어?", f"{fut} 줄 알아?",
|
||||||
|
f"{adn} 거 봤어", f"{adn} 거 멋있다", f"{adn} 거 신기하네요", f"{adn} 로봇이네", f"손님 오면 {imp}", f"나중에 {imp}",
|
||||||
|
f"내일 {imp}", f"민수야 {imp}", f"엄마 {imp} 봐", f"{imp} 달라고 누가 그랬어?", f"왜 {past}어?", f"{imp} 안 해도 돼",
|
||||||
|
f"{imp} 필요 없어", f"{imp}도 돼?", f"{adn} 게 좋아", f"{imp} 그만", f"{adn} 건 나중에 하자"]
|
||||||
|
NO += [t for t in _neg if not t.startswith(("minsu,", "mom,", "민수야", "엄마", "can you really"))] # a name or "can you" is
|
||||||
|
# also how a real request starts: those stay with the guards (For B2)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------- Korean kids / elderly / non-native / chat slang ----------
|
||||||
|
WAVE += ["로봇아 손 흔들어 흔들어", "손 흔들어 흔들어", "안녕 안녕 손 흔들어", "빠빠이 해 빠빠이", "로봇 빠이빠이", "로봇 안녕 해 손으로",
|
||||||
|
"어이 로봇 양반 손 좀 흔들어 보게", "이 사람아 악수나 하세", "젊은이 악수 한번 하세", "로봇 양반 손 한번 흔들어 보시게",
|
||||||
|
"손 흔들어 주세요 로봇 씨", "로봇 손 흔들어요 제발", "악수 해요 우리", "손 흔들어 주세요 부탁", "손 흔들어 ㄱㄱ", "악수 ㄱ",
|
||||||
|
"웨이브 ㄱㄱ", "손 흔들어 ㅇㅇ", "손인사 ㄱㄱ", "악수 ㄱㄱ해", "손 흔들어줘 ㅎㅎ", "악수하자 ㅋㅋ", "손 흔들어 주세용 ㅎㅎ",
|
||||||
|
"로봇아 우리 애한테 손 흔들어 줘라", "애기한테 빠빠이 해 줘", "우리 손주한테 손 좀 흔들어 주게"]
|
||||||
|
ARM_REACH += ["로봇 손 줘 손", "손 손 손 줘", "손 줘 손", "로봇아 손", "손 내밀어 내밀어", "젊은이 손 좀 내밀어 보게",
|
||||||
|
"로봇 양반 손 좀 줘 보게", "이 사람아 손 좀 내밀어 보게나", "손 주세요 부탁", "로봇 씨 손 주세요", "팔 뻗어 ㄱ",
|
||||||
|
"손 내밀어 ㅇㅇ", "손 줘 ㅎㅎ", "팔 쭉 ㄱㄱ", "우리 애가 손 잡게 손 좀 내밀어 줘", "애기 손 잡게 손 내밀어 줘"]
|
||||||
|
ARM_FOLD += ["팔 접어 접어", "팔 넣어 넣어", "로봇 팔 접어", "로봇 양반 팔 좀 접게", "이 사람아 팔 거두게", "팔 접어 주세요 부탁",
|
||||||
|
"로봇 씨 팔 접어요", "팔 접어 ㄱㄱ", "팔 ㄴㄴ 접어", "팔 넣어 ㅇㅇ", "팔 접어줘 ㅎㅎ", "팔 원위치 ㄱ"]
|
||||||
|
ARM_OPEN += ["손 펴 펴", "로봇 손 펴", "손 펴 보게 젊은이", "손 펴 주세요 부탁", "손 펴 ㄱㄱ", "손 쫙 펴 ㅎㅎ", "그리퍼 오픈 ㄱ"]
|
||||||
|
ARM_CLOSE += ["주먹 쥐어 쥐어", "주먹 좀 쥐어 보게 젊은이", "주먹 쥐어 주세요 부탁", "주먹 ㄱㄱ", "손 꽉 ㅎㅎ",
|
||||||
|
"그리퍼 클로즈 ㄱ"]
|
||||||
|
PICK += ["<obj> 집어 집어", "로봇 <obj> 집어", "<obj> 좀 집어 보게 젊은이", "로봇 양반 <obj> 좀 집어 주게", "<obj> 집어 주세요 부탁",
|
||||||
|
"<obj> 잡아 ㄱㄱ", "<obj> 집어 ㅇㅇ", "<obj> 들어 봐 ㅎㅎ", "<obj> 픽 ㄱ"]
|
||||||
|
FETCH += ["<obj> 가져와 가져와", "로봇 <obj> 가져와", "<obj> 좀 가져오게 젊은이", "로봇 양반 <obj> 좀 가져다 주게", "<obj> 가져와 주세요 부탁",
|
||||||
|
"<obj> 갖다 줘 ㄱㄱ", "<obj> 가져와 ㅇㅇ", "<obj> 갖다 줘 ㅋㅋ"]
|
||||||
|
|
||||||
|
|
||||||
|
# ---------- whisper slips from the train sets (송 = 손, 해져 = 해 줘, hend, weib, gib) and more frames ----------
|
||||||
|
SLIP_FRAMES = ["any chance you could {}", "{}, chop chop", "{}, there's a good robot", "let's have you {}", "{}, test one",
|
||||||
|
"hey you, {}", "{}, can?", "{}, ok?"]
|
||||||
|
SLIP_CORES = {"wave": ["wave", "shake hands", "wave hello"], "arm_reach": ["hold out your hand", "reach toward me", "offer me your hand"],
|
||||||
|
"arm_fold": ["fold your arm", "put your arm down"], "arm_open": ["open your hand"], "arm_close": ["close your hand"],
|
||||||
|
"pick": ["pick up the <obj>", "pick the <obj> up"]}
|
||||||
|
for _k, _v in SLIP_CORES.items():
|
||||||
|
{"wave": WAVE, "arm_reach": ARM_REACH, "arm_fold": ARM_FOLD, "arm_open": ARM_OPEN, "arm_close": ARM_CLOSE,
|
||||||
|
"pick": PICK}[_k].extend(f.format(c) for c in _v for f in SLIP_FRAMES)
|
||||||
|
WAVE += ["gib me a shake", "pliz gib me a shake", "give me a shek", "give everyone a wave", "give everyone weib",
|
||||||
|
"weib please", "give weib", "wayve like a queen", "wave one more itme", "하이 웨이브 해", "하이 웨이브",
|
||||||
|
"나랑 악수", "나랑악수", "저랑 악수", "우리 악수", "안녕 해져 손으로", "웨이브 해져", "손 흔들어 져", "악수 해져",
|
||||||
|
"손 흔드러 주소", "악수 shake 해 줄래", "hello wave 해 줄래", "손 wave 한번 해 봐"]
|
||||||
|
ARM_REACH += ["송 줘", "송 이리 줘", "송 한번 줘요", "저한테 송 줘", "송 이리 주면 안 돼?", "송 내밀어", "송 좀 내밀어 줘",
|
||||||
|
"손 내밀어 져", "손 줘 져", "reach for me for mi", "reach for mi", "giv hand", "gib hand", "gib me hand",
|
||||||
|
"손!", "손 쫌 주이소", "앞으로 팔 내밀어 주실래요", "reach 해 봐"]
|
||||||
|
ARM_FOLD += ["기본 pose 로 해", "기본 포즈로 해", "기본 포즈로 돌아가", "기본 자세로 돌아가", "기본 자세", "기본 pose",
|
||||||
|
"팔 기본 포즈", "팔 접어 져", "손 다시 넣어 져", "팔 넣어 져", "folf your arm", "fold yuor arm", "put yor arm down"]
|
||||||
|
ARM_OPEN += ["송 좀 펴 줄래요", "송 펴", "송 펴 줘", "손 펴 져", "opeen your hand", "open yor hand", "open hend",
|
||||||
|
"release ㄱㄱ", "release 해", "release 해 줘", "릴리즈 해 줘"]
|
||||||
|
ARM_CLOSE += ["clench your hend", "cllose hand", "close hend", "close yor hand", "clos hend", "손 쥐어 져",
|
||||||
|
"주먹 쥐어 져", "손가락 쥐어", "손가락 쥐어 줘", "손가락 쥐어 주겠나", "꽉 쥐세요", "그리퍼 오므리시겠어요",
|
||||||
|
"집게 꽉 닫아 봐", "그리퍼 클로즈 해 줘"]
|
||||||
|
PICK += ["<obj> 픽업 해", "<obj> 픽업 해 줘", "<obj> grab 해 줄 수 있어", "take <obj> 해 주이소", "grab the <obj> 가능?",
|
||||||
|
"<obj> 집어 져", "<obj> 잡아 져", "<obj> 집어! 가즈아", "<obj> 들어라", "<obj> 잡아 봐요"]
|
||||||
|
NO += ["송 불러 줘", "송 하나 불러", "송 틀어 줘", "생일 송 불러 줘", "노래 송 틀어", "손 송 노래", "drop the beat", "drop the mic",
|
||||||
|
"let it go 불러 줘", "sing let it go", "release the song", "give everyone a break", "give everyone a minute"]
|
||||||
|
|
||||||
INTENT = {"wave": WAVE, "arm_reach": ARM_REACH, "arm_fold": ARM_FOLD, "arm_open": ARM_OPEN, "arm_close": ARM_CLOSE,
|
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, "give": GIVE, "receive": RECEIVE, "no": NO}
|
"pick": PICK, "fetch": FETCH, "put": PUT, "give": GIVE, "receive": RECEIVE, "no": NO}
|
||||||
|
|||||||
@@ -316,3 +316,9 @@ QUICK["no"] += [
|
|||||||
"엔비디아 대표 누구야", "테슬라 대표 누구예요", "삼성 회장 누구야", "who's the boss of openai", "who runs google",
|
"엔비디아 대표 누구야", "테슬라 대표 누구예요", "삼성 회장 누구야", "who's the boss of openai", "who runs google",
|
||||||
"1달러에 원화로 얼마야", "1달러 원화로 얼만가", "환율 얼마예요", "달러 환율 알려 줘", "엔화 얼마야", "how much is a dollar in won",
|
"1달러에 원화로 얼마야", "1달러 원화로 얼만가", "환율 얼마예요", "달러 환율 알려 줘", "엔화 얼마야", "how much is a dollar in won",
|
||||||
"what's the exchange rate", "배터리 얼만가", "배터리 얼마예요", "배터리 얼마야", "배터리 얼마 남았는가"]
|
"what's the exchange rate", "배터리 얼만가", "배터리 얼마예요", "배터리 얼마야", "배터리 얼마 남았는가"]
|
||||||
|
QUICK["co_what"] = QUICK.get("co_what", []) + ["tell me a bit about cutshion", "tell me a little about cutshion", "a few words about cutshion",
|
||||||
|
"what is cutshion like", "cutshion 소개 좀", "쿳션 소개 부탁해요", "쿳션 얘기 좀 해 줘"]
|
||||||
|
QUICK["co_founded"] += _ko(["쿳션 창업한 지 얼마나 됐", "회사 창업한 지 얼마나 됐", "쿳션 설립된 지 얼마나 됐", "쿳션 세워진 지 몇 년 됐"],
|
||||||
|
["어", "어요", "니", "습니까", "나요", "노", "어유", "는가"])
|
||||||
|
QUICK["co_hq"] += ["where is cutshion's office", "where's cutshion's office", "where is the cutshion office", "cutshion office location",
|
||||||
|
"where is your company's office", "쿳션 오피스 어디예요"]
|
||||||
|
|||||||
@@ -738,3 +738,42 @@ QUICK["no"] += ["한 번에 몇 초 걸려", "몇 초 걸려", "몇 초나 걸
|
|||||||
"how long does it take", "얼마나 걸려요", "시간 얼마나 걸려"]
|
"how long does it take", "얼마나 걸려요", "시간 얼마나 걸려"]
|
||||||
QUICK["mics"] += ["clip mic 있어요", "클립 마이크 있어요", "무선 마이크 있어요", "시끄러우면 마이크 써", "시끄러우면 마이크 씀", "do you have a clip mic",
|
QUICK["mics"] += ["clip mic 있어요", "클립 마이크 있어요", "무선 마이크 있어요", "시끄러우면 마이크 써", "시끄러우면 마이크 씀", "do you have a clip mic",
|
||||||
"is there a wireless microphone", "can i use a microphone", "마이크 따로 있어요"]
|
"is there a wireless microphone", "can i use a microphone", "마이크 따로 있어요"]
|
||||||
|
# what Lumi can do is assistant/abilities.py's: "기능" asked is never what it is used for (used_where)
|
||||||
|
QUICK["no"] += _ko(["기능 ", "너 기능 ", "기능이 ", "루미 기능 ", "할 수 있는 기능 ", "니 기능 "], _WHAT) + [
|
||||||
|
"what are your functions", "what functions do you have", "your functions what", "what features do you have", "기능 뭐 있어",
|
||||||
|
"무슨 기능 있어요", "어떤 기능 있어요", "기능 좀 알려 줘", "function 뭐 있어"]
|
||||||
|
QUICK["battery_life"] += _ko(["배터리 타임 ", "배터리 time ", "battery 타임 "], ["얼마나 돼", "얼마나 돼요", "얼마나 되세요", "얼마야", "얼마예요",
|
||||||
|
"몇 시간이야", "몇 시간이에요", "얼마나 가요", "어떻게 돼요"])
|
||||||
|
# round 5 (first-words sweep): commands and status questions that came out as fact kinds
|
||||||
|
QUICK["no"] += [
|
||||||
|
"손", "손!", "손 다시 넣어", "손 넣어", "팔 넣어", "집게 열어", "집게 닫아", "손가락 펴", "손가락 여시면 좋겠어요", "손 펴 주시겠어요", "손 펴",
|
||||||
|
"open your fingers", "could you open your fingers", "close your gripper", "please you can grip", "you can grip", "grip it", "grip please",
|
||||||
|
"바닥에 놔", "바닥에 놓으시겠어요", "바닥 체크", "바닥 봐", "바닥에 내려놔", "put it on the floor",
|
||||||
|
"where is your arm", "where's your arm now", "팔 지금 어디야", "팔 지금 어디예요", "팔 어디 있어", "arm where now",
|
||||||
|
"고개 원위치로 돌려 주세요", "고개 돌려 주세요", "머리 원위치", "허리 왼쪽으로 틀어 주세요", "turn your head ten degrees down",
|
||||||
|
"가까이 오시게", "이리 오시게", "가까이 와", "가까이 와 주세요", "come closer", "홀로 가시지요", "홈으로 가", "go plug yourself in",
|
||||||
|
"go charge yourself", "충전하러 가", "lumi what's your battery", "what's your battery level", "배터리 몇이야",
|
||||||
|
"would you raise your height", "raise your height a little", "키 좀 높여 주시겠어요", "make yourself taller", "키 높여 줘"]
|
||||||
|
# round 6 (own new phrasings, 135 written apart from the bank)
|
||||||
|
QUICK["maker"] += _ko(["너 누구 작품", "누구 작품", "이 로봇 누구 작품", "어디 작품"], ["이야", "이에요", "이니", "입니까", "인가요", "이고", "인교", "이여"]) + [
|
||||||
|
"whose work are you", "who's your creator", "who is behind this robot", "which company is behind you"]
|
||||||
|
QUICK["height"] += ["are you taller than a person", "are you as tall as a man", "are you taller than me", "사람보다 커", "사람보다 키 커요",
|
||||||
|
"어른만 해요", "사람만 해", "are you bigger than a person"]
|
||||||
|
QUICK["weight"] += _ko(["몸무게 몇 ", "무게 몇 ", "너 몇 "], ["키로예요", "키로야", "키로", "키로입니까", "키로고", "킬로예요", "킬로야", "kg이에요", "kg이야"])
|
||||||
|
QUICK["battery_life"] += ["how long can you run before charging", "how long before you need to charge", "how long can you go without charging",
|
||||||
|
"how long until your battery is empty", "충전 안 하고 얼마나 버텨", "충전 없이 몇 시간 가요"]
|
||||||
|
QUICK["model"] += ["what brain do you use to talk", "what's your brain", "what thinks for you", "what ai thinks for you", "which ai do you have inside",
|
||||||
|
"무슨 두뇌로 말해", "어떤 머리로 생각해요"]
|
||||||
|
QUICK["robot"] += ["are you a person in a costume", "is someone wearing you", "are you a costume", "is there a person in there",
|
||||||
|
"사람이 들어가 있는 거야", "탈 쓴 사람이에요", "사람이 인형 옷 입은 거예요"]
|
||||||
|
QUICK["time_now"] += ["time check", "time check please", "현재 시각 알려 줘", "현재 시각이 어떻게 돼요", "현재 시각 좀", "시각 좀 알려 주세요",
|
||||||
|
"do you know what time it is", "can you tell me what time it is"]
|
||||||
|
QUICK["how_are_you"] += _ko(["오늘 기분 좋", "기분 좋", "기분 괜찮", "오늘 컨디션 좋"], ["아", "아요", "니", "으세요", "습니까", "나", "노"])
|
||||||
|
QUICK["no"] += ["이거 몇 살짜리 장난감이야", "몇 살짜리가 쓰는 거야", "몇 살부터 탈 수 있어", "몇 살 이상 이용 가능해요", "what age is this toy for"]
|
||||||
|
QUICK["hello"] = QUICK.get("hello", []) + ["hi there lumi", "hello there lumi", "hey there lumi", "hi there robot", "hello there robot",
|
||||||
|
"hi lumi nice to meet you", "안녕 로봇아", "안녕하세요 로봇님", "루미 반가워요", "하이 로봇"]
|
||||||
|
QUICK["safety"] += _ko(["너 위험한 로봇", "위험한 로봇", "이 로봇 위험한 거"], ["이야", "이에요", "이니", "입니까", "인가요", "이고", "임"])
|
||||||
|
QUICK["tts"] += ["what speech synthesis do you use", "what voice synthesis do you use", "which speech synthesizer do you use", "음성 합성 엔진 뭐예요"]
|
||||||
|
QUICK["no"] += ["can you open the window", "open the window", "창문 열어 줘", "창문 열 수 있어", "turn on the internet", "인터넷 켜 줘",
|
||||||
|
"connect to the wifi", "와이파이 연결해 줘", "여기 안전해", "is it safe here", "이 동네 안전해요", "is this area safe",
|
||||||
|
"바닥 안전해", "is the floor safe"]
|
||||||
|
|||||||
+67
-14
@@ -677,7 +677,7 @@ INTENTS = [ # (action, pattern) checked in order on what the visitor said
|
|||||||
("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
|
("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|(?<!말 )(?<!말을 )따라\s?(?:와|오세요|오십시오|올래)|(?<!로 )(?:같이|함께)\s?(?:가자|가요|갑시다|걸어|가(?=\W*$))|" # me on instagram"
|
r"\bcome along\b|(?<!말 )(?<!말을 )따라\s?(?:와|오세요|오십시오|올래)|(?<!로 )(?:같이|함께)\s?(?:가자|가요|갑시다|걸어|가(?=\W*$))|" # me on instagram"
|
||||||
r"\b(?:and|then) follow(?: me| along)?\W*(?:(?:please|plz|thanks|bro|now|okay|ok)\W*)*$|"
|
r"\b(?:and|then) follow(?: me| along)?\W*(?:(?:please|plz|thanks|bro|now|okay|ok)\W*)*$|"
|
||||||
r"\b(?:keep|stay|walk|go) (?:right )?behind me\b|\bi(?:'?ll| will) walk,? (?:and )?you follow\b|"
|
r"\b(?:keep|stay|walk|go|come) (?:right )?behind me\b|\bi(?:'?ll| will) walk,? (?:and )?you follow\b|"
|
||||||
r"^\W*(?:\w+\W+){0,2}(?:you )?follow\W*(?:(?:please|plz|thanks|bro|now|okay|ok)\W*)*$|\bfolow me\b|"
|
r"^\W*(?:\w+\W+){0,2}(?:you )?follow\W*(?:(?:please|plz|thanks|bro|now|okay|ok)\W*)*$|\bfolow me\b|"
|
||||||
r"\bafter me\b(?! (?:please )?(?:say|repeat))|(?:나|저) ?(?:를|을)? ?따라서? (?:walk|와|걸어)"),
|
r"\bafter me\b(?! (?:please )?(?:say|repeat))|(?:나|저) ?(?:를|을)? ?따라서? (?:walk|와|걸어)"),
|
||||||
# ^ "keep behind me and follow", "I'll walk, you follow", "Lumi, after me walk please", "나 따라서 walk 해"
|
# ^ "keep behind me and follow", "I'll walk, you follow", "Lumi, after me walk please", "나 따라서 walk 해"
|
||||||
@@ -846,7 +846,7 @@ COME_BACK = re.compile( # the whole sentence asks Lumi back to where it stood
|
|||||||
r"(?:come (?:on )?back|return|(?:go|head|drive) back(?= ))(?: to)?(?: (?:where you (?:were|was|started|came from|were standing)"
|
r"(?:come (?:on )?back|return|(?:go|head|drive) back(?= ))(?: to)?(?: (?:where you (?:were|was|started|came from|were standing)"
|
||||||
r"(?: before)?|the way you came|(?:your|the) (?:start(?:ing)? (?:point|place|spot|position)|start|original (?:spot|place|position)|"
|
r"(?: before)?|the way you came|(?:your|the) (?:start(?:ing)? (?:point|place|spot|position)|start|original (?:spot|place|position)|"
|
||||||
r"old (?:spot|place)|spot|place)))?(?: (?:now|please|lumi|again|for me))*|"
|
r"old (?:spot|place)|spot|place)))?(?: (?:now|please|lumi|again|for me))*|"
|
||||||
r"(?:(?:다시|이제|좀|얼른|어서)\s*)*(?:(?:원래|아까|처음)\s*(?:있던|있었던|서 ?있던)?\s*(?:자리|곳|데|위치|장소)\s*(?:으로|로|에)\s*|"
|
r"(?:(?:다시|이제|좀|얼른|어서)\s*)*(?:(?:(?:원래|아까|처음|그)\s*)+(?:있던|있었던|서 ?있던)?\s*(?:자리|곳|데|위치|장소)\s*(?:으로|로|에)\s*|"
|
||||||
r"제자리로\s*)?(?:다시\s*)?(?:되)?돌아\s?(?:와|가|오세요|가세요|와요|가요|와라|가라|올래|갈래)"
|
r"제자리로\s*)?(?:다시\s*)?(?:되)?돌아\s?(?:와|가|오세요|가세요|와요|가요|와라|가라|올래|갈래)"
|
||||||
r"(?:\s*(?:줘요?|주세요|줄래요?|봐))?|"
|
r"(?:\s*(?:줘요?|주세요|줄래요?|봐))?|"
|
||||||
r"(?:(?:다시|이제|좀|얼른|어서)\s*)*(?:원래\s*(?:있던|있었던|서 ?있던)\s*(?:자리|곳|데|위치)|왔던\s*(?:길|곳|데|자리))\s*(?:으로|로)\s*"
|
r"(?:(?:다시|이제|좀|얼른|어서)\s*)*(?:원래\s*(?:있던|있었던|서 ?있던)\s*(?:자리|곳|데|위치)|왔던\s*(?:길|곳|데|자리))\s*(?:으로|로)\s*"
|
||||||
@@ -1121,6 +1121,7 @@ def direct_order(text):
|
|||||||
short fragment command ("booth A", "faster", "left a bit", "회전"). Only then may a keyword rule act; anything else
|
short fragment command ("booth A", "faster", "left a bit", "회전"). Only then may a keyword rule act; anything else
|
||||||
(a statement, a story, a plan between people, a question about ability or habit) is read by the LLM with the talk
|
(a statement, a story, a plan between people, a question about ability or habit) is read by the LLM with the talk
|
||||||
before it. Each sentence / clause is checked; one order in it is enough (not_an_order weeds out the rest)."""
|
before it. Each sentence / clause is checked; one order in it is enough (not_an_order weeds out the rest)."""
|
||||||
|
text = re.sub(r"\b(can|could|would|will) (?:ya|yah|yu)\b", r"\1 you", text or "", flags=re.I) # "could ya grab it"
|
||||||
t = re.sub(_LEAD, "", unfill(wording.ko_plain(_MAY_NOT.sub(" 줘", text or ""))).strip(), flags=re.I) # every
|
t = re.sub(_LEAD, "", unfill(wording.ko_plain(_MAY_NOT.sub(" 줘", text or ""))).strip(), flags=re.I) # every
|
||||||
# speech level as 반말
|
# speech level as 반말
|
||||||
t = re.sub(r"[\s~]*(?:[ㅋㅎ]{2,}|ㅠ+|ㅜ+)[\s~]*$|~+(?=\s*[?!.]*\s*$)", "", t) # "가 줄래~?", "고개 내려 ㅎㅎ"
|
t = re.sub(r"[\s~]*(?:[ㅋㅎ]{2,}|ㅠ+|ㅜ+)[\s~]*$|~+(?=\s*[?!.]*\s*$)", "", t) # "가 줄래~?", "고개 내려 ㅎㅎ"
|
||||||
@@ -1285,6 +1286,11 @@ def intent(text, markers=()):
|
|||||||
plain = re.sub(r"줘\s*\?+\s*$", "줘", wording.ko_plain(_MAY_NOT.sub(" 줘", text))) # "놔 줘?": a request asked
|
plain = re.sub(r"줘\s*\?+\s*$", "줘", wording.ko_plain(_MAY_NOT.sub(" 줘", text))) # "놔 줘?": a request asked
|
||||||
if plain != text:
|
if plain != text:
|
||||||
rule = _intent(plain, markers)
|
rule = _intent(plain, markers)
|
||||||
|
if rule is None:
|
||||||
|
prefer, cut = pick_prefer(text or "")
|
||||||
|
if prefer and cut != text:
|
||||||
|
rule = _intent(cut, markers) # "grab the smaller cup": the pick (which one: the reader's prefer)
|
||||||
|
rule = rule if rule and rule[0] in ("pick", "fetch") else None
|
||||||
return rule
|
return rule
|
||||||
|
|
||||||
|
|
||||||
@@ -1534,7 +1540,7 @@ def _intent(text, markers=()):
|
|||||||
if action == "put":
|
if action == "put":
|
||||||
return ("put", "back" if re.search(r"\bback\b|\breturn\b|\bwhere (?:it was|you)\b|\bits (?:spot|place)\b|제자리|다시|원래|원위치|있던|도로", t)
|
return ("put", "back" if re.search(r"\bback\b|\breturn\b|\bwhere (?:it was|you)\b|\bits (?:spot|place)\b|제자리|다시|원래|원위치|있던|도로", t)
|
||||||
else "down")
|
else "down")
|
||||||
if action == "pick" and re.search(r"\b(?:grab|get|fetch|pick up|take) me\b", t):
|
if action == "pick" and re.search(r"\b(?:grab|get|fetch|pick up|take) me\b|\bgimme\b", t):
|
||||||
return ("fetch", text) # "go grab me a cup": brought to me, not only picked
|
return ("fetch", text) # "go grab me a cup": brought to me, not only picked
|
||||||
if action in ("pick", "move_object") and far:
|
if action in ("pick", "move_object") and far:
|
||||||
return ("fetch", text) # "get me an orange at gate one": a trip there, not a pick here
|
return ("fetch", text) # "get me an orange at gate one": a trip there, not a pick here
|
||||||
@@ -1762,8 +1768,8 @@ def unfill(t):
|
|||||||
|
|
||||||
KO_SLIPS = [ # Konglish, dialect and whisper's spellings of the cup / delivery verbs, as the readers know them
|
KO_SLIPS = [ # Konglish, dialect and whisper's spellings of the cup / delivery verbs, as the readers know them
|
||||||
(r"(?:테이크|픽업|그랩|(?<![가-힣])픽)\s?해서", "집어서"), (r"(?:테이크|픽업|그랩|(?<![가-힣])픽)\s?하고", "집고"),
|
(r"(?:테이크|픽업|그랩|(?<![가-힣])픽)\s?해서", "집어서"), (r"(?:테이크|픽업|그랩|(?<![가-힣])픽)\s?하고", "집고"),
|
||||||
(r"(?:드랍|드롭)\s?해", "놔"), (r"기달려", "기다려"), (r"기달리", "기다리"), (r"(?<![가-힣])들구(?=\s|$)", "들고"),
|
(r"(?:드랍|드롭)\s?해", "놔"), (r"기달려", "기다려"), (r"기달리", "기다리"), (r"기다리(?=\W*$)", "기다려"), (r"(?<![가-힣])들구(?=\s|$)", "들고"),
|
||||||
(r"가저(?=와|다|가|오)", "가져"), (r"(?<![가-힣])날라(?=\s*(?:줘|주|다|$))", "옮겨"), (r"((?:갖다|가져다)\s?)도(?=\W*$)", r"\1줘"), (r"놓(?:그라|거라)", "놔"),
|
(r"가저(?=와|다|가|오)", "가져"), (r"((?:몸|손|팔|고개)(?:을|를)? )내러(?=\s|$)", r"\1내려"), (r"(?<![가-힣])날라(?=\s*(?:줘|주|다|$))", "옮겨"), (r"((?:갖다|가져다)\s?)도(?=\W*$)", r"\1줘"), (r"놓(?:그라|거라)", "놔"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -1854,6 +1860,8 @@ def _mentions(text, markers):
|
|||||||
# ^ "and go exit point", "exit 가서", "exit 까지 가 줘": a drive there, said without "to" / 로
|
# ^ "and go exit point", "exit 가서", "exit 까지 가 줘": a drive there, said without "to" / 로
|
||||||
out["dest"] = _as_place(place)
|
out["dest"] = _as_place(place)
|
||||||
for m in re.finditer(r"\bfrom (?:the )?([a-z]+)", t): # "from the kitchen": a place not on the map
|
for m in re.finditer(r"\bfrom (?:the )?([a-z]+)", t): # "from the kitchen": a place not on the map
|
||||||
|
if m.group(1) in ("left", "right", "table", "desk", "front", "back", "top", "side", "middle", "center", "shelf"):
|
||||||
|
continue # "from the right table": a side here, no place
|
||||||
if not re.match(_place_re(markers), t[m.start(1):]) and "source" not in out:
|
if not re.match(_place_re(markers), t[m.start(1):]) and "source" not in out:
|
||||||
out["source"] = None
|
out["source"] = None
|
||||||
for m in re.finditer(r"(?:^|\s)([가-힣a-z0-9]+?)\s?에서(?![가-힣])", t): # "2층에서", "주방에서": not on the map
|
for m in re.finditer(r"(?:^|\s)([가-힣a-z0-9]+?)\s?에서(?![가-힣])", t): # "2층에서", "주방에서": not on the map
|
||||||
@@ -2006,7 +2014,9 @@ ASKS_AGAIN = re.compile(r"\bdidn'?t (?:quite )?(?:catch|understand|get)\b|\b(?:c
|
|||||||
r"(?:that|it|them)\b|\bsay (?:that|it) again\b|\bnot sure what you(?:'re| are)? (?:mean|referring)|"
|
r"(?:that|it|them)\b|\bsay (?:that|it) again\b|\bnot sure what you(?:'re| are)? (?:mean|referring)|"
|
||||||
r"\bplease clarify\b|\bcould you (?:please )?clarify\b|잘 ?못 알아들|다시 (?:한 ?번 ?)?말씀해|"
|
r"\bplease clarify\b|\bcould you (?:please )?clarify\b|잘 ?못 알아들|다시 (?:한 ?번 ?)?말씀해|"
|
||||||
r"\bwhat do you mean by\b|\bwhich \w+ do you mean\b|이해하지 못했|무슨 말씀이신지|무슨 뜻인지 (?:잘 )?모르|"
|
r"\bwhat do you mean by\b|\bwhich \w+ do you mean\b|이해하지 못했|무슨 말씀이신지|무슨 뜻인지 (?:잘 )?모르|"
|
||||||
r"(?:어떤|무슨|어느) \S+(?:을|를)? 말씀하시는|불분명", re.I)
|
r"(?:어떤|무슨|어느) \S+(?:을|를)? 말씀하시는|불분명|말씀하시는 (?:건|것)(?:가요|인가요|이죠)|"
|
||||||
|
r"\bare you (?:referring|asking) (?:to|about)\b|궁금하신가요\W*$", re.I)
|
||||||
|
# (also "무엇이 걸리는 시간을 말씀하시는 건가요?", "Are you referring to the book ...?")
|
||||||
# a reply that asks to hear the words again
|
# a reply that asks to hear the words again
|
||||||
UNSURE_ANSWER = re.compile(r"^\W*(?:maybe|perhaps|not really|kind of|sort of|i don'?t know|글쎄요?|아마(?:도)?|몰라요?|모르겠어요?)\W*$",
|
UNSURE_ANSWER = re.compile(r"^\W*(?:maybe|perhaps|not really|kind of|sort of|i don'?t know|글쎄요?|아마(?:도)?|몰라요?|모르겠어요?)\W*$",
|
||||||
re.I) # an answer to Lumi's question, not filler
|
re.I) # an answer to Lumi's question, not filler
|
||||||
@@ -2031,7 +2041,8 @@ def spoken(sentence, lang):
|
|||||||
return sentence
|
return sentence
|
||||||
|
|
||||||
|
|
||||||
HELD_GIVE = re.compile(r"\b(give|hand)\b|\bbring it\b|줘|주세요|건네", re.I)
|
HELD_GIVE = re.compile(r"\b(give|hand|pass)\b|\bbring it\b|\b(?:can|could|may) i (?:have|get|take)\b|\b(?:lemme|let me) have\b|"
|
||||||
|
r"\bgimme\b|줘|주세요|주십시오|주시|주면|주실|드려|드리|건네|내놔|내놓|이리 내", re.I)
|
||||||
HELD_PLACE = re.compile(r"\b(put|place|set)\b|\b(?:drop|leave) (?:it|that|this|the \w+)(?: off| down)? (?:at|on|by)\b|놔|놓|둬", re.I)
|
HELD_PLACE = re.compile(r"\b(put|place|set)\b|\b(?:drop|leave) (?:it|that|this|the \w+)(?: off| down)? (?:at|on|by)\b|놔|놓|둬", re.I)
|
||||||
|
|
||||||
|
|
||||||
@@ -2110,6 +2121,13 @@ def pick_prefer(text):
|
|||||||
rf"(?!\s+(?:{_SUP_WORDS})\b)", t)
|
rf"(?!\s+(?:{_SUP_WORDS})\b)", t)
|
||||||
if m:
|
if m:
|
||||||
return m.group(2), t[:m.end(1)] + t[m.end():]
|
return m.group(2), t[:m.end(1)] + t[m.end():]
|
||||||
|
m = re.search(rf"(?<![a-z])((?:{_OBJ})s?|ones?)\s+(?:on|from|off)\s+the\s+(left|right)\s+(?:table|desk)s?\b|"
|
||||||
|
rf"(왼쪽|오른쪽)\s*(?:테이블|탁자|책상)(?:\s*위)?(?:에|에서)\s*(?:있는\s*)?(?=(?:(?:{_COL})\s*)?(?:{_OBJ}))", t)
|
||||||
|
if m and m.group(1) and re.search(r"\b(?:put|place|set|leave|drop)\b", t[:m.start()]):
|
||||||
|
m = None # "put the cup on the left table": where it goes
|
||||||
|
if m: # "the cup on the left table", "왼쪽 테이블에 있는 컵": that side
|
||||||
|
side = m.group(2) or {"왼쪽": "left", "오른쪽": "right"}[m.group(3)]
|
||||||
|
return side, (t[:m.end(1)] + t[m.end():]) if m.group(1) else t[:m.start()] + t[m.end():]
|
||||||
m = re.search(rf"(?:(?:제일|가장|더)\s*)?(작은|큰|왼쪽(?:에\s*있는|의)?|오른쪽(?:에\s*있는|의)?|가까운|가까이\s*있는|먼|"
|
m = re.search(rf"(?:(?:제일|가장|더)\s*)?(작은|큰|왼쪽(?:에\s*있는|의)?|오른쪽(?:에\s*있는|의)?|가까운|가까이\s*있는|먼|"
|
||||||
rf"멀리\s*있는)\s*(?=(?:(?:{_COL})\s*)?(?:{_OBJ})|(?:거|것|걸)(?![가-힣]))", t)
|
rf"멀리\s*있는)\s*(?=(?:(?:{_COL})\s*)?(?:{_OBJ})|(?:거|것|걸)(?![가-힣]))", t)
|
||||||
if m:
|
if m:
|
||||||
@@ -2150,6 +2168,10 @@ def place_on(text):
|
|||||||
def held_command(text):
|
def held_command(text):
|
||||||
"""While holding: 'give' / 'place' for "give it to me", "put it on the table", "줘", "테이블에 놔". A thing to put
|
"""While holding: 'give' / 'place' for "give it to me", "put it on the table", "줘", "테이블에 놔". A thing to put
|
||||||
it on wins ("bring it to p5 and put it on the table" is a place)."""
|
it on wins ("bring it to p5 and put it on the table" is a place)."""
|
||||||
|
if re.search(r"들고\s*(?:계속\s*)?있|\bkeep (?:holding|it|hold of it)\b|\b(?:just )?hold (?:it|on to it|onto it)\b", text, re.I):
|
||||||
|
return None # "계속 들고 있어 주세요", "keep holding it": nothing to do with it
|
||||||
|
if re.search(r"내놔|내놓(?:아|으)|이리 내", text):
|
||||||
|
return "give" # "내놔": hand it over, not a put
|
||||||
if HELD_PLACE.search(text) and place_on(text):
|
if HELD_PLACE.search(text) and place_on(text):
|
||||||
return "place"
|
return "place"
|
||||||
if HELD_GIVE.search(re.sub(r"(?:놔|놓아|둬|올려|내려|(?<![갖다])가|가져가|들고 가|옮겨|와|이동해)\s*(?:좀\s*|쫌\s*)?(?:줘|주|드려|드리)", "놔", text)): # "그거 놔 줘": 줘 helps the put
|
if HELD_GIVE.search(re.sub(r"(?:놔|놓아|둬|올려|내려|(?<![갖다])가|가져가|들고 가|옮겨|와|이동해)\s*(?:좀\s*|쫌\s*)?(?:줘|주|드려|드리)", "놔", text)): # "그거 놔 줘": 줘 helps the put
|
||||||
@@ -2173,7 +2195,7 @@ RECEIVE_EN = re.compile(
|
|||||||
rf"|\b(?:take|grab|get|accept|receive)\s+(?:(?:the|this|that|a|an|my)\s+)?(?:\w+\s+)?\w+\s+(?:from (?:me|my hands?)|out of my hands?|i'?m holding|in my hand)\b"
|
rf"|\b(?:take|grab|get|accept|receive)\s+(?:(?:the|this|that|a|an|my)\s+)?(?:\w+\s+)?\w+\s+(?:from (?:me|my hands?)|out of my hands?|i'?m holding|in my hand)\b"
|
||||||
rf"|\b(?:take|grab)\s+my\s+(?:(?:{_COL})\s+)?(?:{_OBJ})s?\b|\b(?:take|hold|catch)\s+this\s+(?:(?:{_COL})\s+)?(?:{_OBJ})s?\b(?!\s+(?:on|from|off|over)\b)"
|
rf"|\b(?:take|grab)\s+my\s+(?:(?:{_COL})\s+)?(?:{_OBJ})s?\b|\b(?:take|hold|catch)\s+this\s+(?:(?:{_COL})\s+)?(?:{_OBJ})s?\b(?!\s+(?:on|from|off|over)\b)"
|
||||||
rf"|(?:^|[\s,.!])hold\s+(?:{_IT}|this \w+|my \w+)\b(?!\s+(?:up|out|on|thought)\b)(?! for me while)"
|
rf"|(?:^|[\s,.!])hold\s+(?:{_IT}|this \w+|my \w+)\b(?!\s+(?:up|out|on|thought)\b)(?! for me while)"
|
||||||
rf"|\bhang on to (?:{_IT})\b|\bhere(?: you go| it is|'?s (?:the|a|my|your) \w+(?: \w+)?)\b|^\W*here\W+(?:take|hold|catch)\b"
|
rf"|\bhang on to (?:{_IT})\b|\bhere(?: you go| it is|'?s (?:the|a|my|your) (?!(?:task|job|order|plan|question|answer|chance|turn|problem|deal|thing:)\b)\w+(?: \w+)?)\b|^\W*here\W+(?:take|hold|catch)\b"
|
||||||
rf"|\bi(?:'ll| will|'m going to| want to| wanna|'d like to| would like to)\s+(?:give|hand)\s+you\b"
|
rf"|\bi(?:'ll| will|'m going to| want to| wanna|'d like to| would like to)\s+(?:give|hand)\s+you\b"
|
||||||
r"(?!\s+(?:a|an|some) (?:tip|hint|call|ring|ride|hand|hug|break|second|minute|chance|clue|idea)\b)"
|
r"(?!\s+(?:a|an|some) (?:tip|hint|call|ring|ride|hand|hug|break|second|minute|chance|clue|idea)\b)"
|
||||||
rf"|\bi(?:'m| am)\s+(?:giving|handing)\s+you\b|\bi (?:have|got|brought) (?:something|a \w+|this|it) for you\b", re.I)
|
rf"|\bi(?:'m| am)\s+(?:giving|handing)\s+you\b|\bi (?:have|got|brought) (?:something|a \w+|this|it) for you\b", re.I)
|
||||||
@@ -2189,7 +2211,8 @@ PAID_Q = re.compile(r"(?<![가-힣])(?:월급|연봉|급여|보너스|월세|세
|
|||||||
r"훈련|충전|수리|검사|업데이트)(?:을|를|은|는|도|이|가)?\s*(?:많이 |잘 |자주 |얼마나 )?받|"
|
r"훈련|충전|수리|검사|업데이트)(?:을|를|은|는|도|이|가)?\s*(?:많이 |잘 |자주 |얼마나 )?받|"
|
||||||
r"^\W*(?:너|넌|너는|루미는?|당신은?)\s.*받(?:아|아요|니|나요|냐|았어|으세요)?\s*\?\s*$") # a question about Lumi
|
r"^\W*(?:너|넌|너는|루미는?|당신은?)\s.*받(?:아|아요|니|나요|냐|았어|으세요)?\s*\?\s*$") # a question about Lumi
|
||||||
GIVE_EN = re.compile(
|
GIVE_EN = re.compile(
|
||||||
rf"\b(?:give|hand|pass|bring|deliver)\s+(?:{_IT}|the \w+|that \w+|this \w+)(?:\s+(?:back|over))?(?:\s+(?:to|for)\s+{_WHO})?(?:\s+(?:here|over here|over there|there|back))*{_TAIL}"
|
rf"\b(?:give|hand|pass|bring|deliver)\s+(?:{_IT}|the \w+|that \w+|this \w+)(?:\s+(?:back|over))?(?:\s+(?:to|for)\s+(?:{_WHO}|"
|
||||||
|
rf"(?!(?:the|a|an|my|your|his|her|their|our|table|floor|ground|it|that|this)\b)[a-z][a-z'-]+))?(?:\s+(?:here|over here|over there|there|back))*{_TAIL}"
|
||||||
rf"|\b(?:give|hand|pass)\s+(?:{_WHO})\s+(?:{_IT}|the \w+|that \w+|that|this \w+|what you(?:'re| are) holding)\b"
|
rf"|\b(?:give|hand|pass)\s+(?:{_WHO})\s+(?:{_IT}|the \w+|that \w+|that|this \w+|what you(?:'re| are) holding)\b"
|
||||||
rf"|\bhand (?:{_IT} )?over\b|\bpass (?:{_IT} )?over\b|\bcan i (?:have|get|take) (?:{_IT}|the \w+)\b|\bi'?ll take (?:{_IT}|(?:that|the|this) \w+)\b(?! from here)|"
|
rf"|\bhand (?:{_IT} )?over\b|\bpass (?:{_IT} )?over\b|\bcan i (?:have|get|take) (?:{_IT}|the \w+)\b|\bi'?ll take (?:{_IT}|(?:that|the|this) \w+)\b(?! from here)|"
|
||||||
rf"\blet me (?:have|take) (?:{_IT})\b|^\W*(?:okay,? )?give (?:{_IT})\W*$|^\W*gimme(?: (?:{_IT}))?{_TAIL}", re.I)
|
rf"\blet me (?:have|take) (?:{_IT})\b|^\W*(?:okay,? )?give (?:{_IT})\W*$|^\W*gimme(?: (?:{_IT}))?{_TAIL}", re.I)
|
||||||
@@ -2248,7 +2271,7 @@ GIVE_LOOSE = re.compile( # with something in the hand, the whole sentence asks
|
|||||||
rf"{_POL}\W*|\W*(?:me|to me)\W+(?:please\W+)?give{_POL}\W*|\W*i want (?:it|that|this|that one)(?: back)?{_POL}\W*|"
|
rf"{_POL}\W*|\W*(?:me|to me)\W+(?:please\W+)?give{_POL}\W*|\W*i want (?:it|that|this|that one)(?: back)?{_POL}\W*|"
|
||||||
rf"\W*(?:that'?s|it'?s) mine{_POL}\W*|\W*could i trouble you to (?:hand|give|pass) (?:it|that|this)(?: over| to me)?\W*|"
|
rf"\W*(?:that'?s|it'?s) mine{_POL}\W*|\W*could i trouble you to (?:hand|give|pass) (?:it|that|this)(?: over| to me)?\W*|"
|
||||||
rf"\W*(?:(?:나|저|우리|나한테|저한테|우리한테|이리|그거|이거|그것|이것|저거|내 거야|내 거|제 거예요|그|이|좀|빨리|어서|얼른|"
|
rf"\W*(?:(?:나|저|우리|나한테|저한테|우리한테|이리|그거|이거|그것|이것|저거|내 거야|내 거|제 거예요|그|이|좀|빨리|어서|얼른|"
|
||||||
rf"(?:그|이|저) \S+)\W*)*(?:줘|주게|주세요|주라|줄래요?|줘요|내놔|내놓으세요|건네 ?줘|건네 ?주세요)(?:\W+(?:줘|주세요))*{_POL}\W*",
|
rf"(?:그|이|저) \S+)\W*)*(?:줘|주게|주세요|주라|줄래요?|줘요|내놔|내놓으세요|건네 ?줘|건네 ?주세요|(?<=이리 )내)(?:\W+(?:줘|주세요))*{_POL}\W*",
|
||||||
re.I)
|
re.I)
|
||||||
IN_MY_HAND = re.compile(r"\b(?:in|into|on) my (?:hands?|palm)\b|(?:제|내|나의|저의) 손(?:에|위에|바닥에|으로)", re.I)
|
IN_MY_HAND = re.compile(r"\b(?:in|into|on) my (?:hands?|palm)\b|(?:제|내|나의|저의) 손(?:에|위에|바닥에|으로)", re.I)
|
||||||
REFUSE_PICK = ("I'm holding something already. Tell me where to put it first.",
|
REFUSE_PICK = ("I'm holding something already. Tell me where to put it first.",
|
||||||
@@ -2417,7 +2440,8 @@ def held_place(text, markers=()):
|
|||||||
|
|
||||||
CARRY_HELD = re.compile(r"\b(?:take|bring|carry|move|get) (?:it|that|this|them|the \w+)(?: over| along)? (?:to|towards?) |"
|
CARRY_HELD = re.compile(r"\b(?:take|bring|carry|move|get) (?:it|that|this|them|the \w+)(?: over| along)? (?:to|towards?) |"
|
||||||
r"\b(?:drop|leave|put|set) (?:it|that|this|them|the \w+)(?: off| down)? (?:at|by|near|on) |"
|
r"\b(?:drop|leave|put|set) (?:it|that|this|them|the \w+)(?: off| down)? (?:at|by|near|on) |"
|
||||||
r"(?:으로|로|에|까지)\s*(?:좀\s*)?(?:가져가|가지고 ?가|갖고 ?가|들고 ?가|옮겨|가져다 ?놔|가 ?줘|가)", re.I)
|
r"(?:으로|로|에|까지)\s*(?:좀\s*)?(?:가져가|가지고 ?가|갖고 ?가|들고 ?가|옮겨|가져다 ?놔|가 ?줘|가)|"
|
||||||
|
r"(?:테이블|탁자|책상)?\s*(?:위)?\s*에\s*(?:좀\s*)?(?:놔|놓아|둬|올려)", re.I) # "p5 테이블에 놔"
|
||||||
|
|
||||||
|
|
||||||
def object_ko(name):
|
def object_ko(name):
|
||||||
@@ -2471,9 +2495,10 @@ def held_give(text, markers=()):
|
|||||||
return False
|
return False
|
||||||
if any(_resolve(m, markers) not in (None, "here") for m in re.finditer(_place_re(markers), t)):
|
if any(_resolve(m, markers) not in (None, "here") for m in re.finditer(_place_re(markers), t)):
|
||||||
return False # a marker named: a carry there (the mission reader's)
|
return False # a marker named: a carry there (the mission reader's)
|
||||||
if re.search(r"\b(?:give|hand|pass|bring)\s+(?:it|that|this)\s+to\s+(?!me\b|him\b|her\b|them\b|us\b|my\b|his\b|our\b|"
|
if re.search(r"\bbring\s+(?:it|that|this)\s+to\s+(?!me\b|him\b|her\b|them\b|us\b|my\b|his\b|our\b|"
|
||||||
r"your\b|that\b|the\b|this\b|whoever\b|someone\b|a\b|an\b)[a-z]+\s*[.!?]*$", t):
|
r"your\b|that\b|the\b|this\b|whoever\b|someone\b|a\b|an\b)[a-z]+\s*[.!?]*$", t):
|
||||||
return False # "give it to Mina": a named person, the mission reader's
|
return False # "bring it to Mina": a trip to her, the mission reader's; "give /
|
||||||
|
# hand it to Mina" is given here, as "민수한테 줘"
|
||||||
if GIVE_HELD_EN.search(t):
|
if GIVE_HELD_EN.search(t):
|
||||||
return True
|
return True
|
||||||
for m in GIVE_HELD_KO.finditer(t):
|
for m in GIVE_HELD_KO.finditer(t):
|
||||||
@@ -2987,6 +3012,11 @@ _PRONOUN_KO = r"그거|이거|저거|그것|이것|저것|거기|여기|저기|
|
|||||||
OWN_SUBJECT = re.compile(rf"(?<=\S )(?!I\b|Lumi\b|OK\b|Okay\b)[A-Z][a-z]+|(?<![가-힣A-Za-z])(?!(?:{_PRONOUN_KO})(?:은|는|이|가)(?![가-힣]))"
|
OWN_SUBJECT = re.compile(rf"(?<=\S )(?!I\b|Lumi\b|OK\b|Okay\b)[A-Z][a-z]+|(?<![가-힣A-Za-z])(?!(?:{_PRONOUN_KO})(?:은|는|이|가)(?![가-힣]))"
|
||||||
r"[가-힣A-Za-z]{2,}(?:은|는|이|가)(?=[\s?!.~,]|요|$)")
|
r"[가-힣A-Za-z]{2,}(?:은|는|이|가)(?=[\s?!.~,]|요|$)")
|
||||||
# a short question that names its own subject ("BTS는 언제 데뷔했어요?", "Who was Sejong?")
|
# a short question that names its own subject ("BTS는 언제 데뷔했어요?", "Who was Sejong?")
|
||||||
|
BACK_TO = re.compile(r"\b(?:back to|go(?:ing)? back to|return(?:ing)? to|again about)\b|돌아가서|돌아와서|돌아가면|"
|
||||||
|
r"(?:다시|아까) \S+ ?(?:얘기|이야기|토크|말씀)", re.I) # a return to an earlier topic
|
||||||
|
BACK_TO_STOP = re.compile(r"(?i:back|go|going|return|returning|again|about|what|you|your|said|say|the|did|tell|"
|
||||||
|
r"me|that|this|talk|topic|part)$|다시|아까|얘기|이야기|말씀|돌아|뭐라|했지|했죠|하셨|토크|루미|그거|그건")
|
||||||
|
KO_PARTICLE_END = r"(?<=[가-힣])(?:으로|로|이라는|라는|에|은|는|이|가|을|를|의)(?=\s|$|[,.?!])"
|
||||||
NOT_SUBJECT_KO = re.compile(r"(?:으로|적으로|에서|에|까지|부터|보다|한테|에게)는$")
|
NOT_SUBJECT_KO = re.compile(r"(?:으로|적으로|에서|에|까지|부터|보다|한테|에게)는$")
|
||||||
# "공식적으로는", "옛날에는", "서울에서는": a time / place / manner, not the subject
|
# "공식적으로는", "옛날에는", "서울에서는": a time / place / manner, not the subject
|
||||||
WHAT_IS = re.compile(r"(?:뭐|무엇|뭔|머)(?:예요|에요|야|이야|입니까|인가요|이에요|가요|죠|지|냐|고|여|임|래요|래)?\W*$|"
|
WHAT_IS = re.compile(r"(?:뭐|무엇|뭔|머)(?:예요|에요|야|이야|입니까|인가요|이에요|가요|죠|지|냐|고|여|임|래요|래)?\W*$|"
|
||||||
@@ -2996,6 +3026,10 @@ THAT_ONE_KO = re.compile(rf"(?<![가-힣A-Za-z])(?!(?:{_PRONOUN_KO})\s)([가-힣
|
|||||||
OF_THING_KO = re.compile(rf"(?<![가-힣A-Za-z])(?!(?:{_PRONOUN_KO})(?:의)?\s)([가-힣A-Za-z]{{2,}}?)(?:의)?\s+"
|
OF_THING_KO = re.compile(rf"(?<![가-힣A-Za-z])(?!(?:{_PRONOUN_KO})(?:의)?\s)([가-힣A-Za-z]{{2,}}?)(?:의)?\s+"
|
||||||
r"(?:이름|나이|키|높이|무게|속도|가격|크기|색|색깔|모양|뜻)(?:은|는|이|가|도)?(?![가-힣])")
|
r"(?:이름|나이|키|높이|무게|속도|가격|크기|색|색깔|모양|뜻)(?:은|는|이|가|도)?(?![가-힣])")
|
||||||
# "블루투스 이름은 왜 그렇게 지었나?": Bluetooth's name, not Lumi's
|
# "블루투스 이름은 왜 그렇게 지었나?": Bluetooth's name, not Lumi's
|
||||||
|
TOPIC_OF_TALK = re.compile(rf"(?<![가-힣A-Za-z])(?!(?:{_PRONOUN_KO}|아까|그런|이런|저런|무슨|다른|재밌는|재미있는|옛날|"
|
||||||
|
r"딴|그|이|저|제|내|네|니)\s)([가-힣A-Za-z]{2,})\s*(?:얘기|이야기|토크)|"
|
||||||
|
r"\b(?i:tell me about|talk about|talking about|back to)\s+(?:the\s+|an?\s+)?([a-z]{3,})")
|
||||||
|
# "emoji 얘기 좀 해 줘요", "tell me about mirrors": the talk's subject
|
||||||
EN_SUBJECT = re.compile(r"\b(?i:do|does|did|can|could|are|is|were|was|will|would)\s+(?:the\s+|an?\s+)?"
|
EN_SUBJECT = re.compile(r"\b(?i:do|does|did|can|could|are|is|were|was|will|would)\s+(?:the\s+|an?\s+)?"
|
||||||
r"(?!(?:you|i|we|they|he|she|it|people|there|this|that|these|those|your|my|our|me|not|so|very)\b)"
|
r"(?!(?:you|i|we|they|he|she|it|people|there|this|that|these|those|your|my|our|me|not|so|very)\b)"
|
||||||
r"([a-z]{3,})\b") # "Why do whales sing?": the whales (world_talk; lower case, so not OWN_SUBJECT)
|
r"([a-z]{3,})\b") # "Why do whales sing?": the whales (world_talk; lower case, so not OWN_SUBJECT)
|
||||||
@@ -3277,7 +3311,8 @@ class Brain:
|
|||||||
def named(t): # "공식적으로는 언제로 쳐요?" names no subject (an adverb + 는)
|
def named(t): # "공식적으로는 언제로 쳐요?" names no subject (an adverb + 는)
|
||||||
return [m.group(0) for m in OWN_SUBJECT.finditer(core(t)) if not NOT_SUBJECT_KO.search(m.group(0))] + \
|
return [m.group(0) for m in OWN_SUBJECT.finditer(core(t)) if not NOT_SUBJECT_KO.search(m.group(0))] + \
|
||||||
[m.group(1) for m in EN_SUBJECT.finditer(core(t))] + [m.group(1) for m in THAT_ONE_KO.finditer(core(t))] + \
|
[m.group(1) for m in EN_SUBJECT.finditer(core(t))] + [m.group(1) for m in THAT_ONE_KO.finditer(core(t))] + \
|
||||||
[m.group(1) for m in OF_THING_KO.finditer(core(t))]
|
[m.group(1) for m in OF_THING_KO.finditer(core(t))] + \
|
||||||
|
[m.group(1) or m.group(2) for m in TOPIC_OF_TALK.finditer(core(t))]
|
||||||
qs = [topic_turn(self.history)[0]] + [h[0] for h in reversed(self.history[-3:])] if self.history else [""]
|
qs = [topic_turn(self.history)[0]] + [h[0] for h in reversed(self.history[-3:])] if self.history else [""]
|
||||||
q = next((x for x in qs if named(x)), qs[0]) # "문어 피는?" "왜?" "심장은?": the octopus, two turns back
|
q = next((x for x in qs if named(x)), qs[0]) # "문어 피는?" "왜?" "심장은?": the octopus, two turns back
|
||||||
if named(text) and WHAT_IS.search(core(text)):
|
if named(text) and WHAT_IS.search(core(text)):
|
||||||
@@ -3289,9 +3324,27 @@ class Brain:
|
|||||||
return list(dict.fromkeys(re.sub(r"[은는가]$", "", w) for w in subjects # "부엉이" keeps its 이
|
return list(dict.fromkeys(re.sub(r"[은는가]$", "", w) for w in subjects # "부엉이" keeps its 이
|
||||||
if not SELF_THINGS.match(w[:-1] if HANGUL.search(w) else w)))
|
if not SELF_THINGS.match(w[:-1] if HANGUL.search(w) else w)))
|
||||||
|
|
||||||
|
def _back_to(self, text):
|
||||||
|
""" "Back to the hydrogen: what did you say?", "다시 페트라 얘기로 돌아가서, 뭐라고 했지?": the earlier turn of this
|
||||||
|
talk that named that topic, as a hint, else "". Late in a talk that turn is out of the window and the model
|
||||||
|
answered the topic just before (r13 train, 2026-10-27)."""
|
||||||
|
if not BACK_TO.search(text) or len(self.history) < 2:
|
||||||
|
return ""
|
||||||
|
words = {w for w in re.findall(r"[가-힣]{2,}|[A-Za-z]{3,}", re.sub(KO_PARTICLE_END, "", text))
|
||||||
|
if not BACK_TO_STOP.match(w)}
|
||||||
|
for q, a in reversed(self.history):
|
||||||
|
said = " ".join(ln for ln in a.splitlines() if not re.match(r"\s*\**ACTION", ln)).strip()
|
||||||
|
if said and any(w.lower() in f"{q} {said}".lower() for w in words):
|
||||||
|
return (f"(They go back to an earlier topic: to \"{q[:80]}\" you said \"{said[:FRAGMENT_CHARS * 2]}\". "
|
||||||
|
f"Answer about that topic, with those facts.)\n")
|
||||||
|
return ""
|
||||||
|
|
||||||
def _fragment_hint(self, text):
|
def _fragment_hint(self, text):
|
||||||
"""For a bare fragment ("얼마?", "Which one?", "Where is it used?"): what it follows, so the model reads it
|
"""For a bare fragment ("얼마?", "Which one?", "Where is it used?"): what it follows, so the model reads it
|
||||||
as about the last answer's subject, not about itself or a price."""
|
as about the last answer's subject, not about itself or a price."""
|
||||||
|
back = self._back_to(text)
|
||||||
|
if back:
|
||||||
|
return back
|
||||||
last = self._last_said() if self.history else ""
|
last = self._last_said() if self.history else ""
|
||||||
done = self._redo(text)
|
done = self._redo(text)
|
||||||
if done: # "do it again" / "한 번 더" after a wave, "more" after a look
|
if done: # "do it again" / "한 번 더" after a wave, "more" after a look
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ def parts(text):
|
|||||||
text = re.sub(r"(?<![\w가-힣])([\w가-힣]+)[—–-]+\s*(?=\1)", "", text) # a stutter: "go ah— ahead", "센— 센티"
|
text = re.sub(r"(?<![\w가-힣])([\w가-힣]+)[—–-]+\s*(?=\1)", "", text) # a stutter: "go ah— ahead", "센— 센티"
|
||||||
cut, says = steps._cut_says(text)
|
cut, says = steps._cut_says(text)
|
||||||
cut = re.sub(r"(?<=[가-힣])고\s*나서(?=[\s,]|$)", "고", cut) # "-고 나서" = "-고"
|
cut = re.sub(r"(?<=[가-힣])고\s*나서(?=[\s,]|$)", "고", cut) # "-고 나서" = "-고"
|
||||||
|
cut = re.sub(r"(?<=[가-힣]{2}고)(?=(?:오른쪽|왼쪽|앞으로|뒤로|위로|아래로|손|고개|몸|팔|허리|나를?|저를?|이리|여기|저기|"
|
||||||
|
r"p\d|[a-z]{3}))", " ", cut) # whisper's run-together "몸내리고오른쪽으로돌아주라": the next order apart
|
||||||
out = []
|
out = []
|
||||||
for p in _SPLIT.split(cut):
|
for p in _SPLIT.split(cut):
|
||||||
out += [q for q in steps._SPLIT_KO.split(p) if q.strip()]
|
out += [q for q in steps._SPLIT_KO.split(p) if q.strip()]
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ FILLS = 3 # place / object fills made of each template (the same e
|
|||||||
|
|
||||||
# ---------- guards: words the bank never reads ----------
|
# ---------- guards: words the bank never reads ----------
|
||||||
NEGATION = re.compile(r"\b(?:don'?t|do not|never|no need|not now|no more|stop \w+ing|quit \w+ing|without|forget it|"
|
NEGATION = re.compile(r"\b(?:don'?t|do not|never|no need|not now|no more|stop \w+ing|quit \w+ing|without|forget it|"
|
||||||
r"never ?mind|scratch that|cancel that)\b|취소|아니다|됐다|"
|
r"never ?mind|scratch that|cancel that|cancel)\b|취소|아니다|됐다|"
|
||||||
r"[가-힣]지 ?마(?:세요|요|라|십시오|쇼|소|이소|시오|셔)?(?:잉|요)?(?![가-힣])|하지 ?말|말고|[가-힣]지 ?(?:말아|말라|마시|마셔|말게)|필요 ?없|안 ?(?:해|돼|가|와)(?:도)?\b|그만", re.I)
|
r"[가-힣]지 ?마(?:세요|요|라|십시오|쇼|소|이소|시오|셔)?(?:잉|요)?(?![가-힣])|하지 ?말|말고|[가-힣]지 ?(?:말아|말라|마시|마셔|말게)|필요 ?없|안 ?(?:해|돼|가|와)(?:도)?\b|그만", re.I)
|
||||||
LATER = re.compile(r"\b(?:when|whenever|if|unless|after|before|once|until|till|as soon as|later|tomorrow|tonight|"
|
LATER = re.compile(r"\b(?:when|whenever|if|unless|after|before|once|until|till|as soon as|later|tomorrow|tonight|"
|
||||||
r"next time|some ?day|one day|in (?:\w+ ){0,2}(?:minute|hour|second|min|sec)s?|in a (?:while|bit)|soon)\b|분 ?(?:뒤|후|있다)|"
|
r"next time|some ?day|one day|in (?:\w+ ){0,2}(?:minute|hour|second|min|sec)s?|in a (?:while|bit)|soon)\b|분 ?(?:뒤|후|있다)|"
|
||||||
@@ -83,7 +83,7 @@ REPEAT = re.compile(r"^\W*(?:(?:\w+\W+){0,2})?(?:again|one more time|once more|d
|
|||||||
r"^\W*(?:[가-힣]+\s+)?(?:한 ?번(?:만)? 더|다시|또)\s*(?:해|해 ?줘|해 ?봐|해 ?주세요|하자)?\W*$", re.I)
|
r"^\W*(?:[가-힣]+\s+)?(?:한 ?번(?:만)? 더|다시|또)\s*(?:해|해 ?줘|해 ?봐|해 ?주세요|하자)?\W*$", re.I)
|
||||||
# "again", "한 번만 더 해 줘": what again is the history's (driving.read, the LLM)
|
# "again", "한 번만 더 해 줘": what again is the history's (driving.read, the LLM)
|
||||||
SEVERAL = re.compile(r"\b(?<!hundred )and\b(?! a half\b)|\bwait\w*|\bcorrection\b|\binstead\b|"
|
SEVERAL = re.compile(r"\b(?<!hundred )and\b(?! a half\b)|\bwait\w*|\bcorrection\b|\binstead\b|"
|
||||||
r"\b(?:look|turn|go|move|wave|come|follow|pick|take|put|lift|raise|lower|reach|grab|bring)\b[^,]*,\s*(?:(?:\w+\W+){0,2})?(?:look|turn|go|move|wave|come|follow|pick|take|put|lift|raise|lower|reach|grab|bring|tell|say|sing|show|ask|answer|check)\b|\b(?:then|after that|also|plus|while|no|not|wait|stay|sleep|sorry|i mean|actually|rather)\b|;|"
|
r"\b(?:look|turn|go|move|wave|come|follow|pick|take|put|lift|raise|lower|reach|grab|bring)\b[^,]*,\s*(?:(?:\w+\W+){0,2})?(?:look|turn|go|move|wave|come|follow|pick|take|put|lift|raise|lower|reach|grab|bring|tell|say|sing|show|ask|answer|check)\b|\b(?:then|after that|also|plus|while|no|not|wait|stay|sleep|sorry|i mean|actually|rather|oops|first)\b|;|"
|
||||||
r"(?!갖고|고고|에서)(?<!가)[가-힣](?:서|고)(?:[\s,.…]|$)|(?:으로|로|에) ?가서|"
|
r"(?!갖고|고고|에서)(?<!가)[가-힣](?:서|고)(?:[\s,.…]|$)|(?:으로|로|에) ?가서|"
|
||||||
r"(?:흔들|흔드시|보시|돌|내리|올리|집어|내밀|숙이|들|봐 ?주시)고(?=[가-힣])|(?:쪽|나|날|위|아래|앞)보고(?=[가-힣])|(?:집어|와|가져와)서(?=[가-힣])|하고|셔서|면서|다가(?![와오])|갔다|다녀|아니|기다|대기|(?:가|와) ?있어|계세요|"
|
r"(?:흔들|흔드시|보시|돌|내리|올리|집어|내밀|숙이|들|봐 ?주시)고(?=[가-힣])|(?:쪽|나|날|위|아래|앞)보고(?=[가-힣])|(?:집어|와|가져와)서(?=[가-힣])|하고|셔서|면서|다가(?![와오])|갔다|다녀|아니|기다|대기|(?:가|와) ?있어|계세요|"
|
||||||
r"계십시오", re.I)
|
r"계십시오", re.I)
|
||||||
@@ -92,7 +92,7 @@ HAND_WORDS = re.compile(r"\byou(?:'re| are) holding\b|\b(?:in|from) my hand\b|\b
|
|||||||
r"\bhold this\b|\bfrom me\b|\bmy hand\b|\bhand ?에|\bhand it (?:over|to me)\b|\bhand over\b|내 손|제 손|손에 ?(?:줘|놔|주세요|쥐어)|\bi'?m holding\b|\bi am holding\b|들고 있는|손에 있는|받아|드릴게|줄게|가져가세요", re.I) # the hand reader's (brain.hand_request)
|
r"\bhold this\b|\bfrom me\b|\bmy hand\b|\bhand ?에|\bhand it (?:over|to me)\b|\bhand over\b|내 손|제 손|손에 ?(?:줘|놔|주세요|쥐어)|\bi'?m holding\b|\bi am holding\b|들고 있는|손에 있는|받아|드릴게|줄게|가져가세요", re.I) # the hand reader's (brain.hand_request)
|
||||||
GROUP_CALL = re.compile(r"(?:^|[,:;.!?]\s*)(?:(?:hey|ok|okay|alright|so|come on)\s+)?(?:(?:you )?guys|folks|y'?all|"
|
GROUP_CALL = re.compile(r"(?:^|[,:;.!?]\s*)(?:(?:hey|ok|okay|alright|so|come on)\s+)?(?:(?:you )?guys|folks|y'?all|"
|
||||||
r"you all|everyone|everybody|team|kids|people|ladies|gentlemen)\s*(?:[,:;!.]|$)|"
|
r"you all|everyone|everybody|team|kids|people|ladies|gentlemen)\s*(?:[,:;!.]|$)|"
|
||||||
r"얘들아|애들아|친구들아|여러분[,\s]", re.I) # "guys, get me the bottle": said to the people around
|
r"얘들아|애들아|친구들아|여러분[,\s]|(?<![가-힣])(?!로봇|루미)[가-힣]{1,4}님(?:[,!\s]|$)", re.I) # "guys, get me the bottle": said to the people around
|
||||||
NAME_CALL = re.compile(r"^\W*(?:(?:ah|oh|hey|hi|okay|ok|so|um|uh|look|and)\W+)?([A-Z][a-z]+)\s*,") # "Jake, follow me": said to Jake
|
NAME_CALL = re.compile(r"^\W*(?:(?:ah|oh|hey|hi|okay|ok|so|um|uh|look|and)\W+)?([A-Z][a-z]+)\s*,") # "Jake, follow me": said to Jake
|
||||||
NOT_A_NAME = {"lumi", "loomi", "rumi", "okay", "ok", "please", "hey", "hi", "hello", "so", "well", "now", "alright",
|
NOT_A_NAME = {"lumi", "loomi", "rumi", "okay", "ok", "please", "hey", "hi", "hello", "so", "well", "now", "alright",
|
||||||
"yes", "yeah", "no", "sorry", "um", "uh", "oh", "wait", "look", "then", "first", "also", "and", "but",
|
"yes", "yeah", "no", "sorry", "um", "uh", "oh", "wait", "look", "then", "first", "also", "and", "but",
|
||||||
@@ -863,7 +863,9 @@ CARRY = (r"\b(?:bring(?! yourself)|fetch|deliver|carry)\b|\bget me\b|\b(?:to|for
|
|||||||
COME_SAID = (r"\bcome\b|\bcum\b|\bkum\b|\bget over\b|\bapproach|\bcloser\b|\bhither\b|\bnear me\b|"
|
COME_SAID = (r"\bcome\b|\bcum\b|\bkum\b|\bget over\b|\bapproach|\bcloser\b|\bhither\b|\bnear me\b|"
|
||||||
r"\bget closer\b|\broll over\b|\bdrive over\b|\bmy side\b|\bnext to me\b|\bto me\b|와|오세요|오십시오|오시|올래|"
|
r"\bget closer\b|\broll over\b|\bdrive over\b|\bmy side\b|\bnext to me\b|\bto me\b|와|오세요|오십시오|오시|올래|"
|
||||||
r"(?<![가-힣])컴(?= ?히어|(?![가-힣]))") # Konglish "컴 히어 해 줘", "이리 컴"
|
r"(?<![가-힣])컴(?= ?히어|(?![가-힣]))") # Konglish "컴 히어 해 줘", "이리 컴"
|
||||||
HOME_SAID = r"\b(?:home|dock|charger|charging)\b|집|충전|도크|홈" # brain.named_place also reads a bare "go back" as home
|
PREV_SPOT = r"원래|아까|처음|출발|원위치|\bwhere you (?:were|started|came from|stood)\b|\b(?:original|previous|starting|old) " # where
|
||||||
|
HOME_SAID = r"\b(?:home|dock|charger|charging)\b|집|충전|도크|홈" # it stood before; brain.named_place reads a bare "go back"
|
||||||
|
# / "돌아가" as home (and the test sets read "go back to your spot" as home), so home counts only when said
|
||||||
LIFT_SAID_MAX_M = 0.3 # m; a longer lift amount said is no lift request ("grow to three meters tall")
|
LIFT_SAID_MAX_M = 0.3 # m; a longer lift amount said is no lift request ("grow to three meters tall")
|
||||||
LIFT_BODY = (r"\b(?:yourself|your (?:body|torso|upper body)|body|make you|taller|shorter|smaller|small|tall|high|lift|rise|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"shrink|come down|go up|go down|move up|move down|raise up|lower down|come up|sink down|elevate|squat|height|"
|
||||||
@@ -1031,7 +1033,7 @@ def _slot(kind, text, markers, holding):
|
|||||||
return ("move", f"forward {n:g}") if exact and driving.MOVE_MIN_M <= n <= brain.MOVE_MAX_M else None
|
return ("move", f"forward {n:g}") if exact and driving.MOVE_MIN_M <= n <= brain.MOVE_MAX_M else None
|
||||||
if kind == "come_back" and (re.search(r"\bpose\b|\barm\b|\bhead\b|팔|고개|\bpick|\bput\b|\bit\b|그거|놓|놔", t) or
|
if kind == "come_back" and (re.search(r"\bpose\b|\barm\b|\bhead\b|팔|고개|\bpick|\bput\b|\bit\b|그거|놓|놔", t) or
|
||||||
any(brain.named_place(text, m, markers) for m in markers
|
any(brain.named_place(text, m, markers) for m in markers
|
||||||
if m != "home" or re.search(HOME_SAID, t))):
|
if m != "home" or not re.search(PREV_SPOT, t) or re.search(HOME_SAID, t))):
|
||||||
return None # "go back to your dock", "go back to your look pose": not here
|
return None # "go back to your dock", "go back to your look pose": not here
|
||||||
if kind == "come_back" and re.search(r"\b(?:back|over|right|come|get) here\b|\bto me\b|이리|여기|나한테|저한테", t):
|
if kind == "come_back" and re.search(r"\b(?:back|over|right|come|get) here\b|\bto me\b|이리|여기|나한테|저한테", t):
|
||||||
return ("come", "") # "come back here": to the person, not to the old spot
|
return ("come", "") # "come back here": to the person, not to the old spot
|
||||||
@@ -1049,7 +1051,7 @@ def _slot(kind, text, markers, holding):
|
|||||||
return None # "turn left a bit", "왼쪽으로 도세요": a turn, not a drive
|
return None # "turn left a bit", "왼쪽으로 도세요": a turn, not a drive
|
||||||
if re.search(r"\b(?:some|more than|less than|few|several|couple)\b|\b(?:to|too) (?:meters?|metres?|m)\b", t):
|
if re.search(r"\b(?:some|more than|less than|few|several|couple)\b|\b(?:to|too) (?:meters?|metres?|m)\b", t):
|
||||||
return None # "move back some", "forward to meters": how far? asked
|
return None # "move back some", "forward to meters": how far? asked
|
||||||
d = _dirs(t)
|
d = _dirs(re.sub(r"\bright\s*,", " ", t))
|
||||||
n = said_amount(text)[0]
|
n = said_amount(text)[0]
|
||||||
n = driving.amount(re.sub(r"(?:^|\s)좀(?=\s)", " ", t))[0] if n is None else n # "뒤로 좀 가": 좀 is "please"
|
n = driving.amount(re.sub(r"(?:^|\s)좀(?=\s)", " ", t))[0] if n is None else n # "뒤로 좀 가": 좀 is "please"
|
||||||
if re.search(r"\b(?:third|fourth)\b", t) or n is None and re.search(r"\b(?:half|meters?|metres?|cm|centimet\w*|inch\w*|feet|foot|yards?)\b|미터|"
|
if re.search(r"\b(?:third|fourth)\b", t) or n is None and re.search(r"\b(?:half|meters?|metres?|cm|centimet\w*|inch\w*|feet|foot|yards?)\b|미터|"
|
||||||
@@ -1065,7 +1067,7 @@ def _slot(kind, text, markers, holding):
|
|||||||
return None # "look the other way", "twist your torso": not the base
|
return None # "look the other way", "twist your torso": not the base
|
||||||
if re.search(r"\bquarter\b|\bhalf\b|반 ?바퀴", t) and not re.search(r"\d", t):
|
if re.search(r"\bquarter\b|\bhalf\b|반 ?바퀴", t) and not re.search(r"\d", t):
|
||||||
return None # "spin left a bit, like a quarter": not a full turn (A2)
|
return None # "spin left a bit, like a quarter": not a full turn (A2)
|
||||||
if re.search(r"\bspin\b|\ball the way (?:a)?round\b|\b360\b|한 ?바퀴", t) and \
|
if re.search(r"\bspin\b|\ball (?:the|teh|da) way (?:a)?round\b|\b360\b|한 ?바퀴", t) and \
|
||||||
not re.search(r"\bface\b|\bother (?:side|way)\b|\d+\s*(?:degrees?|도)", t.replace("360", "")) and \
|
not re.search(r"\bface\b|\bother (?:side|way)\b|\d+\s*(?:degrees?|도)", t.replace("360", "")) and \
|
||||||
said_amount(text)[1] in (None, 360):
|
said_amount(text)[1] in (None, 360):
|
||||||
return ("turn", ("right" if re.search(r"\bright\b|오른쪽", t) else "left") + " 360")
|
return ("turn", ("right" if re.search(r"\bright\b|오른쪽", t) else "left") + " 360")
|
||||||
@@ -1101,7 +1103,7 @@ def _slot(kind, text, markers, holding):
|
|||||||
target = "me"
|
target = "me"
|
||||||
return ("look", target) if target else None
|
return ("look", target) if target else None
|
||||||
if kind == "lift":
|
if kind == "lift":
|
||||||
if not re.search(LIFT_BODY, t):
|
if not re.search(LIFT_BODY, t) or re.search(r"\bto me\b|나한테|저한테", t): # "come up to me": come
|
||||||
return None # "go upstairs": no word about Lumi's own height
|
return None # "go upstairs": no word about Lumi's own height
|
||||||
down = re.search(r"\b(?:down|lower|shorter|smaller|small|sink|shrink|squat)\b|낮|줄여|작게|작아|내려|아래|다운", t)
|
down = re.search(r"\b(?:down|lower|shorter|smaller|small|sink|shrink|squat)\b|낮|줄여|작게|작아|내려|아래|다운", t)
|
||||||
up = re.search(r"\b(?:up|higher|taller|tall|high|bigger|raise|rise|grow|elevate|stretch)\b|높(?:여|게|아|혀)|키워|올려|늘려|"
|
up = re.search(r"\b(?:up|higher|taller|tall|high|bigger|raise|rise|grow|elevate|stretch)\b|높(?:여|게|아|혀)|키워|올려|늘려|"
|
||||||
@@ -1199,7 +1201,10 @@ def _verb_conflict(kind, text, holding):
|
|||||||
return True
|
return True
|
||||||
if kind == "look" and PICK_VERB.search(text) and not LOOK_VERB.search(text) and not HEAD_WORD.search(text):
|
if kind == "look" and PICK_VERB.search(text) and not LOOK_VERB.search(text) and not HEAD_WORD.search(text):
|
||||||
return True
|
return True
|
||||||
if kind == "come_back" and (POINTED.search(text) or not BACK_VERB.search(text)):
|
if kind == "come_back" and (POINTED.search(text) or not BACK_VERB.search(text) or not RETURN_WORD.search(text) or
|
||||||
|
re.search(r"제자리에서|바퀴|자세|포즈", text)):
|
||||||
|
return True # "다시 가 주세요" (go again), "제자리에서 한 바퀴", "원래 자세로"
|
||||||
|
if kind == "come_back" and not TRAVEL.search(re.sub(r"\bback\s+해", "", text)):
|
||||||
return True
|
return True
|
||||||
if kind in ("turn", "move") and (HEAD_WORD.search(text) or re.search(r"돌아 ?보|허리|\bwaa*i*st\b|\btorso\b", text, re.I)):
|
if kind in ("turn", "move") and (HEAD_WORD.search(text) or re.search(r"돌아 ?보|허리|\bwaa*i*st\b|\btorso\b", text, re.I)):
|
||||||
return True # "머리 왼쪽으로 15도 돌려": the head
|
return True # "머리 왼쪽으로 15도 돌려": the head
|
||||||
@@ -1216,6 +1221,10 @@ def _verb_conflict(kind, text, holding):
|
|||||||
return True # "you must straighten your waist": the waist, not the arm
|
return True # "you must straighten your waist": the waist, not the arm
|
||||||
if kind == "arm_open" and not OPEN_WORD.search(text) or kind == "arm_close" and not CLOSE_WORD.search(text):
|
if kind == "arm_open" and not OPEN_WORD.search(text) or kind == "arm_close" and not CLOSE_WORD.search(text):
|
||||||
return True # "grip immediately": no open word, no gripper opening
|
return True # "grip immediately": no open word, no gripper opening
|
||||||
|
if kind in ("pick", "fetch") and not TAKE_WORD.search(text):
|
||||||
|
return True # "컵을 바 주라" (봐 heard as 바): no take verb
|
||||||
|
if kind == "arm_reach" and not ARM_WORD.search(text) and not REACH_WORD.search(text):
|
||||||
|
return True # "그거 주시게", "건네시겠어요": a hand-over, not the arm out
|
||||||
if kind == "wave" and not WAVE_VERB.search(text):
|
if kind == "wave" and not WAVE_VERB.search(text):
|
||||||
return True # "손 벌려 줘", "손 쥐어 빨리", "손 좀 주이소"
|
return True # "손 벌려 줘", "손 쥐어 빨리", "손 좀 주이소"
|
||||||
return holding and kind in ("arm_open", "arm_fold", "arm_reach", "arm_close")
|
return holding and kind in ("arm_open", "arm_fold", "arm_reach", "arm_close")
|
||||||
@@ -1229,6 +1238,13 @@ COME_VERB = re.compile(r"(?<![가-힣])와(?![가-힣])|와 ?(?:줘|주)|오세
|
|||||||
ARM_WORD = re.compile(r"손|팔|\b(?:hand|arm)\b", re.I)
|
ARM_WORD = re.compile(r"손|팔|\b(?:hand|arm)\b", re.I)
|
||||||
WAVE_VERB = re.compile(r"흔들|흔드|악수|인사|빠이|바이|웨이브|하이|\b(?:wave|waving|hello|hi|hey|shake|greet|bye)\b|"
|
WAVE_VERB = re.compile(r"흔들|흔드|악수|인사|빠이|바이|웨이브|하이|\b(?:wave|waving|hello|hi|hey|shake|greet|bye)\b|"
|
||||||
r"handshake|shaking|goodbye", re.I)
|
r"handshake|shaking|goodbye", re.I)
|
||||||
|
TAKE_WORD = re.compile(r"집|잡|들어|들고|가져|갖|가지고|가저|가 ?온나|챙|쥐|픽|그랩|브링|겟|캐치|홀드|지버|테이크|옮겨|"
|
||||||
|
r"\b(?:pick|grab|take|took|get|fetch|bring|brin|brung|hold|snatch|lift|nab|seize|collect|snag|"
|
||||||
|
r"scoop|pluck|grasp|grip|carry|deliver|hand|pass|gimme|obtain|retrieve|go for|pic|grap|pik|peek up|reach for|"
|
||||||
|
r"fech|need the|like the|taking|move the)|자바", re.I)
|
||||||
|
RETURN_WORD = re.compile(r"(?:다시|도로) ?와|도라|돌아|복귀|원래|제자리|원위치|아까|처음|출발|컴백|리턴|\b(?:back|return|comeback|bak)\b", re.I)
|
||||||
|
TRAVEL = re.compile(r"돌아|도라|복귀|원위치|가|와|오|컴백|리턴|\bback to\b|\bcoming\b|\b(?:come|go|return|head|drive|move|get|cum|comeback|roll)\b", re.I)
|
||||||
|
REACH_WORD = re.compile(r"내밀|뻗|리치|핸드|(?<![가-힣])암(?![가-힣])|아웃|\bpaw\b|\b(?:reach|extend|stretch|out)\b", re.I)
|
||||||
OPEN_WORD = re.compile(r"펴|펼|벌려|벌리|열|오픈|풀어|놔|놓|\b(?:open|release|let go|loosen|unclench|spread|relax|widen|"
|
OPEN_WORD = re.compile(r"펴|펼|벌려|벌리|열|오픈|풀어|놔|놓|\b(?:open|release|let go|loosen|unclench|spread|relax|widen|"
|
||||||
r"opn|apart)", re.I)
|
r"opn|apart)", re.I)
|
||||||
CLOSE_WORD = re.compile(r"쥐|닫|오므|모아|모으|주먹|클로즈|꽉|잡|\b(?:close|clos|shut|grip|clench|fist|squeeze|tighten|grasp|curl|"
|
CLOSE_WORD = re.compile(r"쥐|닫|오므|모아|모으|주먹|클로즈|꽉|잡|\b(?:close|clos|shut|grip|clench|fist|squeeze|tighten|grasp|curl|"
|
||||||
|
|||||||
+12
-6
@@ -1789,7 +1789,10 @@ class Lumi:
|
|||||||
target = f"{colour} {name}" if colour else name
|
target = f"{colour} {name}" if colour else name
|
||||||
if action == "pick":
|
if action == "pick":
|
||||||
said, done = (f"Okay, I'll pick up the {target}.", "네, 집어 볼게요."), ("I've got it.", "잡았어요.")
|
said, done = (f"Okay, I'll pick up the {target}.", "네, 집어 볼게요."), ("I've got it.", "잡았어요.")
|
||||||
run = lambda: skills.pick(name, colour)
|
def run(): # the held name for the dashboard and the replies
|
||||||
|
from tasks import fetch
|
||||||
|
skills.pick(name, colour)
|
||||||
|
fetch.held_by_skill({"object": name, "colour": colour})
|
||||||
else:
|
else:
|
||||||
said, done = (f"Okay, I'll move the {target}.", "네, 옮겨 볼게요."), ("Done.", "다 옮겼어요.")
|
said, done = (f"Okay, I'll move the {target}.", "네, 옮겨 볼게요."), ("Done.", "다 옮겼어요.")
|
||||||
run = lambda: skills.move_object(name, colour)
|
run = lambda: skills.move_object(name, colour)
|
||||||
@@ -3345,8 +3348,8 @@ def status_question(text):
|
|||||||
def says_goodbye(text):
|
def says_goodbye(text):
|
||||||
"""A goodbye whatever was said before: "okay, bye", "I have to go", "수고하세요", "you can go" alone (not "bye, but
|
"""A goodbye whatever was said before: "okay, bye", "I have to go", "수고하세요", "you can go" alone (not "bye, but
|
||||||
where is...?", not an order with it, not said to a child nearby)."""
|
where is...?", not an order with it, not said to a child nearby)."""
|
||||||
if brain_mod.to_someone_else(text):
|
if brain_mod.to_someone_else(text) or re.search(r"\b(?:let me|lemme|wanna|want to|like to|love to|let'?s) see you\b", text, re.I):
|
||||||
return False # "Okay kids, say bye to the robot."
|
return False # "Okay kids, say bye to the robot."; "lemme see you go charge"
|
||||||
return bool(RELEASE.match(text) or CLEAR_BYE.search(text) and not ASKS_MORE.search(text)
|
return bool(RELEASE.match(text) or CLEAR_BYE.search(text) and not ASKS_MORE.search(text)
|
||||||
and len(text.split()) <= 10 and not brain_mod.intent(text) and not brain_mod.hand_request(text, False)
|
and len(text.split()) <= 10 and not brain_mod.intent(text) and not brain_mod.hand_request(text, False)
|
||||||
and not COMMAND_START.search(brain_mod.CALLING.sub("", text))) # "grab the cup, bye": an order
|
and not COMMAND_START.search(brain_mod.CALLING.sub("", text))) # "grab the cup, bye": an order
|
||||||
@@ -3409,8 +3412,11 @@ def route(text, markers, b, holding=False, seen=None, last="", chain_ok=True):
|
|||||||
return "detour", how
|
return "detour", how
|
||||||
plan = chain_ok and not brain_mod.not_an_order(text, asked=False) and brain_mod.direct_order(text) and \
|
plan = chain_ok and not brain_mod.not_an_order(text, asked=False) and brain_mod.direct_order(text) and \
|
||||||
chain.plan(text, markers, NOT_A_STEP) # not "when the show starts, go to the stage", "Jake, wave"
|
chain.plan(text, markers, NOT_A_STEP) # not "when the show starts, go to the stage", "Jake, wave"
|
||||||
if plan and any(k == "steps" and any(st.get("do") == "pick" for st in w) or k == "quick" and w[0] in ("pick", "move_object")
|
picks = [i for i, (k, _, w) in enumerate(plan or []) if k == "steps" and any(st.get("do") == "pick" for st in w) or
|
||||||
for k, _, w in plan) and (holding() if callable(holding) else holding):
|
k == "quick" and w[0] in ("pick", "move_object")]
|
||||||
|
frees = [i for i, (k, _, w) in enumerate(plan or []) if k == "steps" and any(st.get("do") in ("place", "give") for st in w)
|
||||||
|
or k == "quick" and w[0] in ("put", "give")] # "왼쪽에 내려놓고 오른편 컵 잡아 줘": the hand is free first
|
||||||
|
if picks and not (frees and frees[0] < picks[0]) and (holding() if callable(holding) else holding):
|
||||||
plan = None # "그 cup 들고 wave 해" with a cup in the hand: no second pick; the LLM
|
plan = None # "그 cup 들고 wave 해" with a cup in the hand: no second pick; the LLM
|
||||||
if plan:
|
if plan:
|
||||||
return "chain", plan
|
return "chain", plan
|
||||||
@@ -3419,7 +3425,7 @@ def route(text, markers, b, holding=False, seen=None, last="", chain_ok=True):
|
|||||||
got = seen(text) if seen and not held_order else None # the hand, not "I put it down, now?"
|
got = seen(text) if seen and not held_order else None # the hand, not "I put it down, now?"
|
||||||
if got:
|
if got:
|
||||||
return "seeing", got
|
return "seeing", got
|
||||||
if status_question(text):
|
if status_question(text) and not brain_mod.to_someone_else(text): # not "Mina, what are you doing over there?"
|
||||||
return "status", None
|
return "status", None
|
||||||
if (holding() if callable(holding) else holding) and not brain_mod.held_back(text) and \
|
if (holding() if callable(holding) else holding) and not brain_mod.held_back(text) and \
|
||||||
not brain_mod.ARM_TALK.search(text) and brain_mod.held_put_back(text, markers):
|
not brain_mod.ARM_TALK.search(text) and brain_mod.held_put_back(text, markers):
|
||||||
|
|||||||
+36
-14
@@ -277,14 +277,15 @@ ABOUT_ME = re.compile(r"\b(?:(?<!can )(?<!could )(?<!may )i(?! (?:call|address)
|
|||||||
r"(?<!tell )(?<!give )(?<!let )(?<!show )me|mine)\b|(?:^|\s)(?:나|내|제|저|난|전)(?:는|가|를|의)?\s", re.I)
|
r"(?<!tell )(?<!give )(?<!let )(?<!show )me|mine)\b|(?:^|\s)(?:나|내|제|저|난|전)(?:는|가|를|의)?\s", re.I)
|
||||||
FRAGMENT = re.compile(r"^\W*(?:and|so|but|then|or|also|why|really|seriously|wait|what about|how about|how come|are you sure)\b|"
|
FRAGMENT = re.compile(r"^\W*(?:and|so|but|then|or|also|why|really|seriously|wait|what about|how about|how come|are you sure)\b|"
|
||||||
r"^\W*(?:그럼|그러면|그리고|근데|그런데|그래서|아니|왜|진짜|정말|확실|설마|또)|"
|
r"^\W*(?:그럼|그러면|그리고|근데|그런데|그래서|아니|왜|진짜|정말|확실|설마|또)|"
|
||||||
r"\b(?:that|(?<!is )(?<!was )(?<!is it )(?<!how's )(?<!how is )it(?! is (?:now|today))|they|them|"
|
r"\b(?:that|(?<!is )(?<!was )(?<!is it )(?<!how's )(?<!how is )(?<!time )(?<!day )it(?! is (?:now|today))|they|them|"
|
||||||
r"(?<!hello )(?<!hi )(?<!hey )(?<!is )(?<!are )there(?! (?:is|are)\b)|this one)\b|"
|
r"(?<!hello )(?<!hi )(?<!hey )(?<!is )(?<!are )there(?! (?:is|are)\b)|this one)\b|"
|
||||||
r"그거|그건|거기|그분|그 회사|걔", re.I) # not the clock's "it": "what day is it?"
|
r"그거|그건|거기|그분|그 회사|걔", re.I) # not the clock's "it": "what day is it?"
|
||||||
OTHER = re.compile(r"\b(?:lift|carry|hold|items?|(?<!this )things?|stuff|price|cost)\b|들 ?수|(?<!만)(?<!알아)(?<!뭐 )들어(?! ?있)|물건|"
|
OTHER = re.compile(r"\b(?:lift|carry|hold|items?|(?<!this )things?|stuff|price|cost)\b|들 ?수|(?<!만)(?<!알아)(?<!뭐 )들어(?! ?있)|물건|"
|
||||||
r"^(?!.*(?:키|무게|체중|신장|속도|시간|나이|높이|길이|크기|수명|배터리|하이트|웨이트|스피드|에이지|height|weight|speed|age|battery|life))"
|
r"^(?!.*(?:키|무게|체중|신장|속도|시간|나이|높이|길이|크기|수명|배터리|하이트|웨이트|스피드|에이지|속력|하중|정밀도|오차|height|weight|speed|age|battery|life))"
|
||||||
r".*얼마(?:야|예요)|"
|
r".*얼마(?:야|예요)|"
|
||||||
r"맞(?:아|지|죠|나|습니까)|아니(?:야|에요|죠)", re.I) # what it can hold, the price, a check: the LLM
|
r"맞(?:아|지|죠|나|습니까)|아니(?:야|에요|죠)", re.I) # what it can hold, the price, a check: the LLM
|
||||||
SEVERAL = re.compile(r"\band\b(?!\s+(?:built|made|\w+ed)\s+(?:you|lumi|this robot)\b)|\bthen\b|그리고|[??].+\S|하고\s|랑\s|"
|
SEVERAL = re.compile(r"\band\b(?!\s+(?:built|made|\w+ed)\s+(?:you|lumi|this robot)\b)|\bthen\b|그리고|[??].+\S|하고\s|랑\s|"
|
||||||
|
r"(?:가|와|돌아|들어|내려|올라|가져와|가지고 와|하고 나)서\s|"
|
||||||
r"[가-힣](?<![최광참사창공경재원라])(?<!그리)고\s+(?!싶|있|계)", re.I) # "고개 숙이고 몇 시야?", "보고 시간 알려 줘"
|
r"[가-힣](?<![최광참사창공경재원라])(?<!그리)고\s+(?!싶|있|계)", re.I) # "고개 숙이고 몇 시야?", "보고 시간 알려 줘"
|
||||||
EVENT_TIME = re.compile(r"\b(?:what time|what day|which day|what date) (?:does|do|did|will|is|are|was|were|should|can)\b"
|
EVENT_TIME = re.compile(r"\b(?:what time|what day|which day|what date) (?:does|do|did|will|is|are|was|were|should|can)\b"
|
||||||
r"(?!\s+(?:it|today)\b)|몇 ?시(?:에|부터|까지|쯤에)|며칠(?:에|까지|부터)|무슨 요일(?:에|까지|부터)|"
|
r"(?!\s+(?:it|today)\b)|몇 ?시(?:에|부터|까지|쯤에)|며칠(?:에|까지|부터)|무슨 요일(?:에|까지|부터)|"
|
||||||
@@ -304,7 +305,9 @@ _exact_kinds = None
|
|||||||
|
|
||||||
|
|
||||||
def _squeezed(t):
|
def _squeezed(t):
|
||||||
return re.sub(r"[\s,.!?~]", "", t).lower()
|
"""The words without spaces, marks, a calling word or "너" first: "실례지만너무게얼마예요" = "무게 얼마예요"."""
|
||||||
|
t = re.sub(r"[\s,.!?~]", "", t).lower()
|
||||||
|
return re.sub(r"^(?:실례지만|실례합니다|저기요|저기|어이|이보게|우리|야|하나여쭤봐도될까요)?(?:루미야|루미|로봇아|로봇)?(?:너|니|네|당신)?", "", t)
|
||||||
|
|
||||||
|
|
||||||
def _exact():
|
def _exact():
|
||||||
@@ -350,7 +353,7 @@ OPENER = re.compile(r"^\W*(?:(?:hello|hi|hllo|helo|hey|excuse me|well|okay|ok|oh
|
|||||||
r"(?:야|아야|우리|이보게|어이|야야) ?(?:루미야|루미|로봇아|로봇)|실례합니다|실례지만|실례할게요|하나 묻겠습니다|하나 물을게(?:요)?|루미루미|누미야|"
|
r"(?:야|아야|우리|이보게|어이|야야) ?(?:루미야|루미|로봇아|로봇)|실례합니다|실례지만|실례할게요|하나 묻겠습니다|하나 물을게(?:요)?|루미루미|누미야|"
|
||||||
r"루미 ?(?:님|군|상|씨|언니|오빠|누나|형)|루미야|루미|로봇(?:아|님|씨)?|robot|lumi)(?![\w가-힣])[\s,.!?~:-]*)+", re.I)
|
r"루미 ?(?:님|군|상|씨|언니|오빠|누나|형)|루미야|루미|로봇(?:아|님|씨)?|robot|lumi)(?![\w가-힣])[\s,.!?~:-]*)+", re.I)
|
||||||
# calling words before the question ("hello robot, ...", "루미 님, ...", "실례합니다. ..."): left out of the meaning
|
# calling words before the question ("hello robot, ...", "루미 님, ...", "실례합니다. ..."): left out of the meaning
|
||||||
REMARK = re.compile(r"(?:quick question|just (?:curious|wondering|asking)|(?:i'?m )?curious|i want to know|i'd like to know|"
|
REMARK = re.compile(r"(?:(?:어+|아+|음+|um+|uh+)\s+)?(?:quick question|just (?:curious|wondering|asking)|(?:i'?m )?curious|i want to know|i'd like to know|"
|
||||||
r"please|thanks?|thank you|tell me(?: please)?|any idea|ㅎ+|ㅋ+|\^+|그냥 궁금해서(?:요)?|궁금하다|궁금해(?:요)?|"
|
r"please|thanks?|thank you|tell me(?: please)?|any idea|ㅎ+|ㅋ+|\^+|그냥 궁금해서(?:요)?|궁금하다|궁금해(?:요)?|"
|
||||||
r"궁금하네(?:요)?|궁금합니다|알고 싶어(?:요)?|알고 싶습니다|(?:좀 )?(?:알려|말해|가르쳐) ?(?:줘|줄래|줄래요|주세요|"
|
r"궁금하네(?:요)?|궁금합니다|알고 싶어(?:요)?|알고 싶습니다|(?:좀 )?(?:알려|말해|가르쳐) ?(?:줘|줄래|줄래요|주세요|"
|
||||||
r"주실래요|주시겠어요|주시겠습니까|주십시오|봐)|진짜 궁금해(?:요)?|"
|
r"주실래요|주시겠어요|주시겠습니까|주십시오|봐)|진짜 궁금해(?:요)?|"
|
||||||
@@ -373,7 +376,8 @@ def _core(text):
|
|||||||
from assistant import brain
|
from assistant import brain
|
||||||
t = brain.unfill(text or "")
|
t = brain.unfill(text or "")
|
||||||
rest = OPENER.sub("", t)
|
rest = OPENER.sub("", t)
|
||||||
if len(rest.split()) >= 2 or re.search(r"[가-힣]{4}", rest): # "hello there", "hi lumi" stay whole
|
words = re.sub(r"\b(?:there|lumi|robot)\b|[^\w\s]", " ", rest, flags=re.I).split()
|
||||||
|
if len(words) >= 2 or re.search(r"[가-힣]{4}", rest): # "hello there", "hi there, Lumi!" stay whole
|
||||||
t = rest
|
t = rest
|
||||||
t = ASKING.sub("", brain.CALLING.sub("", t).strip()).strip() or text or ""
|
t = ASKING.sub("", brain.CALLING.sub("", t).strip()).strip() or text or ""
|
||||||
if not re.search(r"\b(?:is|was|name|named|called)\s+lumi\W*$|이름(?:이|은|을)?\s*루미", t, re.I): # "How wide is Lumi?",
|
if not re.search(r"\b(?:is|was|name|named|called)\s+lumi\W*$|이름(?:이|은|을)?\s*루미", t, re.I): # "How wide is Lumi?",
|
||||||
@@ -386,8 +390,12 @@ def _core(text):
|
|||||||
lambda m: m.group(1) + ("이에요" if (ord(m.group(1)) - 0xAC00) % 28 else "예요"), t)
|
lambda m: m.group(1) + ("이에요" if (ord(m.group(1)) - 0xAC00) % 28 else "예요"), t)
|
||||||
t = re.sub(r"(?<=[가-힣])는지 (?:궁금|알고 싶|알려|말해|알 수 있|여쭤)\S*(?: \S+)?$", "나요", t) # "몇 살인지 궁금해요"
|
t = re.sub(r"(?<=[가-힣])는지 (?:궁금|알고 싶|알려|말해|알 수 있|여쭤)\S*(?: \S+)?$", "나요", t) # "몇 살인지 궁금해요"
|
||||||
t = re.sub(r"(?:뭔가|무엇인가)$", "뭐예요", re.sub(r"(?<=[가-힣])(?:는교|남유|는감)$", "나요", t)) # 하게체, dialect
|
t = re.sub(r"(?:뭔가|무엇인가)$", "뭐예요", re.sub(r"(?<=[가-힣])(?:는교|남유|는감)$", "나요", t)) # 하게체, dialect
|
||||||
|
t = re.sub(r"(?<=[가-힣])인교$", "인가요", t)
|
||||||
t = re.sub(r"얼만가$", "얼마예요", re.sub(r"(?<=[가-힣])는가$", "나요", re.sub(r"(?<=[가-힣])인가$", "인가요", t)))
|
t = re.sub(r"얼만가$", "얼마예요", re.sub(r"(?<=[가-힣])는가$", "나요", re.sub(r"(?<=[가-힣])인가$", "인가요", t)))
|
||||||
return t or (text or "").strip(" ,.!?~") # 하게체 questions ("키 얼만가", "얼마나 되는가") as 해요체
|
# 하게체 questions ("키 얼만가", "얼마나 되는가") as 해요체
|
||||||
|
if re.fullmatch(r"(?:there|all|everyone|everybody)\W*", t, re.I):
|
||||||
|
t = "" # "Hi there, Lumi!": a hello, said whole
|
||||||
|
return t or (text or "").strip(" ,.!?~")
|
||||||
|
|
||||||
|
|
||||||
def guarded(text, history=()):
|
def guarded(text, history=()):
|
||||||
@@ -418,12 +426,16 @@ def guarded(text, history=()):
|
|||||||
return "event time"
|
return "event time"
|
||||||
if re.search(r"타워|빌딩|건물|(?<![가-힣])탑|에펠|남산|한라산|백두산|\b(?:tower|building|mountain|bridge|skyscraper)\b", t, re.I):
|
if re.search(r"타워|빌딩|건물|(?<![가-힣])탑|에펠|남산|한라산|백두산|\b(?:tower|building|mountain|bridge|skyscraper)\b", t, re.I):
|
||||||
return "another thing" # "롯데타워 하이트 얼마야?": not Lumi's height
|
return "another thing" # "롯데타워 하이트 얼마야?": not Lumi's height
|
||||||
if re.search(r"날씨|날시|비 ?(?:와|오|올|온)|눈 ?(?:와|오|올)|미세 ?먼지|황사|우산|기온|덥|춥|\b(?:weather|rain|raining|snow|"
|
if re.search(r"날씨|날시|웨더|뉴스|소식|비 ?(?:와|오|올|온)|눈 ?(?:와|오|올)|미세 ?먼지|황사|우산|기온|덥|춥|\b(?:weather|rain|raining|snow|"
|
||||||
r"forecast|temperature|umbrella|sunny|cloudy)\b", t, re.I):
|
r"forecast|temperature|umbrella|sunny|cloudy|news|headlines?)\b", t, re.I):
|
||||||
return "weather" # "오늘 미세먼지 어때?": the weather lookup, never how Lumi is
|
return "weather or news" # "오늘 미세먼지 어때?", "투데이 뉴스 뭐야?": the lookups
|
||||||
if re.search(r"충전\S*\s*(?:\S+\s+)?(?:얼마나|몇\s*시간|몇\s*분)\s*(?:\S+\s+)?걸|완충|충전\s*시간|"
|
if re.search(r"충전\S*\s*(?:\S+\s+)?(?:얼마나|몇\s*시간|몇\s*분)\s*(?:\S+\s+)?걸|완충|충전\s*시간|"
|
||||||
r"\b(?:how long|how many hours)\b.*\b(?:to charge|charging|recharge|full charge take)\b|\bcharg\w* time\b", t, re.I):
|
r"\bhow long\b.*\b(?:to (?:re)?charge|(?:charging|recharging|a (?:full )?charge) takes?)\b|\bcharg\w* time\b", t, re.I):
|
||||||
return "charging time" # "충전하는 데 얼마나 걸려?": not known (the LLM says so), not the battery life
|
return "charging time" # "충전하는 데 얼마나 걸려?": not known (the LLM says so), not the battery life
|
||||||
|
if REQUEST.search(t) or re.search(r"(?:시지요|시죠|십시오|하시오|가시게|오시게|하시게|라 마|원위치)\W*$", t):
|
||||||
|
return "a command" # the rules' (or the LLM's), never a fact
|
||||||
|
if re.search(r"살짜리|살 짜리|살용|살 이상", t):
|
||||||
|
return "for an age" # "이거 몇 살짜리 장난감이야?": not Lumi's age
|
||||||
if OTHER_DAY.search(t):
|
if OTHER_DAY.search(t):
|
||||||
return "another day" # "내일 며칠이야?", "크리스마스가 무슨 요일이야?": the LLM
|
return "another day" # "내일 며칠이야?", "크리스마스가 무슨 요일이야?": the LLM
|
||||||
if OTHER_ROBOT.search(t):
|
if OTHER_ROBOT.search(t):
|
||||||
@@ -444,9 +456,17 @@ ASKS = re.compile(r"[??]\W*$|\b(?:what|who|whom|whose|how|where|when|why|which
|
|||||||
r"(?:까|니|냐|나요|가요|래|죠)\W*$", re.I) # words that ask something
|
r"(?:까|니|냐|나요|가요|래|죠)\W*$", re.I) # words that ask something
|
||||||
ORDER = re.compile(r"^\W*(?:please\s+)?(?:go|come|turn|take|bring|pick|put|give|follow|wave|look|move|lift|raise|lower|stop|sing|"
|
ORDER = re.compile(r"^\W*(?:please\s+)?(?:go|come|turn|take|bring|pick|put|give|follow|wave|look|move|lift|raise|lower|stop|sing|"
|
||||||
r"dance|fold|reach|grab|show|open|close|hold|drive|walk|fly|speak|say|tell|let'?s|wait|stand|sit)\b|"
|
r"dance|fold|reach|grab|show|open|close|hold|drive|walk|fly|speak|say|tell|let'?s|wait|stand|sit)\b|"
|
||||||
r"(?:줘|줘요|주세요|주십시오|주시오|주라|해라|하자|가자|와라|봐라|내밀어|흔들어|돌아|돌려|들어|내려|접어|펴|가|와|멈춰|그만)\s*[!.~…]*$", re.I)
|
r"(?<!알려 )(?<!말해 )(?<!알려)(?<!말해)(?<!가르쳐 )(?:줘|줘요|주세요|주십시오|주시오|주라|해라|하자|가자|와라|봐라|내밀어|흔들어|돌아|돌려|들어|내려|접어|펴|가|와|멈춰|그만|"
|
||||||
|
r"시지요|시죠|십시오|하시오|가시게|오시게|하시게|라 마|넣어|열어|닫아|놔|잡아|집어|가져와|이동해 좀|틀어|원위치)\s*[!.~…]*$", re.I)
|
||||||
# a command (said before a question, or as one sentence of several): never left out for the question
|
# a command (said before a question, or as one sentence of several): never left out for the question
|
||||||
CORRECTION = re.compile(r"(?:^|[\s,.])(?:아 아니|아니 아니|아니 그러니까|아니다|아니 잠깐|no wait|wait no|i mean|scratch that|sorry i mean)"
|
REQUEST = re.compile(r"\b(?:would|could|can|will) you (?:please |kindly )?(?:go|come|turn|take|bring|pick|put|give|wave|look|move|lift|"
|
||||||
|
r"raise|lower|fold|open|close|plug|tilt|spin|rotate)\b(?!.*\b(?:stairs?|steps?|ramps?|slopes?|doors?)\b)"
|
||||||
|
r".*\b(?:\d+|degrees?|left|right|up|down|in|a (?:little|bit)|higher|lower|please)\b|"
|
||||||
|
r"(?:돌려|올려|내려|열어|닫아|펴|접어|틀어|넣어|숙여|들어)\s*(?:주세요|줘|주시겠어요|줄래|주실래요|주시면|주십시오|주시겠습니까)|"
|
||||||
|
r"(?:손|팔)\s*(?:좀|쫌)?\s*(?:주실래요|줄래|주세요|내밀어|원위치)", re.I)
|
||||||
|
# a request to move put as a question: "could you turn your head ten degrees down?", "허리 왼쪽으로 틀어 주시면"
|
||||||
|
CORRECTION = re.compile(r"(?:^|[\s,.?])(?:아 아니|아니 아니|아니 그러니까|아니다|아니 잠깐|아 됐고|됐고|아 됐다|아 됐어|no wait|wait no|"
|
||||||
|
r"i mean|scratch that|sorry i mean|never ?mind|forget (?:it|that))"
|
||||||
r"(?=[\s,.])[\s,.]*", re.I)
|
r"(?=[\s,.])[\s,.]*", re.I)
|
||||||
ASIDE = re.compile(r"(?<=[가-힣])(?:니까|으니까|는데|인데|라서|이라서|라고 생각하고|동안)\s+|:\s+")
|
ASIDE = re.compile(r"(?<=[가-힣])(?:니까|으니까|는데|인데|라서|이라서|라고 생각하고|동안)\s+|:\s+")
|
||||||
# the end of a remark said before the question, without a comma
|
# the end of a remark said before the question, without a comma
|
||||||
@@ -465,10 +485,12 @@ def kind_of(text, history=(), _whole=True):
|
|||||||
fix = list(CORRECTION.finditer(text))
|
fix = list(CORRECTION.finditer(text))
|
||||||
if fix and len(text[fix[-1].end():].split()) >= 2:
|
if fix and len(text[fix[-1].end():].split()) >= 2:
|
||||||
text = text[fix[-1].end():] # "배터리, 아 아니, 지금 뭐 해?": what is said after the correction
|
text = text[fix[-1].end():] # "배터리, 아 아니, 지금 뭐 해?": what is said after the correction
|
||||||
|
if not ASKS.search(text):
|
||||||
|
return None # "몇 살이야? 아 됐고, 검정 컵 잡으시지요", "70cm, I mean 150 cm"
|
||||||
parts = [p for p in SENTENCES.split(text) if p.strip() and not REMARK.fullmatch(p.strip(" ,.!??~"))
|
parts = [p for p in SENTENCES.split(text) if p.strip() and not REMARK.fullmatch(p.strip(" ,.!??~"))
|
||||||
and OPENER.sub("", p).strip(" ,.!??~")]
|
and OPENER.sub("", p).strip(" ,.!??~")]
|
||||||
if len(parts) > 1:
|
if len(parts) > 1:
|
||||||
if any(ORDER.search(p) for p in parts):
|
if any(ORDER.search(p) or REQUEST.search(p) or re.search(r"봐\W*$", p) for p in parts):
|
||||||
return None # "fold it! your arm!", "손! 손 내밀어!": a command, the rules'
|
return None # "fold it! your arm!", "손! 손 내밀어!": a command, the rules'
|
||||||
asked = [p for p in parts if ASKS.search(p)]
|
asked = [p for p in parts if ASKS.search(p)]
|
||||||
kinds = {kind_of(p, history) for p in asked}
|
kinds = {kind_of(p, history) for p in asked}
|
||||||
@@ -487,7 +509,7 @@ def kind_of(text, history=(), _whole=True):
|
|||||||
m = list(ASIDE.finditer(rest))
|
m = list(ASIDE.finditer(rest))
|
||||||
head, comma, tail = (rest[:m[-1].start()], ",", rest[m[-1].end():]) if m else (rest, "", "")
|
head, comma, tail = (rest[:m[-1].start()], ",", rest[m[-1].end():]) if m else (rest, "", "")
|
||||||
if comma and len(tail.split()) >= (2 if re.search(r"[가-힣]", tail) else 3) and ASKS.search(tail) and \
|
if comma and len(tail.split()) >= (2 if re.search(r"[가-힣]", tail) else 3) and ASKS.search(tail) and \
|
||||||
not ASKS.search(head) and not ORDER.search(head): # "Your voice, what program?": the head is the topic
|
not ASKS.search(head) and not ORDER.search(head) and not REQUEST.search(head): # "Your voice, what program?": the head is the topic
|
||||||
last = kind_of(tail, history, False)
|
last = kind_of(tail, history, False)
|
||||||
if got and last and last != got:
|
if got and last and last != got:
|
||||||
return None # "저기 평가 항목, 루미, 오늘 무슨 요일이야?" read whole as another kind
|
return None # "저기 평가 항목, 루미, 오늘 무슨 요일이야?" read whole as another kind
|
||||||
|
|||||||
+13
-4
@@ -40,6 +40,7 @@ _FILL = (r"(?:(?:저기 |그 )?(?:이보게(?: 루미)?|어이(?: 로봇아?|
|
|||||||
r"번거로우시겠지만)|" # calls of every level ("이보게 루미", "루미 님께서") before "루미" alone
|
r"번거로우시겠지만)|" # calls of every level ("이보게 루미", "루미 님께서") before "루미" alone
|
||||||
r"please|let'?s|lets|hey lumi|hi lumi|hey|hi|lumi|loomi|rumi|okay|ok|alright|all right|so|well|real quick|if you can|if you could|자|저기|저기요|혹시|instead|um+|uh+|er|hmm|thank you|thanks|now|then|and|also|first|next|"
|
r"please|let'?s|lets|hey lumi|hi lumi|hey|hi|lumi|loomi|rumi|okay|ok|alright|all right|so|well|real quick|if you can|if you could|자|저기|저기요|혹시|instead|um+|uh+|er|hmm|thank you|thanks|now|then|and|also|first|next|"
|
||||||
r"finally|after that|there|for me|for us|again|carefully|slowly|could you|can you|would you|will you|could u|can u|would u|will u|"
|
r"finally|after that|there|for me|for us|again|carefully|slowly|could you|can you|would you|will you|could u|can u|would u|will u|"
|
||||||
|
r"could ya|can ya|would ya|will ya|"
|
||||||
r"pls|plz|yo|would it be possible to|is it possible to|could i ask you to|would you mind|lumi야|루미야|루미|음|응|어|야 로봇|로봇아|로봇야|"
|
r"pls|plz|yo|would it be possible to|is it possible to|could i ask you to|would you mind|lumi야|루미야|루미|음|응|어|야 로봇|로봇아|로봇야|"
|
||||||
r"감사합니다|고마워요|고마워|고맙습니다|좀|먼저|우선|일단|그다음|그 다음|마지막으로|다시|lastly|first of all|"
|
r"감사합니다|고마워요|고마워|고맙습니다|좀|먼저|우선|일단|그다음|그 다음|마지막으로|다시|lastly|first of all|"
|
||||||
r"(?:i'?d|i would) like you to|i want you to|i need you to|you should|kindly|go ahead and|maybe|possibly|"
|
r"(?:i'?d|i would) like you to|i want you to|i need you to|you should|kindly|go ahead and|maybe|possibly|"
|
||||||
@@ -58,6 +59,8 @@ def _norm(text, markers=()):
|
|||||||
"0.5 m", "오십 센치" -> "0.5 m", "table front" -> "table_front" on a map with it), titles without their dot."""
|
"0.5 m", "오십 센치" -> "0.5 m", "table front" -> "table_front" on a map with it), titles without their dot."""
|
||||||
t = re.sub(r"\b(mr|mrs|ms|dr|prof)\. ", r"\1 ", wording.durations(brain.unfill(brain.ko_slips(wording.norm(text, markers)))) + " ")
|
t = re.sub(r"\b(mr|mrs|ms|dr|prof)\. ", r"\1 ", wording.durations(brain.unfill(brain.ko_slips(wording.norm(text, markers)))) + " ")
|
||||||
t = re.sub(r"\b(?:take|pick up|pick|grab)\s?(?:해서|하고)", "집어서", t) # "컵 take해서": mixed
|
t = re.sub(r"\b(?:take|pick up|pick|grab)\s?(?:해서|하고)", "집어서", t) # "컵 take해서": mixed
|
||||||
|
t = re.sub(r"(?:(?<=들고)|(?<=집고)|(?<=잡고)|(?<=가서)|(?<=와서)|(?<=챙겨서)|(?<=가지고)|(?<=받아서)|(?<=집어서)|(?<=갔다가))"
|
||||||
|
r"(?=[가-힣a-z0-9])", " ", t) # "컵들고exit가서기다려" (typed or heard run together): its parts
|
||||||
t = re.sub(r"(?<=[가-힣])고\s*나서(?=[\s,]|$)", "고", t) # "가고 나서" = "가고"
|
t = re.sub(r"(?<=[가-힣])고\s*나서(?=[\s,]|$)", "고", t) # "가고 나서" = "가고"
|
||||||
t = re.sub(r"(?<![가-힣])(집었|잡았)다가(?=[\s,]|$)", lambda m: m.group(1)[0] + "고", t) # "컵 집었다가" = "컵 집고"
|
t = re.sub(r"(?<![가-힣])(집었|잡았)다가(?=[\s,]|$)", lambda m: m.group(1)[0] + "고", t) # "컵 집었다가" = "컵 집고"
|
||||||
for said, same in _SAME: # "get yourself to" = "go to"
|
for said, same in _SAME: # "get yourself to" = "go to"
|
||||||
@@ -77,6 +80,7 @@ _SAME = [ # wordings read as the plain one (the blind mission sets, 2026-10-22
|
|||||||
(r"\b((?:take|bring|carry) (?:it|that|this|the \w+|a \w+)) (?:with you|along)\b", r"\1"), # "take the cup with you to p5"
|
(r"\b((?:take|bring|carry) (?:it|that|this|the \w+|a \w+)) (?:with you|along)\b", r"\1"), # "take the cup with you to p5"
|
||||||
(r"^(?:go|head|drive)(?: over)? to (\S+) with (the|a|this|that) ((?:\w+ )?\w+)\s*$", r"take \2 \3 to \1"), # "go to
|
(r"^(?:go|head|drive)(?: over)? to (\S+) with (the|a|this|that) ((?:\w+ )?\w+)\s*$", r"take \2 \3 to \1"), # "go to
|
||||||
# exit with the cup": the cup taken there
|
# exit with the cup": the cup taken there
|
||||||
|
(r"^(?:wait|stay)(?: for me)? (?:at|by) (\S+) with (the|a|this|that) ((?:\w+ )?\w+)\s*$", r"take \2 \3 to \1 and wait there"),
|
||||||
(r"\bcome back to where (?:i am|you are|we are)\b", "come back"),
|
(r"\bcome back to where (?:i am|you are|we are)\b", "come back"),
|
||||||
(r"\buntil (?:someone|somebody|they|i|we) (?:says?|tells? you)(?: to)? (?:go on|continue|move on)\b"
|
(r"\buntil (?:someone|somebody|they|i|we) (?:says?|tells? you)(?: to)? (?:go on|continue|move on)\b"
|
||||||
r"|\buntil you(?:'re| are) told to (?:go on|continue|move on)\b", "until i tell you to go on"),
|
r"|\buntil you(?:'re| are) told to (?:go on|continue|move on)\b", "until i tell you to go on"),
|
||||||
@@ -739,7 +743,7 @@ def _clause_steps(c, markers, after=None):
|
|||||||
if m and (got := _clause_steps(m.group(1), markers, after)) and got[-1]["do"] == "receive":
|
if m and (got := _clause_steps(m.group(1), markers, after)) and got[-1]["do"] == "receive":
|
||||||
return got + [{"do": "go", "to": "here"}] # "사라한테 컵 받아 와": taken from her, then brought back here
|
return got + [{"do": "go", "to": "here"}] # "사라한테 컵 받아 와": taken from her, then brought back here
|
||||||
c = re.sub(r"^go (?:and )?(?=(?:grab|get) me\b)", "", c) # "go grab me a cup"
|
c = re.sub(r"^go (?:and )?(?=(?:grab|get) me\b)", "", c) # "go grab me a cup"
|
||||||
m = re.fullmatch(rf"(?:(?:pass|hand|give|get|grab|bring|fetch) me|(?:can|could|may) i (?:have|get|grab|take)|lemme have|let me have|"
|
m = re.fullmatch(rf"(?:(?:pass|hand|give|get|grab|bring|fetch) me|gimme|(?:can|could|may) i (?:have|get|grab|take)|lemme have|let me have|"
|
||||||
rf"(?:would you )?mind (?:passing|handing|giving) me) (?:the |that |this |a |an |one )?"
|
rf"(?:would you )?mind (?:passing|handing|giving) me) (?:the |that |this |a |an |one )?"
|
||||||
rf"(?:({COL}) )?({OBJ})s?(?: (?:on|from|off) the table| over(?: here)?| there| please)?"
|
rf"(?:({COL}) )?({OBJ})s?(?: (?:on|from|off) the table| over(?: here)?| there| please)?"
|
||||||
rf"|(?:(?:나|저)(?:한테|에게)?\s*)?(?:({COL})\s*)?({OBJ})\s*(?:을|를)?\s*(?:하나만?\s*)?(?:(?:나|저)(?:한테|에게)\s*)?"
|
rf"|(?:(?:나|저)(?:한테|에게)?\s*)?(?:({COL})\s*)?({OBJ})\s*(?:을|를)?\s*(?:하나만?\s*)?(?:(?:나|저)(?:한테|에게)\s*)?"
|
||||||
@@ -845,9 +849,14 @@ def _place_at(c, markers, after=None):
|
|||||||
thing, where = m["a"] or m["b"], m["where"]
|
thing, where = m["a"] or m["b"], m["where"]
|
||||||
verb = "put" if re.fullmatch(_PUT_KO, m["verb"]) else "deliver"
|
verb = "put" if re.fullmatch(_PUT_KO, m["verb"]) else "deliver"
|
||||||
on = None
|
on = None
|
||||||
sup = re.fullmatch(rf"(.+?)\s+((?:(?:{COL})\s*)?(?:{_SUP_KO}))(?:\s*위)?|((?:(?:{COL}) )?(?:{_SUP})s?) (?:at|in|by|near) (?:the )?(.+)", where)
|
sup = re.fullmatch(rf"(.+?)\s+((?:(?:왼쪽|오른쪽)\s*)?(?:(?:{COL})\s*)?(?:{_SUP_KO}))(?:\s*위)?|"
|
||||||
if sup and verb == "put": # "exit 테이블에 놔", "put it on the table at p3": there, on that
|
rf"((?:(?:left|right) )?(?:(?:{COL}) )?(?:{_SUP})s?) (?:at|in|by|near) (?:the )?(.+)", where)
|
||||||
where, on = sup.group(1) or sup.group(4), _support("on the " + sup.group(3) if sup.group(3) else sup.group(2))
|
if sup and verb == "put": # "exit 테이블에 놔", "put it on the left table at p3": there,
|
||||||
|
side = re.match(r"(왼쪽|오른쪽|left|right)\s*", sup.group(3) or sup.group(2)) # on that (on its side)
|
||||||
|
what = (sup.group(3) or sup.group(2))[side.end() if side else 0:]
|
||||||
|
where, on = sup.group(1) or sup.group(4), _support("on the " + what if sup.group(3) else what)
|
||||||
|
if on and side:
|
||||||
|
on["side"] = {"왼쪽": "left", "오른쪽": "right"}.get(side.group(1), side.group(1))
|
||||||
to = _places(where, markers)
|
to = _places(where, markers)
|
||||||
if not to or len(to) != 1 or to == ["here"]:
|
if not to or len(to) != 1 or to == ["here"]:
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -762,16 +762,18 @@ def checked(waypoints, start_joints):
|
|||||||
def pick_options(obj, start, max_yaw=None):
|
def pick_options(obj, start, max_yaw=None):
|
||||||
"""(waypoints, joints above) of every grasp turn (GRASP_YAWS; within `max_yaw` deg when given) and wrist solution
|
"""(waypoints, joints above) of every grasp turn (GRASP_YAWS; within `max_yaw` deg when given) and wrist solution
|
||||||
reachable from `start`: a joint move down to above that stays above it, then straight down and up; the controller
|
reachable from `start`: a joint move down to above that stays above it, then straight down and up; the controller
|
||||||
confirms each one given. Objects of the wrong width raise."""
|
confirms each one given. Every pick that worked live had J5 > 0: those come first. Objects of the wrong width
|
||||||
|
raise."""
|
||||||
plan_pick(obj)
|
plan_pick(obj)
|
||||||
tried = []
|
tried = []
|
||||||
for seeds in (IK_SEEDS[:1], IK_SEEDS[1:]): # the proven `ready` configuration at every turn first
|
for wrist, seeds in ((1, IK_SEEDS[:1]), (1, IK_SEEDS[1:]), (-1, IK_SEEDS[:1]), (-1, IK_SEEDS[1:])):
|
||||||
for yaw in GRASP_YAWS:
|
for yaw in GRASP_YAWS: # the proven wrist (J5 > 0) and `ready` configuration first
|
||||||
if max_yaw is not None and abs(yaw) > max_yaw:
|
if max_yaw is not None and abs(yaw) > max_yaw:
|
||||||
continue
|
continue
|
||||||
waypoints = plan_pick(obj, yaw)
|
waypoints = plan_pick(obj, yaw)
|
||||||
for ja in above_joints(waypoints[0][1], start, seeds):
|
for ja in above_joints(waypoints[0][1], start, seeds):
|
||||||
if any(y == yaw and max(abs(a - b) for a, b in zip(t, ja)) <= 1.0 for y, t in tried):
|
if ja[4] * wrist < 0 or any(y == yaw and max(abs(a - b) for a, b in zip(t, ja)) <= 1.0
|
||||||
|
for y, t in tried):
|
||||||
continue # another seed found the same solution
|
continue # another seed found the same solution
|
||||||
tried.append((yaw, ja))
|
tried.append((yaw, ja))
|
||||||
rows = ik_chain(waypoints[1:], ja)
|
rows = ik_chain(waypoints[1:], ja)
|
||||||
|
|||||||
+35
-13
@@ -98,13 +98,15 @@ SAME_BASE_RAD = 0.035
|
|||||||
WAIST_REACH_STEPS = (0.0, 15.0, -15.0, 30.0, -30.0) # deg; a pick out of reach: waist turns tried around the one
|
WAIST_REACH_STEPS = (0.0, 15.0, -15.0, 30.0, -30.0) # deg; a pick out of reach: waist turns tried around the one
|
||||||
# that brings the object to PICK_ZONE_CENTRE's bearing about the column (the waist carries
|
# that brings the object to PICK_ZONE_CENTRE's bearing about the column (the waist carries
|
||||||
# the arm round the column: what it reaches beside it, it reaches ahead), before a base move
|
# the arm round the column: what it reaches beside it, it reaches ahead), before a base move
|
||||||
|
GOAL_SLACK_MM = 20.0 # mm; a goal further out must also be reached this much further (the base stops short)
|
||||||
GOAL_OUT_MM = range(0, 201, 20) # mm; the pick goal moves this far out from PICK_ZONE_CENTRE when the torso camera
|
GOAL_OUT_MM = range(0, 201, 20) # mm; the pick goal moves this far out from PICK_ZONE_CENTRE when the torso camera
|
||||||
# would not see the cup there (a low table at lift 0)
|
# would not see the cup there (a low table at lift 0)
|
||||||
VIEW_MARGIN_PX = 10 # px; "in view" means this far inside the torso camera's image
|
VIEW_MARGIN_PX = 10 # px; "in view" means this far inside the torso camera's image
|
||||||
KEPT_MM = 150.0 # mm; after a base move the thing is the one seen this near where its map place says
|
KEPT_MM = 150.0 # mm; after a base move the thing is the one seen this near where its map place says
|
||||||
TORSO_HALF_DEG = 30.0 # deg; a kept thing further than this to a side of the torso camera's view: the waist turns
|
TORSO_HALF_DEG = 30.0 # deg; a kept thing further than this to a side of the torso camera's view: the waist turns
|
||||||
WAIST_FOUND_MM = 80.0 # mm; after that turn the object is looked for this near where it should be seen
|
WAIST_FOUND_MM = 80.0 # mm; after that turn the object is looked for this near where it should be seen
|
||||||
APPROACH_TRIES = 5 # base moves to bring an object out of reach to PICK_ZONE_CENTRE before asking the person
|
APPROACH_TRIES = 8 # base moves to bring an object out of reach to PICK_ZONE_CENTRE before asking the person
|
||||||
|
# (a move cut short by the base stopping at a chair still counts: 5 ran out, X1)
|
||||||
STRAIGHT_MAX_M = 0.6 # m; a straight drive (after a turn on the spot) at most this long, else navigation
|
STRAIGHT_MAX_M = 0.6 # m; a straight drive (after a turn on the spot) at most this long, else navigation
|
||||||
STANDOFF_M = 0.4 # m; navigation goes to this far back from the pick pose, then straight in
|
STANDOFF_M = 0.4 # m; navigation goes to this far back from the pick pose, then straight in
|
||||||
APPROACH_SIDES = (0, 45, -45, 90, -90, 135, -135, 180) # deg; ways in to the object tried by navigation, the
|
APPROACH_SIDES = (0, 45, -45, 90, -90, 135, -135, 180) # deg; ways in to the object tried by navigation, the
|
||||||
@@ -126,6 +128,7 @@ FURNITURE_MAP_M = 0.5 # on the map this near): tables, chairs, bo
|
|||||||
NEAR_GAP_M = 0.4 # m; something this near the base's outline when nothing is seen ahead: back off ...
|
NEAR_GAP_M = 0.4 # m; something this near the base's outline when nothing is seen ahead: back off ...
|
||||||
NEAR_RING_M = 0.5 # m from the base centre where _near_look probes for something near after a failed search
|
NEAR_RING_M = 0.5 # m from the base centre where _near_look probes for something near after a failed search
|
||||||
NEAR_VIEWS = (0.0, 60.0, -60.0) # deg; _near_look's views after it turned to what is near
|
NEAR_VIEWS = (0.0, 60.0, -60.0) # deg; _near_look's views after it turned to what is near
|
||||||
|
NEAR_BACKS = 2 # _near_look backs off this many times (a cup on a low table is seen from ~0.7 m only)
|
||||||
NEAR_BACK_M = 0.3 # ... this much and look again before the whole search (a cup < ~450 mm from the column
|
NEAR_BACK_M = 0.3 # ... this much and look again before the whole search (a cup < ~450 mm from the column
|
||||||
# is below both cameras, X1's sweep)
|
# is below both cameras, X1's sweep)
|
||||||
LOST_BACK_M = 0.15 # an object lost after a base move: back off this much (the camera sees more) ...
|
LOST_BACK_M = 0.15 # an object lost after a base move: back off this much (the camera sees more) ...
|
||||||
@@ -1137,10 +1140,14 @@ def _near_look(attempt, holding=False):
|
|||||||
_straight_clear(-NEAR_BACK_M)
|
_straight_clear(-NEAR_BACK_M)
|
||||||
if abs(d) >= TURN_MIN_DEG:
|
if abs(d) >= TURN_MIN_DEG:
|
||||||
_turn(d, holding, why="to look at what is near me")
|
_turn(d, holding, why="to look at what is near me")
|
||||||
for view in NEAR_VIEWS: # ahead, then the waist each way once (X1: a cup 60 deg aside)
|
for k in range(NEAR_BACKS): # a low table: the cup's middle comes into view only further off
|
||||||
got = _look_at(view, attempt)
|
if k:
|
||||||
if got is not None:
|
_waist_front()
|
||||||
return got
|
_straight_clear(-NEAR_BACK_M)
|
||||||
|
for view in NEAR_VIEWS: # ahead, then the waist each way once (X1: a cup 60 deg aside)
|
||||||
|
got = _look_at(view, attempt)
|
||||||
|
if got is not None:
|
||||||
|
return got
|
||||||
_waist_front()
|
_waist_front()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -1272,8 +1279,9 @@ def _approach(obj, yaw, tried, goal=PICK_ZONE_CENTRE, holding=False):
|
|||||||
x, y, _ = agv.pose()
|
x, y, _ = agv.pose()
|
||||||
g, before = (goal[0] + dx, goal[1]), left()
|
g, before = (goal[0] + dx, goal[1]), left()
|
||||||
move = approach_move(now(), yaw, t, g)
|
move = approach_move(now(), yaw, t, g)
|
||||||
if dx and agv.clearance(x, y) < BASE_HALF_M + CLEAR_M + PROBE_STEP_M:
|
if dx and (agv.clearance(x, y) < BASE_HALF_M + CLEAR_M + PROBE_STEP_M or "stood" in tried):
|
||||||
break # flush at something: a small turn won't get it in (X1's sweep)
|
break # flush at something, or the base stood still on the straight
|
||||||
|
# way in: a small turn won't get it in (X1's sweep)
|
||||||
if move is None or abs(move[1]) > STRAIGHT_MAX_M or any(
|
if move is None or abs(move[1]) > STRAIGHT_MAX_M or any(
|
||||||
k[0] == "straight" and k[3] == dx and math.hypot(k[1] - x, k[2] - y) < SAME_PLACE_M
|
k[0] == "straight" and k[3] == dx and math.hypot(k[1] - x, k[2] - y) < SAME_PLACE_M
|
||||||
for k in tried if isinstance(k, tuple)):
|
for k in tried if isinstance(k, tuple)):
|
||||||
@@ -1288,9 +1296,13 @@ def _approach(obj, yaw, tried, goal=PICK_ZONE_CENTRE, holding=False):
|
|||||||
why.append("turning")
|
why.append("turning")
|
||||||
continue
|
continue
|
||||||
if abs(s) >= PROBE_STEP_M:
|
if abs(s) >= PROBE_STEP_M:
|
||||||
|
p0 = agv.pose()
|
||||||
_straight_clear(s)
|
_straight_clear(s)
|
||||||
|
if math.hypot(agv.pose()[0] - p0[0], agv.pose()[1] - p0[1]) < PROBE_STEP_M:
|
||||||
|
tried.add("stood") # (forgotten again once the base gets elsewhere)
|
||||||
gain = before - left()
|
gain = before - left()
|
||||||
if gain >= PROGRESS_MM:
|
if gain >= PROGRESS_MM:
|
||||||
|
tried.discard("stood")
|
||||||
return True
|
return True
|
||||||
log(f"that move brought it only {gain:.0f} mm nearer: another way")
|
log(f"that move brought it only {gain:.0f} mm nearer: another way")
|
||||||
why.append("something in front of me")
|
why.append("something in front of me")
|
||||||
@@ -1331,6 +1343,7 @@ def _approach(obj, yaw, tried, goal=PICK_ZONE_CENTRE, holding=False):
|
|||||||
p = agv.pose()
|
p = agv.pose()
|
||||||
if math.hypot(p[0] - x, p[1] - y) >= PROGRESS_MM / 1000.0 or \
|
if math.hypot(p[0] - x, p[1] - y) >= PROGRESS_MM / 1000.0 or \
|
||||||
abs((p[2] - th + math.pi) % (2 * math.pi) - math.pi) >= math.radians(TURN_MIN_DEG):
|
abs((p[2] - th + math.pi) % (2 * math.pi) - math.pi) >= math.radians(TURN_MIN_DEG):
|
||||||
|
tried.discard("stood")
|
||||||
return True # at another side: the straight way in follows from there
|
return True # at another side: the straight way in follows from there
|
||||||
tried.add(("nav", sx, sy))
|
tried.add(("nav", sx, sy))
|
||||||
log("navigation left me where I was: another side")
|
log("navigation left me where I was: another side")
|
||||||
@@ -1479,12 +1492,13 @@ def pick_goal(obj):
|
|||||||
to z ~-375 at y 580 only (a cup on a lower table was lost at the pick zone and chased again, X1's sweep). No goal
|
to z ~-375 at y 580 only (a cup on a lower table was lost at the pick zone and chased again, X1's sweep). No goal
|
||||||
both seen and reached: FetchError saying so at once (a low table at lift 0), never a goal out of view."""
|
both seen and reached: FetchError saying so at once (a low table at lift 0), never a goal out of view."""
|
||||||
z = obj["top_mm"] - (obj.get("height_mm") or 2 * skills.BELOW_RIM_MM) / 2
|
z = obj["top_mm"] - (obj.get("height_mm") or 2 * skills.BELOW_RIM_MM) / 2
|
||||||
for dy in GOAL_OUT_MM:
|
for slack in (GOAL_SLACK_MM, 0.0): # reached a little further too (the base stops short), else just
|
||||||
g = (PICK_ZONE_CENTRE[0], PICK_ZONE_CENTRE[1] + dy)
|
for dy in GOAL_OUT_MM:
|
||||||
if at_edge({"x": g[0], "y": g[1]}):
|
g = (PICK_ZONE_CENTRE[0], PICK_ZONE_CENTRE[1] + dy)
|
||||||
break
|
if at_edge({"x": g[0], "y": g[1]}):
|
||||||
if in_view(g[0], g[1], z) and (not dy or _reach_at(obj, g)):
|
break
|
||||||
return g
|
if in_view(g[0], g[1], z) and (not dy or _reach_at(obj, (g[0], g[1] + slack))):
|
||||||
|
return g
|
||||||
raise FetchError("The table is too low for me: where my arm reaches the cup, my camera can't see it.",
|
raise FetchError("The table is too low for me: where my arm reaches the cup, my camera can't see it.",
|
||||||
"테이블이 너무 낮아요. 팔이 닿는 곳에서는 카메라로 컵이 보이지 않아요.")
|
"테이블이 너무 낮아요. 팔이 닿는 곳에서는 카메라로 컵이 보이지 않아요.")
|
||||||
|
|
||||||
@@ -2259,6 +2273,14 @@ def _forget_held():
|
|||||||
skills._held.clear()
|
skills._held.clear()
|
||||||
|
|
||||||
|
|
||||||
|
def held_by_skill(what):
|
||||||
|
"""Record a hold made outside a fetch (assistant/lumi.py's voice pick: skills.pick directly): `what` {"object",
|
||||||
|
"colour"} becomes the held object, so the state file, the dashboard and every reply name it ("the white cup")."""
|
||||||
|
with _lock:
|
||||||
|
skills._held["what"] = {"object": what.get("object"), "colour": what.get("colour")}
|
||||||
|
_set(holding=True, held_object=skills._held["what"], status="holding", step="holding")
|
||||||
|
|
||||||
|
|
||||||
def _hold_again():
|
def _hold_again():
|
||||||
"""The hand holds something the state does not: it is the thing forgotten last (_forget_held), its name and what
|
"""The hand holds something the state does not: it is the thing forgotten last (_forget_held), its name and what
|
||||||
put down needs. Live 2026-10-26 18:53:00 one hand read said empty with the cup in it; after that every reply said
|
put down needs. Live 2026-10-26 18:53:00 one hand read said empty with the cup in it; after that every reply said
|
||||||
|
|||||||
+12
-3
@@ -137,7 +137,7 @@ def _save_queries(known):
|
|||||||
|
|
||||||
def _run(job):
|
def _run(job):
|
||||||
"""One share of the cases: (counts by set, wrong, hits, read times, missed, new query vectors)."""
|
"""One share of the cases: (counts by set, wrong, hits, read times, missed, new query vectors)."""
|
||||||
part, stress, fast, marks = job
|
part, stress, fast, marks, misses = job
|
||||||
known = KNOWN # the embed wrapper's own dict (in a forked job: its copy)
|
known = KNOWN # the embed wrapper's own dict (in a forked job: its copy)
|
||||||
n0 = set(known)
|
n0 = set(known)
|
||||||
from assistant import detour, steps
|
from assistant import detour, steps
|
||||||
@@ -169,6 +169,14 @@ def _run(job):
|
|||||||
times.append(time.time() - t0)
|
times.append(time.time() - t0)
|
||||||
if not got:
|
if not got:
|
||||||
by[name]["llm" if ruled in (None, "llm?") else "rules"] += 1
|
by[name]["llm" if ruled in (None, "llm?") else "rules"] += 1
|
||||||
|
if ruled == "llm?" and fast and misses and expect.startswith("action:"):
|
||||||
|
intent_bank.read = lambda *a, **k: None # --misses: the rules asked only here (true misses)
|
||||||
|
try:
|
||||||
|
ruled = command_check.rules(text, state, mk, b)
|
||||||
|
except command_check.NoLLM:
|
||||||
|
pass
|
||||||
|
finally:
|
||||||
|
intent_bank.read = real
|
||||||
if ruled in (None, "llm?") and expect.startswith("action:"):
|
if ruled in (None, "llm?") and expect.startswith("action:"):
|
||||||
missed.append(f"- [{name}/{state}] {text!r} (want {expect})")
|
missed.append(f"- [{name}/{state}] {text!r} (want {expect})")
|
||||||
continue
|
continue
|
||||||
@@ -186,7 +194,8 @@ def _run(job):
|
|||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
"""--fast: the rules are not run (0.8 s a case): wrong and llm are the same, hit and agree are counted together as
|
"""--fast: the rules are not run (0.8 s a case): wrong and llm are the same, hit and agree are counted together as
|
||||||
hit. --jobs N: N processes (the embedding server is shared)."""
|
hit. --misses (with --fast): the rules read only the cases the bank leaves, so the "Left to the LLM" list holds
|
||||||
|
only what nothing but the LLM answers. --jobs N: N processes (the embedding server is shared)."""
|
||||||
global OUT
|
global OUT
|
||||||
if "--rounds" in args:
|
if "--rounds" in args:
|
||||||
ROUNDS[:] = args[args.index("--rounds") + 1].split(",")
|
ROUNDS[:] = args[args.index("--rounds") + 1].split(",")
|
||||||
@@ -199,7 +208,7 @@ def main(args):
|
|||||||
jobs = int(args[args.index("--jobs") + 1]) if "--jobs" in args else 1
|
jobs = int(args[args.index("--jobs") + 1]) if "--jobs" in args else 1
|
||||||
intent_bank._load(), intent_bank._codes() # loaded once, shared by the forked jobs
|
intent_bank._load(), intent_bank._codes() # loaded once, shared by the forked jobs
|
||||||
every = cases("--blind" in args)
|
every = cases("--blind" in args)
|
||||||
parts = [(every[i::jobs], stress, fast, marks) for i in range(jobs)]
|
parts = [(every[i::jobs], stress, fast, marks, "--misses" in args) for i in range(jobs)]
|
||||||
if jobs > 1:
|
if jobs > 1:
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
with multiprocessing.get_context("fork").Pool(jobs) as pool:
|
with multiprocessing.get_context("fork").Pool(jobs) as pool:
|
||||||
|
|||||||
+13
-3
@@ -431,7 +431,8 @@ def _moved(kind, want, before):
|
|||||||
after = W["base"]
|
after = W["base"]
|
||||||
W["rec"]["moves"].append([kind, round(float(want), 3),
|
W["rec"]["moves"].append([kind, round(float(want), 3),
|
||||||
round(float(math.hypot(after[0] - before[0], after[1] - before[1])), 3),
|
round(float(math.hypot(after[0] - before[0], after[1] - before[1])), 3),
|
||||||
round(math.degrees((after[2] - before[2] + math.pi) % (2 * math.pi) - math.pi), 1)])
|
round(math.degrees((after[2] - before[2] + math.pi) % (2 * math.pi) - math.pi), 1),
|
||||||
|
[round(float(v), 3) for v in before]])
|
||||||
|
|
||||||
|
|
||||||
def f_go_point(x, y, th):
|
def f_go_point(x, y, th):
|
||||||
@@ -750,6 +751,11 @@ def run_scene(sc, cam=1.0):
|
|||||||
rec["still"] = sum(1 for m in mv if m[2] < 0.02 and abs(m[3]) < 2.0)
|
rec["still"] = sum(1 for m in mv if m[2] < 0.02 and abs(m[3]) < 2.0)
|
||||||
rec["repeats"] = sum(1 for a, b in zip(mv, mv[1:]) if a[0] == b[0] and abs(a[1] - b[1]) < 0.02
|
rec["repeats"] = sum(1 for a, b in zip(mv, mv[1:]) if a[0] == b[0] and abs(a[1] - b[1]) < 0.02
|
||||||
and a[2] < 0.02 and abs(a[3]) < 2.0)
|
and a[2] < 0.02 and abs(a[3]) < 2.0)
|
||||||
|
nowhere = lambda m: m[2] < 0.02 and abs(m[3]) < 2.0
|
||||||
|
same_spot = lambda a, b: math.hypot(a[4][0] - b[4][0], a[4][1] - b[4][1]) < 0.05 and \
|
||||||
|
abs((a[4][2] - b[4][2] + math.pi) % (2 * math.pi) - math.pi) < math.radians(3)
|
||||||
|
rec["loops"] = sum(1 for k, b in enumerate(mv) if nowhere(b) and any(
|
||||||
|
a[0] == b[0] and abs(a[1] - b[1]) < 0.02 and nowhere(a) and same_spot(a, b) for a in mv[:k]))
|
||||||
if sc["kind"] == "pick" and rec["result"] != "ok" and sc["cup"]["grip"] >= 72.0:
|
if sc["kind"] == "pick" and rec["result"] != "ok" and sc["cup"]["grip"] >= 72.0:
|
||||||
lines_kept = list(W["lines"])
|
lines_kept = list(W["lines"])
|
||||||
try:
|
try:
|
||||||
@@ -874,7 +880,9 @@ def report(rows, path, title, mtimes):
|
|||||||
f"- moves that went nowhere (< 2 cm, < 2 deg): {sum(r['still'] for r in mv)} in "
|
f"- moves that went nowhere (< 2 cm, < 2 deg): {sum(r['still'] for r in mv)} in "
|
||||||
f"{sum(r['still'] > 0 for r in mv)} scenes",
|
f"{sum(r['still'] > 0 for r in mv)} scenes",
|
||||||
f"- the same move repeated after one that went nowhere: {sum(r['repeats'] for r in mv)} in "
|
f"- the same move repeated after one that went nowhere: {sum(r['repeats'] for r in mv)} in "
|
||||||
f"{sum(r['repeats'] > 0 for r in mv)} scenes", ""]
|
f"{sum(r['repeats'] > 0 for r in mv)} scenes",
|
||||||
|
f"- a move that went nowhere tried again later from the same spot: {sum(r.get('loops', 0) for r in mv)} in "
|
||||||
|
f"{sum(r.get('loops', 0) > 0 for r in mv)} scenes", ""]
|
||||||
if places:
|
if places:
|
||||||
ok = sum(r["result"] == "ok" for r in places)
|
ok = sum(r["result"] == "ok" for r in places)
|
||||||
out += [f"## Places: {ok}/{len(places)} ok ({100 * ok / len(places):.1f} %)", "",
|
out += [f"## Places: {ok}/{len(places)} ok ({100 * ok / len(places):.1f} %)", "",
|
||||||
@@ -882,7 +890,9 @@ def report(rows, path, title, mtimes):
|
|||||||
table(places, ("beside L", "left", "ahead", "right", "beside R", "behind"),
|
table(places, ("beside L", "left", "ahead", "right", "beside R", "behind"),
|
||||||
["in reach", "near (< 1 m)", "far"], "sector")
|
["in reach", "near (< 1 m)", "far"], "sector")
|
||||||
out += [f"- moves that went nowhere: {sum(r['still'] for r in places)} in "
|
out += [f"- moves that went nowhere: {sum(r['still'] for r in places)} in "
|
||||||
f"{sum(r['still'] > 0 for r in places)} scenes; repeated: {sum(r['repeats'] for r in places)}", ""]
|
f"{sum(r['still'] > 0 for r in places)} scenes; repeated: {sum(r['repeats'] for r in places)}; tried again "
|
||||||
|
f"later from the same spot: {sum(r.get('loops', 0) for r in places)} in "
|
||||||
|
f"{sum(r.get('loops', 0) > 0 for r in places)} scenes", ""]
|
||||||
rel = [r["released"] for r in places if r.get("released") and r["released"]["above_table_mm"] is not None]
|
rel = [r["released"] for r in places if r.get("released") and r["released"]["above_table_mm"] is not None]
|
||||||
if rel:
|
if rel:
|
||||||
hz = [x["above_table_mm"] for x in rel]
|
hz = [x["above_table_mm"] for x in rel]
|
||||||
|
|||||||
@@ -155,6 +155,81 @@ NEG += ["내일 며칠이야?", "어제 무슨 요일이었어?", "what's the da
|
|||||||
"그거 몇 킬로야?", "that one, how heavy?", "저 로봇 이름 뭐야?", "옆에 로봇은 몇 살이야?", "what's the name of that robot?"]
|
"그거 몇 킬로야?", "that one, how heavy?", "저 로봇 이름 뭐야?", "옆에 로봇은 몇 살이야?", "what's the name of that robot?"]
|
||||||
|
|
||||||
|
|
||||||
|
# night 5, rounds 6-7: new phrasings written apart from the bank (every Korean level), and new "no" risks
|
||||||
|
POS_a = {
|
||||||
|
"name": ["I didn't catch your name, what was it?", "Sorry, your name again?", "Got a name, little guy?", "What should I call you, robot?",
|
||||||
|
"니 이름이 뭐였더라?", "이름이 뭐라 그랬지?", "이름을 여쭤봐도 될까요?", "로봇님 존함이 어떻게 되십니까?", "이름 뭐라카노?",
|
||||||
|
"이름이 뭐시여?", "너 이름 뭐냐고", "네임 좀 알려 주세요", "what's ur name lol", "이름 있으세요?"],
|
||||||
|
"age": ["How long ago were you built?", "Are you old or new?", "When's your birthday?", "how many years old is lumi",
|
||||||
|
"너 태어난 지 얼마나 됐어?", "몇 살이나 먹었니?", "연식이 어떻게 돼요?", "나이 좀 물어봐도 돼요?", "니 몇 살이고?",
|
||||||
|
"몇 살이당가?", "올해로 몇 살 되셨어요?", "your age, please?"],
|
||||||
|
"maker": ["Who's behind you, which company?", "Who built this robot?", "What company are you from?", "Who created you?",
|
||||||
|
"누가 널 만든 거야?", "어디서 만든 로봇이에요?", "제작사가 어디죠?", "만든 곳이 어디예요?", "누가 맹글었노?", "어디 제품인교?",
|
||||||
|
"who's your creator?", "너 누구 작품이야?"],
|
||||||
|
"height": ["How tall do you stand?", "What's your height exactly?", "Are you taller than a person?", "키가 어느 정도 돼요?",
|
||||||
|
"몇 센티나 돼?", "키가 몇 센치야?", "신장이 어떻게 되십니까?", "키 얼마나 되노?", "키가 몇이여?", "how tall r u lumi"],
|
||||||
|
"weight": ["How much do you weigh exactly?", "Are you heavy?", "What's your weight in kilograms?", "무게가 어느 정도 돼요?",
|
||||||
|
"몇 키로 나가?", "몸무게 몇 키로예요?", "중량이 얼마입니까?", "무게 우째 되노?", "얼마나 무거워요?", "how heavy is lumi"],
|
||||||
|
"battery_life": ["How long can you run before charging?", "How many hours does a full battery give you?", "What's your runtime on battery?",
|
||||||
|
"충전 한 번에 몇 시간 일해요?", "배터리 몇 시간 버텨요?", "한 번 충전하면 하루 종일 가요?", "배터리가 몇 시간이나 갑니까?",
|
||||||
|
"배터리 오래가노?", "배터리 지속 시간이 어떻게 되세요?"],
|
||||||
|
"languages": ["What languages do you understand?", "Do you understand Korean?", "Can I talk to you in Japanese?", "Do you speak French?",
|
||||||
|
"한국어로 말해도 돼?", "영어도 알아들어요?", "일본어 돼요?", "몇 개 언어 하세요?", "중국말 할 줄 아나?", "외국어 할 수 있습니까?"],
|
||||||
|
"chatgpt": ["Is this ChatGPT talking?", "Are you powered by OpenAI?", "Do you use GPT-4?", "챗GPT로 대답하는 거야?", "너 GPT 기반이야?",
|
||||||
|
"오픈AI 거 써요?"],
|
||||||
|
"model": ["What brain do you use to talk?", "Which AI answers me?", "What's the name of your language model?", "너 무슨 모델로 대답해?",
|
||||||
|
"어떤 인공지능으로 말해요?", "언어 모델 이름이 뭐예요?", "LLM 뭐 쓰세요?"],
|
||||||
|
"robot": ["Are you a person in a costume?", "Is there a human inside?", "Do you have a soul?", "Can you feel pain?", "너 사람이니 로봇이니?",
|
||||||
|
"안에 사람 들어 있어요?", "감정이 있으세요?", "아픈 거 느껴?", "너 기계 맞아?", "are you conscious?"],
|
||||||
|
"speed": ["How fast do you drive?", "What's your top speed in km/h?", "Can you go quickly?", "속도가 얼마나 나와요?", "최고 속력이 얼마예요?",
|
||||||
|
"얼마나 빨리 움직여?", "빠르게 갈 수 있어요?", "속도 우째 되노?"],
|
||||||
|
"time_now": ["Do you know what time it is?", "What's the time please?", "Time check?", "지금 몇 시예요?", "몇 시쯤 됐어요?", "시간 좀 알려 주시겠어요?",
|
||||||
|
"지금 몇 시나 됐노?", "현재 시각 알려 줘"],
|
||||||
|
"date_today": ["What's today's date?", "What day is it today?", "Which day of the week is today?", "오늘 날짜 좀 알려 주세요", "오늘 무슨 요일이에요?",
|
||||||
|
"오늘이 며칠이죠?", "오늘 몇 월 며칠이고?", "today date?"],
|
||||||
|
"hello": ["Hi there, Lumi!", "Good afternoon!", "Hey robot!", "안녕하십니까!", "하이~", "반가워 루미!"],
|
||||||
|
"how_are_you": ["How's your day been?", "Are you having a good day?", "오늘 기분 좋아?", "잘 지내셨어요?", "컨디션 괜찮아?"],
|
||||||
|
}
|
||||||
|
NEG_a = ["Can you see my hand?", "What's on the table?", "Where did my friend go?", "How old is my son?", "What am I holding?",
|
||||||
|
"Come with me please", "Turn to the left", "Bring me the cup", "Sing me a song", "Tell me a story",
|
||||||
|
"What's the weather tomorrow?", "Who won the game yesterday?", "What's the capital of France?", "How tall is BTS Jungkook?",
|
||||||
|
"How old is the CEO?", "When does the exhibition close?", "What time does the bus come?", "Where is the restroom?",
|
||||||
|
"내 손 보여?", "책상 위에 뭐 있어?", "우리 아들 몇 살로 보여?", "왼쪽으로 돌아", "컵 가져와", "노래 불러 줘", "이야기 해 줘",
|
||||||
|
"내일 날씨 어때?", "어제 경기 누가 이겼어?", "프랑스 수도가 어디야?", "대표님 나이가 어떻게 돼요?", "전시회 몇 시에 끝나요?",
|
||||||
|
"버스 몇 시에 와요?", "화장실 어디예요?", "고마워", "잘 가", "그래서?", "진짜야?", "왜?", "알았어", "음...", "그럼 이건?",
|
||||||
|
"이 컵 무게 얼마야?", "how heavy is this cup?", "how tall is the table?", "책상 높이 얼마야?", "이거 몇 살짜리 장난감이야?",
|
||||||
|
"how old is this building?", "what's your favorite food?", "좋아하는 음식 뭐야?", "do you love me?", "나 좋아해?"]
|
||||||
|
POS_b = {
|
||||||
|
"co_what": ["쿳션은 어떤 회사입니까?", "쿳션 뭐 하는 회사여?", "Tell me a bit about Cutshion", "쿳션이 뭐 하는 곳이에요?"],
|
||||||
|
"co_founded": ["When was your company set up?", "쿳션은 몇 년도에 생겼어요?", "회사 설립이 언제입니까?", "쿳션 창업한 지 얼마나 됐어?"],
|
||||||
|
"co_ceo": ["Who runs Cutshion?", "쿳션 사장님이 누구세요?", "쿳션 대표님 이름이 뭐예요?", "Who's the boss of Cutshion?"],
|
||||||
|
"co_hq": ["Where is Cutshion's office?", "쿳션 사무실이 어디 있어요?", "회사가 어디에 있습니까?", "쿳션 본사가 어디고?"],
|
||||||
|
"co_contact": ["How do I contact Cutshion?", "쿳션 이메일이 뭐예요?", "회사 전화번호 좀 알려 주세요", "쿳션에 연락하려면 어떻게 해요?"],
|
||||||
|
"safety": ["Is it safe for my kids to be near you?", "로봇 옆에 있어도 위험하지 않나요?", "너 위험한 로봇이야?", "Can you hurt someone?"],
|
||||||
|
"cameras": ["How many cameras are on you?", "카메라가 몇 개 달려 있어요?", "What camera do you have in your head?", "카메라 어떤 거 쓰세요?"],
|
||||||
|
"mics": ["Do you have a microphone?", "마이크가 몇 개 있어요?", "How far away can you hear people?", "멀리서도 들려요?"],
|
||||||
|
"stt": ["How do you understand my words?", "말을 어떻게 알아들어요?", "음성 인식 뭐 써요?", "Do you use Whisper?"],
|
||||||
|
"tts": ["How do you make your voice?", "목소리는 어떻게 내세요?", "What speech synthesis do you use?", "TTS 뭐 씁니까?"],
|
||||||
|
"internet": ["Are you connected to the internet?", "인터넷 연결돼 있어요?", "Can you work without wifi?", "와이파이 써?"],
|
||||||
|
"computer": ["What computer is inside you?", "안에 무슨 컴퓨터 들어 있어요?", "Do you use an NVIDIA chip?", "컴퓨터 사양이 어떻게 돼요?"],
|
||||||
|
"stairs": ["Can you climb stairs?", "계단 올라갈 수 있어요?", "Can you go over a step?", "턱 넘을 수 있어?"],
|
||||||
|
"doors": ["Can you open a door?", "문 열 수 있어요?", "문 열 줄 아니?"],
|
||||||
|
"lidar": ["Do you have a lidar?", "라이다 있어요?", "How far does your lidar see?"],
|
||||||
|
"gripper": ["What gripper do you have?", "그리퍼 뭐 써요?", "How many fingers do you have?", "손가락 몇 개야?"],
|
||||||
|
"payload": ["How much can your arm carry?", "팔 가반하중이 얼마예요?", "What's your payload?"],
|
||||||
|
"dance": ["Can you dance?", "춤출 수 있어요?", "Can you walk?", "걸을 수 있어?"],
|
||||||
|
"touch": ["Can I touch you?", "만져 봐도 돼요?", "Is it okay to touch the robot?"],
|
||||||
|
}
|
||||||
|
NEG_b = ["Where can I buy a robot like you?", "쿳션 주식 살 수 있어요?", "Is Cutshion's CEO married?", "대표님 몇 살이에요?",
|
||||||
|
"Can you open the window?", "문 좀 열어 줘", "Climb the stairs now", "계단으로 가", "Dance for me!", "춤 춰 봐", "Touch my hand",
|
||||||
|
"내 손 만져 봐", "Show me your camera", "카메라 보여 줘", "Turn on the internet", "와이파이 비밀번호 뭐야?", "What's the wifi password?",
|
||||||
|
"Pick up the bottle", "병 집어 줘", "How heavy is this bottle?", "이 병 몇 킬로야?", "Is the floor safe?", "여기 안전해?"]
|
||||||
|
for _p in (POS_a, POS_b):
|
||||||
|
for _k, _t in _p.items():
|
||||||
|
POS.setdefault(_k, []).extend(_t)
|
||||||
|
NEG += NEG_a + NEG_b
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
ok = bad = miss = 0
|
ok = bad = miss = 0
|
||||||
lines = []
|
lines = []
|
||||||
|
|||||||
+14
-4
@@ -3,17 +3,19 @@
|
|||||||
python tests/qa_sweep.py # first words (commands: 'text' with no 'before'; dialogues: first turn
|
python tests/qa_sweep.py # first words (commands: 'text' with no 'before'; dialogues: first turn
|
||||||
# 'say') of train, r2-r4, r6, r8, r9, r10: the hits, for review
|
# 'say') of train, r2-r4, r6, r8, r9, r10: the hits, for review
|
||||||
python tests/qa_sweep.py r9 r10 # only these rounds' train sets
|
python tests/qa_sweep.py r9 r10 # only these rounds' train sets
|
||||||
|
python tests/qa_sweep.py --sample 3000 # at most 3000 first words per round (seeded, the same each run)
|
||||||
python tests/qa_sweep.py --questions r6 r8 r9 # questions_world: want-quick answered at once, and every quick
|
python tests/qa_sweep.py --questions r6 r8 r9 # questions_world: want-quick answered at once, and every quick
|
||||||
# answer that misses the case's must / says its must_not (wrong)
|
# answer that misses the case's must / says its must_not (wrong)
|
||||||
python tests/qa_sweep.py --questions -v r9 # ... and the questions left to the LLM
|
python tests/qa_sweep.py --questions -v r9 # ... and the questions left to the LLM
|
||||||
|
|
||||||
The words are embedded in batches first (the embedding server is shared), then read from memory.
|
The words are embedded in batches first (the embedding server is shared), then read from memory.
|
||||||
"""
|
"""
|
||||||
import glob, importlib, re, sys
|
import glob, importlib, random, re, sys
|
||||||
sys.path.insert(0, __file__.rsplit("/tests/", 1)[0])
|
sys.path.insert(0, __file__.rsplit("/tests/", 1)[0])
|
||||||
from assistant import knowledge, quick_answers as qa
|
from assistant import knowledge, quick_answers as qa
|
||||||
QUESTIONS, VERBOSE = "--questions" in sys.argv, "-v" in sys.argv
|
QUESTIONS, VERBOSE = "--questions" in sys.argv, "-v" in sys.argv
|
||||||
ROUNDS = [a for a in sys.argv[1:] if not a.startswith("-")] or \
|
SAMPLE = int(sys.argv[sys.argv.index("--sample") + 1]) if "--sample" in sys.argv else None
|
||||||
|
ROUNDS = [a for a in sys.argv[1:] if not a.startswith("-") and not a.isdigit()] or \
|
||||||
(["r6", "r8", "r9"] if QUESTIONS else ["train", "r2", "r3", "r4", "r6", "r8", "r9", "r10"])
|
(["r6", "r8", "r9"] if QUESTIONS else ["train", "r2", "r3", "r4", "r6", "r8", "r9", "r10"])
|
||||||
_embed, _known = knowledge.embed, {}
|
_embed, _known = knowledge.embed, {}
|
||||||
|
|
||||||
@@ -45,6 +47,7 @@ def sets(r, questions):
|
|||||||
def first_words():
|
def first_words():
|
||||||
seen, todo = set(), []
|
seen, todo = set(), []
|
||||||
for r in ROUNDS:
|
for r in ROUNDS:
|
||||||
|
mine = []
|
||||||
for f, m in sets(r, False):
|
for f, m in sets(r, False):
|
||||||
texts = [(c["text"], c.get("expect") or c.get("kind")) for c in getattr(m, "CASES", [])
|
texts = [(c["text"], c.get("expect") or c.get("kind")) for c in getattr(m, "CASES", [])
|
||||||
if isinstance(c, dict) and c.get("text") and not c.get("before") and not c.get("ctx")]
|
if isinstance(c, dict) and c.get("text") and not c.get("before") and not c.get("ctx")]
|
||||||
@@ -53,7 +56,8 @@ def first_words():
|
|||||||
for t, e in texts:
|
for t, e in texts:
|
||||||
if t not in seen:
|
if t not in seen:
|
||||||
seen.add(t)
|
seen.add(t)
|
||||||
todo.append((t, e, f"{r}/{f.rsplit('/', 1)[1][:-3]}"))
|
mine.append((t, e, f"{r}/{f.rsplit('/', 1)[1][:-3]}"))
|
||||||
|
todo += random.Random(1).sample(mine, SAMPLE) if SAMPLE and len(mine) > SAMPLE else mine
|
||||||
embed([p for t, _, _ in todo for p in pieces(t)])
|
embed([p for t, _, _ in todo for p in pieces(t)])
|
||||||
hits = 0
|
hits = 0
|
||||||
for t, e, where in todo:
|
for t, e, where in todo:
|
||||||
@@ -61,7 +65,7 @@ def first_words():
|
|||||||
if k:
|
if k:
|
||||||
hits += 1
|
hits += 1
|
||||||
print(f"{k:12} {where:22} {t!r} want={e}")
|
print(f"{k:12} {where:22} {t!r} want={e}")
|
||||||
print("texts", len(seen), "quick", hits)
|
print("texts", len(todo), "quick", hits)
|
||||||
|
|
||||||
|
|
||||||
def questions():
|
def questions():
|
||||||
@@ -69,10 +73,15 @@ def questions():
|
|||||||
cases = [c for r in ROUNDS for _, m in sets(r, True) for c in m.CASES]
|
cases = [c for r in ROUNDS for _, m in sets(r, True) for c in m.CASES]
|
||||||
embed([p for c in cases for p in pieces(c["text"])])
|
embed([p for c in cases for p in pieces(c["text"])])
|
||||||
want = hit = wrong = 0
|
want = hit = wrong = 0
|
||||||
|
levels = {}
|
||||||
for c in cases:
|
for c in cases:
|
||||||
k = qa.kind_of(c["text"])
|
k = qa.kind_of(c["text"])
|
||||||
quick = c["expect"] == "quick"
|
quick = c["expect"] == "quick"
|
||||||
want += quick
|
want += quick
|
||||||
|
if quick:
|
||||||
|
lv = levels.setdefault(c.get("level") or c["lang"], [0, 0])
|
||||||
|
lv[0] += 1
|
||||||
|
lv[1] += k is not None
|
||||||
if k is None:
|
if k is None:
|
||||||
if quick and VERBOSE:
|
if quick and VERBOSE:
|
||||||
print(f"miss [{c['q']}] {c['text']!r}")
|
print(f"miss [{c['q']}] {c['text']!r}")
|
||||||
@@ -86,6 +95,7 @@ def questions():
|
|||||||
if probs:
|
if probs:
|
||||||
wrong += 1
|
wrong += 1
|
||||||
print(f"WRONG [{c['q']}, {c['expect']}] {c['text']!r} -> {k} {probs[:2]}")
|
print(f"WRONG [{c['q']}, {c['expect']}] {c['text']!r} -> {k} {probs[:2]}")
|
||||||
|
print("want quick answered at once, by level: " + ", ".join(f"{lv} {h}/{n}" for lv, (n, h) in sorted(levels.items())))
|
||||||
print(f"{' '.join(ROUNDS)}: cases {len(cases)}, want quick {want}, answered at once {hit}, wrong quick answers {wrong}")
|
print(f"{' '.join(ROUNDS)}: cases {len(cases)}, want quick {want}, answered at once {hit}, wrong quick answers {wrong}")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ NEVER = [ # no motion at all from the bank
|
|||||||
("shake your head", False), ("pick up the pace", False), ("give it up for lumi", False),
|
("shake your head", False), ("pick up the pace", False), ("give it up for lumi", False),
|
||||||
("thanks for the wave", False), ("악수해 줘서 고마워요", False), ("close your eyes", False), ("의자 들어 줄래?", False),
|
("thanks for the wave", False), ("악수해 줘서 고마워요", False), ("close your eyes", False), ("의자 들어 줄래?", False),
|
||||||
("the kids want to wave at you", False), ("can my son shake your hand", False),
|
("the kids want to wave at you", False), ("can my son shake your hand", False),
|
||||||
|
("shaking hands is fun", False), ("you folded your arm earlier", False), ("손 펴도 돼?", False),
|
||||||
|
("팔 접는 게 좋아", False), ("you're good at opening your hand", False),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -171,14 +171,16 @@ def plan(text, held=False):
|
|||||||
for st in r["steps"]) + (" !" + r["problems"][0] if r["problems"] else "")
|
for st in r["steps"]) + (" !" + r["problems"][0] if r["problems"] else "")
|
||||||
if a == "fetch":
|
if a == "fetch":
|
||||||
t = r["task"]
|
t = r["task"]
|
||||||
return " ".join(x for x in ("fetch", t["colour"], t["object"], f"{where(t['source'])}>{where(t['dest'])}", t["finish"]) if x)
|
return " ".join(x for x in ("fetch", t.get("prefer"), t["colour"], t["object"], f"{where(t['source'])}>{where(t['dest'])}",
|
||||||
|
t["finish"]) if x)
|
||||||
if a in ("place", "give"):
|
if a in ("place", "give"):
|
||||||
return a + (" on " + where(r["task"]["on"]) if (r.get("task") or {}).get("on") else "")
|
return a + (" on " + where(r["task"]["on"]) if (r.get("task") or {}).get("on") else "")
|
||||||
if a == "carry":
|
if a == "carry":
|
||||||
return f"carry {where(r['task']['dest'])} {r['task'].get('then') or 'hold'}"
|
return f"carry {where(r['task']['dest'])} {r['task'].get('then') or 'hold'}"
|
||||||
if a == "command":
|
if a == "command":
|
||||||
return "stop" if r["sentence"] == "Stop." else "chain" if "parts" in r else \
|
return "stop" if r["sentence"] == "Stop." else "chain" if "parts" in r else \
|
||||||
"rule " + " ".join(x for x in r["rule"] if x) if "rule" in r else "talk"
|
"rule " + " ".join(x for x in r["rule"] if x) if "rule" in r else \
|
||||||
|
"talk:status" if r.get("talk") == "status" else "talk"
|
||||||
p = r.get("problems") or []
|
p = r.get("problems") or []
|
||||||
return "empty" if p and "hand is empty" in p[0] else "ask: " + p[0] if p else \
|
return "empty" if p and "hand is empty" in p[0] else "ask: " + p[0] if p else \
|
||||||
"ask: " + r["sentence"] if r.get("talk") == "refuse" else "talk"
|
"ask: " + r["sentence"] if r.get("talk") == "refuse" else "talk"
|
||||||
@@ -330,7 +332,47 @@ READ = [ # the owner's Korean cup / delivery list (2026-10-26 18:40), then mor
|
|||||||
("excuse me robot, first look me, then follow me", False, "chain"), ("야 루미, 오른쪽 보고 손 흔들어라", False, "chain"),
|
("excuse me robot, first look me, then follow me", False, "chain"), ("야 루미, 오른쪽 보고 손 흔들어라", False, "chain"),
|
||||||
("hello robot, first turn left, then lower yourself", False, "chain"),
|
("hello robot, first turn left, then lower yourself", False, "chain"),
|
||||||
("악수하고 lower yourself 해 주세요", False, "chain"), ("오늘 날짜 알리고 look left 해 주세요", False, "chain"),
|
("악수하고 lower yourself 해 주세요", False, "chain"), ("오늘 날짜 알리고 look left 해 주세요", False, "chain"),
|
||||||
("wave 하고 look left 해 줘", False, "chain"),
|
("wave 하고 look left 해 줘", False, "chain"), ("루미 님, 손 흔드시고 몸 내러 주시길 부탁드립니다", False, "chain"),
|
||||||
|
("몸내리고오른쪽으로돌아주라", False, "chain"), ("컵들고exit가서기다려", False, "pick cup; go exit; wait"),
|
||||||
|
("컵들고p5가서민수한테줘", False, "pick cup; go p5; give 민수"), ("컵 들구 p5 가서 기다리", False, "pick cup; go p5; wait"),
|
||||||
|
("wait at p5 with the cup", False, "pick cup; go p5; wait"), ("lemme see you go charge", False, "go home"),
|
||||||
|
("let me see you wave", False, "rule wave"), ("okay see you", False, "talk"), ("you come behind me", False, "rule follow"),
|
||||||
|
("here's your task: get over here", False, "talk"), ("Mina, what are you doing over there?", False, "talk"),
|
||||||
|
("민수야, 너 거기서 뭐 하고 있어?", False, "talk"), ("루미야 뭐 하고 있어?", False, "talk:status"),
|
||||||
|
("계속 들고 있어 주세요", True, "talk"), ("keep holding it", True, "talk"), ("just hold it", True, "talk"),
|
||||||
|
("give it back", True, "give"), ("돌려줘", True, "give"), ("hand it back to me", True, "give"), ("그거 다시 줘", True, "give"),
|
||||||
|
("put it back where you found it", True, "place"), ("원래 있던 데 놔 주세요", True, "place"),
|
||||||
|
("할머니께 이거 전해 드려", True, "give"), ("이거 저분께 드리세요", True, "give"), ("사장님께 드려 주십시오", True, "give"),
|
||||||
|
("그 컵 저 주시면 돼요", True, "give"), ("저한테 주시겠어요?", True, "give"), ("내놔", True, "give"), ("그거 이리 내", True, "give"),
|
||||||
|
("pass it to me", True, "give"), ("could I have it please", True, "give"), ("lemme have it", True, "give"),
|
||||||
|
("give it to that lady", True, "give"), ("테이블에 놔 주시면 돼요", True, "place on table"), ("내려놔 주십시오", True, "place"),
|
||||||
|
("p5로 가 주시겠어요?", True, "carry p5 hold"),
|
||||||
|
("gimme the cup", False, "pick cup; give"), ("could ya grab the cup", False, "pick cup"),
|
||||||
|
("can ya bring the cup to p5", False, "fetch cup here>p5 hold"), ("컵 줘요 빨리", False, "pick cup; give"),
|
||||||
|
("would you be a dear and fetch the cup from p1", False, "fetch cup p1>here hold"),
|
||||||
|
("kindly deliver the cup to p5", False, "pick cup; go p5; give"),
|
||||||
|
# which one and which side
|
||||||
|
("왼쪽 컵 집어", False, "pick cup left"), ("pick up the cup on the left", False, "pick cup left"),
|
||||||
|
("오른쪽에 있는 컵 집어 줘", False, "pick cup right"), ("grab the cup on your right", False, "pick cup right"),
|
||||||
|
("grab the smaller cup", False, "pick cup small"), ("작은 컵 집어 줘", False, "pick cup small"),
|
||||||
|
("제일 가까운 컵 집어", False, "pick cup near"),
|
||||||
|
("컵 p3 왼쪽 테이블에 놔", False, "pick cup; go p3; place left table"),
|
||||||
|
("put the cup on the left table at p3", False, "pick cup; go p3; place left table"),
|
||||||
|
("p3 왼쪽 테이블에 놔", True, "go p3; place left table"), ("put it on the left table at p3", True, "go p3; place left table"),
|
||||||
|
("오른쪽 테이블에 내려놔", True, "place right table"), ("오른쪽 테이블에 내려놔", False, "empty"),
|
||||||
|
("왼쪽 테이블에 있는 컵 가져와", False, "fetch left cup here>here hold"),
|
||||||
|
("bring me the cup from the right table", False, "fetch right cup here>here hold"),
|
||||||
|
# holding: the box reads the hand as voice does (E1's parity run, 2026-10-27): no motion on talk about it
|
||||||
|
("give me a shake", True, "talk"), ("you wave hand please", True, "talk"), ("로봇아, 핸드 오픈 해 주세요", True, "talk"),
|
||||||
|
("컵 내려놓지 마", True, "talk"), ("제자리에 놓지 마~", True, "talk"), ("탁자 위에 놓지 마 ㅋㅋ", True, "talk"),
|
||||||
|
("옆 테이블에 놓지 마세요", True, "talk"), ("루미는 나한테 건네줄 수 있대", True, "talk"), ("루미가 나한테 건네주는 걸 봤나", True, "talk"),
|
||||||
|
("mira mira put ur phone away honey", True, "talk"), ("캘리브레이션 보게, 아까 컵 내려어놓는 거 봤어?", True, "talk"),
|
||||||
|
("애들 재우고 싶다, 루미, 내놔 제발", True, "talk"), ("우리 루미, 이리 내놔 봐", True, "give"),
|
||||||
|
("로봇 씨, 나한테 지금 주십시오", True, "give"), ("할머니께 드려 봐", True, "give"), ("Lumi, I want you pass it to me", True, "give"),
|
||||||
|
("저한테 주실 수 있으신가요?", True, "give"), ("선생님께 드리세요", True, "give"), ("lower it down", True, "place"),
|
||||||
|
("you putt dawn that", True, "place"), ("lay it on this table lay it on this table please", True, "place"),
|
||||||
|
("왼쪽에 내려놓고 오른편 컵 잡아 줘", True, "chain"), ("put it back", True, "place"), ("제자리에 갖다 놔", True, "place"),
|
||||||
|
("pick up the cup on the left table", False, "pick cup left"), ("오른쪽 테이블에 있는 빨간 컵 집어 줘", False, "pick cup red right"),
|
||||||
("컵이랑 같이 p5로 가", False, "fetch cup here>p5 hold"), ("컵 하고 같이 exit 가 줘", False, "fetch cup here>exit hold"),
|
("컵이랑 같이 p5로 가", False, "fetch cup here>p5 hold"), ("컵 하고 같이 exit 가 줘", False, "fetch cup here>exit hold"),
|
||||||
("컵 가지고 p5에서 기다려", False, "pick cup; go p5; wait"), ("컵 들고 p5에 가 있어", False, "pick cup; go p5; wait"),
|
("컵 가지고 p5에서 기다려", False, "pick cup; go p5; wait"), ("컵 들고 p5에 가 있어", False, "pick cup; go p5; wait"),
|
||||||
("이 컵 p5까지 좀 날라 줘", False, "fetch cup here>p5 hold"), ("컵 좀 p5로 옮겨 줘", False, "fetch cup here>p5 hold"),
|
("이 컵 p5까지 좀 날라 줘", False, "fetch cup here>p5 hold"), ("컵 좀 p5로 옮겨 줘", False, "fetch cup here>p5 hold"),
|
||||||
|
|||||||
@@ -1135,6 +1135,9 @@ fetch._give = lambda say: (named.append(fetch.held_name()), fetch._set(holding=F
|
|||||||
st = run(fetch.run_steps, [{"do": "give"}])
|
st = run(fetch.run_steps, [{"do": "give"}])
|
||||||
fetch._give = real_give
|
fetch._give = real_give
|
||||||
assert st["status"] == "done" and named == ["the white cup"], (st["log"], named)
|
assert st["status"] == "done" and named == ["the white cup"], (st["log"], named)
|
||||||
|
fetch.held_by_skill({"object": "cup", "colour": "white"}) # a voice pick (skills.pick, not a fetch)
|
||||||
|
assert fetch.state()["held_object"] == {"object": "cup", "colour": "white"} and fetch.state()["status"] == "holding"
|
||||||
|
assert fetch.held_name() == "the white cup" and skills._held["what"]["object"] == "cup"
|
||||||
fetch._set(holding=True, held_object={"object": "cup", "colour": "white"})
|
fetch._set(holding=True, held_object={"object": "cup", "colour": "white"})
|
||||||
assert fetch.held_name("ko") == "흰 컵"
|
assert fetch.held_name("ko") == "흰 컵"
|
||||||
fetch._set(holding=True, held_object={"object": "bottle", "colour": None})
|
fetch._set(holding=True, held_object={"object": "bottle", "colour": None})
|
||||||
|
|||||||
@@ -159,7 +159,8 @@ HAND = {
|
|||||||
("put it on that table", True): ("place", {"name": "dining table", "colour": None}),
|
("put it on that table", True): ("place", {"name": "dining table", "colour": None}),
|
||||||
("open your hand", True): ("refuse", brain.REFUSE_OPEN), ("손 펴", True): ("refuse", brain.REFUSE_OPEN),
|
("open your hand", True): ("refuse", brain.REFUSE_OPEN), ("손 펴", True): ("refuse", brain.REFUSE_OPEN),
|
||||||
("open your hand", False): None, ("take the cup", False): None, ("give me the cup", False): None,
|
("open your hand", False): None, ("take the cup", False): None, ("give me the cup", False): None,
|
||||||
("grab that cup on the table", False): None, ("give it to Mina", True): None, ("put it back", True): None,
|
("grab that cup on the table", False): None, ("give it to Mina", True): ("give", None), # as "미나한테 줘": given here
|
||||||
|
("put it back", True): None,
|
||||||
("take it to p2 and put it on the table", True): None, ("just hold it", True): None,
|
("take it to p2 and put it on the table", True): None, ("just hold it", True): None,
|
||||||
("can you give things to people?", False): None, ("don't give it to him", True): None, ("팔 거둬", True): None,
|
("can you give things to people?", False): None, ("don't give it to him", True): None, ("팔 거둬", True): None,
|
||||||
("what happens if I put something in your hand?", False): None, ("I get it", False): None,
|
("what happens if I put something in your hand?", False): None, ("I get it", False): None,
|
||||||
|
|||||||
@@ -57,6 +57,10 @@ def main():
|
|||||||
("", "블루투스 이름은 왜 그렇게 지었나?", ["블루투스"]),
|
("", "블루투스 이름은 왜 그렇게 지었나?", ["블루투스"]),
|
||||||
("", "에펠탑의 높이는 얼마예요?", ["에펠탑"]),
|
("", "에펠탑의 높이는 얼마예요?", ["에펠탑"]),
|
||||||
("", "너 이름은 뭐야?", []),
|
("", "너 이름은 뭐야?", []),
|
||||||
|
("emoji 얘기 좀 해 줘요", "Hey, 실례지만 처음 만든 해 언제인지 알려 주시겠습니까", ["emoji"]),
|
||||||
|
("", "tell me about mirrors", ["mirrors"]),
|
||||||
|
("", "아까 그 얘기 다시 해 줘", []),
|
||||||
|
("", "네 얘기 좀 해 봐", []),
|
||||||
("", "루미 이름은 누가 지었어?", []),
|
("", "루미 이름은 누가 지었어?", []),
|
||||||
("문어는 피가 무슨 색이야?", "심장은 몇 개고?", ["문어", "심장"])]:
|
("문어는 피가 무슨 색이야?", "심장은 몇 개고?", ["문어", "심장"])]:
|
||||||
b = brain.Brain()
|
b = brain.Brain()
|
||||||
@@ -70,6 +74,16 @@ def main():
|
|||||||
assert b._after(none, "몇 살이야?")["action"] == "search"
|
assert b._after(none, "몇 살이야?")["action"] == "search"
|
||||||
assert b._after(none, "그게 뭐예요?")["action"] == "search"
|
assert b._after(none, "그게 뭐예요?")["action"] == "search"
|
||||||
|
|
||||||
|
b = brain.Brain() # back to an earlier topic: that turn's answer as a hint
|
||||||
|
b.history = [("페트라가 뭐야?", "ACTION: none -\n요르단에 있는 바위를 깎아 만든 도시예요."),
|
||||||
|
("물곰은 얼마나 작아?", "ACTION: none -\n0.5mm 정도예요."), ("그거 사실이야?", "ACTION: none -\n네.")]
|
||||||
|
assert "요르단" in b._back_to("다시 페트라 얘기로 돌아가서, 뭐라고 했지?")
|
||||||
|
assert "요르단" in b._fragment_hint("다시 페트라 얘기로 돌아가서, 뭐라고 했지?")
|
||||||
|
assert b._back_to("물곰은 왜 안 죽어?") == ""
|
||||||
|
b.history = [("Tell me about hydrogen", "ACTION: none -\nHydrogen is the most common element."),
|
||||||
|
("What is salt for?", "ACTION: none -\nSeasoning."), ("ok", "ACTION: none -\nSure.")]
|
||||||
|
assert "most common" in b._back_to("again about hydrogen, what did you say?")
|
||||||
|
|
||||||
picked = []
|
picked = []
|
||||||
talk_examples.pick = lambda said, lang, k=4, bank=None: picked.append(bank) or []
|
talk_examples.pick = lambda said, lang, k=4, bank=None: picked.append(bank) or []
|
||||||
brain._examples("윤초는 뭐예요?", world=True)
|
brain._examples("윤초는 뭐예요?", world=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user