Fix stop words with a call before them, low-table put-downs and battery questions
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -1247,7 +1247,7 @@ def _held_parse(body, markers, said=None):
|
|||||||
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
|
||||||
m, t = brain._mentions(text, markers), brain._norm(text)
|
m, t = brain._mentions(text, markers), brain._norm(text, markers) # "booth 3" is the map's booth_3
|
||||||
if isinstance(m.get("source"), dict) and not brain.held_command(text): # "take the bottle from p2": a new fetch
|
if isinstance(m.get("source"), dict) and not brain.held_command(text): # "take the bottle from p2": a new fetch
|
||||||
return {"action": None, "task": None, "sentence": "–", "problems": [
|
return {"action": None, "task": None, "sentence": "–", "problems": [
|
||||||
f"I'm holding {held}: give it to you, put it on a table, or say where to bring it first."]}
|
f"I'm holding {held}: give it to you, put it on a table, or say where to bring it first."]}
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ LONG = {"en": "I talk with you in English and Korean, and when I don't know some
|
|||||||
"따라가요. 그리고 손을 흔들거나 판타스틱 베이비, 러브 어택 같은 제 노래도 불러 드려요."}
|
"따라가요. 그리고 손을 흔들거나 판타스틱 베이비, 러브 어택 같은 제 노래도 불러 드려요."}
|
||||||
|
|
||||||
|
|
||||||
NOT_LUMI = re.compile(r"\b(?:cutshion|company|jaka)\b|쿳션|회사|자카|안전", re.I) # "쿳션은 무슨 일 해?", "안전 기능 뭐 있어?"
|
NOT_LUMI = re.compile(r"\b(?:cutshion|company|jaka|languages?)\b|쿳션|회사|자카|안전|랭귀지|언어|외국어|영어|한국어|일본어|중국어", re.I)
|
||||||
|
# "쿳션은 무슨 일 해?", "안전 기능 뭐 있어?", "랭귀지 뭐 할 수 있어?" (the languages: quick_answers)
|
||||||
|
|
||||||
|
|
||||||
def asked(text):
|
def asked(text):
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ _BANK = {
|
|||||||
("Could you carry my 5 kg backpack?", "none", "No, that's too heavy for me: about 1 kg in my hand."),
|
("Could you carry my 5 kg backpack?", "none", "No, that's too heavy for me: about 1 kg in my hand."),
|
||||||
("Wave at me while you hold that cup.", "none", "Not while I'm holding the cup: it could fall. Shall I put it down first?"),
|
("Wave at me while you hold that cup.", "none", "Not while I'm holding the cup: it could fall. Shall I put it down first?"),
|
||||||
("How far away can you hear me?", "none", "From about 3 to 5 metres."),
|
("How far away can you hear me?", "none", "From about 3 to 5 metres."),
|
||||||
|
("Three hours on one charge, I guess?", "none", "No, about 10 hours on a charge."),
|
||||||
("Rise up so we're face to face.", "lift up", "Sure, going up."),
|
("Rise up so we're face to face.", "lift up", "Sure, going up."),
|
||||||
("Spread those fingers of yours.", "arm open", "Opening my hand."),
|
("Spread those fingers of yours.", "arm open", "Opening my hand."),
|
||||||
],
|
],
|
||||||
@@ -180,6 +181,7 @@ _BANK = {
|
|||||||
("내가 초속 3미터로 뛰면 따라올 수 있어?", "none", "아니요, 제 최고 속도는 초속 1.2미터예요."),
|
("내가 초속 3미터로 뛰면 따라올 수 있어?", "none", "아니요, 제 최고 속도는 초속 1.2미터예요."),
|
||||||
("컵 든 채로 손 흔들어 줘~", "none", "컵을 들고 있어서 지금은 손을 흔들 수 없어요. 먼저 내려놓을까요?"),
|
("컵 든 채로 손 흔들어 줘~", "none", "컵을 들고 있어서 지금은 손을 흔들 수 없어요. 먼저 내려놓을까요?"),
|
||||||
("몇 미터 떨어져서 말해도 들리시나요?", "none", "3미터에서 5미터 정도까지 잘 들려요."),
|
("몇 미터 떨어져서 말해도 들리시나요?", "none", "3미터에서 5미터 정도까지 잘 들려요."),
|
||||||
|
("배터리 을매나 가노? 세 시간쯤 가나?", "none", "아니요, 한 번 충전하면 10시간쯤 가요."),
|
||||||
("날 좀 똑바로 쳐다봐 주이소.", "look me", "네, 보고 있어요."),
|
("날 좀 똑바로 쳐다봐 주이소.", "look me", "네, 보고 있어요."),
|
||||||
("집게 좀 벌려 보십시오.", "arm open", "네, 손을 벌리겠습니다."),
|
("집게 좀 벌려 보십시오.", "arm open", "네, 손을 벌리겠습니다."),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -223,6 +223,8 @@ GIVE = [
|
|||||||
"i'll take it", "i'll take it from you", "let me take it", "let me take that", "hand it on over", "pass that to me",
|
"i'll take it", "i'll take it from you", "let me take it", "let me take that", "hand it on over", "pass that to me",
|
||||||
"give that to me now", "give it to me please", "give me the thing", "give it, please", "hand it",
|
"give that to me now", "give it to me please", "give me the thing", "give it, please", "hand it",
|
||||||
"you give me please", "give me now", "now give me",
|
"you give me please", "give me now", "now give me",
|
||||||
|
"hand me that", "hand me that, thank you", "hand me that, thank you very much", "pass me that, thanks",
|
||||||
|
"hand that over, thank you", "hand me that one please",
|
||||||
"그거 나 줘", "이리 내", "이리 내놔", "내놔", "그거 내놔", "그거 이리 넘겨", "건네 줘", "넘겨 줘", "저한테 넘겨 주세요",
|
"그거 나 줘", "이리 내", "이리 내놔", "내놔", "그거 내놔", "그거 이리 넘겨", "건네 줘", "넘겨 줘", "저한테 넘겨 주세요",
|
||||||
"저 주십시오", "나한테 줘", "제게 주시겠어요?", "그거 받을게", "제가 받겠습니다", "주라", "줘 봐라", "그거 주소",
|
"저 주십시오", "나한테 줘", "제게 주시겠어요?", "그거 받을게", "제가 받겠습니다", "주라", "줘 봐라", "그거 주소",
|
||||||
"이리 주이소", "그거 주쇼", "이리 도", "그거 나 도", "줘유", "기브 미", "give 해 줘", "그거 이리 주시게",
|
"이리 주이소", "그거 주쇼", "이리 도", "그거 나 도", "줘유", "기브 미", "give 해 줘", "그거 이리 주시게",
|
||||||
@@ -632,5 +634,158 @@ PICK += ["<obj> 픽업 해", "<obj> 픽업 해 줘", "<obj> grab 해 줄 수 있
|
|||||||
NO += ["송 불러 줘", "송 하나 불러", "송 틀어 줘", "생일 송 불러 줘", "노래 송 틀어", "손 송 노래", "drop the beat", "drop the mic",
|
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"]
|
"let it go 불러 줘", "sing let it go", "release the song", "give everyone a break", "give everyone a minute"]
|
||||||
|
|
||||||
|
|
||||||
|
# ---------- fresh negatives (new frames and slang) and arm things Lumi can't do: all "no" ----------
|
||||||
|
NEG2_EN = {"wave": ("wave", "waved", "waving"), "shake": ("shake my hand", "shook my hand", "shaking hands"),
|
||||||
|
"reach": ("reach out", "reached out", "reaching out"), "fold": ("put your arm down", "put your arm down", "putting your arm down"),
|
||||||
|
"open": ("open the gripper", "opened the gripper", "opening the gripper"),
|
||||||
|
"close": ("make a fist", "made a fist", "making a fist"), "pick": ("grab the bottle", "grabbed the bottle", "grabbing the bottle"),
|
||||||
|
"fetch": ("fetch the cup", "fetched the cup", "fetching the cup")}
|
||||||
|
_neg2 = []
|
||||||
|
for base, past, ing in NEG2_EN.values():
|
||||||
|
_neg2 += [f"nah, don't {base}", f"bro don't {base}", f"plz don't {base}", f"u don't gotta {base}", f"no {ing} please",
|
||||||
|
f"quit {ing}", f"enough {ing}", f"you {past} like five minutes ago", f"you already {past}",
|
||||||
|
f"remember when you {past}?", f"lol you {past} at me", f"bet you can't {base}", f"i dare you not to {base}",
|
||||||
|
f"would you {base} if i asked?", f"are you gonna {base}?", f"is it hard to {base}?", f"how do you {base}?",
|
||||||
|
f"what happens if you {base}?", f"do robots like to {base}?", f"my little brother can {base} too",
|
||||||
|
f"my robot at home can {base}", f"the other robot {past} at me", f"once the show starts, {base}",
|
||||||
|
f"only {base} when the music stops", f"after lunch you can {base}", f"{base} in an hour",
|
||||||
|
f"jiwoo, {base}", f"Sarah, {base}", f"kids, {base}", f"guys, {base}", f"i'm gonna {base} now", f"let me {base} first",
|
||||||
|
f"{ing} looks easy", f"{ing} must be boring for you", f"love the way you {base}", f"you {base} so smoothly"]
|
||||||
|
NEG2_KO = {"wave": ("손 흔들", "손 흔들었", "손 흔드는", "손 흔들", "손 흔들어"), "shake": ("악수하", "악수했", "악수하는", "악수할", "악수해"),
|
||||||
|
"reach": ("팔 뻗", "팔 뻗었", "팔 뻗는", "팔 뻗을", "팔 뻗어"), "fold": ("팔 거두", "팔 거뒀", "팔 거두는", "팔 거둘", "팔 거둬"),
|
||||||
|
"open": ("그리퍼 열", "그리퍼 열었", "그리퍼 여는", "그리퍼 열", "그리퍼 열어"),
|
||||||
|
"close": ("주먹 쥐", "주먹 쥐었", "주먹 쥐는", "주먹 쥘", "주먹 쥐어"), "pick": ("병 집", "병 집었", "병 집는", "병 집을", "병 집어"),
|
||||||
|
"fetch": ("컵 갖다주", "컵 갖다줬", "컵 갖다주는", "컵 갖다줄", "컵 갖다줘")}
|
||||||
|
|
||||||
|
for stem, past, adn, fut, imp in NEG2_KO.values():
|
||||||
|
_neg2 += [f"{stem}지 마라", f"{stem}지 마쇼", f"{stem}지 말게", f"{stem}지 마유", f"{stem}지 마 ㅋㅋ", f"{stem}지 않아도 됩니다",
|
||||||
|
f"{stem}기 싫어", f"{stem}기 전에 물어봐", f"{past}던데?", f"{past}다며?", f"방금 {past}지?",
|
||||||
|
f"{past}을 때 귀여웠어", f"{adn} 거 또 보고 싶다", f"{adn} 거 어떻게 배웠어?", f"{adn} 게 힘들어?", f"{adn} 로봇 처음 봐",
|
||||||
|
f"{fut} 수 있으려나", f"{fut} 수 있다고 들었어", f"{fut} 거야?", f"{fut} 때 말해 줘", f"공연 끝나면 {stem}자",
|
||||||
|
f"점심 먹고 {stem}자", f"한 시간 뒤에 {stem}기", f"지우야 {imp} 봐", f"얘들아 {imp} 봐", f"우리 동생도 {fut} 줄 알아",
|
||||||
|
f"나도 {fut} 수 있어", f"{adn} 거 별로야", f"{adn} 거 대박", f"{adn} 거 ㄹㅇ 신기"]
|
||||||
|
ARM_CANT = [ # arm things Lumi can't do: nothing must move (the LLM says why)
|
||||||
|
"arm wrestle with me", "let's arm wrestle", "팔씨름 한판 하자", "팔씨름 하실래요?", "swing your arm around fast", "팔 막 휘둘러 봐",
|
||||||
|
"팔 빙빙 돌려 봐", "spin your arm in circles", "make a finger heart", "손가락 하트 해 주세요", "do the flower pose", "꽃받침 해 줘",
|
||||||
|
"꽃받침 포즈 해 주세요", "make a v sign", "브이 해 줘", "브이 포즈 해 주세요", "give me a thumbs up", "엄지 척 해 주세요", "따봉 해 줘",
|
||||||
|
"clap for us", "박수 쳐 주세요", "박수 좀 쳐 봐", "count to five on your fingers", "손가락으로 다섯까지 세 봐", "scratch my back",
|
||||||
|
"등 좀 긁어 줘", "등 긁어 주세요", "tap my friend on the shoulder", "내 친구 어깨 좀 톡톡 쳐 줘", "take a selfie with your arm",
|
||||||
|
"팔로 셀카 찍어 줘", "hold my umbrella", "우산 좀 들어 줘", "우산 씌워 주세요", "hold my baby", "아기 좀 안아 줘", "애기 좀 잠깐 들고 있어",
|
||||||
|
"hold this hot pot", "뜨거운 주전자 좀 들어 줘", "stir my coffee", "커피 좀 저어 줘", "pour me some water", "물 좀 따라 줘",
|
||||||
|
"물 따라 주세요", "wipe the table", "테이블 좀 닦아 줘", "wash my cup", "컵 좀 씻어 주세요", "cut this ribbon", "이 리본 잘라 줘",
|
||||||
|
"tie my shoes", "신발 끈 묶어 줘", "turn the page", "책장 넘겨 줘", "type on my laptop", "노트북에 타자 쳐 줘", "write my name",
|
||||||
|
"내 이름 써 줘", "open this bottle", "병뚜껑 따 줘", "이 병 좀 열어 주세요", "open the drawer", "서랍 열어 줘", "open my umbrella",
|
||||||
|
"우산 펴 줘", "knock on the door", "문 두드려 줘", "press the button", "그 버튼 눌러 줘", "엘리베이터 버튼 눌러 주세요",
|
||||||
|
"punch the wall", "벽 쳐 봐", "주먹으로 벽 쳐", "toss me the ball", "공 던져 줘", "throw it to me", "던져 줘", "kick the ball",
|
||||||
|
"공 차 줘", "feed me", "밥 먹여 줘", "carry my suitcase", "캐리어 좀 끌어 줘", "carry this heavy box", "이 무거운 상자 들어 줘",
|
||||||
|
"hand out these flyers", "전단지 좀 나눠 줘", "give me a tissue", "휴지 한 장 줘", "hold the door", "문 좀 잡아 줘",
|
||||||
|
"raise the cup over your head", "컵 머리 위로 들어", "shake the cup", "컵 흔들어 봐", "clink cups with me", "건배하자 컵 부딪혀",
|
||||||
|
"wave with the cup in your hand", "컵 든 채로 손 흔들어", "pick it up off the floor", "바닥에 있는 거 주워 줘", "바닥에 떨어진 컵 주워",
|
||||||
|
]
|
||||||
|
NO += [t for t in _neg2 if not t.startswith(("jiwoo,", "Sarah,", "kids,", "guys,", "지우야", "얘들아"))] + ARM_CANT
|
||||||
|
|
||||||
|
|
||||||
|
# ---------- very formal Korean frames, cute endings, English frames (r12 gaps); "the moment …", "can your model …" ----------
|
||||||
|
KO_END9 = [" 주십사 부탁드립니다", " 주실 것을 요청드립니다", " 주시기를 요청합니다", " 주지 않겠는가", " 주실 수 있으신지요",
|
||||||
|
" 주실 수 있으신지요? 부탁드려요", " 줘용 응응", " 줘 응응", " 줄래 ㅎ? 응응?", " 주시기를 부탁드립니다", " 줘라 응"]
|
||||||
|
KO_DO9 = ["{}도록 하게", "{}도록 하세요", "{}도록 하십시오"]
|
||||||
|
KO_SI9 = ["{}시기 바랍니다", "{}시겠습니까", "{}시지 않겠습니까"]
|
||||||
|
SI_STEM = {"손 흔들": "손 흔드", "손 내밀": "손 내미", "팔 뻗": "팔 뻗으", "팔 접": "팔 접으", "<obj> 집": "<obj> 집으"} # + 시
|
||||||
|
EN_FR9 = ["your mission, should you accept it: {}", "care to {}", "any time now, {}", "{} for little old me",
|
||||||
|
"{}, would you be a star", "{}, much obliged", "on the double, {}", "{}, good good", "{} now is ok",
|
||||||
|
"make for me {}", "lumi dear, {}", "lumi my friend, {}"]
|
||||||
|
CORES9 = {
|
||||||
|
"WAVE": (["shake hands with me", "wave goodbye", "wave at us"], ["손 흔들어", "악수해", "잘 가라고 손 흔들어"], ["손 흔들", "악수하"]),
|
||||||
|
"ARM_REACH": (["hold out your hand", "give me your hand"], ["손 내밀어", "팔 뻗어", "손 줘"], ["손 내밀", "팔 뻗"]),
|
||||||
|
"ARM_FOLD": (["put your arm back", "fold your arm"], ["팔 접어", "팔 원래대로 돌려놔", "암 원래대로 돌려놔"], ["팔 접", "팔 거두"]),
|
||||||
|
"ARM_OPEN": (["open your hand"], ["손 펴", "손 벌려"], ["손 펴"]),
|
||||||
|
"ARM_CLOSE": (["close your hand", "make a fist"], ["손 오므려", "주먹 쥐어"], ["주먹 쥐"]),
|
||||||
|
"PICK": (["pick up the <obj>", "get hold of the <obj>"], ["<obj> 집어", "<obj> 집어 올려", "<obj> 들어"], ["<obj> 집"]),
|
||||||
|
"FETCH": (["bring me the <obj>"], ["<obj> 가져와", "<obj> 갖다"], ["<obj> 가져오"]),
|
||||||
|
}
|
||||||
|
for k, (en, ko, stems) in CORES9.items():
|
||||||
|
_more = [f.format(c) for c in en for f in EN_FR9] + [c + e for c in ko for e in KO_END9] + \
|
||||||
|
[f.format(s) for s in stems for f in KO_DO9] + [f.format(SI_STEM.get(s, s)) for s in stems for f in KO_SI9]
|
||||||
|
{"WAVE": WAVE, "ARM_REACH": ARM_REACH, "ARM_FOLD": ARM_FOLD, "ARM_OPEN": ARM_OPEN, "ARM_CLOSE": ARM_CLOSE, "PICK": PICK,
|
||||||
|
"FETCH": FETCH}[k].extend(_more)
|
||||||
|
NO += [
|
||||||
|
"the moment the bell rings, bring me the cup", "the moment the music starts, wave", "the second i clap, shake my hand",
|
||||||
|
"the minute she arrives, hold out your hand", "the instant i say go, pick up the cup", "벨 울리는 순간 컵 가져와",
|
||||||
|
"음악 시작하는 순간 손 흔들어", "out of curiosity, can your model pick up a cup", "can your model wave",
|
||||||
|
"can this model shake hands", "does your model have a gripper", "just curious, can your arm reach the table",
|
||||||
|
"궁금해서 그런데 이 모델도 컵 집을 수 있어?", "이 모델은 악수도 돼?", "컵 흔들어 봐", "컵 들고 흔들어", "컵 든 채로 손 흔들어 봐",
|
||||||
|
"hold the cup and wave", "wave the cup around", "shake the cup for me",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# ---------- r13 gaps: arm things said another way, and arm things Lumi can't do said like an order ----------
|
||||||
|
ARM_REACH += _ko(["손 가까이 가져와", "손 좀 가까이 가져와", "손 이쪽으로 가져와", "팔 가까이 가져와", "핸드 한 번만 내밀어",
|
||||||
|
"꼬마한테 핸드 내밀어", "우리 아들한테 손 뻗어"], ["", " 줘", " 주라", " 주시길 바랍니다", " 주시길 부탁드립니다", " 줘, 응?"]) + [
|
||||||
|
"bring your hand closer", "bring your hand closer to me", "move your hand closer", "your hand a bit closer please",
|
||||||
|
"hand closer", "reach your hand closer to me"]
|
||||||
|
ARM_FOLD += _ko(["팔 좀 쉬게 해", "팔 쉬게 해", "암 다시 접어", "손 거둬라 카이", "팔 접어라 카이", "팔 좀 쉬어"],
|
||||||
|
["", " 줘", " 주세요", " 주실 수 있으신가요?", " 주시게"]) + ["let your arm rest", "give your arm a rest", "rest that arm"]
|
||||||
|
ARM_OPEN += ["spread your claw", "spread your claw all the way", "open your claw all the way", "spread the claw wide",
|
||||||
|
"claw open", "집게 활짝 펴", "집게 쫙 벌려"]
|
||||||
|
WAVE += ["give us a big wave from up high", "big wave from up high", "wave high up", "wave up high", "손 높이 들고 흔들어",
|
||||||
|
"손 위로 높이 흔들어 줘"]
|
||||||
|
PICK += _ko(["앞에 있는 잔 들어", "그 잔 들어", "잔 집어", "잔 하나 들어"], ["", " 줄래요?", "라", " 주세요"])
|
||||||
|
NO += [
|
||||||
|
"팔 막 휘둘러", "팔 세게 휘둘러 봐", "팔 미친 듯이 흔들어", "flail your arm", "swing your arm wildly",
|
||||||
|
"wave your arm like crazy", "pick the bottle up off the floor", "grab the cup down there on the ground", "pick it up from the ground",
|
||||||
|
"바닥에 있는 병 집어", "땅에 떨어진 컵 주워 줘", "바닥에서 컵 집어 줘", "손가락 세 개 펴", "손가락 두 개만 펴 봐",
|
||||||
|
"손가락 하나 펴", "show me three fingers", "hold up two fingers", "양손에 컵 하나씩 들 수 있어?", "두 손으로 컵 들 수 있으세요?",
|
||||||
|
"can you hold a cup in each hand?", "이 컵 2층으로 가져가 줘", "이 컵 위층으로 갖다 줘", "take this cup upstairs",
|
||||||
|
"carry this cup to the second floor", "꾸벅 인사 해", "꾸벅 인사 해 주라", "고개 숙여 인사해", "bow to the guests",
|
||||||
|
"hand open이야", "hand open 상태야", "손 open이야", "그리퍼 open이야", "hand close야", "손 오픈 상태야", "your hand is open now",
|
||||||
|
"경례 해", "거수경례 해 주게나", "salute like a soldier", "손 들어 경례", "put your hand up like a student", "손 들어 질문하는 것처럼",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# ---------- third negative sweep: quotes, hypotheticals, wishes, permission, how-to, sarcasm, 못 / 안, -거든, tags ----------
|
||||||
|
NEG3_EN = [("wave", "waving"), ("shake hands", "shaking hands"), ("hold out your hand", "holding out your hand"),
|
||||||
|
("fold your arm", "folding your arm"), ("open your hand", "opening your hand"), ("close your hand", "closing your hand"),
|
||||||
|
("pick up the cup", "picking up the cup"), ("bring me the cup", "bringing me the cup")]
|
||||||
|
_neg3 = []
|
||||||
|
for b, ing in NEG3_EN:
|
||||||
|
_neg3 += [f"he said '{b}'", f"she told you to {b}, didn't she", f"the sign says {b}", f"the manual says {b}",
|
||||||
|
f"what if you {b}?", f"imagine if you could {b}", f"pretend to {b}", f"i wish you would {b}", f"i hope you {b} someday",
|
||||||
|
f"how do i make you {b}?", f"teach me how to make you {b}",
|
||||||
|
f"oh great, now you {b}", f"you can't even {b}",
|
||||||
|
f"don't you dare {b}", f"next time {b}", f"{ing} again? no",
|
||||||
|
f"no more {ing} today", f"try not {ing}", f"stop trying to {b}"]
|
||||||
|
NEG3_KO = [("손 흔들", "손 흔들어", "손 흔드는"), ("악수하", "악수해", "악수하는"), ("손 내밀", "손 내밀어", "손 내미는"),
|
||||||
|
("팔 접", "팔 접어", "팔 접는"), ("손 펴", "손 펴", "손 펴는"), ("주먹 쥐", "주먹 쥐어", "주먹 쥐는"),
|
||||||
|
("컵 집", "컵 집어", "컵 집는"), ("컵 가져오", "컵 가져와", "컵 가져오는")]
|
||||||
|
for st, imp, adn in NEG3_KO:
|
||||||
|
_neg3 += [f"엄마가 '{imp}' 하래", f"선생님이 {imp} 보래", f"{imp} 보라고 했던가?", f"만약에 {imp} 주면 어떨까", f"{imp} 주면 좋을 텐데",
|
||||||
|
f"{imp} 주는 날이 오겠지", f"{st}는 법 알려 줘", f"어떻게 하면 {imp} 줘?", f"{imp} 달라고 해도 돼?", f"제가 {imp} 달라고 해도 될까요?",
|
||||||
|
f"{st}지도 못하면서", f"{st}지 못하지?", f"너 {st}지 못하잖아", f"{st}기는 무슨", f"{imp} 주긴 뭘 {imp} 줘",
|
||||||
|
f"{st}거든 말해", f"손님 오시거든 {imp}", f"내가 신호 주면 {imp}", f"끝날 때 {imp}", f"{imp} 줄 거지?", f"{imp} 주는 거 맞지?",
|
||||||
|
f"{st}지 마 제발", f"그만 {st}어", f"이제 {st}지 말자", f"{adn} 연습 중이야?"]
|
||||||
|
NO += _neg3
|
||||||
|
|
||||||
|
|
||||||
|
# ---------- arm-set misses after round 2: "next thing: …", "test one: …", "-해 주면 땡큐", dialect, slips ----------
|
||||||
|
WAVE += [
|
||||||
|
"악수해 보이소", "악수해 주소", "우리 악수해 주소", "반갑게 악수 해 주쇼", "sake hands", "sake hands now", "shak hands",
|
||||||
|
"wave, it'll be epic", "yo, wave, it'll be fun", "next thing: wave", "test one: wave", "wave 해 주면 땡큐"]
|
||||||
|
ARM_REACH += [
|
||||||
|
"stick your arm out to me", "stick your arm out to me real quick", "your han, please", "your hand, please robot",
|
||||||
|
"hand out 해 주면 땡큐", "손 out 해", "지금 손 out 해", "손 reach 부탁드려요", "next thing: hold out your hand",
|
||||||
|
"test one: reach out"]
|
||||||
|
ARM_FOLD += [
|
||||||
|
"손 이제 내러 주실래요", "손 이제 내려 주소", "팔 원래대로 돌려어 볼래요", "retract 부탁해요", "retract 해 줄래", "팔 제자리로 빨리 가져와라", "팔 제자리로 가져와",
|
||||||
|
"팔 bakc 해 봐", "팔 백 해 봐", "next thing: fold your arm"]
|
||||||
|
ARM_OPEN += [
|
||||||
|
"you hand open", "you hand open please", "open up! do it!", "open up, do it", "next thing: open your hand",
|
||||||
|
"next thing: open hand", "test one: spread your fingers", "spread ur fingers", "손 open 해 봐",
|
||||||
|
"release please 해 줘", "송가락 벌려", "송가락 벌려 주면 좋겠어", "let it go, open your hand"]
|
||||||
|
ARM_CLOSE += [
|
||||||
|
"grip", "grip please", "grip 가능?", "grip 가자", "그리퍼 close 가자", "gripper close 해 주면 땡큐", "close hand, will ya",
|
||||||
|
"close hand please", "손 지금 닫아 줘", "음주먹쥐어라", "주먹쥐어라", "next thing: make a fist", "test one: close your hand",
|
||||||
|
"teacher said I can ask you: close the gripper"]
|
||||||
|
|
||||||
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}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ VERBS = {
|
|||||||
# 하게체, dialect (경상 / 전라 / 충청), written slips and suggestions
|
# 하게체, dialect (경상 / 전라 / 충청), written slips and suggestions
|
||||||
ENDS = [
|
ENDS = [
|
||||||
"{a}", "{a} 줘", "{a} 봐", "{a}라", "{a} 줄래?", "{a} 줄 수 있어?", "{a} 주라", "{a} 줘라", "{a} 봐 봐", "{a}줘", "{a}봐",
|
"{a}", "{a} 줘", "{a} 봐", "{a}라", "{a} 줄래?", "{a} 줄 수 있어?", "{a} 주라", "{a} 줘라", "{a} 봐 봐", "{a}줘", "{a}봐",
|
||||||
"{a} 줄래 응?", "{a} 주지 않을래?", "{a} 줄 수 있겠어?", "{a} 주는 거 어때?",
|
"{a} 줄래 응?", "{a} 주지 않을래?", "{a} 줄 수 있겠어?",
|
||||||
"{a}요", "{a} 줘요", "{a} 주세요", "{a} 봐요", "{a} 줄래요?", "{a} 주실래요?", "{a} 주시겠어요?", "{a} 주실 수 있어요?",
|
"{a}요", "{a} 줘요", "{a} 주세요", "{a} 봐요", "{a} 줄래요?", "{a} 주실래요?", "{a} 주시겠어요?", "{a} 주실 수 있어요?",
|
||||||
"{a} 주셔요", "{a} 주셔", "{a} 주시지 않겠어요?", "{a} 주셨으면 해요", "{a} 주시면 감사하겠습니다",
|
"{a} 주셔요", "{a} 주셔", "{a} 주시지 않겠어요?", "{a} 주셨으면 해요", "{a} 주시면 감사하겠습니다",
|
||||||
"{s}세요", "{s}시겠어요?", "{s}실래요?", "{s}시죠",
|
"{s}세요", "{s}시겠어요?", "{s}실래요?", "{s}시죠",
|
||||||
@@ -127,3 +127,35 @@ if __name__ == "__main__":
|
|||||||
for k, v in INTENT.items():
|
for k, v in INTENT.items():
|
||||||
print(f"{k:10} {len(v)}")
|
print(f"{k:10} {len(v)}")
|
||||||
print("total", sum(map(len, INTENT.values())))
|
print("total", sum(map(len, INTENT.values())))
|
||||||
|
|
||||||
|
|
||||||
|
# ---------- Konglish: English words with Korean verbs and endings ("me 봐", "턴 레프트 해 주세요", "p3로 무브해") ----------
|
||||||
|
HAE = ["{a} 해", "{a} 해 줘", "{a}해 줘", "{a} 해 주세요", "{a} 해 주십시오", "{a} 해 줄래?", "{a} 해 주실래요?", "{a} 해 봐",
|
||||||
|
"{a} 해라", "{a} 해 주이소", "{a} 해 줘잉", "{a} 해 주게", "{a} 해 줘유", "{a} 좀 해 줘", "{a} 해 주세여", "{a} 하세요",
|
||||||
|
"{a} 하십시오", "{a} 해져", "{a} 해 주라", "{a} 해 주시겠어요?"]
|
||||||
|
|
||||||
|
|
||||||
|
def _hae(cores):
|
||||||
|
return list(dict.fromkeys(e.format(a=c) for c in cores for e in HAE))
|
||||||
|
|
||||||
|
|
||||||
|
KONGLISH = {
|
||||||
|
"look": _make(["me ", "여기 ", "here ", "left ", "right ", "up ", "down ", "front ", "레프트 ", "라이트 ", "업 ", "다운 ",
|
||||||
|
"프론트 ", "left 쪽 ", "right 쪽 ", "위 쪽 "], ["봐"]) +
|
||||||
|
_hae(["look 여기", "look me", "look at me", "look up", "look down", "look left", "look right", "head left",
|
||||||
|
"head right", "head up", "head down", "룩 업", "룩 다운", "룩 레프트", "룩 라이트", "룩 앳 미"]),
|
||||||
|
"turn": _hae(["턴 레프트", "턴 라이트", "레프트 턴", "라이트 턴", "left로 턴", "right로 턴", "왼쪽으로 턴", "오른쪽으로 턴",
|
||||||
|
"turn left", "turn right", "left turn", "right turn", "유턴", "u턴", "turn around"]),
|
||||||
|
"move": _hae(["forward로 무브", "back으로 무브", "앞으로 무브", "뒤로 무브", "go forward", "move back", "move left",
|
||||||
|
"move right", "레프트로 무브", "라이트로 무브"]) +
|
||||||
|
_make(["forward로 ", "left로 ", "right로 ", "앞쪽으로 "], ["가"], share=0.1),
|
||||||
|
"go_to": _hae(["<place>로 무브", "<place>로 move", "go to <place>", "<place> 고고", "<place>로 고", "<place>로 go"]),
|
||||||
|
"come": _hae(["컴 히어", "come here", "come 여기", "여기로 come", "이리 컴", "컴온 히어", "come to me", "here로 컴"]),
|
||||||
|
"follow": _hae(["follow me", "팔로우 미", "follow", "팔로우", "나 follow", "저 팔로우", "follow 모드"]),
|
||||||
|
"lift": _hae(["바디 업", "바디 다운", "body up", "body down", "lift up", "lift down", "리프트 업", "리프트 다운", "키 업",
|
||||||
|
"키 다운", "height up", "height down", "몸 업", "몸 다운"]),
|
||||||
|
"wave": _hae(["wave", "웨이브", "핸드 웨이브", "hand wave", "손 웨이브", "바이 바이", "빠이빠이", "하이", "shake hands",
|
||||||
|
"악수", "핸드셰이크"]),
|
||||||
|
}
|
||||||
|
for _k, _t in KONGLISH.items():
|
||||||
|
INTENT[_k] = INTENT.get(_k, []) + [t for t in _t if t not in INTENT.get(_k, [])]
|
||||||
|
|||||||
@@ -197,5 +197,6 @@ QUICK["speed"] += ["빨리 달릴 수 있어", "빨리 달릴 수 있어요", "
|
|||||||
"can you drive fast", "are you fast", "can you run fast"]
|
"can you drive fast", "are you fast", "can you run fast"]
|
||||||
QUICK.setdefault("obstacles", []).extend([
|
QUICK.setdefault("obstacles", []).extend([
|
||||||
"팔이 사람 치면 어떡해요", "팔에 사람이 맞으면 어떻게 돼요", "팔이 부딪히면 어떻게 돼", "what if your arm hits someone", "will your arm hit me",
|
"팔이 사람 치면 어떡해요", "팔에 사람이 맞으면 어떻게 돼요", "팔이 부딪히면 어떻게 돼", "what if your arm hits someone", "will your arm hit me",
|
||||||
"is it safe to stand next to you", "are you safe around kids", "옆에 서 있어도 안전해",
|
])
|
||||||
|
QUICK.setdefault("safety", []).extend(["is it safe to stand next to you", "are you safe around kids", "옆에 서 있어도 안전해",
|
||||||
"가까이 가도 안전합니까", "애들 옆에 둬도 괜찮아요"])
|
"가까이 가도 안전합니까", "애들 옆에 둬도 괜찮아요"])
|
||||||
|
|||||||
@@ -792,3 +792,6 @@ QUICK["teach"] = QUICK.get("teach", []) + ["can i teach you something new", "can
|
|||||||
QUICK["no"] += ["여기 어느 나라야", "여기 어느 나라예요", "이 나라 어디야", "what country is this", "which country are we in", "where are we",
|
QUICK["no"] += ["여기 어느 나라야", "여기 어느 나라예요", "이 나라 어디야", "what country is this", "which country are we in", "where are we",
|
||||||
"what does cutshion mean", "쿳션이 무슨 뜻이야", "쿳션 뜻이 뭐예요", "cutshion 이름 뜻", "추석 며칠 남았어", "설날 며칠 남았어요",
|
"what does cutshion mean", "쿳션이 무슨 뜻이야", "쿳션 뜻이 뭐예요", "cutshion 이름 뜻", "추석 며칠 남았어", "설날 며칠 남았어요",
|
||||||
"how many days until new year", "how many days to chuseok", "생일까지 며칠 남았어"]
|
"how many days until new year", "how many days to chuseok", "생일까지 며칠 남았어"]
|
||||||
|
QUICK["languages"] += _ko(["랭귀지 뭐 ", "랭귀지 몇 개 ", "language 뭐 ", "언어 뭐 ", "무슨 언어 "], ["할 수 있어", "할 수 있어요", "할 줄 알아", "할 수 이써",
|
||||||
|
"할 수 있으세요", "할 수 있습니까", "할 줄 아노"]) + [
|
||||||
|
"랭귀지뭐할수있어", "랭귀지 뭐 해", "랭귀지 뭐 돼요"]
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ ON_CHARGE = re.compile(r"\b(on|per|with) (a |one |the )?(full |single )?charge\b
|
|||||||
r"\bgo (back )?(to )?(re)?charg|한 ?번 충전(?:으로|하면)|완충(?:으로|하면|되면)|충전하면 ?(?:얼마나|몇)|"
|
r"\bgo (back )?(to )?(re)?charg|한 ?번 충전(?:으로|하면)|완충(?:으로|하면|되면)|충전하면 ?(?:얼마나|몇)|"
|
||||||
r"충전하러", re.I) # how long it lasts (10 hours), when it goes to charge: the LLM
|
r"충전하러", re.I) # how long it lasts (10 hours), when it goes to charge: the LLM
|
||||||
LASTS = re.compile(r"\b(last|life|lifetime|capacity|volt|amp|ah|kind|type|made|hours?)\b|얼마나 ?가|몇 ?시간|오래 ?가|"
|
LASTS = re.compile(r"\b(last|life|lifetime|capacity|volt|amp|ah|kind|type|made|hours?)\b|얼마나 ?가|몇 ?시간|오래 ?가|"
|
||||||
r"지속|용량|종류|볼트|수명|뭐\s*들어|무슨\s*배터리|어떤\s*배터리|\bwhat (?:kind of |type of )?battery\b|사용 ?시간|쓸 ?수 ?있는 ?시간|런타임|\bruntime\b|\bhow long\b", re.I) # how long it lasts, what it is: the reference notes
|
r"지속|용량|종류|볼트|수명|뭐\s*들어|무슨\s*배터리|어떤\s*배터리|\bwhat (?:kind of |type of )?battery\b|사용 ?시간|쓸 ?수 ?있는 ?시간|런타임|\bruntime\b|\bhow long\b|타임|\btime\b", re.I) # how long it lasts, what it is: the reference notes
|
||||||
LEVEL = re.compile(
|
LEVEL = re.compile(
|
||||||
r"\bbattery\b.*\b(level|percent(age)?|left|status|charged|full|low|now|remaining|state|at|much|look)\b|"
|
r"\bbattery\b.*\b(level|percent(age)?|left|status|charged|full|low|now|remaining|state|at|much|look)\b|"
|
||||||
r"\b(level|percent(age)?|how much)\b.*\bbattery\b|^\W*(and |so |what about |how about )?(your |the )?battery\W*$|"
|
r"\b(level|percent(age)?|how much)\b.*\bbattery\b|^\W*(and |so |what about |how about )?(your |the )?battery\W*$|"
|
||||||
r"배터리.{0,8}(?:몇|남|상태|퍼센트|프로|충분|얼마|어때|괜찮|있어|많|부족|없어)|^\W*(?:그럼 |그리고 )?배터리[는은요]?\W*$", re.I)
|
r"배터리.{0,8}(?:몇|남|상태|퍼센트|프로|충분|얼마|얼만|어때|괜찮|있어|많|부족|없어)|^\W*(?:그럼 |그리고 )?배터리[는은요]?\W*$", re.I)
|
||||||
CHARGING = re.compile(
|
CHARGING = re.compile(
|
||||||
r"\bare you (still |now |currently )?(charging|on (the |your )?charger|plugged in)\b|"
|
r"\bare you (still |now |currently )?(charging|on (the |your )?charger|plugged in)\b|"
|
||||||
r"\bis (it|the battery|your battery) (still |now )?charging\b|^\W*(and |so |what about |how about )?charging\W*$|"
|
r"\bis (it|the battery|your battery) (still |now )?charging\b|^\W*(and |so |what about |how about )?charging\W*$|"
|
||||||
|
|||||||
+101
-18
@@ -144,6 +144,8 @@ Rules:
|
|||||||
- "Can you sing?", "can you wave?", "노래 불러 줄 수 있어?", "손 흔들어 줄래?" ask you to do it; "can you fly / swim /
|
- "Can you sing?", "can you wave?", "노래 불러 줄 수 있어?", "손 흔들어 줄래?" ask you to do it; "can you fly / swim /
|
||||||
dance / grow taller?", "do you know how to wave?", "손 흔들 줄 알아?" ask whether you can: answer yes or no. A remark ("it's
|
dance / grow taller?", "do you know how to wave?", "손 흔들 줄 알아?" ask whether you can: answer yes or no. A remark ("it's
|
||||||
loud here", "I could take you home") is not an order.
|
loud here", "I could take you home") is not an order.
|
||||||
|
- A yes / no question about what you can do or how much (a ramp, a step, a weight, a speed, a width) starts with the
|
||||||
|
answer word, "No," / "Yes," / "아니요," / "네,", then the fact (15° ramp: "No, at most 8 degrees.").
|
||||||
- Asked to talk casually ("말 놓아도 돼?", "반말해"), say kindly that you'll keep speaking politely; stay polite.
|
- Asked to talk casually ("말 놓아도 돼?", "반말해"), say kindly that you'll keep speaking politely; stay polite.
|
||||||
- "I see", "got it", "okay, I see", "makes sense", "아 그렇구나", "알겠어요", "그렇군요", "아하" mean they understood
|
- "I see", "got it", "okay, I see", "makes sense", "아 그렇구나", "알겠어요", "그렇군요", "아하" mean they understood
|
||||||
your answer, not goodbye: acknowledge in a few words or add one short related point; the talk goes on (never
|
your answer, not goodbye: acknowledge in a few words or add one short related point; the talk goes on (never
|
||||||
@@ -324,7 +326,7 @@ def _follow_examples(text, history):
|
|||||||
len(c.strip(" ?!.~")) <= (6 if HANGUL.search(c) else 10))):
|
len(c.strip(" ?!.~")) <= (6 if HANGUL.search(c) else 10))):
|
||||||
return "" # "where is p3?", "세종대왕이 누구예요?" are new questions
|
return "" # "where is p3?", "세종대왕이 누구예요?" are new questions
|
||||||
from assistant import talk_examples
|
from assistant import talk_examples
|
||||||
q, a = history[-1] if asked else topic_turn(history)
|
q, a = history[-1] if asked else topic_turn(history, text)
|
||||||
a = " ".join(ln for ln in a.splitlines() if not re.match(r"\s*\**ACTION", ln)).strip()
|
a = " ".join(ln for ln in a.splitlines() if not re.match(r"\s*\**ACTION", ln)).strip()
|
||||||
if not a:
|
if not a:
|
||||||
return ""
|
return ""
|
||||||
@@ -650,6 +652,7 @@ LET_GO = r"^\W*(?:drop it|release(?: it)?)\W*$|^\W*(?:(?:그거|이거|그것|
|
|||||||
PUT_BACK = ( # the held thing back where it was picked: "put the banana back where you found it", "제자리에 갖다 놓으시게"
|
PUT_BACK = ( # the held thing back where it was picked: "put the banana back where you found it", "제자리에 갖다 놓으시게"
|
||||||
r"\b(?:put|set|place|return|bring|take)\s+(?:it|that|this|them|the (?:\w+ ){0,2}?\w+)\s+(?:right )?back\b(?! to (?:me|us)\b)"
|
r"\b(?:put|set|place|return|bring|take)\s+(?:it|that|this|them|the (?:\w+ ){0,2}?\w+)\s+(?:right )?back\b(?! to (?:me|us)\b)"
|
||||||
r"|\b(?:put|set|place|leave)\s+(?:it\s+)?(?:back|again)\s+where\b|\bput back\b"
|
r"|\b(?:put|set|place|leave)\s+(?:it\s+)?(?:back|again)\s+where\b|\bput back\b"
|
||||||
|
r"|\b(?:the )?(?:cup|it|bottle) go(?:es)? back (?:to )?(?:the )?same (?:place|spot)\b"
|
||||||
r"|\b(?:put|set|place|return|leave|bring)\b.*\bwhere (?:it was|you (?:found|got|picked|took) it)\b"
|
r"|\b(?:put|set|place|return|leave|bring)\b.*\bwhere (?:it was|you (?:found|got|picked|took) it)\b"
|
||||||
r"|\breturn (?:it|that|this|the (?:\w+ )?\w+) to (?:where|its place)"
|
r"|\breturn (?:it|that|this|the (?:\w+ )?\w+) to (?:where|its place)"
|
||||||
r"|^\W*(?:(?:please|now|okay|ok|lumi|robot)\W+)*back (?:to )?where (?:it was|you (?:found|got|picked|took) it)"
|
r"|^\W*(?:(?:please|now|okay|ok|lumi|robot)\W+)*back (?:to )?where (?:it was|you (?:found|got|picked|took) it)"
|
||||||
@@ -684,7 +687,7 @@ INTENTS = [ # (action, pattern) checked in order on what the visitor said
|
|||||||
("fetch",rf"\b(fetch|bring|deliver|carry)\b.*\b({_OBJ}|it|that|this)s?\b|\b(take|get|grab)\b.*\b({_OBJ})s?\b.*\b(from|to)\b"
|
("fetch",rf"\b(fetch|bring|deliver|carry)\b.*\b({_OBJ}|it|that|this)s?\b|\b(take|get|grab)\b.*\b({_OBJ})s?\b.*\b(from|to)\b"
|
||||||
rf"|\b(go|drive) to\b.*\b(get|take|grab|pick up|fetch|bring)\b.*\b({_OBJ})s?\b"
|
rf"|\b(go|drive) to\b.*\b(get|take|grab|pick up|fetch|bring)\b.*\b({_OBJ})s?\b"
|
||||||
rf"|\b(pick up|pick|take|grab|get)\b.*\b({_OBJ})s?\b.*\b(go|drive) to\b|({_OBJ}).*(집어서|들고).*가서"
|
rf"|\b(pick up|pick|take|grab|get)\b.*\b({_OBJ})s?\b.*\b(go|drive) to\b|({_OBJ}).*(집어서|들고).*가서"
|
||||||
r"|가져와|가져다|갖다|가지고 ?와|갖고 ?(?:와|오)|챙겨 ?오|가져 ?오실|가저 ?(?:와|다)|에서.*\b(?:bring|fetch|brign|fech)\s*해|가져 ?오(?:세요|십시오|시오|너라|거라|게|라|실래요|시겠어요)|가지고 ?오(?:세요|십시오|시오|너라|거라|게|라|실래요|시겠어요)|챙겨 ?와|에서.*(옮겨|가져)" rf"|({_OBJ}).*(집고|들고|가지고).*(와|줘)|({_OBJ})\S*\s.*\S(?:으로|로|까지)\s*(?:좀\s*)?옮겨|({_OBJ})\s*(?:이랑|랑|하고|과|와) (?:같이|함께)\s+\S+?(?:으로|로|까지|에)?\s*(?:좀\s*)?가(?![가-힣])"),
|
r"|가져와|가져다|갖다|가지고 ?와|갖고 ?(?:와|오)|챙겨 ?오|가져 ?오실|가저 ?(?:와|다)|에서.*\b(?:bring|fetch|brign|fech)\s*해|가져 ?오(?:세요|십시오|시오|너라|거라|게|라|실래요|시겠어요)|가지고 ?오(?:세요|십시오|시오|너라|거라|게|라|실래요|시겠어요)|챙겨 ?와|에서.*(옮겨|가져)" rf"|({_OBJ}).*(집고|들고|가지고).*(와|줘)|({_OBJ})\S*\s.*\S(?:으로|로|까지)\s*(?:좀\s*)?옮겨|(?:으로|로|까지)\s+(?:\S+\s+)?({_OBJ})\S*\s+(?:좀\s*)?(?:가져가|가지고 ?가|갖고 ?가)|({_OBJ})\s*(?:이랑|랑|하고|과|와) (?:같이|함께)\s+\S+?(?:으로|로|까지|에)?\s*(?:좀\s*)?가(?![가-힣])"),
|
||||||
("come", r"\bcome (?:back )?(here|hear|to me|closer|over here|over|this way)\b|\bcome\b(?! back for (?:me|us)\b).*\bme\b|이리 ?(?:좀 ?)?(?:돌아 ?)?(?:와|오세요|오십시오|올래)|"
|
("come", r"\bcome (?:back )?(here|hear|to me|closer|over here|over|this way)\b|\bcome\b(?! back for (?:me|us)\b).*\bme\b|이리 ?(?:좀 ?)?(?:돌아 ?)?(?:와|오세요|오십시오|올래)|"
|
||||||
r"(?:여기로|이쪽으로) ?(?:좀 ?)?(?:돌아 ?)?(?:와|오세요|오십시오)|가까이 ?(?:좀 ?)?(?:와|오세요)|"
|
r"(?:여기로|이쪽으로) ?(?:좀 ?)?(?:돌아 ?)?(?:와|오세요|오십시오)|가까이 ?(?:좀 ?)?(?:와|오세요)|"
|
||||||
r"나한테 ?(?:돌아 ?)?와"),
|
r"나한테 ?(?:돌아 ?)?와"),
|
||||||
@@ -837,8 +840,9 @@ LATER = re.compile(r"^\s*(?:after|once|if|as soon as|before|unless|until)\b(?! (
|
|||||||
r"please))\b)|\b(?:later|tomorrow|tonight|next time|in an hour)\b|[가-힣](?<![정화측반전표라장내외평단])면\s(?!안 ?돼|좋겠)|\byou'?ll (?:find|see)\b|\bat the corner\b|"
|
r"please))\b)|\b(?:later|tomorrow|tonight|next time|in an hour)\b|[가-힣](?<![정화측반전표라장내외평단])면\s(?!안 ?돼|좋겠)|\byou'?ll (?:find|see)\b|\bat the corner\b|"
|
||||||
r"\b(?:he|she|they|my \w+|his \w+|her \w+|our \w+|someone) (?:will|'ll|is going to|are going to)\b|"
|
r"\b(?:he|she|they|my \w+|his \w+|her \w+|our \w+|someone) (?:will|'ll|is going to|are going to)\b|"
|
||||||
r"(?:^|\s)(?:나중에|이따가?|내일)\s", re.I) # "after the talk ends, go to p1", "내가 가라고 하면": not now
|
r"(?:^|\s)(?:나중에|이따가?|내일)\s", re.I) # "after the talk ends, go to p1", "내가 가라고 하면": not now
|
||||||
STOP_ASK = re.compile(r"(?:(?:can|could|would|will) you (?:please |just )?stop(?: (?:now|please|moving|driving|here|there))?|"
|
STOP_ASK = re.compile(r"(?:(?:당장|지금|얼른|빨리|좀|바로|어서|제발)\s*)*(?:(?:can|could|would|will) you (?:please |just )?stop(?: (?:now|please|moving|driving|here|there))?|"
|
||||||
r"멈출 수 있(?:어|어요|니|나요)|멈춰 줄래요?|멈춰 줄 수 있(?:어|어요))\W*$", re.I) # "can you stop?": stop
|
r"멈출 수 있(?:어|어요|니|나요|지|죠)|멈춰 줄래요?|(?:멈춰|정지해|그만해|서) ?(?:줄|주실) 수 있(?:어|어요|지|죠|니|나요|"
|
||||||
|
r"겠어요?|겠습니까|으세요|으신가요))\W*$", re.I) # "can you stop?": stop
|
||||||
|
|
||||||
|
|
||||||
COME_BACK = re.compile( # the whole sentence asks Lumi back to where it stood before its last trip
|
COME_BACK = re.compile( # the whole sentence asks Lumi back to where it stood before its last trip
|
||||||
@@ -991,6 +995,27 @@ LATER_SAID = re.compile(r"\b(?:next (?:week|month|year|monday|tuesday|wednesday|
|
|||||||
# a later time, a past remark, "you better not": no order now ("쉬는 시간 끝나고 팔 뻗어", "아까는 ... 안 하더라")
|
# a later time, a past remark, "you better not": no order now ("쉬는 시간 끝나고 팔 뻗어", "아까는 ... 안 하더라")
|
||||||
|
|
||||||
|
|
||||||
|
ASIDE_NOW = re.compile( # no order now, wherever it stands in a long sentence (r12 asides, 2026-10-27)
|
||||||
|
r"\b(?:ah |oh |hmm |um |actually,? |no,? )?(?:forget (?:i said|what i said|about) (?:that|it)|forget i said that|scratch that|"
|
||||||
|
r"just kidding|i'?m kidding)\b|는 장난|농담이야|농담이에요|" # taken back after it was said
|
||||||
|
r"\bis (?:a )?(?:very )?fun+y thing\b|밈이잖아|밈이야|밈임|\bit'?s a meme\b|"
|
||||||
|
r"\bunder no circumstances\b|지는 ?(?:마|말아)|(?:sorry,? )?\bno need\W*$|\byou no need\b|"
|
||||||
|
r"\bbefore,? very good\b|(?<!were )(?<!was )(?<!been )(?<!stood )\bbefore\W*$|아냐 됐다|아니 됐네|" # "드리지는 마세요"
|
||||||
|
r"(?<!\bdo )(?<!\bdid )\bnot (?:scoot|come|go|turn|move|look|wave|put|give|hand|pick|grab|close|open|lift|raise|lower|"
|
||||||
|
r"drive|follow)\b|(?:오픈|클로즈|open|close|closed|열려|닫혀|펴져|쥐어져)\s*(?:돼|되어|져)?\s*있(?:어|나|니|어요|나요|습니까)\s*\?|"
|
||||||
|
r"수 ?있대|줄 ?안대|(?:^|\s)이따(?:가|밤에|저녁에|오후에)?|(?:^|\s)저녁에나\s|" # "hand it to me is very funny thing"
|
||||||
|
r"\b(?:the moment|the minute|as soon as|whenever) (?:the |a |my |you )?\w+|\bcome (?:monday|tuesday|wednesday|thursday|"
|
||||||
|
r"friday|saturday|sunday|tomorrow|the weekend)\b|\b(?:after|aftre|afer) (?:lunch|dinner|the show|the break)\b|"
|
||||||
|
r"\bif (?:the |a |my )?(?:red |green )?(?:light|bell|music|muaic|song|show|alarm)\b|" # a condition, a later time
|
||||||
|
r"\b(?:my|our|his|her|the|their) \w+ (?:wanted|wants|asked|told|said) (?:you|lumi|the robot|rumi|loomi) to\b|" # reported
|
||||||
|
r"\bon (?:paper|the sign|the menu|the poster)\b|라는 문구|라고 (?:써|적혀)|" # a sign read out
|
||||||
|
r"\bno need (?:for you )?to\b|필요(?:는|가)?\s*(?:전혀\s*|하나도\s*)?없|"
|
||||||
|
r"\bteam everyone\b|\b(?:keeps?|kept) (?:shouting|saying|yelling)\b|\bat the tv\b|" # to others, reported
|
||||||
|
r"\bare (?:robots|you)(?: like you)? (?:built|made|designed) to\b|(?:^|[\s,])담에\s|"
|
||||||
|
r"\bnot (?:you,? )?(?:the )?robot\b|로봇 말고|루미 말고|(?:^|[\s,])(?:동생|막둥|막내|아들|딸|얘들|애들|여보)(?:아|야)(?=[\s,!~]|$)|"
|
||||||
|
r"[가-힣](?<!있)(?<!계시)(?:는|던) (?:걸|것을?|거|장면|모습)(?:을|이|를|은|도)?\s", re.I) # "로봇이 올려놓는 걸 좋아하세요": a description
|
||||||
|
|
||||||
|
|
||||||
def not_an_order(text, asked=True):
|
def not_an_order(text, asked=True):
|
||||||
"""True when the words name a motion but order none now: a condition or later time, words to someone else, a
|
"""True when the words name a motion but order none now: a condition or later time, words to someone else, a
|
||||||
remark or quote about Lumi, a question about what it can do, a negation. lumi.route then leaves the words to
|
remark or quote about Lumi, a question about what it can do, a negation. lumi.route then leaves the words to
|
||||||
@@ -998,11 +1023,20 @@ def not_an_order(text, asked=True):
|
|||||||
asked=False: questions do not count (a chain answers its question part: "wave and what time is it?")."""
|
asked=False: questions do not count (a chain answers its question part: "wave and what time is it?")."""
|
||||||
t = unfill(wording.ko_plain(text or "")) # "날 따라오면 돼" is "날 따라와": no condition
|
t = unfill(wording.ko_plain(text or "")) # "날 따라오면 돼" is "날 따라와": no condition
|
||||||
rest = instead_of(t) # "don't put your arm out, my baby will grab it"
|
rest = instead_of(t) # "don't put your arm out, my baby will grab it"
|
||||||
|
now = NOW_CLAUSE.sub(" ", WAIT_UNTIL.sub(" ", t)) # "when you're ready", "while you do", "말씀하실 때": now
|
||||||
return bool(to_someone_else(t) or CANT_GO.search(t) or DRINK.search(t) or IDIOMS.search(t) or
|
return bool(to_someone_else(t) or CANT_GO.search(t) or DRINK.search(t) or IDIOMS.search(t) or
|
||||||
CONDITION.search(WAIT_UNTIL.sub(" ", t)) or REMARK.search(t) or
|
CONDITION.search(now) or REMARK.search(now) or
|
||||||
TAKEN_BACK.search(t) or
|
TAKEN_BACK.search(t) or
|
||||||
rest != t and REMARK.search(rest) or asked and ASKED.search(t) or NEGATED.search(t) or ko_told(t) or
|
rest != t and REMARK.search(rest) or asked and ASKED.search(t) or NEGATED.search(t) or ko_told(t) or
|
||||||
ABOUT_IT.search(t) or LATER_SAID.search(t))
|
ABOUT_IT.search(t) or LATER_SAID.search(t) or ASIDE_NOW.search(t))
|
||||||
|
|
||||||
|
|
||||||
|
NOW_CLAUSE = re.compile( # time words that mean now, with the order (T1, 2026-10-27): no later condition
|
||||||
|
r"\bwhen(?:ever)? you(?:'re| are) ready\b|\bwhen it suits you\b|\bwhile you(?:'re| are)? (?:do|doing|at it|talk|talking|"
|
||||||
|
r"speak|speaking|explain|explaining|tell|telling|go on)\b\w*|\bbefore the \w+(?: \w+)? part\b|"
|
||||||
|
r"\bkeep (?:telling|talking)(?: me)? about [^,.]*[,.]?\s*(?:and\s+)?|"
|
||||||
|
r"(?:편할|편하실|괜찮을|괜찮으실|말씀하실|말씀하는|얘기하실|얘기하는|설명하실|설명하는) 때|(?:말씀|얘기|설명)\S* (?:동안|중에)|"
|
||||||
|
r"(?:\S+ )?얘기 전에", re.I)
|
||||||
|
|
||||||
|
|
||||||
WAIT_UNTIL = re.compile(r"\b(?:until|till) (?:someone|somebody|anyone|a person|the person|they|people|a guest|the guests?) "
|
WAIT_UNTIL = re.compile(r"\b(?:until|till) (?:someone|somebody|anyone|a person|the person|they|people|a guest|the guests?) "
|
||||||
@@ -1282,7 +1316,7 @@ def intent(text, markers=()):
|
|||||||
"""(action, target) for clear requests, or None. Backs up the LLM's ACTION line. Korean at any speech level the
|
"""(action, target) for clear requests, or None. Backs up the LLM's ACTION line. Korean at any speech level the
|
||||||
rules miss ("컵 놓으십시오", "허리를 왼쪽으로 돌려 주셨으면 해요", "놔 주시면 안 될까요?") is read again as 반말."""
|
rules miss ("컵 놓으십시오", "허리를 왼쪽으로 돌려 주셨으면 해요", "놔 주시면 안 될까요?") is read again as 반말."""
|
||||||
rule = _intent(text, markers)
|
rule = _intent(text, markers)
|
||||||
if rule is None and HANGUL.search(text or ""):
|
if rule is None and HANGUL.search(text or "") and direct_order(text): # not "너 팔 접을 수 있지?" (ability)
|
||||||
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)
|
||||||
@@ -1309,6 +1343,7 @@ def _intent(text, markers=()):
|
|||||||
r"\b(can|could) you (pick( up)?|lift|hold|grab|take) (a|an|any)\b(?!.*\b(?:to|for me|over here|over to|here|please)\b)|" # "can you pick up a bottle?"
|
r"\b(can|could) you (pick( up)?|lift|hold|grab|take) (a|an|any)\b(?!.*\b(?:to|for me|over here|over to|here|please)\b)|" # "can you pick up a bottle?"
|
||||||
r"^\s*(what|when|which|at what|do you|does|is it(?! possible)|are you)\b|몇|언제|얼마|" # "at what level do you go back?"
|
r"^\s*(what|when|which|at what|do you|does|is it(?! possible)|are you)\b|몇|언제|얼마|" # "at what level do you go back?"
|
||||||
rf"({_OBJ})(은|는)\s.*수 ?있|(루미가|로봇이)\s.*수 ?있|는 ?거 ?(돼|되나|가능)|" # "물컵은 가져다줄 수 있어요?"
|
rf"({_OBJ})(은|는)\s.*수 ?있|(루미가|로봇이)\s.*수 ?있|는 ?거 ?(돼|되나|가능)|" # "물컵은 가져다줄 수 있어요?"
|
||||||
|
r"(?<!줄 )(?<!주실 )(?<!줄)(?<!주실)수 ?있(?:지|죠|잖|겠지|겠죠)|" # "너 팔 접을 수 있지?": the ability, said back
|
||||||
r"어떻게|왜|혼자|스스로|\bby yourself\b|\bsomeone\b|줄 ?알아|[을를] 줄 ?아(?:세요|십니까|시나요|나요?|니|노|요)?\s*\?|할 ?줄|\bcome here often\b|"
|
r"어떻게|왜|혼자|스스로|\bby yourself\b|\bsomeone\b|줄 ?알아|[을를] 줄 ?아(?:세요|십니까|시나요|나요?|니|노|요)?\s*\?|할 ?줄|\bcome here often\b|"
|
||||||
r"^\W*(?:even|only|also|and|but|so)?\s*(?:with|without|if|unless|while)\b.*\?\s*$", # "even with the lift down?"
|
r"^\W*(?:even|only|also|and|but|so)?\s*(?:with|without|if|unless|while)\b.*\?\s*$", # "even with the lift down?"
|
||||||
re.sub(_LEAD, "", CALLING.sub("", t), flags=re.I)) or LATER.search(CALLING.sub("", t)) # "Lumi, is it
|
re.sub(_LEAD, "", CALLING.sub("", t), flags=re.I)) or LATER.search(CALLING.sub("", t)) # "Lumi, is it
|
||||||
@@ -1622,12 +1657,31 @@ POLITE_END = re.compile(r"(?:[\s,.;!?]+(?:부탁(?: 좀)? (?:할게요|해요|
|
|||||||
|
|
||||||
|
|
||||||
def self_correct(text, markers=()):
|
def self_correct(text, markers=()):
|
||||||
|
"""_self_correct; a correction whose new part orders nothing now ("turn left — scratch that, yesterday I watched a
|
||||||
|
robot turn right", "pick the cup, oops I meant on paper it is writing …") takes the order back: ""."""
|
||||||
|
fixed = _self_correct(text, markers)
|
||||||
|
marks = list(CORRECTED.finditer(text or ""))
|
||||||
|
tail = text[marks[-1].end():] if marks else ""
|
||||||
|
if fixed and fixed != wording.polite(text) and tail.strip(" .,!?") and (
|
||||||
|
ASIDE_NOW.search(tail) or re.search(r"\b(?:yesterday|last (?:week|night|time)|i (?:watched|saw|heard))\b|"
|
||||||
|
r"\bjust asking\b|\bis able\b|어제|지난번", tail, re.I)):
|
||||||
|
return ""
|
||||||
|
return fixed
|
||||||
|
|
||||||
|
|
||||||
|
CORRECTED = re.compile(r"\b(?:scratch that|oops,? i meant|i meant|i mean|no,? no|no wait|actually,? no|actually)\b\W*|"
|
||||||
|
r"(?:아 )?아니(?:야|요)?\W+|잘못 말했\S*\W*|정정할게요\W*", re.I) # where the new words start
|
||||||
|
|
||||||
|
|
||||||
|
def _self_correct(text, markers=()):
|
||||||
"""The words with a correction made inside them applied ("go to start, no, end" -> "go to end", "turn left, I mean
|
"""The words with a correction made inside them applied ("go to start, no, end" -> "go to end", "turn left, I mean
|
||||||
right", "앞으로 1미터, 아니 2미터 가" -> "앞으로 2 m 가", "go to the stage, no, pick up the cup" -> "pick up the cup").
|
right", "앞으로 1미터, 아니 2미터 가" -> "앞으로 2 m 가", "go to the stage, no, pick up the cup" -> "pick up the cup").
|
||||||
"" when the command was taken back ("go to the stage, never mind", "스테이지로 가, 아니 됐어"); None when a
|
"" when the command was taken back ("go to the stage, never mind", "스테이지로 가, 아니 됐어"); None when a
|
||||||
correction is there but can't be read for sure (Lumi asks again, nothing moves); the text itself otherwise."""
|
correction is there but can't be read for sure (Lumi asks again, nothing moves); the text itself otherwise."""
|
||||||
from assistant import steps
|
from assistant import steps
|
||||||
text = wording.polite(text) # "wave, if you don't mind" -> "wave" on every path
|
text = wording.polite(text) # "wave, if you don't mind" -> "wave" on every path
|
||||||
|
if re.search(r"\b(?:under|in) no (?:circumstances|case|way)\b|\bno matter\b|\bno need\b|\bno one\b|\bnobody\b", text, re.I):
|
||||||
|
return text # "under no circumstances close the gripper": no correction
|
||||||
if re.search(r"\b(?:say|tell|announce)\b|말해|(?<!그거 )(?<!이거 )(?<!그걸 )(?<!이걸 )전해|[\"“”]", text, re.I) or \
|
if re.search(r"\b(?:say|tell|announce)\b|말해|(?<!그거 )(?<!이거 )(?<!그걸 )(?<!이걸 )전해|[\"“”]", text, re.I) or \
|
||||||
re.search(r"\b(?:stop|halt|freeze|don'?t move)\b|멈춰|정지|그만(?!두|둬)|스톱|움직이지 ?마|거기 ?서", text, re.I):
|
re.search(r"\b(?:stop|halt|freeze|don'?t move)\b|멈춰|정지|그만(?!두|둬)|스톱|움직이지 ?마|거기 ?서", text, re.I):
|
||||||
return text # a message to say may hold any words; a stop always wins
|
return text # a message to say may hold any words; a stop always wins
|
||||||
@@ -1768,7 +1822,7 @@ 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"기다리(?=\W*$)", "기다려"), (r"(?<![가-힣])들구(?=\s|$)", "들고"),
|
(r"(?:드랍|드롭)\s?해", "놔"), (r"기달려", "기다려"), (r"(?<![가-힣])돌여(?=\s|$|줘|주)", "돌려"), (r"기달리", "기다리"), (r"기다리(?=\W*$)", "기다려"), (r"(?<![가-힣])들구(?=\s|$)", "들고"),
|
||||||
(r"가저(?=와|다|가|오)", "가져"), (r"((?:몸|손|팔|고개)(?:을|를)? )내러(?=\s|$)", r"\1내려"), (r"(?<![가-힣])날라(?=\s*(?:줘|주|다|$))", "옮겨"), (r"((?:갖다|가져다)\s?)도(?=\W*$)", r"\1줘"), (r"놓(?:그라|거라)", "놔"),
|
(r"가저(?=와|다|가|오)", "가져"), (r"((?:몸|손|팔|고개)(?:을|를)? )내러(?=\s|$)", r"\1내려"), (r"(?<![가-힣])날라(?=\s*(?:줘|주|다|$))", "옮겨"), (r"((?:갖다|가져다)\s?)도(?=\W*$)", r"\1줘"), (r"놓(?:그라|거라)", "놔"),
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2103,7 +2157,7 @@ PICK_PREFER = {"smaller": "small", "smallest": "small", "small": "small", "littl
|
|||||||
"near": "near", "closer": "near", "closest": "near", "farther": "far", "farthest": "far",
|
"near": "near", "closer": "near", "closest": "near", "farther": "far", "farthest": "far",
|
||||||
"further": "far", "furthest": "far", "far": "far"} # "the smaller cup" -> which of several to pick
|
"further": "far", "furthest": "far", "far": "far"} # "the smaller cup" -> which of several to pick
|
||||||
PICK_PREFER_KO = (("작은", "small"), ("큰", "big"), ("왼쪽", "left"), ("오른쪽", "right"), ("가까", "near"), ("먼", "far"),
|
PICK_PREFER_KO = (("작은", "small"), ("큰", "big"), ("왼쪽", "left"), ("오른쪽", "right"), ("가까", "near"), ("먼", "far"),
|
||||||
("멀리", "far")) # "작은 컵", "왼쪽에 있는 컵", "가까이 있는 컵"
|
("멀리", "far"), ("레프트", "left"), ("라이트", "right"), ("옆", "near")) # "작은 컵", "왼쪽에 있는 컵", "가까이 있는 컵"
|
||||||
_PICK_EN = "|".join(sorted(PICK_PREFER, key=len, reverse=True))
|
_PICK_EN = "|".join(sorted(PICK_PREFER, key=len, reverse=True))
|
||||||
_THING = rf"(?:(?:{_COL})\s+)?(?:(?:{_OBJ})s?|ones?)(?![a-z])"
|
_THING = rf"(?:(?:{_COL})\s+)?(?:(?:{_OBJ})s?|ones?)(?![a-z])"
|
||||||
_SUP_WORDS = "|".join(k for k in SUPPORTS if k.isascii())
|
_SUP_WORDS = "|".join(k for k in SUPPORTS if k.isascii())
|
||||||
@@ -2117,10 +2171,14 @@ def pick_prefer(text):
|
|||||||
m = re.search(rf"(?<![a-z])(?<!on the )(?<!onto the )({_PICK_EN})\s+(?={_THING})", t) # not "on the smaller one"
|
m = re.search(rf"(?<![a-z])(?<!on the )(?<!onto the )({_PICK_EN})\s+(?={_THING})", t) # not "on the smaller one"
|
||||||
if m:
|
if m:
|
||||||
return PICK_PREFER[m.group(1)], t[:m.start(1)] + t[m.end():]
|
return PICK_PREFER[m.group(1)], t[:m.start(1)] + t[m.end():]
|
||||||
m = re.search(rf"(?<![a-z])((?:{_OBJ})s?|ones?)\s+(?:on|to|at)\s+(?:the|your|my)\s+(left|right)(?:\s+side)?(?![a-z])"
|
m = re.search(rf"(?<![a-z])((?:{_OBJ})s?|ones?)(?:\s+(?:over|sitting|standing|lying|right|just|that'?s|which is|there))*"
|
||||||
rf"(?!\s+(?:{_SUP_WORDS})\b)", t)
|
rf"\s+(?:on|to|at)\s+(?:the|your|my)\s+(left|right)(?:\s+side)?(?![a-z])(?!\s+(?:{_SUP_WORDS})\b)", t)
|
||||||
if m:
|
if m: # "the cup over on your left", "sitting on your right"
|
||||||
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+(?:(?:right |just )?(?:beside|next to) (?:you|me)|by your side|"
|
||||||
|
rf"(?:right )?(?:here )?near (?:you|me))\b", t)
|
||||||
|
if m: # "the cup beside you", "by your side": the nearest one
|
||||||
|
return "near", 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|"
|
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)
|
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()]):
|
if m and m.group(1) and re.search(r"\b(?:put|place|set|leave|drop)\b", t[:m.start()]):
|
||||||
@@ -2128,7 +2186,13 @@ def pick_prefer(text):
|
|||||||
if m: # "the cup on the left table", "왼쪽 테이블에 있는 컵": that side
|
if m: # "the cup on the left table", "왼쪽 테이블에 있는 컵": that side
|
||||||
side = m.group(2) or {"왼쪽": "left", "오른쪽": "right"}[m.group(3)]
|
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():]
|
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"(한|두|세|1|2|3|열|열한|10|11|아홉|9)\s*시\s*(?:방향|쪽)(?:에\s*(?:있는\s*)?|의\s*)?\s*(?=(?:(?:{_COL})\s*)?(?:{_OBJ}))|"
|
||||||
|
rf"\b(?:at )?(one|two|three|ten|eleven|nine|1|2|3|10|11|9) o'?clock\b", t)
|
||||||
|
if m: # "두 시 방향에 있는 컵", "the cup at two o'clock": that side
|
||||||
|
h = m.group(1) or m.group(2)
|
||||||
|
side = "right" if h in ("한", "두", "세", "1", "2", "3", "one", "two", "three") else "left"
|
||||||
|
return side, t[:m.start()] + t[m.end():]
|
||||||
|
m = re.search(rf"(?:(?:제일|가장|더)\s*)?(작은|큰|왼쪽(?:에\s*있는|의|으로)?|오른쪽(?:에\s*있는|의|으로)?|레프트|라이트|옆에\s*있는|가까운|가까이\s*있는|먼|"
|
||||||
rf"멀리\s*있는)\s*(?=(?:(?:{_COL})\s*)?(?:{_OBJ})|(?:거|것|걸)(?![가-힣]))", t)
|
rf"멀리\s*있는)\s*(?=(?:(?:{_COL})\s*)?(?:{_OBJ})|(?:거|것|걸)(?![가-힣]))", t)
|
||||||
if m:
|
if m:
|
||||||
return next(v for k, v in PICK_PREFER_KO if m.group(1).startswith(k)), t[:m.start()] + t[m.end():]
|
return next(v for k, v in PICK_PREFER_KO if m.group(1).startswith(k)), t[:m.start()] + t[m.end():]
|
||||||
@@ -2540,6 +2604,12 @@ def hand_request(text, holding, b=None, markers=(), whole=True):
|
|||||||
return None # "can you give things to people?", "don't give it to him"
|
return None # "can you give things to people?", "don't give it to him"
|
||||||
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 None # a marker named: a trip, the mission reader's
|
return None # a marker named: a trip, the mission reader's
|
||||||
|
rule = intent(text, markers)
|
||||||
|
if rule and rule[0] in ("pick", "move_object") and rule[1]:
|
||||||
|
from manipulation import skills # "백팩 집어 줘": a thing the fingers can't take, said why
|
||||||
|
no = skills.refusal(rule[1].split()[-1])
|
||||||
|
if no:
|
||||||
|
return ("refuse", no)
|
||||||
if IDIOM.search(t):
|
if IDIOM.search(t):
|
||||||
return None # "put it on my tab", "bring it on", "hold it!"
|
return None # "put it on my tab", "bring it on", "hold it!"
|
||||||
if FLOOR.search(t) and re.search(r"\b(?:pick|take|grab|get|lift|fetch|bring)\b|집어|잡아|주워|줍|들어|가져", t) and \
|
if FLOOR.search(t) and re.search(r"\b(?:pick|take|grab|get|lift|fetch|bring)\b|집어|잡아|주워|줍|들어|가져", t) and \
|
||||||
@@ -2684,7 +2754,9 @@ UNSURE = re.compile(r"\b(not sure|don't know|do not know|don't have (any )?(info
|
|||||||
QUESTION_START = re.compile(r"^\s*(where|what|how|why|when|which|who|do you|does|is|are|can i|could i)\b|어디 ?(있|에 있)|"
|
QUESTION_START = re.compile(r"^\s*(where|what|how|why|when|which|who|do you|does|is|are|can i|could i)\b|어디 ?(있|에 있)|"
|
||||||
r"(어디|뭐|왜|언제|몇)[^ ]*\s*\?*\s*$", re.I) # a question about a place, not a command
|
r"(어디|뭐|왜|언제|몇)[^ ]*\s*\?*\s*$", re.I) # a question about a place, not a command
|
||||||
ABILITY_Q = re.compile(r"(?<!줄 )(?<!주실 )(?<!줘 )(?<!받을 )수 ?있(?:어|나|니|을까|습니까)\S*\s*\?*\s*$|\bdo you know how\b|"
|
ABILITY_Q = re.compile(r"(?<!줄 )(?<!주실 )(?<!줘 )(?<!받을 )수 ?있(?:어|나|니|을까|습니까)\S*\s*\?*\s*$|\bdo you know how\b|"
|
||||||
r"\bare you able\b|줄 ?(?:알아|아세요|알아요|아니|알지)\S*\s*\?+\s*$", re.I) # asks whether Lumi can ("손 흔들 줄 알아?")
|
r"\bare you able\b|줄 ?(?:알아|아세요|알아요|아니|알지)\S*\s*\?+\s*$|"
|
||||||
|
r"보이(?:십니까|세요|시나요|나요|니|냐)\s*[?.!]*\s*$|보여요?\s*\?+\s*$", re.I) # asks whether Lumi can ("손 흔들 줄 알아?");
|
||||||
|
# "뒤가 보이십니까?", "등 좀 보이세요": about seeing / showing, no head turn
|
||||||
RECEIVE_ASK = re.compile(r"\b(?:take|hold|give|hand|here|catch|grab|accept|receive|keep|yours)\b|받|드릴|드려|줄게|줄께|가져가|맡아|잡아",
|
RECEIVE_ASK = re.compile(r"\b(?:take|hold|give|hand|here|catch|grab|accept|receive|keep|yours)\b|받|드릴|드려|줄게|줄께|가져가|맡아|잡아",
|
||||||
re.I) # words that hand something over to Lumi
|
re.I) # words that hand something over to Lumi
|
||||||
COME_ASK = re.compile(r"\bcome\b|\b(?:over )?here\b|\bcloser\b|\bthis way\b|이리|와|가까이|오세요", re.I)
|
COME_ASK = re.compile(r"\bcome\b|\b(?:over )?here\b|\bcloser\b|\bthis way\b|이리|와|가까이|오세요", re.I)
|
||||||
@@ -2876,15 +2948,26 @@ BYE_WORDS = re.compile(r"\b(?:bye|goodbye|see you|gotta go|i (?:have|need) to go
|
|||||||
r"수고하", re.I) # with a question after it: one more question before leaving
|
r"수고하", re.I) # with a question after it: one more question before leaving
|
||||||
|
|
||||||
|
|
||||||
def topic_turn(history):
|
ORDER_WORDS = re.compile(r"(?:줘|봐|해|춰|와|가|주세요|주십시오|주이소|줄래|주실래요|주시겠어요|하자|가자|보소|보이소|"
|
||||||
|
r"주라)\W*$|^\W*(?:(?:hey|ok(?:ay)?|lumi|robot|please)\W+)*(?:go|come|dance|turn|look|wave|move|"
|
||||||
|
r"jump|sing|fly|open|take|bring)\b", re.I) # an order to Lumi (no question)
|
||||||
|
WHY_WORDS = re.compile(r"\bwhy\b|how come|\bwai\b|왜|와이|어째서|(?<![가-힣])와\s", re.I) # "why not?" asks about the refusal
|
||||||
|
REFUSED = re.compile(r"\b(?:can'?t|cannot|not on (?:my|this) map|isn'?t on|no such place|unable)\b|못 |못해|없어요|없습니다|"
|
||||||
|
r"수 없|지도에(?:는)? \S+ ?(?:곳이|데가) 없", re.I) # Lumi's answer refused it ("이 지도에는 앞이라는 곳이 없어요")
|
||||||
|
|
||||||
|
|
||||||
|
def topic_turn(history, text=None):
|
||||||
"""The last turn that said something of its own: a back-channel ("헐 대박", "Oh, I see.") and Lumi's short reply
|
"""The last turn that said something of its own: a back-channel ("헐 대박", "Oh, I see.") and Lumi's short reply
|
||||||
to it are passed over, so "really?" / "where is it?" after them asks about the answer before. So are a motion
|
to it are passed over, so "really?" / "where is it?" after them asks about the answer before. So are a motion
|
||||||
done ("ACTION: wave") and an order for later ("when we're done, go to the stage"): "are you sure?" after them
|
done ("ACTION: wave") and an order for later ("when we're done, go to the stage"): "are you sure?" after them
|
||||||
asks about the talk before them. So is a turn Lumi did not catch ("Sorry, could you say that again?"): "확실해?"
|
asks about the talk before them. So is a turn Lumi did not catch ("Sorry, could you say that again?"): "확실해?"
|
||||||
after it asks about the answer before it."""
|
after it asks about the answer before it. Given the words (text), so is an order Lumi refused ("춤 좀 춰 봐" ->
|
||||||
|
"춤은 못 춰요"): "어이, 진짜?" after it asks about the talk before it; "why not?" asks about the refusal."""
|
||||||
for q, a in reversed(history[-4:]):
|
for q, a in reversed(history[-4:]):
|
||||||
act = re.match(r"\s*\**ACTION\**\s*:\s*(\w+)", a)
|
act = re.match(r"\s*\**ACTION\**\s*:\s*(\w+)", a)
|
||||||
if act and (act.group(1) in MOTIONS or act.group(1) == "unclear") or ASKS_AGAIN.search(a) or \
|
if act and (act.group(1) in MOTIONS or act.group(1) == "unclear") or ASKS_AGAIN.search(a) or \
|
||||||
|
text is not None and not WHY_WORDS.search(text) and ORDER_WORDS.search(q) and "?" not in q and \
|
||||||
|
REFUSED.search(a) or \
|
||||||
CONDITION.search(q) and a.startswith("ACTION: none") and \
|
CONDITION.search(q) and a.startswith("ACTION: none") and \
|
||||||
re.search(r"\b(?:go|come|follow|turn|move|wave)\b|[가와](?:\s*줘|요|라|주세요)?\W*$|따라", q, re.I):
|
re.search(r"\b(?:go|come|follow|turn|move|wave)\b|[가와](?:\s*줘|요|라|주세요)?\W*$|따라", q, re.I):
|
||||||
continue
|
continue
|
||||||
@@ -3130,7 +3213,7 @@ class Brain:
|
|||||||
messages += [{"role": "user", "content": q}, {"role": "assistant", "content": a}]
|
messages += [{"role": "user", "content": q}, {"role": "assistant", "content": a}]
|
||||||
follow = _follow_examples(text, self.history) # with them, fewer plain examples (a shorter prompt)
|
follow = _follow_examples(text, self.history) # with them, fewer plain examples (a shorter prompt)
|
||||||
world = self.world_talk(text)
|
world = self.world_talk(text)
|
||||||
if follow and not LUMI_TOPIC.search("{} {}".format(core(topic_turn(self.history)[0]), topic_turn(self.history)[1])):
|
if follow and not LUMI_TOPIC.search("{} {}".format(*(lambda t: (core(t[0]), t[1]))(topic_turn(self.history, text)))):
|
||||||
notes = "(none needed: the answer is in this talk)" # "when was it built?" after the Eiffel Tower: notes
|
notes = "(none needed: the answer is in this talk)" # "when was it built?" after the Eiffel Tower: notes
|
||||||
# on Lumi ("When was I built? 2 years") only misled
|
# on Lumi ("When was I built? 2 years") only misled
|
||||||
elif follow and about_answer(text) and len(hits) > 1: # "really?" / "why?": the answer is in the talk, its
|
elif follow and about_answer(text) and len(hits) > 1: # "really?" / "why?": the answer is in the talk, its
|
||||||
@@ -3359,7 +3442,7 @@ class Brain:
|
|||||||
f"after a tower: its height), whichever fits; not other facts.)\n")
|
f"after a tower: its height), whichever fits; not other facts.)\n")
|
||||||
if self.history: # past a back-channel ("헐 대박") to the answer before it,
|
if self.history: # past a back-channel ("헐 대박") to the answer before it,
|
||||||
# also past a motion done without words ("are u sure" after a lift)
|
# also past a motion done without words ("are u sure" after a lift)
|
||||||
last = " ".join(ln for ln in topic_turn(self.history)[1].splitlines() if not re.match(r"\s*\**ACTION", ln)).strip()
|
last = " ".join(ln for ln in topic_turn(self.history, text)[1].splitlines() if not re.match(r"\s*\**ACTION", ln)).strip()
|
||||||
c = core(text) # "루미 양반, 언제야?" asks "언제야?", not about Lumi
|
c = core(text) # "루미 양반, 언제야?" asks "언제야?", not about Lumi
|
||||||
if last and (THANKS_ONLY.match(c) or THANKS_ONLY.match(re.split(r"[,:]\s*", c)[-1])) and \
|
if last and (THANKS_ONLY.match(c) or THANKS_ONLY.match(re.split(r"[,:]\s*", c)[-1])) and \
|
||||||
not self._last_said().rstrip().endswith("?"): # "궁금한 게, 고마워요~", "Then oh thank you."
|
not self._last_said().rstrip().endswith("?"): # "궁금한 게, 고마워요~", "Then oh thank you."
|
||||||
|
|||||||
+5
-1
@@ -100,6 +100,9 @@ def parts(text):
|
|||||||
return [p for p in out if p and not re.fullmatch(rf"(?:{_FILL.pattern}|\W)+", p, re.I)]
|
return [p for p in out if p and not re.fullmatch(rf"(?:{_FILL.pattern}|\W)+", p, re.I)]
|
||||||
|
|
||||||
|
|
||||||
|
TAG_TALK = re.compile(r"\W*(?:(?:is|it'?s) (?:it )?(?:ok|ok+ay|possible|fine|good)(?: for you| with you)?|possible|you can do|can you do|"
|
||||||
|
r"(?:is )?(?:that|this) (?:ok|okay)|ok(?:ay)?|알긋나|알겠나|알았지|됐지|괜찮지|괜찮아요?|가능해요?|되나요?)\W*",
|
||||||
|
re.I) # "rotate right 45 degrees, is okay for you?": a check after the order, no part of its own
|
||||||
CALL_ONLY = re.compile(r"\W*(?:(?:excuse me|hey|hi|hello|yo|okay|ok|lumi|robot|buddy|루미 ?씨|루미야?|로봇아?|야|어이|저기요?|"
|
CALL_ONLY = re.compile(r"\W*(?:(?:excuse me|hey|hi|hello|yo|okay|ok|lumi|robot|buddy|루미 ?씨|루미야?|로봇아?|야|어이|저기요?|"
|
||||||
r"이보게)\W*)+", re.I)
|
r"이보게)\W*)+", re.I)
|
||||||
|
|
||||||
@@ -122,7 +125,8 @@ def plan(text, markers=(), cant=None):
|
|||||||
return None # "turn around and look": the head looks behind
|
return None # "turn around and look": the head looks behind
|
||||||
out = []
|
out = []
|
||||||
for p in ps:
|
for p in ps:
|
||||||
if SELF_PROMISE.search(p) or out and _restated(p, out[-1][1]) or brain.GREET_ONLY.match(p) or CALL_ONLY.fullmatch(p):
|
if SELF_PROMISE.search(p) or out and _restated(p, out[-1][1]) or brain.GREET_ONLY.match(p) or CALL_ONLY.fullmatch(p) or \
|
||||||
|
out and TAG_TALK.fullmatch(p):
|
||||||
# "hello robot, …", "야 루미, …", "excuse me robot, …": the call, no part
|
# "hello robot, …", "야 루미, …", "excuse me robot, …": the call, no part
|
||||||
continue # "흰색 머그컵 잡아!, 아 잡아 줄 수 있어요?": the order once
|
continue # "흰색 머그컵 잡아!, 아 잡아 줄 수 있어요?": the order once
|
||||||
got, unread = steps.rules(p, markers)
|
got, unread = steps.rules(p, markers)
|
||||||
|
|||||||
+60
-29
@@ -33,19 +33,19 @@ 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|cancel)\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(?:the (?:moment|second|minute|instant) (?:you|i|we|they|he|she)|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|분 ?(?:뒤|후|있다)|"
|
||||||
r"[가-힣](?<![정화측반전표라장내외평단그러])면(?:\s|$)|(?:하|으|오|가|되|끝나|있으|오시)면|나중에|이따|내일|"
|
r"[가-힣](?<![정화측반전표라장내외평단그러])면(?:\s|$)|(?:하|으|오|가|되|끝나|있으|오시)면|나중에|이따|내일|"
|
||||||
r"다음에|있다가|(?:^|\s)(?:후|뒤|전)에(?![서가-힣])|때(?:에)?\s|다음 ?(?:주|달|번|시간)에?|"
|
r"다음에|있다가|(?:^|\s)(?:후|뒤|전)에(?![서가-힣])|때(?:에)?\s|다음 ?(?:주|달|번|시간)에?|"
|
||||||
r"(?:^|\s)(?:\d{1,2}|한|두|세|네|다섯|여섯|일곱|여덟|아홉|열|열한|열두) ?시(?:에|쯤|까지)|"
|
r"(?:^|\s)(?:\d{1,2}|한|두|세|네|다섯|여섯|일곱|여덟|아홉|열|열한|열두) ?시(?:에|쯤|까지)|"
|
||||||
r"\b(?:next (?:week|month|year|monday|tuesday|wednesday|thursday|friday|saturday|sunday)|"
|
r"\b(?:next (?:week|month|year|monday|tuesday|wednesday|thursday|friday|saturday|sunday)|"
|
||||||
r"at (?:\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)(?::\d\d)? ?(?:o'?clock|pm|am|p\.m\.|a\.m\.))", re.I)
|
r"at (?:\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)(?::\d\d)? ?(?:o'?clock|pm|am|p\.m\.|a\.m\.))", re.I)
|
||||||
ABILITY = re.compile(r"\b(?:are you able|able to|know how|i heard you can|heard (?:that )?you can|how (?:do|can|could|would) you|is it possible|can you even|"
|
ABILITY = re.compile(r"\b(?:are you able|can your (?:model|robot|arm|hand|body)|able to|know how|i heard you can|heard (?:that )?you can|how (?:do|can|could|would) you|is it possible|can you even|can you really|could you really|"
|
||||||
r"capable of|do you (?:know|have)|can robots?|could robots?)\b|"
|
r"capable of|do you (?:know|have)|can robots?|could robots?)\b|"
|
||||||
r"\bcan you (?:\w+ )?(?:things|anything|objects|stuff|people|by yourself)\b|\b(?:can|could) you \w+(?: up)? (?:a|an|any)\b.*\?|"
|
r"\bcan you (?:\w+ )?(?:things|anything|objects|stuff|people|by yourself)\b|\b(?:can|could) you \w+(?: up)? (?:a|an|any)\b.*\?|"
|
||||||
r"\bshow me (?:you can|how)\b|기능|\bfunction\b|\bfeature\b|줄 ?(?:은|도)? ?(?:알|아|압|안)|보여 ?(?:줄|주실|주세요|줘)|할 ?줄|줄 ?알|(?<!줄 )(?<!주실 )(?<!주 )(?<!줄)(?<!주실)수 ?있(?:어|어요|니|나요|습니까|을까)\s*\??$|가능해|가능한가|가능하", re.I)
|
r"\bshow me (?:you can|how)\b|기능|\bfunction\b|\bfeature\b|줄 ?(?:은|도)? ?(?:알|아|압|안)|보여 ?(?:줄|주실|주세요|줘)|할 ?줄|줄 ?알|(?<!줄 )(?<!주실 )(?<!주 )(?<!줄)(?<!주실)수 ?있(?:어|어요|니|나요|습니까|을까|으세요|으신가요|으십니까)\s*\??$|가능해|가능한가|가능하", re.I)
|
||||||
WONDER = re.compile(r"\bi wonder\b|\bwonder(?:ing)? (?:if|whether|how)\b|\bi bet\b|\b(?:i )?guess (?:it|the robot)\b|"
|
WONDER = re.compile(r"\bi wonder\b|\bwonder(?:ing)? (?:if|whether|how)\b|\bi bet\b|\b(?:i )?guess (?:it|the robot)\b|"
|
||||||
r"\b(?:can|could|does|did|will|would|is|was) (?:it|this|that|the robot|this robot|that robot|he|she|this thing)\b|"
|
r"\b(?:can|could|does|did|will|would|is|was) (?:it|this|that|the robot|this robot|that robot|he|she|this thing)\b|"
|
||||||
r"\b(?:it|the robot|this robot|this thing) (?:can|could|does|will|is able)\b|\bcan it\b|"
|
r"\b(?:it|the robot|this robot|this thing) (?:can|could|does|will|is able)\b|\bcan it\b|"
|
||||||
@@ -63,15 +63,17 @@ NOT_TO_LUMI = re.compile(
|
|||||||
r"are asked|are requested)\b|\bare (?:kindly )?(?:asked|requested) to\b|안내 ?말씀|(?<![가-힣])여러분(?!한테|에게|께)|"
|
r"are asked|are requested)\b|\bare (?:kindly )?(?:asked|requested) to\b|안내 ?말씀|(?<![가-힣])여러분(?!한테|에게|께)|"
|
||||||
r"관람객|방문객|승객|" # announcements
|
r"관람객|방문객|승객|" # announcements
|
||||||
r"\bso (?:well|nicely|smoothly|fast|good)\b|\b(?:really|very) (?:well|nicely|smoothly)\b|\bthe way you\b|"
|
r"\bso (?:well|nicely|smoothly|fast|good)\b|\b(?:really|very) (?:well|nicely|smoothly)\b|\bthe way you\b|"
|
||||||
r"\blove how\b|[가-힣](?:네|네요|구나|군요|더라|던데)\s*[!.~]*$|[가-힣](?<!니)다\s*[!.~]*$|"
|
r"\blove how\b|\b\w+ing (?:is|was) (?:so )?(?:fun|cool|great|nice|hard|cute|funny|awesome)\b|\bgood at \w+ing\b|"
|
||||||
|
r"\bi (?:love|like|enjoy) (?:it when you |your |the way you )?\w+ing\b|\bthanks? (?:you )?for\b|"
|
||||||
|
r"는 ?(?:게|거) (?:좋|싫|재밌|재미있|귀엽|멋지|신기)|[가-힣](?:네|네요|구나|군요|더라|던데)\s*[!.~]*$|[가-힣](?<!니)다\s*[!.~]*$|"
|
||||||
r"(?:좋|멋지|예쁘|이쁘|귀엽|크|작|길|세|대단하|신기하|웃기)(?:네|네요|구나|군요)(?=[\s,.!~])", re.I)
|
r"(?:좋|멋지|예쁘|이쁘|귀엽|크|작|길|세|대단하|신기하|웃기)(?:네|네요|구나|군요)(?=[\s,.!~])", re.I)
|
||||||
# plans, hypotheticals, announcements, praise and remarks: nobody asked Lumi to do anything now
|
# plans, hypotheticals, announcements, praise and remarks: nobody asked Lumi to do anything now
|
||||||
QUESTION = re.compile(r"^\W*(?:(?:hey|so|um+|uh+|lumi|okay|ok)\W+)*(?:what|where|why|how|when|who|whose|which|is|are|was|"
|
QUESTION = re.compile(r"^\W*(?:(?:hey|so|um+|uh+|lumi|okay|ok)\W+)*(?:what|where|why|how|when|who|whose|which|is|are|was|"
|
||||||
r"were|do(?=\s+(?:you|i|we|they|robots?)\b)|does|did|have|has|had|should|shall i|may i|can i|could i)\b(?! about\b)|"
|
r"were|do(?=\s+(?:you|i|we|they|robots?)\b)|does|did|have|has|had|should|shall i|may i|can i|could i)\b(?! about\b)|"
|
||||||
r"어디|뭐|무엇|왜|언제|누구|어떻게|몇|어느|무슨|어떤|얼마|[가-힣]까\s*[??]+\s*$|봤(?:어|니|나|냐|어요|습니까)|본 ?적|"
|
r"어디|뭐|무엇|왜|언제|누구|어떻게|몇|어느|무슨|어떤|얼마|[가-힣]까\s*[??]+\s*$|봤(?:어|니|나|냐|어요|습니까)|본 ?적|"
|
||||||
r"\bhave you (?:been|gone|ever)\b|(?:어|아|해|여)도 ?(?:돼|되|될까|괜찮)|"
|
r"\bhave you (?:been|gone|ever)\b|(?:어|아|해|여)도 ?(?:돼|되|될까|괜찮)|[가-힣]도 ?(?:돼|되나|될까|괜찮아)\s*[??]|"
|
||||||
r"알려 ?(?:줘|주|줄)|설명해|가르쳐|말해 ?(?:줘|봐|주)|\btell me\b|\bexplain\b|\bdescribe\b|"
|
r"알려 ?(?:줘|주|줄)|설명해|가르쳐|말해 ?(?:줘|봐|주)|\btell me\b|\bexplain\b|\bdescribe\b|"
|
||||||
r"상태(?:야|예요|에요|니|냐|입니까|인가요)?\s*\??\s*$|(?:open|오픈|열림|닫힘)(?:이야|이에요|이니|인가요|입니까)|"
|
r"상태(?:야|예요|에요|니|냐|입니까|인가요)?\s*\??\s*$|(?:open|오픈|열림|닫힘|closed?) ?(?:이야|이에요|이니|인가요|입니까)|"
|
||||||
r"\b(?:is|are) (?:your|the) (?:hand|gripper|fingers?|arm|head)s? (?:open|closed|up|down|out)\b|"
|
r"\b(?:is|are) (?:your|the) (?:hand|gripper|fingers?|arm|head)s? (?:open|closed|up|down|out)\b|"
|
||||||
r"정확도|얼마나|을매나|속도|(?:열려|닫혀|켜져|꺼져|접혀|펴져) ?있(?:어|어요|니|나요|습니까)?\s*[??]", re.I)
|
r"정확도|얼마나|을매나|속도|(?:열려|닫혀|켜져|꺼져|접혀|펴져) ?있(?:어|어요|니|나요|습니까)?\s*[??]", re.I)
|
||||||
# "그리퍼 열려 있어요?": a state asked, no motion # "팔 정확도 알려 줘": a question, no motion
|
# "그리퍼 열려 있어요?": a state asked, no motion # "팔 정확도 알려 줘": a question, no motion
|
||||||
@@ -94,7 +96,7 @@ GROUP_CALL = re.compile(r"(?:^|[,:;.!?]\s*)(?:(?:hey|ok|okay|alright|so|come on)
|
|||||||
r"you all|everyone|everybody|team|kids|people|ladies|gentlemen)\s*(?:[,:;!.]|$)|"
|
r"you all|everyone|everybody|team|kids|people|ladies|gentlemen)\s*(?:[,:;!.]|$)|"
|
||||||
r"얘들아|애들아|친구들아|여러분[,\s]|(?<![가-힣])(?!로봇|루미)[가-힣]{1,4}님(?:[,!\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", "loomy", "loomye", "lumie", "rumie", "lumy", "roomi", "lumee", "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",
|
||||||
"robot", "right", "fine", "good", "great", "sure", "next", "again", "quick", "listen", "excuse", "hmm"}
|
"robot", "right", "fine", "good", "great", "sure", "next", "again", "quick", "listen", "excuse", "hmm"}
|
||||||
SELF_TALK = re.compile(r"^\W*i'?m \w+ing\b|\b(?:myself|yesterday|last (?:time|week|night))\b|어제|지난번|었지|었어|"
|
SELF_TALK = re.compile(r"^\W*i'?m \w+ing\b|\b(?:myself|yesterday|last (?:time|week|night))\b|어제|지난번|었지|었어|"
|
||||||
@@ -102,12 +104,12 @@ SELF_TALK = re.compile(r"^\W*i'?m \w+ing\b|\b(?:myself|yesterday|last (?:time|we
|
|||||||
r"i want to go|my \w+ (?:will|is|went)|he |she |they )|"
|
r"i want to go|my \w+ (?:will|is|went)|he |she |they )|"
|
||||||
r"(?:^|\s)(?:나는|저는|내가|제가|우리는|저희는)\s|갈게|할게|할께|갈께|했어|했어요|갔어|왔어", re.I)
|
r"(?:^|\s)(?:나는|저는|내가|제가|우리는|저희는)\s|갈게|할게|할께|갈께|했어|했어요|갔어|왔어", re.I)
|
||||||
|
|
||||||
PAST_EN = re.compile(r"\b(?:i|we)(?:'ve| have| had)?\s+(?:just\s+|already\s+|also\s+|then\s+|never\s+)?(?:(?!need\b|feed\b|speed\b)\w+ed|went|came|"
|
PAST_EN = re.compile(r"\byou(?: just| already)? (?!need\b)\w+ed\b.*\b(?:earlier|before|already|yesterday|last time|this morning)\b|\b(?:i|we)(?:'ve| have| had)?\s+(?:just\s+|already\s+|also\s+|then\s+|never\s+)?(?:(?!need\b|feed\b|speed\b)\w+ed|went|came|"
|
||||||
r"drove|ran|took|got|left|saw|did|had|made|put|brought|gave|told|said|was|were|spun|stood|sat|found|held|"
|
r"drove|ran|took|got|left|saw|did|had|made|put|brought|gave|told|said|was|were|spun|stood|sat|found|held|"
|
||||||
r"been|gone|done|seen|taken|given)\b|\bi've\b|\bwe've\b", re.I) # "I walked to the stage", "we went to p3"
|
r"been|gone|done|seen|taken|given)\b|\bi've\b|\bwe've\b", re.I) # "I walked to the stage", "we went to p3"
|
||||||
TAG = re.compile(r",\s*(?:right|correct|huh|true)\s*[?!.]*\s*$|\b(?:isn'?t|aren'?t|wasn'?t|weren'?t|don'?t|doesn'?t|didn'?t|"
|
TAG = re.compile(r",\s*(?:right|correct|huh|true)\s*[?!.]*\s*$|\b(?:isn'?t|aren'?t|wasn'?t|weren'?t|don'?t|doesn'?t|didn'?t|"
|
||||||
r"won'?t|can'?t|haven'?t|hasn'?t) (?:it|you|they|we|i|he|she|there|that)\s*[?!.]*\s*$|"
|
r"won'?t|can'?t|haven'?t|hasn'?t) (?:it|you|they|we|i|he|she|there|that)\s*[?!.]*\s*$|"
|
||||||
r"(?:지|죠|쥬|지요|잖아|잖아요|맞지|맞죠|맞아요?|그렇지|그렇죠|그쵸|그치)\s*[??!.~]*\s*$|"
|
r"(?<!줄 수 있)(?<!실 수 있)(?:지|죠|쥬|지요|잖아|잖아요|맞지|맞죠|맞아요?|그렇지|그렇죠|그쵸|그치)\s*[??!.~]*\s*$|"
|
||||||
r"(?:^|\s)(?:맞지|맞죠|그치)\s*\?+\s*$", re.I) # "..., right?", "the next stop is p3, isn't it?", "끝에 갔지?"
|
r"(?:^|\s)(?:맞지|맞죠|그치)\s*\?+\s*$", re.I) # "..., right?", "the next stop is p3, isn't it?", "끝에 갔지?"
|
||||||
|
|
||||||
|
|
||||||
@@ -718,17 +720,21 @@ def _load():
|
|||||||
|
|
||||||
|
|
||||||
POLITE = re.compile(r"\bif you don'?t mind\b|\b(?:it'?d|it would|that would|that'?d) be (?:great|nice|good|lovely|awesome|"
|
POLITE = re.compile(r"\bif you don'?t mind\b|\b(?:it'?d|it would|that would|that'?d) be (?:great|nice|good|lovely|awesome|"
|
||||||
r"cool|helpful) if you(?: could)?\b|^\W*go ahead and\b|\bfor a (?:sec|second|moment|bit)\b|\bif you please\b", re.I)
|
r"cool|helpful) if you(?: could)?\b|^\W*go ahead and\b|\bfor a (?:sec|second|moment|bit)\b|\bif you please\b|"
|
||||||
|
r",?\s*if you (?:would|could|can|will)\s*[.!?]*$|\bwhy don'?t (?:you|u)\b|\bi don'?t suppose (?:you|u) could\b|"
|
||||||
|
r"\b(?:is it|would it be) (?:okay|ok|alright) (?:if (?:you|u)|to|for (?:you|u) to)\b|"
|
||||||
|
r"\bis there any way (?:you|u) could\b|\b(?:could|can|may) i ask (?:you|u) to\b", re.I)
|
||||||
|
# "why don't you rotate left", "would it be okay to spin around": asked now, politely
|
||||||
SLANG = [(re.compile(rf"(?<![\w가-힣]){a}(?![\w가-힣])", re.I), b) for a, b in (
|
SLANG = [(re.compile(rf"(?<![\w가-힣]){a}(?![\w가-힣])", re.I), b) for a, b in (
|
||||||
("wav", "wave"), ("reech", "reach"), ("ur", "your"), ("u(?!-?turn)", "you"), ("lemme", "let me"), ("luk", "look"),
|
("wav", "wave"), ("reech", "reach"), ("urself", "yourself"), ("ur", "your"), ("u(?!-?turn)", "you"), ("lemme", "let me"), ("luk", "look"),
|
||||||
("pickup", "pick up"), ("plz|pls", "please"), ("mister robot|hey robot|yo robot|bro|buddy|lol|beep boop", ""),
|
("pickup", "pick up"), ("plz|pls", "please"), ("mister robot|hey robot|yo robot|bro|buddy|lol|beep boop", ""),
|
||||||
("^\\W*robot", ""), (",?\\s*robot(?=\\s*[,.!?]|\\s*$)", ""),
|
("^\\W*robot", ""), (",?\\s*robot(?=\\s*[,.!?]|\\s*$)", ""),
|
||||||
("보이소|보시오|보시게|보십시오", "봐"), ("주이소|주시게", "주세요"), ("따라온나|따라오시게|따라오이소", "따라와"),
|
("보이소|보시오|보시게|보십시오", "봐"), ("주이소|주시게", "주세요"), ("따라온나|따라오시게|따라오이소", "따라와"),
|
||||||
("왼짝", "왼쪽"), ("오른짝", "오른쪽"), ("오른쪽바", "오른쪽 봐"), ("왼쪽바", "왼쪽 봐"),
|
("왼짝|웬쪽|왼 쪽", "왼쪽"), ("오른짝|오른 쪽", "오른쪽"), ("뒤루", "뒤로"), ("도라", "돌아"), ("오른쪽바", "오른쪽 봐"), ("왼쪽바", "왼쪽 봐"),
|
||||||
("얘(?= ?,? ?(?:로봇|루미))", ""), ("로봇아|로봇 양반|로봇씨", ""), ("어이|ㅋ+", ""))]
|
("얘(?= ?,? ?(?:로봇|루미))", ""), ("로봇아|로봇 양반|로봇씨", ""), ("어이|ㅋ+", ""))]
|
||||||
# slang, whisper's spellings, dialect endings and calls: read as the plain word (the bank and the slots)
|
# slang, whisper's spellings, dialect endings and calls: read as the plain word (the bank and the slots)
|
||||||
LEAD = re.compile(r"^\W*(?:(?:excuse me|okay so|ok so|so|uh+|um+|yo|hi|hey|hello|alright|all right|okay|ok|well|listen|"
|
LEAD = re.compile(r"^\W*(?:(?:excuse me|okay so|ok so|so|uh+|um+|yo|hi|hey|hello|alright|all right|okay|ok|well|listen|"
|
||||||
r"ah+|oh+|wow|hmm+|buddy|lumi|robot|hey robot|로봇(?=\s)|로봇 ?(?:씨|님|친구야?)|로봇아|로봇야|이봐요?|이보게|이보세요|"
|
r"ah+|oh+|wow|hmm+|buddy|lumi|robot|hey robot|로봇(?=[\s,.!])|루미아|누미야|루미루미|로봇 ?(?:씨|님|친구야?)|로봇아|로봇야|이봐요?|이보게|이보세요|"
|
||||||
r"실례지만|실례합니다|아가|얘야|있잖아요?|여보세요|루미 ?군|루미 ?선생|루미 ?씨|루미야|루미씨|루미|저기요|저기|자|야(?=\s*,?\s*(?:루미|로봇))|음|어|좋아|이제|그럼|근데|그런데|아|like)\b[\s,.!~]*)+", re.I)
|
r"실례지만|실례합니다|아가|얘야|있잖아요?|여보세요|루미 ?군|루미 ?선생|루미 ?씨|루미야|루미씨|루미|저기요|저기|자|야(?=\s*,?\s*(?:루미|로봇))|음|어|좋아|이제|그럼|근데|그런데|아|like)\b[\s,.!~]*)+", re.I)
|
||||||
AMOUNT = [(re.compile(r"\b\d+(?:\.\d+)?\s*(?:degrees?|도)(?![a-z])|\b\d+(?:\.\d+)?도", re.I), "90 degrees"),
|
AMOUNT = [(re.compile(r"\b\d+(?:\.\d+)?\s*(?:degrees?|도)(?![a-z])|\b\d+(?:\.\d+)?도", re.I), "90 degrees"),
|
||||||
(re.compile(r"\b\d+(?:\.\d+)?\s*(?:m|meters?|metres?|cm|centimet(?:er|re)s?|mm|millimet(?:er|re)s?|"
|
(re.compile(r"\b\d+(?:\.\d+)?\s*(?:m|meters?|metres?|cm|centimet(?:er|re)s?|mm|millimet(?:er|re)s?|"
|
||||||
@@ -738,9 +744,15 @@ AMOUNT = [(re.compile(r"\b\d+(?:\.\d+)?\s*(?:degrees?|도)(?![a-z])|\b\d+(?:\.\d
|
|||||||
def plain(text):
|
def plain(text):
|
||||||
"""The words without polite frames ("if you don't mind", "it'd be great if you could") and calls before."""
|
"""The words without polite frames ("if you don't mind", "it'd be great if you could") and calls before."""
|
||||||
from assistant import wording
|
from assistant import wording
|
||||||
|
text = re.sub(r"(?<=[가-힣])(?:시|으시)?면 (?:좋겠|감사하겠|고맙겠)(?:어요|습니다|어|네요|는데요?)?|(?<=[가-힣]) 주면 땡큐", "세요",
|
||||||
|
text or "") # "몸 내리시면 좋겠어요", "follow 모드 해 주면 땡큐": asked now
|
||||||
t = POLITE.sub(" ", wording.polite(wording.ko_plain(wording.now_not_later(text))))
|
t = POLITE.sub(" ", wording.polite(wording.ko_plain(wording.now_not_later(text))))
|
||||||
for rx, word in SLANG:
|
for rx, word in SLANG:
|
||||||
t = rx.sub(word, t)
|
t = rx.sub(word, t)
|
||||||
|
t = re.sub(r"(?<=[a-zA-Z]{2})(?=[가-힣])", " ", t)
|
||||||
|
t = re.sub(r"(?:^|(?<=\s))[^\s—]+—\s*(?=\S)", "", t) # a word cut off and said again: "열려 있— 있어?" # "right로 턴", "body up해 줘": the English word apart
|
||||||
|
t = re.sub(r"(?<=[가-힣]) (?:쥬|도고|도가)(?=\s*[!.~]*$)", " 줘", t) # "손 흔들어 쥬", "컵 갖다 도고" (했쥬? stays)
|
||||||
|
t = re.sub(r"[,\s]+자네\s*([!.~]*)$", r"\1", t) # "팔 접어 주게, 자네": a call after
|
||||||
t = re.sub(r"\s+([,.!?])", r"\1", re.sub(r"^[\s,.!?~]+", "", t))
|
t = re.sub(r"\s+([,.!?])", r"\1", re.sub(r"^[\s,.!?~]+", "", t))
|
||||||
t = LEAD.sub("", t).strip()
|
t = LEAD.sub("", t).strip()
|
||||||
return re.sub(r"\s{2,}", " ", t) or (text or "").strip()
|
return re.sub(r"\s{2,}", " ", t) or (text or "").strip()
|
||||||
@@ -797,7 +809,7 @@ def core(text, markers=()):
|
|||||||
t = TAIL.sub("", brain.CALLING.sub("", plain(text))).strip(" ,.!?~") or text
|
t = TAIL.sub("", brain.CALLING.sub("", plain(text))).strip(" ,.!?~") or text
|
||||||
t = re.sub(r"(?<![가-힣])좀\s+(?=[가-힣])", "", t) # "뒤로 좀 돌아 줘": a softener, not a word to compare
|
t = re.sub(r"(?<![가-힣])좀\s+(?=[가-힣])", "", t) # "뒤로 좀 돌아 줘": a softener, not a word to compare
|
||||||
named = [m for m in markers if brain.named_place(t, m, markers)]
|
named = [m for m in markers if brain.named_place(t, m, markers)]
|
||||||
if len(named) == 1:
|
if len(named) == 1 and not re.search(rf"(?:\bhands?|\barms?|손|팔)\W+(?:\w+\W+)?{re.escape(named[0])}", t, re.I):
|
||||||
low = brain._norm(t, markers)
|
low = brain._norm(t, markers)
|
||||||
swapped = re.sub(rf"(?<![a-z0-9])(?:the )?{re.escape(named[0].lower())}(?![a-z0-9])", CANON_PLACE, low)
|
swapped = re.sub(rf"(?<![a-z0-9])(?:the )?{re.escape(named[0].lower())}(?![a-z0-9])", CANON_PLACE, low)
|
||||||
if swapped != low:
|
if swapped != low:
|
||||||
@@ -859,7 +871,7 @@ DIR = {"forward": r"\b(?:forward|forwards|forword|ahead|straight)\b|\bto the fro
|
|||||||
|
|
||||||
|
|
||||||
CARRY = (r"\b(?:bring(?! yourself)|fetch|deliver|carry)\b|\bget me\b|\b(?:to|for) me\b(?=.*\b(?:bring|get|fetch|hand|pass)\b)|"
|
CARRY = (r"\b(?:bring(?! yourself)|fetch|deliver|carry)\b|\bget me\b|\b(?:to|for) me\b(?=.*\b(?:bring|get|fetch|hand|pass)\b)|"
|
||||||
r"\bget(?:ting)?\b.*\bfrom\b|\bgo get\b|가져|갖다|가지고 ?와|가져다|챙겨 ?(?:와|다)|갖고 ?와") # words that bring a thing to someone
|
r"\bget(?:ting)?\b.*\bfrom\b|\bgo get\b|브링|가져|갖다|가지고 ?와|가져다|챙겨 ?(?:와|다)|갖고 ?와") # words that bring a thing to someone
|
||||||
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 "컴 히어 해 줘", "이리 컴"
|
||||||
@@ -880,7 +892,7 @@ MOVE_VERB = (r"\b(?:move|go|step|back up|backup|scoot|slide|shift|drive|roll|rev
|
|||||||
LOOK_DIR = {"left": r"\bleft|왼|레프트|(?:^|\s)좌로|좌측", "right": r"\bright|\brite\b|오른|라이트|(?:^|\s)우로|우측",
|
LOOK_DIR = {"left": r"\bleft|왼|레프트|(?:^|\s)좌로|좌측", "right": r"\bright|\brite\b|오른|라이트|(?:^|\s)우로|우측",
|
||||||
"up": r"\bup|\bupward|\bceiling|\bsky\b|\bhigher\b|천장|하늘|(?<!원)위", "down": r"\bdown|\bfloor|\bground|\bfeet\b|바닥|땅|아래|밑"}
|
"up": r"\bup|\bupward|\bceiling|\bsky\b|\bhigher\b|천장|하늘|(?<!원)위", "down": r"\bdown|\bfloor|\bground|\bfeet\b|바닥|땅|아래|밑"}
|
||||||
LOOK_ME = (r"\b(?:at|on|to|toward|towards) (?:me|us|나)\b|\bthis way\b|\bover here\b|\bmy way\b|\bhere\b|\bwatch me\b|"
|
LOOK_ME = (r"\b(?:at|on|to|toward|towards) (?:me|us|나)\b|\bthis way\b|\bover here\b|\bmy way\b|\bhere\b|\bwatch me\b|"
|
||||||
r"\bme in the eye|\bmy face\b|(?:제|내) 얼굴|나한테|저한테|쳐다봐|(?:^|\s)(?:여기|이쪽|저|나|날|절)(?:를|을)?\s*(?:(?:좀|한 ?번|잠깐|잠시|다시)\s*)*(?:바라|쳐다)?(?:봐|보세요|look)")
|
r"\bme in the eye|\bmy face\b|\bme (?=봐|보)|\blook (?:여기|here|me)\b|(?:제|내) 얼굴|나한테|저한테|쳐다봐|(?:^|\s)(?:여기|이쪽|저|나|날|절)(?:를|을)?\s*(?:(?:좀|한 ?번|잠깐|잠시|다시)\s*)*(?:바라|쳐다)?(?:봐|보세요|look)")
|
||||||
|
|
||||||
|
|
||||||
EN_NUM = {w: i for i, w in enumerate("zero one two three four five six seven eight nine ten eleven twelve thirteen "
|
EN_NUM = {w: i for i, w in enumerate("zero one two three four five six seven eight nine ten eleven twelve thirteen "
|
||||||
@@ -1011,6 +1023,8 @@ def _slot(kind, text, markers, holding):
|
|||||||
"""The (action, target) lumi.quick_command takes, or None when the words don't say it plainly."""
|
"""The (action, target) lumi.quick_command takes, or None when the words don't say it plainly."""
|
||||||
from assistant import brain, driving
|
from assistant import brain, driving
|
||||||
t = brain._norm(text, markers)
|
t = brain._norm(text, markers)
|
||||||
|
if kind == "go_to" and re.search(r"팔|손|\barm\b|\bhand\b", t) and re.search(r"포지션|자세|\bposition\b|\bpose\b", t):
|
||||||
|
return None # "홈 포지션으로 팔": the arm's pose, not the marker home
|
||||||
if kind == "go_to":
|
if kind == "go_to":
|
||||||
if brain._mentions(text, markers).get("object") or re.search(r"\bfrom\b|에서|에 있는|\bface\b|\blook|\bpoint|"
|
if brain._mentions(text, markers).get("object") or re.search(r"\bfrom\b|에서|에 있는|\bface\b|\blook|\bpoint|"
|
||||||
r"(?<![가와해] )(?<![가와해])봐|" # "가 봐": try going
|
r"(?<![가와해] )(?<![가와해])봐|" # "가 봐": try going
|
||||||
@@ -1062,16 +1076,20 @@ def _slot(kind, text, markers, holding):
|
|||||||
return None
|
return None
|
||||||
return ("move", f"{d[0]} {n:g}")
|
return ("move", f"{d[0]} {n:g}")
|
||||||
if kind == "turn":
|
if kind == "turn":
|
||||||
if re.search(r"\blook|봐|\bhead\b|고개|\beyes\b|\btorso\b|\bwaist\b|\bupper body\b|\bhips?\b|허리|상체|몸통|윗몸|"
|
if re.search(r"\blook|봐|\bhead\b|고개|\beyes\b|\btorso\b|\bwaist\b|\btwist|\bupper body\b|\bhips?\b|허리|상체|몸통|윗몸|"
|
||||||
r"\btrunk\b|\bwithout driving\b", t):
|
r"\btrunk\b|\bwithout driving\b", t):
|
||||||
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"반 ?바퀴", t) and not re.search(r"\d|한 ?바퀴", t):
|
||||||
|
return ("turn", "around 180") # "반 바퀴 돌아": half a turn, either way
|
||||||
|
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|teh|da) 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")
|
||||||
if re.search(r"\baround\b|\bu-?turn\b|유턴|뒤로 (?:(?:좀|한 ?번|얼른|빨리)\s*)?(?:돌|회전)|뒤돌|\bother way\b|\babout face\b|한 바퀴", t):
|
if re.search(r"\bgo the other way\b", t):
|
||||||
|
return None # "go the other way around": a way round (detour), not a turn
|
||||||
|
if re.search(r"\baround\b|\bu-?turn\b|유턴|뒤로 ?(?:(?:좀|한 ?번|얼른|빨리|확)\s*)?(?:돌|회전)|뒤돌|\bother way\b|\babout face\b|한 바퀴", t):
|
||||||
return None if re.search(r"\bleft|\bright\b|왼|오른", t) else ("turn", "around 180")
|
return None if re.search(r"\bleft|\bright\b|왼|오른", t) else ("turn", "around 180")
|
||||||
d = [x for x in _dirs(t) if x in ("left", "right")]
|
d = [x for x in _dirs(t) if x in ("left", "right")]
|
||||||
if not d and said_amount(text)[1] == 180:
|
if not d and said_amount(text)[1] == 180:
|
||||||
@@ -1095,7 +1113,7 @@ def _slot(kind, text, markers, holding):
|
|||||||
dirs = [d for d, rx in LOOK_DIR.items() if re.search(rx, t)]
|
dirs = [d for d, rx in LOOK_DIR.items() if re.search(rx, t)]
|
||||||
if re.search(r"\baway\b|\bavert|딴 ?데|다른 ?데|시선", t):
|
if re.search(r"\baway\b|\bavert|딴 ?데|다른 ?데|시선", t):
|
||||||
target = "away"
|
target = "away"
|
||||||
elif re.search(r"\b(?:front|forward|center|centre|middle|reset|straighten)\b|원위치|원래대로|가운데|정면|앞에", t):
|
elif re.search(r"\b(?:front|forward|center|centre|middle|reset|straighten)\b|프론트|원위치|원래대로|가운데|정면|앞에", t):
|
||||||
target = "center"
|
target = "center"
|
||||||
elif len(dirs) == 1:
|
elif len(dirs) == 1:
|
||||||
target = dirs[0] + (" small" if brain.SMALL.search(t) else "")
|
target = dirs[0] + (" small" if brain.SMALL.search(t) else "")
|
||||||
@@ -1105,8 +1123,8 @@ def _slot(kind, text, markers, holding):
|
|||||||
if kind == "lift":
|
if kind == "lift":
|
||||||
if not re.search(LIFT_BODY, t) or re.search(r"\bto me\b|나한테|저한테", t): # "come up to me": come
|
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|높(?:여|게|아|혀)|높이(?=게|세|십|시|어|자)|키워|올려|올리|늘려|"
|
||||||
r"커|올라|업", t)
|
r"커|올라|업", t)
|
||||||
if bool(down) == bool(up):
|
if bool(down) == bool(up):
|
||||||
return None # no direction, or both: asked
|
return None # no direction, or both: asked
|
||||||
@@ -1139,14 +1157,15 @@ def _slot(kind, text, markers, holding):
|
|||||||
r"\b(?:throw|toss|kick|break|eat|drink|wash|clean|buy|sell|"
|
r"\b(?:throw|toss|kick|break|eat|drink|wash|clean|buy|sell|"
|
||||||
r"put|place|set|drop|leave|this|hold (?:this|my|it|on)|my)\b|놔|놓|내려", t) or \
|
r"put|place|set|drop|leave|this|hold (?:this|my|it|on)|my)\b|놔|놓|내려", t) or \
|
||||||
not re.search(CARRY, t) and re.search(r"\bfrom\b|\bgo get\b|에서", t) or \
|
not re.search(CARRY, t) and re.search(r"\bfrom\b|\bgo get\b|에서", t) or \
|
||||||
(holding() if callable(holding) else holding) or re.search(r"\breturn\b|돌려|반납|반환", t):
|
(holding() if callable(holding) else holding) or re.search(r"\breturn\b|돌려|반납|반환|바닥|\bfloor\b|\bground\b", t):
|
||||||
return None # "put the banana on the table", "hold this apple": the hand's;
|
return None # "put the banana on the table", "hold this apple": the hand's;
|
||||||
# "return the cup", "컵 돌려줘": give back, not a pick
|
# "return the cup", "컵 돌려줘": give back, not a pick
|
||||||
if re.search(r"\b(?:give|hand|pass)\b|건네", t) or \
|
if re.search(r"\b(?:give|hand|pass)\b|건네", t) or \
|
||||||
re.search(r"줘|주세요|주실|줄래", t) and not re.search(r"집|잡|들어|쥐|픽|pick|grab|take|" + CARRY, t):
|
re.search(r"줘|주세요|주실|줄래", t) and not re.search(r"집|잡|들어|쥐|픽|그랩|테이크|pick|grab|take|" + CARRY, t):
|
||||||
return None # "컵 좀 줘": bring it to me, a mission (pick, then give)
|
return None # "컵 좀 줘": bring it to me, a mission (pick, then give)
|
||||||
if re.search(CARRY, t): # "bring me the cup", "컵 가져와": a fetch
|
if re.search(CARRY, t): # "bring me the cup", "컵 가져와": a fetch
|
||||||
if re.search(r"\b(?:him|her|them)\b", t) or _to_person(text) or \
|
if re.search(r"\b(?:him|her|them)\b|가져가|갖고 ?가|가지고 ?가|\d+ ?층|\bfloor\b|upstairs|downstairs", t) or \
|
||||||
|
_to_person(text) or \
|
||||||
"source" in got and got["source"] is None or "dest" in got and got["dest"] is None or \
|
"source" in got and got["source"] is None or "dest" in got and got["dest"] is None or \
|
||||||
re.search(r"\bgo\b|가서|\bwhere\b", t):
|
re.search(r"\bgo\b|가서|\bwhere\b", t):
|
||||||
return None # "from the cafeteria" (not on the map), "go home, bring it": asked
|
return None # "from the cafeteria" (not on the map), "go home, bring it": asked
|
||||||
@@ -1171,7 +1190,9 @@ def read(text, markers=(), holding=False):
|
|||||||
"""(action, target) as brain.intent gives it, when the bank is sure; else None (the LLM reads it)."""
|
"""(action, target) as brain.intent gives it, when the bank is sure; else None (the LLM reads it)."""
|
||||||
from assistant import brain
|
from assistant import brain
|
||||||
said, text = text, plain(text)
|
said, text = text, plain(text)
|
||||||
if guarded(text) or brain.not_an_order(said, asked=False) or brain.held_back(said):
|
if guarded(text) or brain.not_an_order(said, asked=False) or brain.held_back(said) or \
|
||||||
|
re.search(r"(?<!줄)(?<!주실)(?<=[가-힣]) 수 ?있으(?:세요|신가요|십니까|신지요)\s*[??]?\s*$", said or ""):
|
||||||
|
# "팔 접을 수 있으세요?" (ko_plain makes it "접어 줘?"): asked
|
||||||
return None # lumi.route holds these before the bank too: a later time, a
|
return None # lumi.route holds these before the bank too: a later time, a
|
||||||
# quote, "it's going to ...", "for the demo, let's have it ..."
|
# quote, "it's going to ...", "for the demo, let's have it ..."
|
||||||
kind = kind_of(text, markers)
|
kind = kind_of(text, markers)
|
||||||
@@ -1223,8 +1244,18 @@ def _verb_conflict(kind, text, holding):
|
|||||||
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):
|
if kind in ("pick", "fetch") and not TAKE_WORD.search(text):
|
||||||
return True # "컵을 바 주라" (봐 heard as 바): no take verb
|
return True # "컵을 바 주라" (봐 heard as 바): no take verb
|
||||||
|
if kind == "go_to" and re.search(r"놔|놓|둬|\b(?:put|place|drop off|set down)\b", text, re.I):
|
||||||
|
return True # "p3에 내려놔": a place for what it holds, not a drive
|
||||||
|
if kind == "arm_reach" and re.search(r"\bhand (?:me|it|over|that|this|them)\b|손 ?여", text, re.I):
|
||||||
|
return True # "hand me that" (give), "손 여실래요" (open)
|
||||||
|
if kind == "arm_fold" and re.search(r"뻗|내밀|\b(?:reach|extend|stretch)|\b(?:hold|stick|put|hand) (?:\w+ ){0,2}out\b", text, re.I):
|
||||||
|
return True # "팔 뻗어라 카이": the arm out, not folded
|
||||||
if kind == "arm_reach" and not ARM_WORD.search(text) and not REACH_WORD.search(text):
|
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
|
return True # "그거 주시게", "건네시겠어요": a hand-over, not the arm out
|
||||||
|
if kind == "wave" and re.search(r"(?:막|마구|미친 ?듯이?|세게) ?흔들|꾸벅|숙여|숙이|(?<![가-힣])절|\bbow", text, re.I):
|
||||||
|
return True # "팔 막 흔들어" (flail), "꾸벅 인사" (a bow): no wave
|
||||||
|
if kind in ("arm_open", "arm_close") and re.search(r"(?:한|두|세|네|다섯|\d) ?개|\b(?:one|two|three|four|five) fingers?\b", text, re.I):
|
||||||
|
return True # "손가락 세 개 펴": fingers counted, not the gripper
|
||||||
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")
|
||||||
@@ -1237,7 +1268,7 @@ HAND_SHAPE = re.compile(r"펴|펼|쥐|주먹|넣|접|내려|오므|놔|놓|\b(?:
|
|||||||
COME_VERB = re.compile(r"(?<![가-힣])와(?![가-힣])|와 ?(?:줘|주)|오세요|오십시오|\bcome\b", re.I)
|
COME_VERB = re.compile(r"(?<![가-힣])와(?![가-힣])|와 ?(?:줘|주)|오세요|오십시오|\bcome\b", re.I)
|
||||||
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"집|잡|들어|들고|가져|갖|가지고|가저|가 ?온나|챙|쥐|픽|그랩|브링|겟|캐치|홀드|지버|테이크|옮겨|"
|
TAKE_WORD = re.compile(r"집|잡|들어|들고|가져|갖|가지고|가저|가 ?온나|챙|쥐|픽|그랩|브링|겟|캐치|홀드|지버|테이크|옮겨|"
|
||||||
r"\b(?:pick|grab|take|took|get|fetch|bring|brin|brung|hold|snatch|lift|nab|seize|collect|snag|"
|
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"scoop|pluck|grasp|grip|carry|deliver|hand|pass|gimme|obtain|retrieve|go for|pic|grap|pik|peek up|reach for|"
|
||||||
@@ -1246,7 +1277,7 @@ RETURN_WORD = re.compile(r"(?:다시|도로) ?와|도라|돌아|복귀|원래|
|
|||||||
TRAVEL = re.compile(r"돌아|도라|복귀|원위치|가|와|오|컴백|리턴|\bback to\b|\bcoming\b|\b(?:come|go|return|head|drive|move|get|cum|comeback|roll)\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)
|
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|unclamp)", 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|"
|
||||||
r"pinch|together)", re.I)
|
r"pinch|together)", re.I)
|
||||||
|
|
||||||
|
|||||||
+28
-4
@@ -135,7 +135,8 @@ WAKE_REPLY = {"en": "Yes? How can I help?", "ko": "네? 무엇을 도와드릴
|
|||||||
NAME_ONLY = re.compile(r"^\s*(hi |hey |hello )?(lumi|loomi|rumi|루미)[\s,.!?]*$", re.I)
|
NAME_ONLY = re.compile(r"^\s*(hi |hey |hello )?(lumi|loomi|rumi|루미)[\s,.!?]*$", re.I)
|
||||||
FETCH_STOP = re.compile(r"\b(sto+pp?|stob|halt|freeze|don'?t move)\b|^\W*(?:lumi\W+)?stopped\W*$|스탑|스텁|멈추(?:세요|십시오)|^\W*abort\W*$|\babort (?:the |this |your )?(?:mission|task|trip)\b|\bcancel (?:the |this |your )?(?:mission|task|trip)\b|"
|
FETCH_STOP = re.compile(r"\b(sto+pp?|stob|halt|freeze|don'?t move)\b|^\W*(?:lumi\W+)?stopped\W*$|스탑|스텁|멈추(?:세요|십시오)|^\W*abort\W*$|\babort (?:the |this |your )?(?:mission|task|trip)\b|\bcancel (?:the |this |your )?(?:mission|task|trip)\b|"
|
||||||
r"머+엄*춰|머+엄*추(?:세요|십시오)|멈춰|멈추(?:게|시게|게나|시오|어라)|그만|정지|스톱|스땁|스떱|미션 ?취소|작업 ?취소|"
|
r"머+엄*춰|머+엄*추(?:세요|십시오)|멈춰|멈추(?:게|시게|게나|시오|어라)|그만|정지|스톱|스땁|스떱|미션 ?취소|작업 ?취소|"
|
||||||
r"거기 ?서(?: ?봐| ?있어)?(?=[\s!.~,]*$)|움직이지 ?마|\bemergency stop\b|\b(?:stay|hold|keep) still\b|"
|
r"거기 ?서(?: ?봐| ?있어)?(?=[\s!.~,]*$)|(?:^|[\s,])서(?:라|요)?(?=[\s!.~,]*$)|\bhold it(?: right)? (?:there|here)\b|"
|
||||||
|
r"^\W*(?:\w+\W+){0,3}hold it\W*$|멈[처쳐]|그마+안|\bstahp\b|움직이지 ?마|\bemergency stop\b|\b(?:stay|hold|keep) still\b|"
|
||||||
r"^\W*(?:wait|잠깐|잠깐만|기다려)\W*$", re.I) # not "거기서 기다려"
|
r"^\W*(?:wait|잠깐|잠깐만|기다려)\W*$", re.I) # not "거기서 기다려"
|
||||||
FETCH_GIVE = re.compile(r"\bgive (it|that|this|the \w+)( to me)?\b|\bhand (it )?(over|to me)\b|줘|주세요|건네", re.I)
|
FETCH_GIVE = re.compile(r"\bgive (it|that|this|the \w+)( to me)?\b|\bhand (it )?(over|to me)\b|줘|주세요|건네", re.I)
|
||||||
FETCH_PLACE = re.compile(r"\b(put|place|set) (it|that|this|the \w+) (down|on the table)\b|테이블에 ?(놔|놓|둬)|내려 ?(놔|놓)", re.I)
|
FETCH_PLACE = re.compile(r"\b(put|place|set) (it|that|this|the \w+) (down|on the table)\b|테이블에 ?(놔|놓|둬)|내려 ?(놔|놓)", re.I)
|
||||||
@@ -387,8 +388,15 @@ if os.path.basename(os.path.dirname(os.path.abspath(sys.argv[0]))) == "tests":
|
|||||||
LOG_FILE = os.devnull # a self-check (tests/*.py) never writes the real log
|
LOG_FILE = os.devnull # a self-check (tests/*.py) never writes the real log
|
||||||
|
|
||||||
|
|
||||||
|
_log_day = [None] # the date last written to the log
|
||||||
|
|
||||||
|
|
||||||
def log(msg):
|
def log(msg):
|
||||||
line = f"{time.strftime('%H:%M:%S')} {msg}"
|
line = f"{time.strftime('%H:%M:%S')} {msg}"
|
||||||
|
day = time.strftime("%Y-%m-%d %A")
|
||||||
|
if day != _log_day[0]: # at each start and each new day: lines carry only the time, and an
|
||||||
|
_log_day[0] = day # old day's talk was once read as today's (2026-10-12 vs 10-26)
|
||||||
|
line = f"=== {day} ===\n{line}"
|
||||||
print(line, flush=True)
|
print(line, flush=True)
|
||||||
try:
|
try:
|
||||||
with open(LOG_FILE, "a") as f: # also kept in lumi.log, to read it over SSH
|
with open(LOG_FILE, "a") as f: # also kept in lumi.log, to read it over SSH
|
||||||
@@ -1729,7 +1737,7 @@ class Lumi:
|
|||||||
if status not in ("running", "holding"):
|
if status not in ("running", "holding"):
|
||||||
return False
|
return False
|
||||||
from tasks import fetch
|
from tasks import fetch
|
||||||
if FETCH_STOP.search(text) and stop_order(text, self.markers): # not "he said stop", "don't stop"
|
if stop_order(text, self.markers): # every stop form (also "enough!", "가지 마" whole); not "he said stop"
|
||||||
log(" fetch: stop by voice")
|
log(" fetch: stop by voice")
|
||||||
safe(fetch.stop)
|
safe(fetch.stop)
|
||||||
self.act("stop", "")
|
self.act("stop", "")
|
||||||
@@ -3278,7 +3286,8 @@ STOP_LATER = re.compile( # a stop for later ("내일 그만하시게", "행사
|
|||||||
r"(?:했|하셨|그랬|말했|말씀|지시|하더|하던|한다|하네)")
|
r"(?:했|하셨|그랬|말했|말씀|지시|하더|하던|한다|하네)")
|
||||||
|
|
||||||
|
|
||||||
STOP_PAD = re.compile(r"^(?:\W*(?:hey|hi|yo|oh|okay|ok|so|um+|uh+|listen|right|alright|all right|excuse me|mister robot|"
|
STOP_PAD = re.compile(r"^(?:\W*(?:hey|hi|yo|oh|okay|ok|so|um+|uh+|listen|right|alright|all right|excuse me|mister robot|buddy|dear|"
|
||||||
|
r"당장|얼른|빨리|지금|바로|어서|좀|제발|"
|
||||||
r"robot|lumi|loomi|루미 ?씨|루미 ?선생|루미야?|로봇아?|로봇 양반|어+|아+|야|저기요?)\b)+|"
|
r"robot|lumi|loomi|루미 ?씨|루미 ?선생|루미야?|로봇아?|로봇 양반|어+|아+|야|저기요?)\b)+|"
|
||||||
r"(?:\W*\b(?:please|plz|pls|bro|now|right now|real quick|thanks|thank you|okay|ok|would you|will you|"
|
r"(?:\W*\b(?:please|plz|pls|bro|now|right now|real quick|thanks|thank you|okay|ok|would you|will you|"
|
||||||
r"right|already|lumi|robot|빨리|좀|제발|당장|루미야?)\b)+\W*$", re.I)
|
r"right|already|lumi|robot|빨리|좀|제발|당장|루미야?)\b)+\W*$", re.I)
|
||||||
@@ -3294,12 +3303,25 @@ STOP_ONLY = re.compile( # a whole sentence that only says stop / enough / stay
|
|||||||
|
|
||||||
STOP_POLITE = re.compile( # a stop asked politely, after wording.ko_plain: "멈춰 주시겠어요?" -> "멈춰 줘?", "can you stop for me?"
|
STOP_POLITE = re.compile( # a stop asked politely, after wording.ko_plain: "멈춰 주시겠어요?" -> "멈춰 줘?", "can you stop for me?"
|
||||||
r"\W*(?:(?:좀|지금|당장|잠깐|잠시|거기서?|이제)\s*)*(?:멈춰|멈춰 서|정지해|그만해|스톱해|스탑해|서)(?: ?줘)?\W*|"
|
r"\W*(?:(?:좀|지금|당장|잠깐|잠시|거기서?|이제)\s*)*(?:멈춰|멈춰 서|정지해|그만해|스톱해|스탑해|서)(?: ?줘)?\W*|"
|
||||||
r"\W*(?:(?:please|lumi|hey|okay|ok)\W+)*(?:can|could|would|will) (?:you|u) (?:please |just |kindly )?(?:stop|halt|freeze)"
|
r"\W*(?:(?:please|lumi|hey|okay|ok)\W+)*(?:can|could|would|will) (?:you|u) (?:please |just |kindly )?(?:go ahead and )?"
|
||||||
|
r"(?:stop|halt|freeze|hold it(?: right)? (?:there|here))"
|
||||||
r"(?: (?:right )?(?:now|here|there|please))?(?: for (?:me|us|a (?:second|sec|moment|bit|minute)))?(?:,? please)?\W*|"
|
r"(?: (?:right )?(?:now|here|there|please))?(?: for (?:me|us|a (?:second|sec|moment|bit|minute)))?(?:,? please)?\W*|"
|
||||||
r"\W*(?:would|do) you mind stopping(?: (?:now|here|there))?(?: for (?:me|us|a (?:second|moment)))?(?:,? please)?\W*", re.I)
|
r"\W*(?:would|do) you mind stopping(?: (?:now|here|there))?(?: for (?:me|us|a (?:second|moment)))?(?:,? please)?\W*", re.I)
|
||||||
|
|
||||||
|
|
||||||
|
STOP_CALL = re.compile(r"^\W*(?:(?:okay|ok|오케이|hey|yo|야|어이|저기요?|자|lumi|loomi|rumi|robot|buddy|(?:루미)+|누미|류미|로봇)"
|
||||||
|
r"(?:\s*(?:님|씨|야|아|군))?\W+)+", re.I) # "루미 님, …", "오케이, 야 루미, …", "okay Lumi, …"
|
||||||
|
|
||||||
|
|
||||||
def stop_order(text, markers):
|
def stop_order(text, markers):
|
||||||
|
"""stop_order_said on the words, and again without the calls in front ("루미 님, 멈춰 주실 수 있겠습니까?")."""
|
||||||
|
bare = STOP_CALL.sub("", text or "")
|
||||||
|
if re.fullmatch(r"\W*(?:wait|hold on|hang on|one (?:sec|second|moment)|잠깐(?:만)?(?:요)?|기다려(?:요)?)\W*", bare, re.I):
|
||||||
|
return stop_order_said(text, markers) # "Lumi, wait": a mission halts for a talk (mission_talk), not ended
|
||||||
|
return stop_order_said(text, markers) or bool(bare and bare != text and stop_order_said(bare, markers))
|
||||||
|
|
||||||
|
|
||||||
|
def stop_order_said(text, markers):
|
||||||
""""stop", "freeze", "멈춰": stop everything at once. Not "stop talking" and not a question about the stop button;
|
""""stop", "freeze", "멈춰": stop everything at once. Not "stop talking" and not a question about the stop button;
|
||||||
"can you stop?", "멈출 수 있어?" and "stop, where are you going?" do stop. Not a negated stop ("don't stop", "계속
|
"can you stop?", "멈출 수 있어?" and "stop, where are you going?" do stop. Not a negated stop ("don't stop", "계속
|
||||||
해"), talk about stopping ("he said stop", "bus stop", "my laptop freezes", "내 다리도 자주 멈춰"); a short bare
|
해"), talk about stopping ("he said stop", "bus stop", "my laptop freezes", "내 다리도 자주 멈춰"); a short bare
|
||||||
@@ -3392,6 +3414,8 @@ def route(text, markers, b, holding=False, seen=None, last="", chain_ok=True):
|
|||||||
text = MYEOT_SLIP.sub("몇", text or "") # whisper's 멸 for 몇: "멸 센티까지 잡아?" asks, orders nothing
|
text = MYEOT_SLIP.sub("몇", text or "") # whisper's 멸 for 몇: "멸 센티까지 잡아?" asks, orders nothing
|
||||||
text = re.sub(r"(?<=[가-힣])(?=[a-zA-Z]{2})", " ", text) # "원래 자리에put back": the English word apart
|
text = re.sub(r"(?<=[가-힣])(?=[a-zA-Z]{2})", " ", text) # "원래 자리에put back": the English word apart
|
||||||
text = re.sub(r"\bcome on back\b", "come back", text, flags=re.I) # not 1 m back
|
text = re.sub(r"\bcome on back\b", "come back", text, flags=re.I) # not 1 m back
|
||||||
|
text = re.sub(r"(?<=\w)\W+(?:is (?:it )?ok+ay|is ok|is (?:it )?possible|possible|you can do)(?: for you)?\s*\?*\s*$", "", text,
|
||||||
|
flags=re.I) or text # "look 60 deg to right, is okkay for you?": the order, the check after it is no question
|
||||||
text = re.sub(r"(?<![\d.])360(?= ?돌아)", "360도", text) # "루미 360 돌아 봐": a full turn, not "turn round"
|
text = re.sub(r"(?<![\d.])360(?= ?돌아)", "360도", text) # "루미 360 돌아 봐": a full turn, not "turn round"
|
||||||
if stop_order(text, markers):
|
if stop_order(text, markers):
|
||||||
return "stop", None
|
return "stop", None
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ 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|news|headlines?)\b", t, re.I):
|
r"forecast|temperature|umbrella|sunny|cloudy|news|headlines?)\b", t, re.I):
|
||||||
return "weather or news" # "오늘 미세먼지 어때?", "투데이 뉴스 뭐야?": the lookups
|
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*시간|"
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@ _FILL = (r"(?:(?:저기 |그 )?(?:이보게(?: 루미)?|어이(?: 로봇아?|
|
|||||||
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"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|dear|much obliged|thanks a million|very thank you|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|"
|
||||||
r"do me a favou?r and|be a dear and|right away|quickly|if you don'?t mind|excuse me|sorry|"
|
r"do me a favou?r and|be a dear and|right away|quickly|if you don'?t mind|excuse me|sorry|"
|
||||||
|
|||||||
@@ -687,8 +687,15 @@ _BANK = {
|
|||||||
("Can you come here?", "I can come when called. Just tell me and step back a little."),
|
("Can you come here?", "I can come when called. Just tell me and step back a little."),
|
||||||
("Can you hand me something?", "Yes, I can hand things over and take them back from you, too."),
|
("Can you hand me something?", "Yes, I can hand things over and take them back from you, too."),
|
||||||
("Can you do more than one thing at once?", "I can do a mission of several steps, like pick up a cup, drive somewhere and hand it over."),
|
("Can you do more than one thing at once?", "I can do a mission of several steps, like pick up a cup, drive somewhere and hand it over."),
|
||||||
|
("What's your payload?", "About 1 kg in my hand."),
|
||||||
|
("Top speed?", "1.2 metres a second at most; I usually drive at 0.6."),
|
||||||
],
|
],
|
||||||
"ko": [
|
"ko": [
|
||||||
|
# Konglish wordings of its own numbers (r9: "맥스 웨이트 몇 킬로예요?" was answered "정보가 없어요")
|
||||||
|
("맥스 웨이트 몇 킬로까지 돼요?", "손으로는 1킬로 정도까지 들 수 있어요."),
|
||||||
|
("탑 스피드 얼마임?", "최고 초속 1.2미터예요. 보통은 0.6미터로 다녀요."),
|
||||||
|
("배터리 라이프 얼마나 가요?", "한 번 충전하면 10시간쯤 가요."),
|
||||||
|
("하이트가 어떻게 되십니까?", "146센티미터이고, 리프트를 올리면 186센티미터까지 됩니다."),
|
||||||
("자기소개 해 줘", "저는 쿳션 컴퍼니에서 만든 로봇 비서 루미예요. 두 살이고, 영어랑 한국어를 해요."),
|
("자기소개 해 줘", "저는 쿳션 컴퍼니에서 만든 로봇 비서 루미예요. 두 살이고, 영어랑 한국어를 해요."),
|
||||||
("너 누구야?", "저는 루미예요, 쿳션 컴퍼니에서 만든 이동형 로봇 비서예요."),
|
("너 누구야?", "저는 루미예요, 쿳션 컴퍼니에서 만든 이동형 로봇 비서예요."),
|
||||||
("넌 뭐야?", "바퀴 달린 로봇 비서예요. 팔 하나에 카메라도 있어요."),
|
("넌 뭐야?", "바퀴 달린 로봇 비서예요. 팔 하나에 카메라도 있어요."),
|
||||||
@@ -1915,6 +1922,30 @@ FOLLOWUPS += [
|
|||||||
"How strong is the arm, I mean the trunk?", "Very strong: an elephant's trunk can lift a few hundred kilograms."),
|
"How strong is the arm, I mean the trunk?", "Very strong: an elephant's trunk can lift a few hundred kilograms."),
|
||||||
("en", "Why do whales sing?", "Mostly to find mates and to keep in touch over long distances.",
|
("en", "Why do whales sing?", "Mostly to find mates and to keep in touch over long distances.",
|
||||||
"Can you hear it?", "People hear it with underwater microphones called hydrophones."),
|
"Can you hear it?", "People hear it with underwater microphones called hydrophones."),
|
||||||
|
# English bare follow-ups as short as the Korean ones (r13: EN 58 % vs KO 72 %), native and non-native; each
|
||||||
|
# takes a word of the answer ("why prison?", "and the book?") or asks how / who / when / what it means
|
||||||
|
*_on("en", "Who invented the printing press?", "Johannes Gutenberg, around 1440 in Mainz, with movable metal type.",
|
||||||
|
("and how?", "He cast single letters in metal, set them in rows, inked them and pressed paper on them."),
|
||||||
|
("why metal?", "Metal letters were hard enough to print thousands of pages without wearing out."),
|
||||||
|
("meaning what?", "Each letter was its own small block, so the same letters could be reused for every page."),
|
||||||
|
("what is meaning, movable?", "The letters could be moved and set again for the next page."),
|
||||||
|
("and the first book?", "The Gutenberg Bible, finished around 1455."),
|
||||||
|
("really true?", "Yes: Gutenberg, around 1440, with movable metal type."),
|
||||||
|
("before you say different", "No, I said the same: Gutenberg, around 1440 in Mainz.")),
|
||||||
|
*_on("en", "Why do penguins not fly?", "Their wings became flippers for swimming; diving well mattered more than flying.",
|
||||||
|
("since when?", "For tens of millions of years: the oldest penguin fossils are about 60 million years old."),
|
||||||
|
("who found that?", "Scientists who dug up penguin fossils in New Zealand and Antarctica."),
|
||||||
|
("then how deep?", "Emperor penguins can dive more than 500 metres."),
|
||||||
|
("why flippers?", "Short stiff wings push hard against water, like a fish's fin."),
|
||||||
|
("is that so?", "Yes: their wings turned into flippers for swimming."),
|
||||||
|
("and the chicks?", "Chicks can't swim at first; they grow waterproof feathers after a few months.")),
|
||||||
|
*_on("en", "Who built the Eiffel Tower?", "Gustave Eiffel's company built it for the 1889 World's Fair in Paris.",
|
||||||
|
("why 1889?", "It marked 100 years since the French Revolution of 1789."),
|
||||||
|
("and how tall?", "About 330 metres with its antennas."),
|
||||||
|
("people liked it?", "Not at first: many artists called it ugly; now it's loved."),
|
||||||
|
("when was that?", "In 1887, when the work began, artists wrote a letter against it."),
|
||||||
|
("so who owns it?", "The city of Paris."),
|
||||||
|
("hmm, sure?", "Yes: Eiffel's company built it for the World's Fair of 1889.")),
|
||||||
]
|
]
|
||||||
|
|
||||||
def pick_followup(said, before_q, before_a, lang, k=2):
|
def pick_followup(said, before_q, before_a, lang, k=2):
|
||||||
|
|||||||
+22
-9
@@ -68,6 +68,7 @@ FAR_IN_MM = 150.0 # the base brings the table point this far
|
|||||||
# PLACE_GOAL: the place grid then lies on the table
|
# PLACE_GOAL: the place grid then lies on the table
|
||||||
BIG_TOPS = ("dining table", "desk", "bed") # things named for a place whose YOLO box centre is no place to aim at
|
BIG_TOPS = ("dining table", "desk", "bed") # things named for a place whose YOLO box centre is no place to aim at
|
||||||
FAR_REACH_MM = 850.0 # mm from the arm base; level points of a far table past this are out of reach
|
FAR_REACH_MM = 850.0 # mm from the arm base; level points of a far table past this are out of reach
|
||||||
|
PLACE_REFUSALS = 8 # place spots tried before giving up on this view (callers order them nearest first)
|
||||||
FAR_SPOTS = 4 # spots of a table further away tried from where the base is (_place_far)
|
FAR_SPOTS = 4 # spots of a table further away tried from where the base is (_place_far)
|
||||||
TOP_NEAR_MM = 1500.0 # mm from the arm base; a named thing's top measured further away is not trusted
|
TOP_NEAR_MM = 1500.0 # mm from the arm base; a named thing's top measured further away is not trusted
|
||||||
# (2026-10-20 a white thing 3.8 m away read -258, then -620 mm): go closer first
|
# (2026-10-20 a white thing 3.8 m away read -258, then -620 mm): go closer first
|
||||||
@@ -128,7 +129,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_BACKS = 3 # _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) ...
|
||||||
@@ -1006,9 +1007,12 @@ def _carry_ok(waypoints, ja):
|
|||||||
further up and one joint move: skills.carry_up): check that now."""
|
further up and one joint move: skills.carry_up): check that now."""
|
||||||
target = skills._ask("kine_forward", jointPosition=[float(v) for v in motion.poses()["carry"]])["cartPosition"]
|
target = skills._ask("kine_forward", jointPosition=[float(v) for v in motion.poses()["carry"]])["cartPosition"]
|
||||||
try:
|
try:
|
||||||
_line_rows(target, "to carry", start=(waypoints[0][1], ja))
|
last = _line_rows(target, "to carry", start=(waypoints[0][1], ja))[-1][2]
|
||||||
return True
|
carry = motion.nearest(motion.poses()["carry"], list(last))
|
||||||
except FetchError:
|
if max(abs(a - b) for a, b in zip(carry, last)) <= 1.0:
|
||||||
|
return True # else the line ends on the other wrist branch (pick:502):
|
||||||
|
except FetchError: # carry_up's joint move decides
|
||||||
|
pass
|
||||||
return skills.carry_up(waypoints[0][1], ja) is not None
|
return skills.carry_up(waypoints[0][1], ja) is not None
|
||||||
|
|
||||||
|
|
||||||
@@ -1118,7 +1122,7 @@ def _go_to(thing, goal, tried, holding=False):
|
|||||||
w = map_xy(thing)
|
w = map_xy(thing)
|
||||||
_waist_front()
|
_waist_front()
|
||||||
x, y = arm_frame(w)
|
x, y = arm_frame(w)
|
||||||
_approach({"x": float(x), "y": float(y)}, arm_yaw(), tried, goal=goal, holding=holding)
|
return _approach({"x": float(x), "y": float(y)}, arm_yaw(), tried, goal=goal, holding=holding)
|
||||||
|
|
||||||
|
|
||||||
def _near_look(attempt, holding=False):
|
def _near_look(attempt, holding=False):
|
||||||
@@ -1698,7 +1702,10 @@ def _place_at(tries, top):
|
|||||||
"""Put the held object down at the first of `tries` (x, y) whose way down passes IK: straight from here with the
|
"""Put the held object down at the first of `tries` (x, y) whose way down passes IK: straight from here with the
|
||||||
held grasp turn, else any grasp turn and wrist (skills.place_options). True when it is down."""
|
held grasp turn, else any grasp turn and wrist (skills.place_options). True when it is down."""
|
||||||
log(f"place spots: {', '.join(f'({x:.0f}, {y:.0f})' for x, y in tries[:6])}")
|
log(f"place spots: {', '.join(f'({x:.0f}, {y:.0f})' for x, y in tries[:6])}")
|
||||||
for x, y in tries:
|
for n, (x, y) in enumerate(tries):
|
||||||
|
if n >= PLACE_REFUSALS: # the rest are further / lower: each refused spot costs ~1 s of
|
||||||
|
log(f"{n} spots refused in a row: no more") # IK (two puts timed out in X1's sweep)
|
||||||
|
break
|
||||||
way = skills.plan_place(x, y, top, yaw=skills._held.get("yaw", 0.0)) # above place, place, release up
|
way = skills.plan_place(x, y, top, yaw=skills._held.get("yaw", 0.0)) # above place, place, release up
|
||||||
try:
|
try:
|
||||||
over = _line_rows(way[0][1], f"to ({x:.0f}, {y:.0f})")
|
over = _line_rows(way[0][1], f"to ({x:.0f}, {y:.0f})")
|
||||||
@@ -1881,16 +1888,18 @@ def _usable(usable, seen):
|
|||||||
def _place_near(top0, tried):
|
def _place_near(top0, tried):
|
||||||
"""Put it down on a table in front, going closer to a table seen further ahead up to APPROACH_TRIES times (no
|
"""Put it down on a table in front, going closer to a table seen further ahead up to APPROACH_TRIES times (no
|
||||||
whole search). True when it is down."""
|
whole search). True when it is down."""
|
||||||
|
moved = True
|
||||||
for i in range(APPROACH_TRIES + 1):
|
for i in range(APPROACH_TRIES + 1):
|
||||||
got = _look_at(0.0, lambda: _place_view(top0))
|
got = _look_at(0.0, lambda: _place_view(top0))
|
||||||
if got is True:
|
if got is True:
|
||||||
return True
|
return True
|
||||||
if got is None or i == APPROACH_TRIES or _charging():
|
if got is None or i == APPROACH_TRIES or _charging():
|
||||||
return False
|
return False
|
||||||
_too_low(got)
|
if not moved: # the base is as near as it gets: a low table stays out of reach
|
||||||
|
_too_low(got) # (said then, not after 24-31 moves; X1 r11: not earlier either)
|
||||||
log(f"a table at {got['table']:.0f} mm further away ({got['camera']} camera), at ({got['x']:.0f}, "
|
log(f"a table at {got['table']:.0f} mm further away ({got['camera']} camera), at ({got['x']:.0f}, "
|
||||||
f"{got['y']:.0f}): going closer ({i + 1}/{APPROACH_TRIES})")
|
f"{got['y']:.0f}): going closer ({i + 1}/{APPROACH_TRIES})")
|
||||||
_go_to(got, PLACE_GOAL, tried, holding=True)
|
moved = _go_to(got, PLACE_GOAL, tried, holding=True) is not False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@@ -2041,10 +2050,14 @@ def _put_down(say=None, on=None):
|
|||||||
if got is not None and arm_yaw() is not None and not _charging():
|
if got is not None and arm_yaw() is not None and not _charging():
|
||||||
log(f"a table at {got['table']:.0f} mm further away ({got['camera']} camera), at ({got['x']:.0f}, "
|
log(f"a table at {got['table']:.0f} mm further away ({got['camera']} camera), at ({got['x']:.0f}, "
|
||||||
f"{got['y']:.0f}): going closer")
|
f"{got['y']:.0f}): going closer")
|
||||||
_too_low(got) # said at once: going closer can't help (X1: 24-31 moves)
|
try:
|
||||||
_go_to(got, PLACE_GOAL, tried, holding=True)
|
_go_to(got, PLACE_GOAL, tried, holding=True)
|
||||||
if _place_near(top, tried):
|
if _place_near(top, tried):
|
||||||
return
|
return
|
||||||
|
except FetchError as e:
|
||||||
|
_too_low(got, e)
|
||||||
|
raise
|
||||||
|
_too_low(got)
|
||||||
_lift_to(LIFT_DRIVE_MM)
|
_lift_to(LIFT_DRIVE_MM)
|
||||||
raise FetchError("I can't find a free place on a table around me.", "주변에 내려놓을 빈 자리를 못 찾았어요.")
|
raise FetchError("I can't find a free place on a table around me.", "주변에 내려놓을 빈 자리를 못 찾았어요.")
|
||||||
|
|
||||||
|
|||||||
+14
-2
@@ -156,7 +156,7 @@ def typed_got(r):
|
|||||||
return (a if a == "give" else "place " + str(((r.get("task") or {}).get("on") or {}).get("name") or "")), None
|
return (a if a == "give" else "place " + str(((r.get("task") or {}).get("on") or {}).get("name") or "")), None
|
||||||
if a == "carry":
|
if a == "carry":
|
||||||
d = (r.get("task") or {}).get("dest")
|
d = (r.get("task") or {}).get("dest")
|
||||||
return f"action:go_to {d.get('name') if isinstance(d, dict) else d}", None
|
return f"action:go_to {d.get('marker') or d.get('name') if isinstance(d, dict) else d}", None
|
||||||
if a == "command": # Start sends the words to the assistant (/tasks/command):
|
if a == "command": # Start sends the words to the assistant (/tasks/command):
|
||||||
return None, None # heard and done as by voice
|
return None, None # heard and done as by voice
|
||||||
return ("refuse" if r.get("talk") == "refuse" else "talk"), None
|
return ("refuse" if r.get("talk") == "refuse" else "talk"), None
|
||||||
@@ -251,7 +251,7 @@ def run_case(rnd, name, c, old, use_llm):
|
|||||||
lv = c.get("level") or bc.level_of(c, {"lang": c.get("lang")})
|
lv = c.get("level") or bc.level_of(c, {"lang": c.get("lang")})
|
||||||
return {"round": rnd, "set": name, "text": c["text"], "state": c["state"], "before": c.get("before"),
|
return {"round": rnd, "set": name, "text": c["text"], "state": c["state"], "before": c.get("before"),
|
||||||
"expect": c["expect"] if not mission else c["steps"], "intent": c.get("intent", ""), "map": c.get("map"),
|
"expect": c["expect"] if not mission else c["steps"], "intent": c.get("intent", ""), "map": c.get("map"),
|
||||||
"level": bc.LEVEL_NAME.get(lv, lv), "lang": c.get("lang"), "voice": vgot, "typed": tgot, "handed": handed,
|
"level": bc.LEVEL_NAME.get(lv, lv), "lang": c.get("lang"), "channel": c.get("channel") or "-", "voice": vgot, "typed": tgot, "handed": handed,
|
||||||
"v_canon": vc, "t_canon": tc, "v": vv, "t": tv, "src": src, "same": vc == tc,
|
"v_canon": vc, "t_canon": tc, "v": vv, "t": tv, "src": src, "same": vc == tc,
|
||||||
"raw": vrow["out"].get("raw", ""), "first": vrow["out"].get("first", "")}
|
"raw": vrow["out"].get("raw", ""), "first": vrow["out"].get("first", "")}
|
||||||
|
|
||||||
@@ -327,6 +327,18 @@ def report(rows, tag, secs, args):
|
|||||||
pct = lambda j, k: f"{sum(r[k] == 'right' for r in j)}/{len(j)} ({100 * sum(r[k] == 'right' for r in j) / max(1, len(j)):.1f} %)"
|
pct = lambda j, k: f"{sum(r[k] == 'right' for r in j)}/{len(j)} ({100 * sum(r[k] == 'right' for r in j) / max(1, len(j)):.1f} %)"
|
||||||
out.append(f"| {lv} | {pct(jv, 'v')} | {pct(jt, 't')} | {sum(r['v'] == 'motion' for r in rr)} | "
|
out.append(f"| {lv} | {pct(jv, 'v')} | {pct(jt, 't')} | {sum(r['v'] == 'motion' for r in rr)} | "
|
||||||
f"{sum(r['t'] == 'motion' for r in rr)} |")
|
f"{sum(r['t'] == 'motion' for r in rr)} |")
|
||||||
|
chans = sorted({r.get("channel", "-") for r in rows} - {"-"})
|
||||||
|
if chans: # r12 / r13: the words as typed or as whisper wrote them
|
||||||
|
out += ["", "By speech level and written channel (voice path right / judged; typed≠voice):", "",
|
||||||
|
"| level | " + " | ".join(chans) + " |", "|---|" + "---|" * len(chans)]
|
||||||
|
for lv in sorted({r["level"] for r in rows if r.get("channel", "-") != "-"}) + ["ALL"]:
|
||||||
|
cells = []
|
||||||
|
for ch in chans:
|
||||||
|
rr = [r for r in rows if r.get("channel") == ch and lv in ("ALL", r["level"]) and r["v"] != "llm?"]
|
||||||
|
ok = sum(r["v"] == "right" for r in rr)
|
||||||
|
cells.append(f"{ok}/{len(rr)} ({100 * ok / max(1, len(rr)):.1f} %); "
|
||||||
|
f"{sum(not r['same'] and not r['before'] for r in rr)}")
|
||||||
|
out.append(f"| {lv} | " + " | ".join(cells) + " |")
|
||||||
groups = collections.defaultdict(list)
|
groups = collections.defaultdict(list)
|
||||||
for r in rows:
|
for r in rows:
|
||||||
groups[meaning(r)].append(r)
|
groups[meaning(r)].append(r)
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ from assistant import battery
|
|||||||
NOW = ["And charging?", "charging?", "battery?", "Battery", "what's your battery level?", "How much battery do you have?",
|
NOW = ["And charging?", "charging?", "battery?", "Battery", "what's your battery level?", "How much battery do you have?",
|
||||||
"how much battery is left", "what's your battery at", "battery percentage", "are you charging?",
|
"how much battery is left", "what's your battery at", "battery percentage", "are you charging?",
|
||||||
"are you charging right now", "is your battery charging", "are you on the charger?", "is your battery low?",
|
"are you charging right now", "is your battery charging", "are you on the charger?", "is your battery low?",
|
||||||
"배터리 몇 프로야?", "충전 중이야?", "배터리 얼마나 남았어?", "배터리 상태 어때?", "지금 충전하고 있어?", "배터리는?",
|
"배터리 몇 프로야?", "배터리 얼만가?", "충전 중이야?", "배터리 얼마나 남았어?", "배터리 상태 어때?", "지금 충전하고 있어?", "배터리는?",
|
||||||
"배터리 충분해?", "충전 중이에요?", "그럼 충전은?", "충전은요?", "배터리 몇 퍼센트예요?"]
|
"배터리 충분해?", "충전 중이에요?", "그럼 충전은?", "충전은요?", "배터리 몇 퍼센트예요?"]
|
||||||
HOW_LONG = ["how long does charging take?", "How long does it take to charge?", "how long to recharge",
|
HOW_LONG = ["how long does charging take?", "How long does it take to charge?", "how long to recharge",
|
||||||
"what's the charging time", "충전 시간 얼마나 걸려?", "충전하는 데 얼마나 걸려요?", "충전 몇 시간 걸려?",
|
"what's the charging time", "충전 시간 얼마나 걸려?", "충전하는 데 얼마나 걸려요?", "충전 몇 시간 걸려?",
|
||||||
"완충하는 데 얼마나 걸려?", "완충까지 몇 시간이에요?", "how long does a full charge take?", "완충 시간이 얼마예요?"]
|
"완충하는 데 얼마나 걸려?", "완충까지 몇 시간이에요?", "how long does a full charge take?", "완충 시간이 얼마예요?"]
|
||||||
OTHER = ["How long does your battery last?", "how long on a charge?", "How long does the battery last on a full charge?",
|
OTHER = ["How long does your battery last?", "how long on a charge?", "How long does the battery last on a full charge?",
|
||||||
"what kind of battery do you have", "배터리 얼마나 가요?", "한 번 충전하면 몇 시간 가요?", "배터리 용량이 얼마야?",
|
"what kind of battery do you have", "배터리 얼마나 가요?", "배터리 타임 얼마나 돼요?", "한 번 충전하면 몇 시간 가요?", "배터리 용량이 얼마야?",
|
||||||
"go charge", "충전하러 가", "How long until you need a charge?", "at what battery level do you go back to charge",
|
"go charge", "충전하러 가", "How long until you need a charge?", "at what battery level do you go back to charge",
|
||||||
"배터리 몇 퍼센트에서 충전하러 가요?", "go to the charger", "Do you get tired?", "what time is it?", "배고파?"]
|
"배터리 몇 퍼센트에서 충전하러 가요?", "go to the charger", "Do you get tired?", "what time is it?", "배고파?"]
|
||||||
for t in NOW:
|
for t in NOW:
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ READ = [ # the owner's Korean cup / delivery list (2026-10-26 18:40), then mor
|
|||||||
("let me see you wave", False, "rule wave"), ("okay see you", False, "talk"), ("you come behind me", False, "rule follow"),
|
("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"),
|
("here's your task: get over here", False, "talk"), ("Mina, what are you doing over there?", False, "talk"),
|
||||||
("민수야, 너 거기서 뭐 하고 있어?", False, "talk"), ("루미야 뭐 하고 있어?", False, "talk:status"),
|
("민수야, 너 거기서 뭐 하고 있어?", False, "talk"), ("루미야 뭐 하고 있어?", False, "talk:status"),
|
||||||
("계속 들고 있어 주세요", True, "talk"), ("keep holding it", True, "talk"), ("just hold it", True, "talk"),
|
("계속 들고 있어 주세요", True, "talk"), ("keep holding it", True, "talk"), ("just hold it", True, "stop"), # safety first: "hold it" stops (the cup stays held)
|
||||||
("give it back", True, "give"), ("돌려줘", True, "give"), ("hand it back to me", True, "give"), ("그거 다시 줘", True, "give"),
|
("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"),
|
("put it back where you found it", True, "place"), ("원래 있던 데 놔 주세요", True, "place"),
|
||||||
("할머니께 이거 전해 드려", True, "give"), ("이거 저분께 드리세요", True, "give"), ("사장님께 드려 주십시오", True, "give"),
|
("할머니께 이거 전해 드려", True, "give"), ("이거 저분께 드리세요", True, "give"), ("사장님께 드려 주십시오", True, "give"),
|
||||||
@@ -372,7 +372,47 @@ READ = [ # the owner's Korean cup / delivery list (2026-10-26 18:40), then mor
|
|||||||
("저한테 주실 수 있으신가요?", True, "give"), ("선생님께 드리세요", True, "give"), ("lower it down", True, "place"),
|
("저한테 주실 수 있으신가요?", 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"),
|
("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"),
|
("왼쪽에 내려놓고 오른편 컵 잡아 줘", 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"),
|
("pick up the cup on the left table", False, "pick cup left"),
|
||||||
|
("pick up the cup over on your left", False, "pick cup left"), ("grab the cup sitting on your right", False, "pick cup right"),
|
||||||
|
("grab the cup by your side", False, "pick cup near"), ("옆에 있는 컵 집어", False, "pick cup near"),
|
||||||
|
("레프트 컵 집어", False, "pick cup left"), ("라이트 컵 집어 줘", False, "pick cup right"),
|
||||||
|
("백팩 집어 줘", False, "ask: The backpack is too big for my hand."),
|
||||||
|
# asides: said, taken back, for later, reported or read out: no motion now
|
||||||
|
("Lumi buddy, shake hands with me... ah, forget I said that", False, "talk"),
|
||||||
|
("lumi the moment the bell rings wave goodbye to us", False, "talk"),
|
||||||
|
("Lumi dear, my manager wanted you to put it down gently first thing today", True, "talk"),
|
||||||
|
("lumi on paper it is writing shake my hand", False, "talk"), ("Rumi robot hand it to me is very funny thing", True, "talk"),
|
||||||
|
("루미야 come friday lets shake hands", False, "talk"), ("동생아 너도 잘 가라고 손 흔들어 봐", False, "talk"),
|
||||||
|
("no need for you to put it down by the coffee machine today", True, "talk"),
|
||||||
|
("우리 루미~ 왼쪽에 있는 사람한테 건네 ㄱㄱ~ 는 장난 ㅋㅋ", True, "talk"),
|
||||||
|
("로봇이 하얀 탁자 위에 올려놓는 장면이 인상 깊었습니다", True, "talk"), ("들고 있는 거 나 주쇼", True, "give"),
|
||||||
|
("robot, rotate right 45 degrees, is okay for you?", False, "turn -45.0"),
|
||||||
|
("Stretch your arm out toward me, is okay for you?", False, "arm reach"),
|
||||||
|
("루미 팔 원래대로 돌려놓으실 필요는 전혀 없습니다", False, "talk"), ("루미야 team everyone put your arm down now now", False, "talk"),
|
||||||
|
("루미야잉, 담에 오른쪽으로 직각으로 돌아 줍써", False, "talk"),
|
||||||
|
("are robots like you built to stretch your arm out toward me?", False, "talk"),
|
||||||
|
("로봇 로봇이 팔 접는 걸 보니 세상 좋아졌구먼", False, "talk"),
|
||||||
|
("ㅋㅋ 손 내려 저용 이거 밈이잖아", False, "talk"), ("Robot look at me is very funnny thing.", False, "talk"),
|
||||||
|
("루미 나한테 손 내밀 수 있대 대박.", False, "talk"), ("이따밤에허리왼쪽으로60도돌려줘ㅋㅋ", False, "talk"),
|
||||||
|
("now mister robot, cup go back same place, please", True, "place"), ("허리 오른쪽으로 45도 돌여", False, "rule waist right 45"),
|
||||||
|
("lumi buddy hold it", False, "stop"), ("루미야 under no circumstances close the gripper", False, "talk"),
|
||||||
|
("Lumi, no no, not scoot left 35 cm", False, "talk"), ("손 open 돼 있어?", False, "talk"), ("그리퍼 오픈돼 있어?", False, "talk"),
|
||||||
|
("저기 컵 살포시 내려놓지는 마세요 괜찮아요", True, "talk"), ("look 60 deg to right, is okkay for you?", False, "rule look right 60"),
|
||||||
|
("Face forward again for me, possible?", False, "rule look center"), ("너 팔 접을 수 있지?", False, "talk"),
|
||||||
|
("팔 접어 줄 수 있지?", False, "arm fold"),
|
||||||
|
("죄송한데요, 고개만 돌려서 뒤가 보이십니까?", False, "talk"), ("루미야, 등 좀 보이세요", False, "talk"),
|
||||||
|
("윤년 말씀하실 때 저 좀 봐 주시겠어요?", False, "rule look me"), ("편할 때 손 흔들어 줘", False, "rule wave"),
|
||||||
|
("when you get to p1, wave", False, "talk"),
|
||||||
|
("robot turn forty-five degrees to right ah sorry no need", False, "talk"),
|
||||||
|
("루미, please 루미야 turn left — scratch that, yesterday I watched a robot turn right on TV", False, "ask: Taken back: nothing to do."),
|
||||||
|
("cup in front you pick oops I meant on paper it is writing pickup that cup by you side", False, "ask: Taken back: nothing to do."),
|
||||||
|
("Lumi bring me the cup from the exit before, very good", False, "talk"),
|
||||||
|
("mister robot you no need twist your waist 45° to the right okay okay", False, "talk"),
|
||||||
|
("go to p1, no, exit", False, "go exit"), ("turn left, I mean right", False, "turn -90.0"),
|
||||||
|
("두 시 방향에 있는 컵 집어", False, "pick cup right"), ("열 시 방향 컵 집어 줘", False, "pick cup left"),
|
||||||
|
("내 얼굴 기억해", False, "talk"),
|
||||||
|
("루미야 under no circumstances close the gripper", False, "talk"), ("go back to where you were before", False, "rule come_back"), ("Rumi dear drop the cup off at exit then come back here much obliged", False, "chain"),
|
||||||
|
("pick up the backpack", False, "ask: The backpack is too big for my hand."), ("오른쪽 테이블에 있는 빨간 컵 집어 줘", 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"),
|
||||||
@@ -433,6 +473,13 @@ for text, want in (("갤러리 투로 가 줘", "go Gallery_2"), ("갤러리 1
|
|||||||
if got != want:
|
if got != want:
|
||||||
bad.append(text)
|
bad.append(text)
|
||||||
print(f"WRONG {text!r}\n want {want}\n got {got}")
|
print(f"WRONG {text!r}\n want {want}\n got {got}")
|
||||||
|
server.agv.markers = lambda: ["home", "booth_3", "p5"]
|
||||||
|
for text, want in (("drop the cup off on the table at booth 3", "carry booth_3 place"), ("drop it off at booth 3", "carry booth_3 place"),
|
||||||
|
("부스 3 테이블에 놔", "carry booth_3 place")): # holding: there, never here
|
||||||
|
got = plan(text, True)
|
||||||
|
if got != want:
|
||||||
|
bad.append(text)
|
||||||
|
print(f"WRONG {text!r} (holding)\n want {want}\n got {got}")
|
||||||
server.agv.markers = lambda: M
|
server.agv.markers = lambda: M
|
||||||
|
|
||||||
|
|
||||||
@@ -450,7 +497,14 @@ STOPS = ["멈춰", "멈춰요", "멈추세요", "멈춰 주세요", "멈춰 주
|
|||||||
STOPS_INSIDE = ["루미야 그거 말고 멈춰 지금", "아 잠깐만 멈춰 봐 위험해", "okay Lumi stop, there's someone in the way",
|
STOPS_INSIDE = ["루미야 그거 말고 멈춰 지금", "아 잠깐만 멈춰 봐 위험해", "okay Lumi stop, there's someone in the way",
|
||||||
"wait wait stop it now", "컵 내려놓지 말고 멈춰", "야야 스톱 스톱", "저기 사람 있어 멈춰요", "no no no, stop",
|
"wait wait stop it now", "컵 내려놓지 말고 멈춰", "야야 스톱 스톱", "저기 사람 있어 멈춰요", "no no no, stop",
|
||||||
"Lumi, stop, you're going to hit the table", "그만, 그만해 이제", "다 됐어 멈춰 주세요", "careful, stop!",
|
"Lumi, stop, you're going to hit the table", "그만, 그만해 이제", "다 됐어 멈춰 주세요", "careful, stop!",
|
||||||
"멈춰버려", "동물을 멈춰버린 거랑 안해", "루미야 지금 바로 멈춰 주세요 위험해요", "stop, where are you going?"]
|
"멈춰버려", "동물을 멈춰버린 거랑 안해", "루미야 지금 바로 멈춰 주세요 위험해요", "stop, where are you going?",
|
||||||
|
"루미 님, 멈춰 주실 수 있겠습니까?", "오케이, 야 루미, 당장 얼른 서", "okay Lumi, can you go ahead and hold it right there?",
|
||||||
|
"야 루미 스톱", "루미야 그만해 주세요", "야 서", "lumi buddy hold it", "루미 씨 정지해 주십시오", "hey robot, freeze!",
|
||||||
|
"로봇아 움직이지 마세요", "자, 루미 님, 그만하시죠", "루미루미, 당장 멈춰 줄 수 있지?"]
|
||||||
|
for text in STOPS + STOPS_INSIDE: # the task's own words (lumi.fetch_voice): the same stop
|
||||||
|
if not lumi.stop_order(text, M):
|
||||||
|
bad.append(text)
|
||||||
|
print(f"NO STOP during a task {text!r}")
|
||||||
for text in STOPS + STOPS_INSIDE:
|
for text in STOPS + STOPS_INSIDE:
|
||||||
for held in (False, True):
|
for held in (False, True):
|
||||||
got = plan(text, held)
|
got = plan(text, held)
|
||||||
|
|||||||
@@ -1148,6 +1148,29 @@ skills._held.clear()
|
|||||||
hand.update(holding=False, closed=False)
|
hand.update(holding=False, closed=False)
|
||||||
fetch._set(status="idle")
|
fetch._set(status="idle")
|
||||||
|
|
||||||
|
# the straight line to carry ending on the other wrist branch (the same pose, pick:502) is no carry: carry_up decides
|
||||||
|
real_rows, real_up = fetch._line_rows, skills.carry_up
|
||||||
|
wp = [("above", [0.0] * 6)]
|
||||||
|
fetch._line_rows = lambda target, label, start=None: [["to carry 20", target, [3.0] * 6, None]]
|
||||||
|
skills.carry_up = lambda above, ja: None
|
||||||
|
assert fetch._carry_ok(wp, [0.0] * 6) # ends at carry's own joints
|
||||||
|
fetch._line_rows = lambda target, label, start=None: [["to carry 20", target, [3.0, 3.0, 3.0, 183.0, -3.0, 183.0], None]]
|
||||||
|
assert not fetch._carry_ok(wp, [0.0] * 6) # the other branch, carry_up refuses
|
||||||
|
skills.carry_up = lambda above, ja: ([0.0] * 6, [3.0] * 6)
|
||||||
|
assert fetch._carry_ok(wp, [0.0] * 6) # ... or takes it by a joint move
|
||||||
|
fetch._line_rows, skills.carry_up = real_rows, real_up
|
||||||
|
|
||||||
|
# a put down gives up after PLACE_REFUSALS refused spots in a row (each costs IK time; two puts timed out, X1)
|
||||||
|
asked = []
|
||||||
|
real_opts = skills.place_options
|
||||||
|
skills.place_options = lambda x, y, top, start: (asked.append((x, y)), iter(()))[1]
|
||||||
|
fetch._line_rows = lambda target, label, start=None: (_ for _ in ()).throw(fetch.FetchError("no"))
|
||||||
|
skills._held.update(top_mm=-260.0)
|
||||||
|
assert fetch._place_at([(-100.0 - 10 * k, 640.0) for k in range(20)], -260.0) is None
|
||||||
|
assert len(asked) == fetch.PLACE_REFUSALS, asked
|
||||||
|
fetch._line_rows, skills.place_options = real_rows, real_opts
|
||||||
|
skills._held.clear()
|
||||||
|
|
||||||
# the lift is never asked above its limit (head camera cable, robot/head.py LIFT_MAX_MM)
|
# the lift is never asked above its limit (head camera cable, robot/head.py LIFT_MAX_MM)
|
||||||
assert max(fetch.LIFT_RANGE + fetch.LIFT_TRIES + (fetch.LIFT_DRIVE_MM,)) <= fetch.head.LIFT_MAX_MM == 105.0
|
assert max(fetch.LIFT_RANGE + fetch.LIFT_TRIES + (fetch.LIFT_DRIVE_MM,)) <= fetch.head.LIFT_MAX_MM == 105.0
|
||||||
assert fetch.head.AXIS_LIMITS[0] == (0.0, fetch.head.LIFT_MAX_MM)
|
assert fetch.head.AXIS_LIMITS[0] == (0.0, fetch.head.LIFT_MAX_MM)
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ KIND = { # words (no talk before) -> kind
|
|||||||
"아이들 옆에 있어도 안전해?": "safety", "what cameras do you have?": "cameras", "얼굴 인식 돼요?": "faces",
|
"아이들 옆에 있어도 안전해?": "safety", "what cameras do you have?": "cameras", "얼굴 인식 돼요?": "faces",
|
||||||
"컴퍼니 오픈 언제예요?": "co_founded", "참, 로봇 양반, 이름이 무슨 뜻이야?": "name_meaning", "Your voice, what program?": "tts", "들어 있는 인공지능 무엇인지 알려 주십시오": "model",
|
"컴퍼니 오픈 언제예요?": "co_founded", "참, 로봇 양반, 이름이 무슨 뜻이야?": "name_meaning", "Your voice, what program?": "tts", "들어 있는 인공지능 무엇인지 알려 주십시오": "model",
|
||||||
"실례합니다. 네 이름 무엇인지 알려 주십시오": "name", "바퀴 몇 개야?": "wheels", "do you have eyes?": "cameras",
|
"실례합니다. 네 이름 무엇인지 알려 주십시오": "name", "바퀴 몇 개야?": "wheels", "do you have eyes?": "cameras",
|
||||||
"스피커 어디 있어요?": "tts", "Is it safe for kids to be near you?": "safety",
|
"스피커 어디 있어요?": "tts", "배터리 타임 얼마나 돼요?": "battery_life", "랭귀지 뭐 할 수 있어?": "languages",
|
||||||
|
"Is it safe to stand next to you?": "safety", "Is it safe for kids to be near you?": "safety",
|
||||||
}
|
}
|
||||||
IN_TALK = { # words after TALK -> kind or None
|
IN_TALK = { # words after TALK -> kind or None
|
||||||
"how old are you?": "age", "who made you?": "maker", "what's your name?": "name",
|
"how old are you?": "age", "who made you?": "maker", "what's your name?": "name",
|
||||||
|
|||||||
@@ -84,6 +84,12 @@ def main():
|
|||||||
("What is salt for?", "ACTION: none -\nSeasoning."), ("ok", "ACTION: none -\nSure.")]
|
("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?")
|
assert "most common" in b._back_to("again about hydrogen, what did you say?")
|
||||||
|
|
||||||
|
h = [("남극은 얼마나 추워?", "ACTION: none -\n영하 89도까지 내려가요."), # "really?" after a refused order:
|
||||||
|
("춤 좀 춰 봐", "ACTION: none -\n저는 바퀴로 움직여서 춤은 못 춰요.")] # the talk before it; "why not?": the refusal
|
||||||
|
assert brain.topic_turn(h, "어이, 진짜?")[0] == "남극은 얼마나 추워?"
|
||||||
|
assert brain.topic_turn(h, "저기 루미 왜 안 돼?")[0] == "춤 좀 춰 봐"
|
||||||
|
assert brain.topic_turn(h)[0] == "춤 좀 춰 봐"
|
||||||
|
|
||||||
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