Improve pick and put from the side, quick answers and Korean command understanding

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 00:21:00 +09:00
co-authored by Claude Opus 5.5
parent 1b3f4568e1
commit d72eb52f66
39 changed files with 4853 additions and 294 deletions
+45
View File
@@ -161,6 +161,51 @@ _BANK = {
("한 바퀴 돌아.", "turn left 360", "네, 한 바퀴 돌게요."),
],
},
"own_limits": { # a yes / no question on its own facts: the answer word first ("No," / "아니요,"), then the fact
"en": [
("Can you drive up a 12 degree slope?", "none", "No, at most 8 degrees."),
("What about a 3 cm bump on the floor?", "none", "No, I can only climb steps up to 1.5 cm."),
("If I jog at 3 metres a second, can you keep up?", "none", "No, my top speed is 1.2 metres a second."),
("Could two of you drive side by side in a one metre corridor?", "none", "No, each of us needs a passage at least 70 cm wide."),
("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?"),
("How far away can you hear me?", "none", "From about 3 to 5 metres."),
("Rise up so we're face to face.", "lift up", "Sure, going up."),
("Spread those fingers of yours.", "arm open", "Opening my hand."),
],
"ko": [
("20도 언덕도 올라갈 수 있어?", "none", "아니요, 저는 8도까지만 올라갈 수 있어요."),
("3센티 턱은 넘으실 수 있으세요?", "none", "아니요, 1.5센티까지만 넘을 수 있어요."),
("80센티 복도에 루미 두 대가 나란히 지나갈 수 있습니까?", "none", "아니요, 저 하나가 지나가는 데 70센티가 필요해서 둘은 어렵습니다."),
("내가 초속 3미터로 뛰면 따라올 수 있어?", "none", "아니요, 제 최고 속도는 초속 1.2미터예요."),
("컵 든 채로 손 흔들어 줘~", "none", "컵을 들고 있어서 지금은 손을 흔들 수 없어요. 먼저 내려놓을까요?"),
("몇 미터 떨어져서 말해도 들리시나요?", "none", "3미터에서 5미터 정도까지 잘 들려요."),
("날 좀 똑바로 쳐다봐 주이소.", "look me", "네, 보고 있어요."),
("집게 좀 벌려 보십시오.", "arm open", "네, 손을 벌리겠습니다."),
],
},
"order_in_talk": { # an order said in the middle of a topic: the order now, the topic goes on after it
"en": [
("Keep telling me about the Moon, and look at me while you do.", "look me", "Sure, I'm looking at you. Where was I?"),
("Before the volcano part, shake my hand.", "wave", "Happily! Here's a wave."),
("While you explain, hold your hand out to me.", "arm reach", "Here's my hand."),
("Um, tell me the whale part again, and look up first.", "look up", "Looking up. Whales sing to find each other."),
("Hang on, give me your hand, then go on about the bees.", "arm reach", "Here you go. Now, the bees."),
("Your story about the palace was cute when you waved.", "none", "Thank you! Shall I tell you more about the palace?"),
("When you finish the Moon story, come here.", "none", "Okay, I'll finish the story first."),
],
"ko": [
("달력 얘기 하시면서 저 좀 봐 주시겠어요?", "look me", "네, 보면서 말씀드릴게요."),
("설명하시는 동안 저를 봐 주십시오.", "look me", "네, 보면서 설명드리겠습니다."),
("전기차 얘기 전에 악수부터 하자.", "wave", "좋아요, 손 흔들어 드릴게요!"),
("상어 얘기하믄서 손 쫌 내밀어 봐라.", "arm reach", "네, 손 내밀게요."),
("부엉이 얘기 하다가 잠깐 위 좀 봐 줄래?", "look up", "네, 위를 볼게요."),
("할머니께 손 좀 흔들어 드리면서 얘기해 주세요.", "wave", "네, 할머니, 안녕하세요!"),
("얘기하다가 나 한 번 봐 주라~", "look me", "네, 보고 있어요."),
("거북선 얘기 끝나면 무대 쪽으로 가 주십시오.", "none", "네, 거북선 얘기를 마치고 말씀해 주시면 가겠습니다."),
("아까 손 흔든 거 귀여웠어요.", "none", "고마워요! 또 흔들어 드릴까요?"),
],
},
"hand": {
"en": [
("Give it to me.", "give", "Here you go."),
+380
View File
@@ -0,0 +1,380 @@
"""More arm and hand wordings for the intent bank (night 5, beyond assistant/bank_words/arm.py): new verbs, frames
and keywords for every arm / hand capability, side words for pick and put ("왼쪽에 있는 컵 집어", "put it down to your
right": the bank keeps them pick / put, the side itself is the rules' or the LLM's), Korean at every level (반말,
해요체, 하십시오체, 하게체, honorific, dialect, Konglish, slips), and hard negatives for "no" (questions about the arm,
remarks, applause and hand gestures Lumi has none of, past, other people's hands).
Endings are written plainly once per stem: the bank stores Korean as wording.ko_plain reads it, so "주십시오" and
"주세요" become one wording; what grows the bank is new verbs and frames, not more endings.
"""
from assistant.bank_words.arm import _ko, _en, ASK_SHORT
# speech levels the ASK lists of arm.py do not have (하게체, 하오체, honorific, more dialect, slips)
LEVELS = ["", " 줘", " 주세요", " 주십시오", " 주시게", " 주시오", " 주쇼", " 주이소", " 줘유", " 주랑께", " 주라", " 줘라",
" 봐", " 보래이", " 봐라잉", " 보소", " 봐유", " 주시지요", " 주시죠", " 주실 수 있으세요?", " 주시겠어요?",
" 줄래", " 줄래요?", " 줘요", " 조", " 쥬", " 도", " 주실래요?"]
SHORT = ["", " 줘", " 주세요", " 주십시오", " 주시게", " 주쇼", " 줘유", " 봐", " 보래이"]
# ---------- wave (every handshake form: the owner's meaning) ----------
WAVE = [
"give me a shake", "let's shake on it", "shake on it", "how about a shake", "can we shake hands",
"let's do a handshake", "handshake time", "time for a handshake", "a handshake, robot", "shake hands, robot",
"shake my hand, friend", "let me shake your hand", "i'd like to shake your hand", "i want to shake your hand",
"i want to shake hands with you", "i'd like a handshake", "shake hands with my son", "shake hands with grandma",
"shake hands with our guest", "shake hands with the kids", "go ahead and shake my hand", "come on, shake my hand",
"wave hi to my son", "wave bye to grandma", "wave them goodbye", "wave so long", "wave farewell",
"say bye-bye with your hand", "say bye bye with your arm", "flap your hand", "waggle your hand",
"wiggle your hand hello", "do the waving thing", "do the hand wave", "hand hello", "give the camera a wave",
"say hi to the camera with your hand", "wave to the nice lady", "wave at my kid", "wave at the baby",
"wave at my little sister", "wave to my brother", "show the kids your wave", "do your little wave",
"wave us goodbye", "wave them hello", "give my mom a wave", "give the kids a wave", "a little wave for the kids",
"one big wave for us", "wave like you mean it", "wave really big", "wave slowly", "wave nicely",
"you make wave", "do wave hand please", "wave hand to me robot", "hand wave for me", "make hand shake with me",
"make handshake with me please", "you and me handshake", "handshake with me", "shake hand me please",
"please hand shake", "robot hand shake", "robot, wave wave", "wave wave robot", "robot robot wave",
"say bye bye robot, wave", "bye bye wave robot", "hello wave robot", "gimme a wave", "throw me a wave",
"toss us a wave", "give us a little wave", "wave at your fans", "wave to your fans",
"would you be so kind as to wave", "would you kindly shake my hand", "would you kindly wave to us",
"be so kind as to wave", "i would appreciate a wave", "a wave would be lovely", "please greet us with your hand",
"greet my mother with a wave", "greet the guests with a wave", "welcome them with a wave",
"wave to welcome them", "wave to say goodbye", "wave to say hello",
*_en(["wave to my kids", "give me a shake", "shake on it", "wave them goodbye", "wave so long"]),
# Korean, every level
*_ko(["손 살랑살랑 흔들어", "손 흔들흔들 해", "손 좌우로 흔들어", "손 들어서 흔들어", "손 번쩍 들어 흔들어",
"손으로 빠이빠이 해", "손으로 작별 인사 해", "손 흔들어서 배웅해", "손 흔들어 배웅해", "손 흔들어 환영해",
"손 흔들어서 반겨", "손 흔들어 반겨", "손 흔들며 인사해", "손 흔들어 안녕 해", "반갑게 손 흔들어",
"크게 손 흔들어", "손 크게 한번 흔들어", "손 천천히 흔들어", "나한테 손 흔들어", "저한테 손 흔들어",
"우리 애한테 손 흔들어", "손녀한테 손 흔들어", "손자한테 손 흔들어", "엄마한테 손 흔들어", "아빠한테 손 흔들어",
"카메라에 손 흔들어", "사진 찍을 때처럼 손 흔들어", "악수 한번 해", "나랑 악수 한번 해", "악수로 인사해",
"핸드셰이크 해", "쉐이크 핸즈 해", "웨이빙 해", "핸드 웨이브 해", "바이 바이 해", "굿바이 손 흔들어",
"하이 손 흔들어"], LEVELS),
"손 흔드시게", "손 흔드시오", "손 흔드십시오", "손 흔드세요", "손 흔드셔요", "손 좀 흔드시지요", "손 흔들어 주시지요",
"악수 한번 하시지요", "악수 한번 하시죠", "악수 청합니다", "악수 부탁드립니다", "악수 부탁해요", "악수 좀 부탁해",
"악수 한번 합시다", "악수 한번 하세", "악수 하세나", "악수나 하세", "악수하시게", "악수 하시오",
"할아버지께 손 흔들어 드려", "할머니께 손 흔들어 드리세요", "선생님께 손 흔들어 드려요", "어르신께 손 흔들어 드리십시오",
"손님들께 손 흔들어 드리세요", "어르신께 손으로 인사드려", "손님께 손으로 인사드리세요", "할머니랑 악수해 드려",
"할아버지랑 악수 한번 해 드려요", "선생님이랑 악수하세요", "회장님께 악수 청해 드리세요",
"악수 하입시더", "악수 하자이", "악수 하장께", "악수 하드라고", "악수 하자 마", "악수 해 보이소", "악수 하쇼",
"손 쪼까 흔들어 봐", "손 흔들어 주소마", "손 흔들어 보래이", "손 흔들어 봐라잉", "손 흔드쇼", "손 흔드소",
"핸즈 쉐이크", "쉐이크 핸즈", "쉐이크 핸즈 플리즈", "웨이브 플리즈", "핸드 웨이브", "핸드 웨이브 플리즈",
"웨이빙 플리즈", "바이바이 플리즈", "하이 해 줘 손으로", "손으로 하이 해", "shake hands 해 주세요",
"wave 좀 해 주세요", "손 wave 해 주세요", "handshake 좀 해요", "악수 please", "please 악수",
"손 흔드러 조", "손 흔들러 줘", "손흔들어", "손흔들어줘", "손흔들어주세요", "악수해조", "악쑤 해 줘", "악수 해쥬",
"악수하쟝", "악수 해 주라", "악수하자구", "악수하자고", "손 흔들어 쥬세요", "손 흔드러 주세여", "손 흔들어 주세여",
"자 악수", "자, 악수하자", "그럼 악수하자", "반가워, 악수", "반갑습니다 악수 한번 하시죠", "만나서 반가워요 악수해요",
"잘 가 손 흔들어", "안녕 손 흔들어 줘", "빠빠이 손 흔들어", "바이바이 손 흔들어 줘",
]
# ---------- arm_reach: hold the arm out ("give me your hand", "손 줘", "손 내밀어") ----------
ARM_REACH = [
"give us your hand", "put out your hand", "put out your arm", "reach your hand to me", "reach me your hand",
"extend your hand to me", "extend your arm out", "extend your arm toward me", "hold your arm straight out",
"arm straight forward", "hand forward please", "can i get your hand", "let's see that hand", "bring your hand out",
"your arm, stretch it out", "out with your hand", "your hand, give it here", "your hand, hold it out",
"stretch your arm toward me", "stretch your hand to me", "reach your arm toward me", "reach your arm forward",
"arm out to me please", "arm toward me", "hand toward me", "reach over to me", "reach over here",
"hold out a hand", "hold a hand out", "offer a hand", "give me your paw", "give paw", "paw please",
"robot gimme hand", "give hand robot", "you give hand me", "hand give me", "your hand give me please",
"please you reach hand", "reach hand please", "you reach out please", "make arm long", "make your arm long",
"long arm", "big reach", "reach far", "reach as far as you can", "stretch as far as you can",
"would you be so kind as to give me your hand", "would you kindly hold out your hand",
"may i have your hand, please", "i'd like to hold your hand", "let me hold your hand", "let me see your arm out",
*_en(["give me your paw", "put out your hand", "extend your hand to me", "reach your hand to me"]),
*_ko(["손 뻗쳐", "팔 뻗쳐", "손 앞으로 쭉", "팔 앞으로 쭉 뻗어", "팔 쭉 내밀어", "손 이리 내", "손 내 봐", "손 좀 내",
"손 내어", "팔 내어", "손 쭉 뻗어", "팔 쭉 빼", "팔 앞으로 빼", "손 앞으로 빼", "팔 길게 내밀어", "팔 멀리 뻗어",
"나한테 팔 내밀어", "저한테 팔 뻗어", "이쪽으로 팔 뻗어", "나 쪽으로 손 뻗어", "내 쪽으로 손 내밀어",
"제 쪽으로 팔 뻗어", "손 줘 봐", "핸드 아웃 해", "암 아웃 해", "리치 아웃 해", "팔 익스텐드 해",
"팔 스트레치 해", "리치 해"], LEVELS),
"손 내미시게", "팔 뻗으시게", "손 내미시오", "팔 뻗으시오", "손 내미십시오", "팔 뻗으십시오", "손 내미세요",
"팔 뻗으세요", "손 내밀어 주시지요", "손 좀 내어 주시겠어요?", "손 내주세요", "손 내줘", "손 내줄래?",
"손 좀 내 주시겠습니까?", "할머니께 손 내밀어 드려", "어르신께 팔 뻗어 드리세요", "선생님께 손 내밀어 드리세요",
"손님께 손 내밀어 드려요", "손 내밀어 보래이", "손 쫌 내 봐라", "팔 뻗어 보랑께", "손 내밀어 주쇼", "손 내미소",
"팔 뻗어 봐라잉", "손 내밀어 보소", "팔 쫌 뻗어 보이소", "손 쪼까 내밀어 봐", "핸드 아웃", "암 아웃", "리치 아웃",
"핸드 플리즈", "hand 좀 줘 봐", "손 out 해", "arm 좀 뻗어 줘", "팔 쭉 reach 해", "손내밀어", "손내밀어줘",
"팔뻗어", "팔뻗어줘", "손 내미러 줘", "팔 뻐더 봐", "손 내미러", "팔 뻗어 쥬", "손 내밀어 쥬세요", "손 쥬", "손 조",
"손 주쇼", "손 주시게", "손 주시오", "손 좀 주시지요", "손 이리 주시게", "손 이리 내 봐", "자 손", "자, 손 줘",
"루미 손", "루미야 손 좀", "손 한번 줘 봐", "손 한 번만 줘", "팔 한번 뻗어 봐", "팔 한 번만 뻗어 줘",
]
# ---------- arm_fold: the arm back to its look pose ----------
ARM_FOLD = [
"arm back to normal", "back to your normal pose", "reset arm position",
"go back to resting position", "rest position", "arm to rest", "arm to rest position",
"put your arm back where it was", "pull in your arm", "bring your arm in close", "fold it up", "fold up",
"fold back", "retract", "retract it", "retract your hand", "pack your arm away", "stow your arm", "stow the arm",
"park your arm", "arm in please", "arm away please", "that's enough, arm back", "ok thanks, you can retract",
"withdraw your arm", "withdraw your hand", "take your hand away", "put that arm away", "arm back, robot", "arm back to look", "back to look", "look pose please",
"arm to the look pose", "you arm back please", "put arm in", "put arm down", "arm back now",
"all done, arm back", "we're done, fold your arm", "done shaking, arm back", "okay you can retract your arm",
"bring it back in", "bring your hand back", "pull your hand in", "draw your hand back", "arm back to start",
"arm to start position", "starting position, arm", "neutral position", "arm neutral", "arm to neutral",
"fold your arm away", "fold the arm in", "tuck your arm back in", "tuck the arm away",
"would you kindly put your arm down", "would you be so kind as to fold your arm",
*_en(["retract your arm", "stow your arm", "pull in your arm", "put your arm back where it was",
"bring your hand back"]),
*_ko(["팔 원래 자세로 해", "팔 기본 자세로 돌려", "팔 원상복구 해", "팔 원상태로 해", "팔 정위치 해", "팔 제자리에 둬",
"팔 다시 원래대로 해", "팔 집어넣어", "손 집어넣어", "팔 거둬들여", "팔 당겨", "팔 안으로 넣어", "팔 몸쪽으로 붙여",
"팔 붙여", "팔 회수해", "팔 복귀해", "팔 원위치 복귀해", "팔 정리해", "팔 다시 접어 놔", "팔 거둬 들여",
"손 다시 가져가", "손 거둬들여", "팔 리셋 해", "팔 폴드 해", "팔 룩 포즈로 해",
"팔 리트랙트 해", "팔 안쪽으로 접어", "팔 몸에 붙여"], SHORT),
"손 거두세요", "손 거두시오", "팔 거두시게", "팔 접으시게", "팔 접으시오", "팔 거두어 주십시오", "팔 거두어 주세요",
"팔 접어 주시지요", "팔 내리시게", "팔 내리시오", "손 거두시게", "팔 원위치 하십시오", "팔 원위치 해 주시죠",
"팔 접어라 마", "팔 접어 보래이", "팔 쫌 접으소", "팔 접어 주쇼", "팔 거둬 부러", "팔 접어 주랑께", "팔 접으쇼",
"팔 거둬유", "팔 쪼까 접어 봐", "암 폴드", "팔 폴드", "팔 리셋", "arm reset 해", "arm reset 해 줘",
"팔 룩 포즈로", "룩 포즈로 팔 접어", "팔 리트랙트", "retract 해 줘", "팔 retract 해",
"팔접어", "팔접어줘", "팔 저버 줘", "팔 거더 줘", "팔 너어", "팔 너어 줘", "팔 접어 쥬", "팔 접어 주세여", "팔내려",
"팔 원위치요", "팔 원위치 좀", "됐어, 팔 접어", "다 됐어 팔 거둬", "악수 끝, 팔 접어", "수고했어 팔 접어",
"고마워요 이제 팔 접으세요", "감사합니다 이제 팔 거두셔도 됩니다", "이제 손 거둬도 돼", "이제 팔 넣어",
]
# ---------- arm_open / arm_close: the gripper ----------
ARM_OPEN = [
"open your gripper wide", "open the fingers", "fingers apart", "spread the gripper", "open the claw", "unclamp",
"unclamp your gripper", "release the gripper", "gripper open please", "open up your gripper", "open your pincers",
"open hand please robot", "hand open you", "you open finger", "open finger", "open fingers please",
"open your hand all the way", "open the hand wide", "spread your hand", "spread your hand out", "palm open",
"relax your grip", "open the grip",
*_en(["open your gripper wide", "unclamp your gripper", "spread your hand", "open your pincers"]),
*_ko(["손가락 벌려", "그리퍼 벌려", "집게 펴", "손 쫙 벌려", "손 열어 봐", "손 오픈 해", "그리퍼 오픈 해", "손 펼쳐",
"손바닥 펼쳐", "손가락 쫙 펴", "손 활짝 열어", "그리퍼 활짝 열어", "집게 활짝 벌려", "손가락 벌려 봐",
"손 쫙 펼쳐"], SHORT),
"손 펴시게", "손 펴시오", "손 펴 보래이", "손 펴 주쇼", "손 펴 봐유", "손펴", "손펴줘", "손 벌려 주십시오",
"그리퍼 여시게", "그리퍼 여십시오", "손 여세요", "손 펴 주시지요", "핸드 오픈", "핸드 오픈 해 줘", "그리퍼 오픈 플리즈",
"open 해 줘 그리퍼", "gripper 열어", "hand open 해 줘", "손 펴 쥬", "손가락 펴 조",
]
ARM_CLOSE = [
"close your pincers", "clamp your gripper", "close the claw", "fingers together", "pinch your fingers",
"pinch your fingers together", "shut the gripper", "close up your hand", "squeeze your hand", "make a fist please",
"fist please", "close fingers", "you close finger", "hand close you", "close the hand all the way",
"close the fingers", "curl your fingers", "ball your hand", "make a fist for me",
*_en(["close your pincers", "clamp your gripper", "fingers together"]),
*_ko(["손가락 모아", "그리퍼 오므려", "집게 쥐어", "손 닫아 봐", "손 클로즈 해", "그리퍼 클로즈 해", "손 꽉 오므려",
"손가락 오므려 봐", "그리퍼 꽉 닫아", "집게 꽉 닫아", "주먹 쥐어 봐"], SHORT),
"주먹 쥐시게", "주먹 쥐시오", "손 쥐어 보래이", "손 오므려 봐유", "손쥐어", "주먹쥐어", "그리퍼닫아", "그리퍼 닫으십시오",
"손 닫으세요", "주먹 쥐어 주시지요", "핸드 클로즈", "핸드 클로즈 해 줘", "그리퍼 클로즈 플리즈", "close 해 줘 그리퍼",
"gripper 닫아", "hand close 해 줘", "주먹 쥐어 쥬", "손 오므려 조",
]
# ---------- pick: an object; the side words keep it a pick (the bank's quick pick takes no side: rules / LLM) ----------
SIDE_EN = ["on your left", "on your right", "to your left", "to your right", "on the left", "on the right",
"on the left side", "on the right side", "next to you", "beside you", "at your side", "in front of you",
"right in front of you", "over on the right", "over on the left", "on your left side", "on your right side"]
SIDE_KO = ["왼쪽에 있는", "오른쪽에 있는", "왼쪽", "오른쪽", "왼편에 있는", "오른편", "옆에 있는", "네 왼쪽에 있는",
"너 오른쪽에 있는", "앞에 있는", "바로 앞에 있는", "좌측", "우측", "왼쪽 테이블 위", "오른쪽 테이블에 있는",
"왼쪽 옆에 있는", "오른쪽 옆에 있는", "니 왼쪽에 있는"]
PICK = [
*[f"pick up the <obj> {s}" for s in SIDE_EN], *[f"grab the <obj> {s}" for s in SIDE_EN[:8]],
*[f"take the <obj> {s}" for s in SIDE_EN[4:10]],
"the <obj> on your right, pick it up", "the <obj> on your left, grab it", "get the <obj> on the left side",
"grab the left <obj>", "pick the right <obj>", "take the left one", "grab the one on the right",
"pick up the one on your left", "pick up the one to your right", "turn and pick up the <obj> on your left",
"pluck the <obj>", "scoop up the <obj>", "take hold of <obj>", "get a grip on the <obj>", "grab hold of the <obj>",
"snatch up the <obj>", "lift up that <obj>", "pick up the <obj>, would you", "robot take <obj>", "get <obj>",
"<obj>, pick up", "you get <obj>", "you lift <obj> please", "pick <obj> please", "grab <obj> please",
"would you kindly pick up the <obj>", "would you be so kind as to pick up the <obj>",
*_en(["pick up the <obj> on your left", "grab the <obj> on your right", "pick up the <obj> next to you"]),
*_ko([f"{s} <obj> {v}" for s in SIDE_KO for v in ("집어", "잡아")], ["", " 줘", " 주세요", " 주십시오", " 봐"]),
*_ko(["<obj> 잡아 들어", "<obj> 집어 들어", "<obj> 꽉 잡아", "<obj> 집어 봐", "<obj> 집어 올려 봐",
"<obj> 픽업 해", "<obj> 들어 올려 봐", "<obj> 그랩 해", "<obj> 테이크 해", "<obj> 쥐어 봐", "그 <obj> 잡아",
"저기 있는 <obj> 집어", "탁자 위에 <obj> 집어", "책상 위에 <obj> 집어", "<obj> 하나만 집어"], LEVELS),
"<obj> 집으시게", "<obj> 잡으시오", "<obj> 집으시오", "<obj> 잡으시게", "<obj> 집어 주시지요", "<obj> 집어 보래이",
"<obj> 쫌 집어 봐라", "<obj> 집어 주쇼", "<obj> 집어 봐라잉", "<obj> 잡아 보소", "<obj> 그랩", "<obj> 픽 업",
"<obj> 테이크", "<obj>집어", "<obj>집어줘", "<obj> 지버 줘", "<obj> 자바", "<obj> 자바 줘", "<obj> 집어 쥬",
]
# ---------- fetch: bring an object to the person ----------
FETCH = [
"bring the <obj> over", "bring the <obj> over here", "fetch me that <obj>", "bring the <obj> back to me",
"could you bring me that <obj>", "carry the <obj> over to me", "deliver me the <obj>", "bring <obj> please",
"<obj>, bring it here", "the <obj>, bring it to me", "fetch <obj> please", "bring cup", "get me <obj>",
"bring me <obj> please", "you bring me <obj>", "please bring <obj> to me", "bring <obj> to me please",
"would you kindly bring me the <obj>", "would you be so kind as to fetch the <obj>",
"go fetch me the <obj>", "fetch the <obj> for me", "bring the <obj> to me, please", "bring that <obj> here",
*_en(["bring the <obj> over here", "fetch me that <obj>", "bring the <obj> back to me"]),
*_ko(["<obj> 갖고 와", "<obj> 챙겨 와", "<obj> 챙겨다", "<obj> 이리 가져와", "<obj> 여기로 갖고 와", "<obj> 좀 챙겨 와",
"<obj> 가지고 와", "나한테 <obj> 갖고 와", "저한테 <obj> 챙겨 와", "<obj> 갖다 와"], SHORT),
"<obj> 가지고 오시게", "<obj> 가져오시오", "<obj> 가져오십시오", "<obj> 가져오세요", "<obj> 가 온나", "<obj> 가져 온나",
"<obj> 갖다 주쇼", "<obj> 가져와 부러", "<obj> 갖고 와유", "<obj> 가져와유", "<obj> 브링 해 줘", "<obj> 가져와줘",
"<obj>가져와", "<obj> 가져와 주시지요", "<obj> 좀 갖다 주시게", "<obj> 가저와 줘", "<obj> 갖고 와 쥬",
]
# ---------- the hand's (not acted on by the bank; kept apart from the motions): put, give, receive ----------
PUT = [
"put it down to your right", "put it down to your left", "put it down on your left", "put it down on your right",
"set it on the left side", "set it on the right side", "place it to the right", "place it to the left",
"put the <obj> down on the right side", "put the <obj> down on the left side", "put it on the table to your left",
"put it on the table to your right", "drop it off on the right", "set the <obj> down", "lay it down",
"lay it on the table", "rest it on the table", "leave it here", "leave it on the table", "put it there",
"put it back where you found it", "put it down beside you", "put it next to you", "put it down gently",
"set it down slowly", "place the <obj> on <place>", "put the <obj> at <place>", "drop the <obj> off at <place>",
"put it on the left table", "put it on the right table", "put it down on the table on your right",
"release it on the table", "put down the <obj>", "put the <obj> back", "set down the <obj> please",
"you put down please", "put down please", "you put it table", "cup down please", "put cup on table",
*_ko(["왼쪽에 내려놔", "오른쪽에 내려놔", "오른쪽 테이블에 내려놔", "왼쪽 테이블에 놔", "왼편에 놔", "옆에 내려놔",
"네 오른쪽에 내려놔", "좌측에 내려놔", "우측에 놔", "여기 놔", "거기 놔", "저기 내려놔", "<place>에 내려놔",
"<place>에 놔", "<place> 테이블에 갖다 놔", "<obj> 내려놔", "<obj> 테이블에 놔", "제자리에 갖다 놔",
"원래 자리에 둬", "살짝 내려놔", "천천히 내려놔", "테이블 위에 살며시 놔", "오른쪽 옆에 놔", "왼쪽 옆에 둬"],
["", " 줘", " 주세요", " 주십시오", " 주시게"]),
"내려놓으십시오", "내려놓으시게", "내려놓으시오", "내려놔 주쇼", "내려놔 보래이", "내려놔 부러", "내려놔유", "내려놓으소",
"풋 다운 해", "put down 해 줘", "테이블에 put 해", "내려놔 쥬", "내려나 조", "그거 놓으세요", "놓으십시오",
]
GIVE = [
"hand it here", "pass it over", "pass it here", "give it back", "give it over", "over here, give it",
"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",
"you give me please", "give me now", "now give me",
"그거 나 줘", "이리 내", "이리 내놔", "내놔", "그거 내놔", "그거 이리 넘겨", "건네 줘", "넘겨 줘", "저한테 넘겨 주세요",
"저 주십시오", "나한테 줘", "제게 주시겠어요?", "그거 받을게", "제가 받겠습니다", "주라", "줘 봐라", "그거 주소",
"이리 주이소", "그거 주쇼", "이리 도", "그거 나 도", "줘유", "기브 미", "give 해 줘", "그거 이리 주시게",
"저에게 건네 주십시오", "할머니 드려", "할머니께 드리세요", "선생님께 드려", "이리 주시지요",
]
RECEIVE = [
"here, take this", "hold this for me", "take this <obj> from me", "here's the <obj>", "this is for you, take it",
"can you take this", "would you hold this", "grab this", "hold onto this", "keep this", "take my <obj>",
"i'm giving you this", "please hold my <obj>", "here, hold it",
"이거 받아 주세요", "이거 들어 줘", "이거 좀 들고 있어 줘", "이거 잡아", "이거 잡아 줘", "이거 받으세요", "이거 받으십시오",
"이거 받으시게", "이거 받아라", "이거 받아 주이소", "받아유", "이것 좀 쥐고 있어",
"이 <obj> 좀 들고 있어", "이거 너 가져", "이거 너 줄게", "이거 테이크 해", "이거 홀드 해 줘", "자, 받아", "옜다 받아",
]
# ---------- no: about the arm and hand, past, other people, gestures Lumi has none of ----------
NO = [
"did you just wave", "you waved at me earlier", "why did you wave", "why are you waving", "can your arm reach the shelf",
"how far can your arm reach", "your arm reached the cup", "you reached out nicely", "no need to wave",
"you don't have to shake my hand", "my grandma likes it when robots wave", "the robot in the video waved",
"i'd rather not shake hands", "i don't shake hands", "no handshake please", "is your hand open",
"is your gripper closed", "why is your hand open", "your fingers are open", "your hand is closed",
"you dropped the cup", "you picked it up yesterday", "you picked the wrong cup", "that cup is heavy",
"what can you pick up", "who taught you to wave", "where did you learn to shake hands",
"the cup on your left is mine", "the cup on the right is empty", "there's a cup on your left",
"is there a cup on your right", "my cup is on the left", "i put the cup down", "i picked up the cup",
"she took the cup", "he gave me the cup", "someone left a cup on the table", "pick up the pace",
"pick up where we left off", "put up with it", "put your hands together for lumi", "give it up for lumi",
"give a hand to our guests", "let's give him a big hand", "hands up", "hands off", "keep your hands to yourself",
"hold your horses", "fold the paper", "fold the towel", "reach your goals", "shake it off", "shake the bottle",
"shake your head", "shake a leg", "wave the flag", "clap your hands", "give me a thumbs up", "do a peace sign",
"make a heart with your hands", "arm wrestle me", "do push ups", "high five me", "fist bump me", "pinky promise",
"the gripper looks strong", "your gripper is cool", "nice reach", "good grab", "nice pick", "you put it down well",
"손 흔들었어?", "아까 손 흔들었잖아", "왜 손 흔들어?", "손 흔드는 거 봤어요", "악수는 됐어", "악수 안 할래", "악수 안 해도 돼",
"팔 뻗는 거 무섭다", "팔이 어디까지 닿아?", "팔 얼마나 뻗을 수 있어?", "팔 길이가 몇이야?", "손 열려 있어?",
"그리퍼 닫혀 있네", "손가락이 몇 개야?", "컵 떨어뜨렸어", "아까 컵 집었잖아", "컵 잘 집네", "왼쪽에 컵 있어",
"오른쪽에 있는 컵 내 거야", "왼쪽 컵 비었어", "오른쪽에 컵 있나?", "컵 누가 놨어?", "컵 내가 내려놨어", "엄마가 컵 가져왔어",
"박수 쳐 줘", "손뼉 쳐 줘", "박수 쳐", "엄지 척 해 줘", "손가락 하트 해 줘", "손하트 해 줘", "브이 해 줘", "팔씨름 하자",
"팔 굽혀 펴기 해 봐", "컵 씻어 줘", "손 흔드는 거 처음 봐", "악수하는 로봇이네", "팔이 참 기네요", "손이 크시네요",
"아까 악수했잖아", "악수 벌써 했어", "팔 접는 소리 났어", "손 내미는 거 귀엽다", "할머니가 손 흔드셨어",
"손 흔들어 주시던데요", "악수는 나중에 하자", "악수는 다음에 해요", "손 흔드는 건 언제 배웠어?", "컵 집는 거 어려워?",
"컵 몇 개나 들어?", "그 컵 무거워?", "왼쪽에 있는 컵 뭐야?", "오른쪽 컵 무슨 색이야?", "왼손잡이야?", "오른손잡이야?",
]
# ---------- more frames and endings: "what I need is for you to …", "-주게나", "-주세유", "-주시길 바랍니다" ----------
FRAMES2 = ["what i need is for you to {}", "the plan is, you {}", "i said {}", "all i ask is that you {}", "time to {}",
"go on and {}", "{} if you would", "{}, would you", "{}, yeah", "your job now is to {}", "next, {}",
"{} right now", "{} quickly", "{} slowly", "{} for us", "{} one time", "you gotta {}", "you should {} now",
"hello lumi, {}", "excuse me robot, {}", "mister robot, {}", "lumi, buddy, {}", "{}, my friend"]
KO_END2 = [" 주게나", " 주세유", " 주시길 바랍니다", " 주셨으면 합니다", " 주시면 고맙겠습니다", " 주면 안 될까요?",
" 주실 수 있을까요?", " 줄 수 있겠니?", " 주겠니?", " 주겠나?", " 주시겠나?", " 주셔", " 줘 봐 응", " 주실래예",
" 주이소 마", " 줘 볼래?", " 주라 응", " 줘 얼른", " 줘 빨리요", " 주실 수 있나요?"]
def _en2(cores):
return [f.format(c) for c in cores for f in FRAMES2]
WAVE += _en2(["wave", "wave hello", "shake my hand", "do a little wave", "give us a wave", "shake hands with me"]) + \
_ko(["손 흔들어", "팔 흔들어", "악수해", "손 인사 해", "손 흔들어서 인사해", "바이바이 해"], KO_END2) + [
"you and me shake hand", "me and you, handshake", "let us shake hands", "a handshake for me please",
"i'd love a wave from you", "how about you wave hello", "show everyone your wave", "wave hi, lumi",
"say hi to my mom with a wave", "it's goodbye time, wave", "wave goodbye to me", "wave to me once",
"손 흔드세유", "손 흔들어 주시길 바랍니다", "wave 해 주시길 바랍니다", "웨이브 해 주시길 바랍니다", "악수 부탁드려요",
"악수해 주시면 고맙겠습니다", "인사 손으로 해 주게나", "우리 악수나 하자", "그럼 악수 한번 할까", "악수 한번 할래?"]
ARM_REACH += _en2(["give me your hand", "hold out your hand", "reach out your arm", "stretch out your arm",
"put your hand out"]) + _ko(["손 줘", "손 내밀어", "팔 뻗어", "손 앞으로 내밀어", "팔 앞으로 뻗어"], KO_END2) + [
"your hand, give me", "hand, give me", "your hand to me", "your arm to me, please", "me your hand please",
"give your hand to me now", "i'd like your hand", "hand over here", "arm over here please", "손 한번 주시게",
"손 한번 주게나", "손 좀 주세유", "손 줘 봐유", "팔 쭉 뻗어 주세유"]
ARM_FOLD += _en2(["fold your arm", "put your arm back", "pull your arm back in", "tuck your arm away", "lower your arm",
"bring your arm home"]) + _ko(["팔 접어", "팔 거둬", "손 내려", "팔 안으로 거둬", "팔 원위치 해"], KO_END2) + [
"bring your hadn home", "put arm back where it was", "you can put arm back where it was", "arm back where it was",
"put your arm where it was", "arm back to where it was", "fold you're arm", "fold your arms", "put your arms down",
"arms back", "arms in", "팔 안으로 거둬 줘", "팔을 안으로 거둬", "손 이제 내려 줘", "팔 이제 거둬 주게나", "암 백", "암 백 해 줘",
"arm back 해 줘", "팔 백 해 줘"]
ARM_OPEN += _en2(["open your hand", "release your grip", "open your fingers", "open the gripper"]) + \
_ko(["손가락 펴", "손 펴", "그리퍼 열어", "손 벌려"], KO_END2) + [
"let go of your grip", "loosen your fingers", "fingers open please", "open hand now", "손가락 펴 주게",
"손가락펴줘", "손가락 쫙 펴 주세유"]
ARM_CLOSE += _en2(["close your hand", "grip with your fingers", "make a fist", "close the gripper"]) + \
_ko(["주먹 쥐어", "손 쥐어", "그리퍼 닫아", "손가락 오므려"], KO_END2) + [
"grip with your fingers", "grip your fingers", "grip tight", "close your grip", "tighten your fingers",
"주먹 꽉 쥐어 주시겠습니까", "손 꽉 쥐어 주세유", "주먹쥐어줘"]
PICK += _en2(["pick up the <obj>", "grab the <obj>", "take the <obj>"]) + \
_ko(["<obj> 집어", "<obj> 잡아", "<obj> 들어"], KO_END2) + [
"peek up the <obj>", "<obj> 잡아 주게나", "<obj> 집어 주세유", "<obj> 들어 올려 주시길 바랍니다", "the <obj>, grab it",
"<obj>, take it", "that <obj> there, pick it up", "pick that <obj> up for me", "grab me that <obj>"]
FETCH += _en2(["bring me the <obj>", "fetch the <obj>"]) + _ko(["<obj> 가져와", "<obj> 갖다"], KO_END2)
NO += [
"she asked you to wave hi to me yesterday", "my grandson told you to shake hands", "you waved to her before",
"will you wave at the party tomorrow", "never grab that apple without asking", "don't ever pick up my phone",
"can robots wave", "do robots shake hands", "the robot shook my hand", "you shook my hand earlier",
"your hand is so cold when we shake", "i'm waving at you", "i'm shaking your hand now", "i'll wave back",
"look, i'm reaching out", "my arm is tired", "my hand is full", "my fingers are cold", "open your mind",
"close your eyes", "open your mouth", "close the curtains", "reach for the stars", "hold my beer",
"grab a seat", "take a seat", "get a grip", "get a grip on yourself", "pick a side", "take my word for it",
"give me your word", "give me your opinion", "give me your number", "lend me your ears", "fold your hands and pray",
"shake things up", "wave of the future", "hand me down clothes", "put your feet up", "put it on my account",
"아까 손자가 악수하라고 했어", "손 흔들라고 누가 그랬어?", "어제 손 흔들어 줬잖아", "내일 행사 때 손 흔들 거야?",
"손 흔드는 로봇 처음 봐요", "로봇이랑 악수했어요", "손 시려워", "손가락이 아파요", "팔이 아파서 못 들겠어",
"눈 감아", "입 벌려", "커튼 닫아", "마음 열어", "자리에 앉아", "정신 차려", "손 들어 질문 있어요", "손 씻으러 가자",
"의자 들어 줄래?", "가방 들어 줘", "백팩 집어 줘", "의자 잡아 줘", "책상 옮겨 줘", "pick up my backpack",
"grab that chair for me", "lift the table", "carry my bag", "hold the door",
]
# ---------- put and pick from any side, give while holding, receive ----------
SIDES_KO = ["왼쪽", "오른쪽", "왼편", "오른편", "좌측", "우측", "왼쪽 옆", "오른쪽 옆", "니 왼쪽", "네 오른쪽", "옆", "앞",
"바로 옆", "왼쪽 테이블", "오른쪽 테이블", "왼쪽 탁자", "오른쪽 책상"]
SIDES_EN = ["to your left", "to your right", "on your left", "on your right", "on the left side", "on the right side",
"to the left", "to the right", "beside you", "next to you", "at your left", "at your right",
"on the table to your left", "on the table to your right", "on the left table", "on the right table",
"over on your left", "over to the right", "by your side", "on your left-hand side", "on your right-hand side"]
PUT_END = ["", " 줘", " 주세요", " 주십시오", " 주시게", " 주세유", " 주이소", " 줘유", " 주게나", " 주시길 바랍니다", " 주쇼", " 봐"]
PUT += [f"put it down {s}" for s in SIDES_EN] + [f"set it down {s}" for s in SIDES_EN[:10]] + \
[f"place the <obj> {s}" for s in SIDES_EN[:8]] + [f"put the <obj> {s}" for s in SIDES_EN[8:16]] + \
[f"leave it {s}" for s in SIDES_EN[:6]] + [f"drop it {s}" for s in SIDES_EN[:4]] + \
_ko([f"{s}에 내려놔" for s in SIDES_KO] + [f"{s}에 놔" for s in SIDES_KO[:10]] + [f"{s}에 둬" for s in SIDES_KO[:6]] +
[f"그거 {s}에 내려놔" for s in SIDES_KO[:6]] + [f"<obj> {s}에 놔" for s in SIDES_KO[:6]] +
[f"{s}에 내려놓아" for s in SIDES_KO[:4]], PUT_END) + [
"왼쪽에다 내려놔", "오른쪽에다 놔 줘", "왼쪽에다가 놔", "오른쪽에다가 내려놓으세요", "레프트에 놔", "라이트 쪽에 내려놔",
"왼쪽 사이드에 놔", "오른쪽 사이드에 내려놔 줘", "put it 왼쪽에", "오른쪽에 put down 해", "왼쪽에 내려나", "오른쪽에 내려 나 줘",
"put it down at your left side", "on the right, put it down", "left side, put it down", "put down left side please",
"you put left side", "put cup right side", "the right side, set it there", "over there on the left, put it down",
]
PICK += [f"pick up the <obj> {s}" for s in SIDES_EN[8:]] + [f"take the <obj> {s}" for s in SIDES_EN[:4]] + \
[f"grab the <obj> sitting {s}" for s in SIDES_EN[:4]] + \
_ko([f"{s}에 있는 <obj> {v}" for s in SIDES_KO for v in ("집어", "잡아", "들어")], ["", " 줘", " 주세요", " 주십시오", " 주게나", " 주세유"]) + [
"왼쪽 거 집어", "오른쪽 거 잡아 줘", "왼쪽 것 좀 집어 주세요", "오른쪽에 있는 거 집어", "레프트 컵 집어", "라이트 쪽 <obj> 잡아",
"the <obj> at your left, take it", "the left <obj>, grab it", "the one on your right, pick it up",
]
GIVE += _ko(["그거 줘", "이리 줘", "나 줘", "저 줘", "그거 이리 건네", "그거 넘겨", "그 <obj> 줘", "들고 있는 거 줘",
"손에 든 거 줘", "그거 나한테 줘"], ["", " 봐", "요", " 주세유", " 주게나", " 주시길 바랍니다"]) + [
"give me what you're holding", "give me the thing you're holding", "hand me what you have", "pass me what you got",
"what you have, give me", "the <obj>, give it to me", "give it me", "give me", "gimme", "gimme it", "hand over",
"그거 주시게", "그거 주게나", "주세유", "그거 주셔", "줘 봐 응", "그거 건네주세요", "손에 든 거 이리 줘요", "그거 저 줘요",
]
RECEIVE += [
"here, this is yours", "take this from me please", "this one you hold", "now you here, take this",
"hold onto this for me", "take it, it's for you", "here, grab this from me", "i'm handing it to you", "keep it for me",
"이거 받아 주게나", "이거 받아 주세유", "이거 가지고 있어", "이거 들고 계세요", "이거 쥐고 있어 줘", "이것 좀 맡아 줘",
"이거 맡아 주세요", "자 이거", "옛다", "받으세유", "받아 주시길 바랍니다",
]
NO += [
"왼쪽에 놔둔 컵 누구 거야?", "오른쪽에 둔 거 뭐야?", "왼쪽에 내려놨어?", "오른쪽에 놓을까?", "왼쪽에 놓으면 돼?",
"어디에 내려놓을까?", "왼쪽이 좋아 오른쪽이 좋아?", "왼쪽 컵 예쁘다", "오른쪽에 있는 컵 누구 거예요?",
"did you put it on the left?", "should i put it on the right?", "the cup on the left is broken",
"put it on the left or the right?", "which side should i put it on", "the left one is mine", "i put it on your left",
"my cup is on your right", "is the cup on the left full?", "you put it down on the left yesterday",
"왼쪽에 컵 있어?", "오른쪽에 뭐 있어?", "옆에 컵 있네", "앞에 컵 있다",
]
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}
+24
View File
@@ -292,3 +292,27 @@ for _en, _ko_, _a in ROBOTS.values(): # where it stands, or asked to work: t
"i want to see the {r}", "show me the {r}"] for r in _en]
QUICK["no"] += [f.format(r=r) for f in ["{r} 어디 있어", "{r} 어디 있어요", "{r} 어디예요", "{r}한테 데려가 줘", "{r} 보여 줘", "{r} 여기 있어요"]
for r in _ko_]
# night 5: Konglish / 하게체 / non-native ways of asking the founding year and the office ("컴퍼니 오픈 언제예요?",
# "company made which year?", "회사 사무실 어딘가?"); in quick_answers.KINDS by the loop above's kinds
QUICK["co_founded"] = [
"company made which year", "company founded which year", "company start when", "your company open when", "company since when",
"which year company start", "when company made", "cutshion made which year", "cutshion start what year", "company birthday when",
"company how many years", "company how old"] + _ko(
["컴퍼니 오픈 언제", "회사 오픈 언제", "쿳션 오픈 언제", "회사 설립 언제", "쿳션 설립 언제", "회사 창립 언제", "회사 창업 언제",
"회사 생긴 게 언제", "회사 세운 게 언제", "쿳션 생긴 게 언제", "컴퍼니 설립 언제", "회사 몇 년도 설립"],
["예요", "야", "니", "입니까", "인가요", "인가", "고", "여", "임", "이에요", "일까요"]) + _ko(
["회사 몇 년 됐", "회사 생긴 지 몇 년 됐", "쿳션 생긴 지 얼마나 됐", "회사 차린 지 얼마나 됐"],
["어", "어요", "니", "습니까", "나요", "노", "어유", "는가"])
QUICK["co_hq"] = _ko(
["회사 사무실 어디", "회사 사무실 어딘", "쿳션 사무실 어디", "회사 위치 어디", "회사 주소 어디", "본사 어디",
"회사는 어디", "쿳션 본사 어디", "컴퍼니 어디", "회사 오피스 어디"],
["야", "예요", "에요", "니", "입니까", "인가요", "인가", "고", "여", "임"]) + _ko(
["회사 어디 있", "쿳션 어디 있", "회사 사무실 어디 있"], ["어", "어요", "니", "나요", "습니까", "노", "는가", "으세요"]) + [
"where is company", "company where", "company office where", "where your company", "company location please",
"office where", "where is the office of cutshion", "where's your company's office", "company address"]
QUICK["no"] += [
"오픈AI 대표 누구야", "오픈AI 대표 누군가", "오픈AI 대표 누구임", "오픈AI 대표 어떤 분이세요", "구글 대표 누구예요", "애플 CEO 누구야",
"엔비디아 대표 누구야", "테슬라 대표 누구예요", "삼성 회장 누구야", "who's the boss of openai", "who runs google",
"1달러에 원화로 얼마야", "1달러 원화로 얼만가", "환율 얼마예요", "달러 환율 알려 줘", "엔화 얼마야", "how much is a dollar in won",
"what's the exchange rate", "배터리 얼만가", "배터리 얼마예요", "배터리 얼마야", "배터리 얼마 남았는가"]
+63 -6
View File
@@ -161,10 +161,10 @@ QUICK_KINDS = {
"자율주행 어떻게 해요", "자율주행 돼요", "자율주행 하니", "혼자 다닐 수 있어요", "길은 어떻게 찾아요", "길 어떻게 찾아", "위치는 어떻게 알아요",
"어디 있는지 어떻게 알아", "지도 있어요", "지도 써요", "지도를 어떻게 만들어요", "GPS 써요", "내비게이션 어떻게 해요", "자율 주행입니까",
"길 우째 찾노", "길 어떻게 찾아유", "혼자 길 찾아가세요", "navigation 어떻게 해요", "자율주행 how", "map 있어요", "SLAM 써요",
], {"en": ["I drive with a map of the room made with my lidar. I compare what the lidar sees with the map to know where I am, to within about 5 cm, and plan a path around people and obstacles.",
"With a lidar map: I know where I am on it to about 5 cm, and I drive to named places on my own, around people and obstacles."],
"ko": ["라이다로 만든 지도에서 제 위치를 약 5cm 정확도로 알고, 지도 위의 장소까지 사람과 장애물을 피해 경로를 짜서 가요.",
"라이다 지도로 다녀요. 지도에서 제 위치를 5cm 정도로 알고, 이름 붙은 장소까지 혼자 장애물을 피해서 가요."]}),
], {"en": ["I drive with a map of the room made with my lidar. I compare what the lidar sees with the map to know where I am, to within about 5 cm, and plan a path around people and obstacles. A separate small computer in my base runs the navigation.",
"With a lidar map: I know where I am on it to about 5 cm, and I drive to named places on my own, around people and obstacles. A separate small computer in my base runs the navigation."],
"ko": ["라이다로 만든 지도에서 제 위치를 약 5cm 정확도로 알고, 지도 위의 장소까지 사람과 장애물을 피해 경로를 짜서 가요. 내비게이션은 베이스 안의 별도 컴퓨터가 돌려요.",
"라이다 지도로 다녀요. 지도에서 제 위치를 5cm 정도로 알고, 이름 붙은 장소까지 혼자 장애물을 피해서 가요. 내비게이션은 베이스 안의 별도 작은 컴퓨터가 맡아요."]}),
"obstacles": ([
"how do you avoid obstacles", "how do you avoid people", "do you avoid obstacles", "will you bump into people",
"do you crash into things", "what if someone is in your way", "what happens if someone stands in front of you",
@@ -227,9 +227,9 @@ QUICK_KINDS = {
"ko": ["제 팔을 손으로 움직여서 가르치거나, 프로그램을 짜거나, VR 헤드셋으로 원격 조종해서 새 일을 가르칠 수 있어요. 시범을 보고 기술을 배울 수도 있어요."]}),
"touch": ([
"is it ok to touch you", "is it safe to touch you", "can people touch you", "may we touch you", "can kids touch you",
"can you be pushed", "is it okay to push you", "are you dangerous", "is it safe near you", "are you safe for kids",
"can you be pushed", "is it okay to push you",
"만져도 돼", "만져도 돼요", "만져도 되니", "만져도 됩니까", "만져도 되나요", "만져 봐도 되세요", "만져도 괜찮아요", "만지면 안 돼요",
"밀어도 돼요", "밀어도 되나", "애들이 만져도 돼요", "아이들 옆에 있어도 안전해요", "만져도 되나", "만지도 되나",
"밀어도 돼요", "밀어도 되나", "애들이 만져도 돼요", "만져도 되나", "만지도 되나",
"만져도 되노", "만져도 돼유", "touch 해도 돼요", "만져도 OK예요",
], {"en": ["You may touch me, but please keep your hands away from my gripper fingers when they close, and please don't push me: I'm heavy.",
"Yes, gently. Keep your hands away from my gripper fingers when they close, and don't push my base while I'm switched on."],
@@ -453,3 +453,60 @@ QUICK["no"] += [
"drive 3 meters ahead", "종이컵 집어 줘", "종이컵 잡아 줘", "pick up the paper cup", "grab my paper cup", "종이컵 가져와",
"팔 들어", "팔 내려", "raise your arm", "대통령 연세가 어떻게 됩니까", "대통령 몇 살이에요", "엄마 연세가 어떻게 되세요", "how old is the president",
"오픈AI는 누가 이끌고 있습니까", "오픈AI CEO가 누구야", "who runs openai", "who leads openai"]
# night 5: is it safe near Lumi (the touch kind answers touching only)
QUICK_KINDS["safety"] = ([
"is it safe to stand next to you", "is it safe near you", "are you safe for kids", "are you dangerous", "are you safe",
"is this robot safe", "is it safe to be around you", "can you hurt someone", "could you hurt me", "will you hit me",
"can kids stand near you", "is it safe for children to be near you", "how do you keep people safe", "what about safety",
"are you safe around people", "is lumi safe", "is it dangerous to stand here", "do you have safety features",
"what safety features do you have", "you won't run me over will you", "safe to be near?"] + [
s + e for s in ["아이들 옆에 있어도 안전", "옆에 있어도 안전", "가까이 가도 안전", "너 옆에 서 있어도 안전", "로봇 옆에 있어도 안전",
"애들 옆에 둬도 안전", "사람 옆에서 안전", "너 안전", "이 로봇 안전"]
for e in ["해", "해요", "하니", "합니까", "한가요", "하세요", "하나", "하노", "해유", "하지"]] + [
s + e for s in ["너 위험", "이 로봇 위험", "옆에 있으면 위험", "가까이 가면 위험", "아이들한테 위험"]
for e in ["해", "해요", "하니", "합니까", "한가요", "하지 않아", "하지 않아요", "하나", "하노"]] + [
"사람 다치게 할 수 있어", "사람 칠 수도 있어요", "부딪히면 어떡해요", "아이들이 가까이 가도 돼요", "옆에 서 있어도 돼요",
"안전장치 있어요", "안전 기능 뭐 있어요", "안전은 어떻게 지켜요", "안전하게 만들어졌어요", "다칠 위험 없어요", "safety 괜찮아요",
"너 안전한 로봇이야", "안전한 로봇입니까", "안전하긴 하나", "옆에 있어도 괜찮아요",
], {"en": ["Yes. I drive slowly and stop for people in my way, and my arm is a collaborative arm: it detects collisions and stops. "
"There are red emergency stop buttons on my body and in my base. Please keep your hands away from my gripper fingers.",
"I'm made to work near people: I stop for people in my way, my arm stops when it bumps into something, and pressing "
"one of my red emergency stop buttons stops my arm and lift at once. Just don't push me, I'm heavy."],
"ko": ["네, 안전해요. 천천히 움직이고 앞에 사람이 있으면 멈춰요. 팔은 협동 로봇 팔이라 충돌을 느끼면 멈추고, 몸과 베이스에 "
"빨간 비상 정지 버튼도 있어요. 그리퍼 손가락에는 손을 가까이 대지 마세요.",
"사람 곁에서 일하도록 만들어졌어요. 길에 사람이 있으면 멈추고, 팔은 부딪히면 멈춰요. 빨간 비상 정지 버튼을 누르면 "
"팔과 리프트가 바로 멈춰요. 저는 무거우니까 밀지는 말아 주세요."]})
# night 5: the cameras and face recognition as facts (quick_answers.SPEC lets these past the camera guard)
_CAM_KO = ["카메라 몇 개", "카메라가 몇 개", "카메라 몇 대", "카메라는 몇 개", "카메라 뭐 쓰", "카메라 어떤 거 쓰", "카메라 기종이 뭐", "카메라 모델이 뭐",
"카메라 종류가 뭐", "카메라 사양이 어떻게 되", "카메라 스펙이 뭐", "카메라 무슨 제품"]
QUICK_KINDS["cameras"] = ([
"what cameras do you have", "what camera do you use", "how many cameras do you have", "which cameras do you use",
"what kind of camera do you have", "what type of cameras are in you", "what camera model do you use", "what's your camera model",
"what depth camera do you use", "do you use orbbec cameras", "what camera brand do you use", "how many cameras does lumi have",
"what camera is in your head", "what cameras does this robot use", "camera model?", "how many camera you have",
"카메라 몇 개야", "카메라 몇 개예요", "카메라 몇 개니", "카메라 몇 개입니까", "카메라 몇 개 달려 있어", "카메라 몇 대 있어요", "카메라 뭐 써",
"카메라 뭐 써요", "카메라 뭐 쓰세요", "카메라 뭐 쓰십니까", "카메라 뭐 쓰노", "카메라 어떤 거 써요", "카메라 기종이 뭐예요", "카메라 모델이 뭐야",
"카메라 종류가 뭐예요", "카메라 사양이 어떻게 돼요", "카메라 스펙이 뭐야", "카메라 무슨 제품이에요", "너 카메라 몇 개야", "루미 카메라 몇 개예요",
"카메라는 몇 개 달렸노", "카메라 몇 개 있어유", "camera 몇 개야", "camera 뭐 써요", "카메라 model 뭐야",
], {"en": ["I have three cameras that see colour and depth: an Orbbec Gemini 2 L in my head, another on my body, and a 3D camera "
"at the front of my base. They see from very close up to about 10 metres.",
"Three: two Orbbec Gemini 2 L depth cameras, one in my head and one on my body, and a 3D camera at the front of my base."],
"ko": ["카메라는 세 대예요. 머리와 몸에 오비벡(Orbbec) Gemini 2 L 깊이 카메라가 하나씩 있고, 베이스 앞에 3D 카메라가 하나 있어요. "
"아주 가까이에서 약 10m까지 봐요.",
"모두 세 대예요. 오비벡 Gemini 2 L 깊이 카메라 두 대(머리, 몸)와 베이스 앞의 3D 카메라 하나예요."]})
QUICK_KINDS["faces"] = ([
"can you recognize faces", "can you recognise faces", "do you recognize faces", "do you have face recognition",
"do you use face recognition", "can you remember faces", "do you remember who people are", "can you recognize people",
"is there face recognition", "face recognition?", "can lumi recognize faces",
"얼굴 인식 돼", "얼굴 인식 돼요", "얼굴 인식 되니", "얼굴 인식 됩니까", "얼굴 인식 되나요", "얼굴 인식 하세요", "얼굴 인식 기능 있어요",
"얼굴 알아볼 수 있어", "얼굴 알아볼 수 있어요", "얼굴 알아보니", "얼굴 알아봐요", "얼굴 기억해", "얼굴 기억할 수 있어요", "얼굴 인식 되노",
"얼굴 인식 돼유", "face recognition 돼요", "얼굴 인식 기능 있으십니까",
], {"en": ["No, I don't recognise faces or remember who people are. I can see that someone is there, but not who it is.",
"I don't do face recognition: I find people with my cameras, but I can't tell who they are or remember them."],
"ko": ["아니요, 저는 얼굴을 알아보거나 사람을 기억하지 못해요. 사람이 있는 건 보지만 누구인지는 알아보지 못해요.",
"얼굴 인식은 안 해요. 카메라로 사람은 찾지만, 누구인지 알아보거나 기억하지는 않아요."]})
QUICK["no"] += ["what can your camera see", "what do you see with your camera", "카메라로 뭐 보여", "카메라에 뭐 보여요", "카메라 켜 줘",
"camera on", "카메라 돌아가고 있어요", "do you recognize me", "나 알아봐", "내 얼굴 기억해", "remember my face",
"카메라 고장 났어", "is your camera on", "카메라 켜져 있어요"]
+129
View File
@@ -0,0 +1,129 @@
"""Korean wordings at every speech level, for the kinds Lumi acts on: each kind's fronts (object with a side, place,
way, body part, who to) x its verbs x the request endings people use, 반말 to 하십시오체, honorific -시-, 하게체,
dialect, friendly and written slips.
wording.ko_plain already reads most endings as the plain 반말 one before the bank compares ("집어 주십시오",
"집으세요", "집어 주이소" -> "집어 줘"), and the bank stores its wordings the same way, so those collapse into one
wording each; they are listed so every level is covered by name. The endings ko_plain leaves as they are ("집어
주라", "집어 줘 보소", "집어 주시겠소?", "집어 주는 거 어때?", "집어줘") are embedded as said.
"""
import itertools
import zlib
# verb: (반말 form "집어", stem before -세요 / -십시오 "집으" or None); a verb whose 반말 form needs 주다 after it
# ("갖다", "가져다") is marked by a trailing "~"
VERBS = {
"집": ("집어", "집으"), "잡": ("잡아", "잡으"), "들어올려": ("들어 올려", "들어 올리"), "쥐": ("쥐어", "쥐"),
"픽업": ("픽업해", "픽업하"),
"가": ("가", "가"), "이동": ("이동해", "이동하"), "움직": ("움직여", "움직이"), "와": ("와", "오"),
"다가와": ("다가와", "다가오"), "따라와": ("따라와", "따라오"), "쫓아와": ("쫓아와", "쫓아오"),
"따라다녀": ("따라다녀", "따라다니"), "돌아와": ("돌아와", "돌아오"), "돌아가": ("돌아가", "돌아가"),
"복귀": ("복귀해", "복귀하"), "돌아": ("돌아", "도"), "회전": ("회전해", "회전하"), "돌아서": ("돌아서", "돌아서"),
"봐": ("봐", "보"), "쳐다봐": ("쳐다봐", "쳐다보"), "바라봐": ("바라봐", "바라보"), "들어": ("들어", None),
"숙여": ("숙여", "숙이"), "돌려": ("돌려", "돌리"), "올려": ("올려", "올리"), "내려": ("내려", "내리"),
"높여": ("높여", "높이"), "낮춰": ("낮춰", "낮추"), "흔들어": ("흔들어", "흔드"), "악수": ("악수해", "악수하"),
"인사": ("인사해", "인사하"), "내밀어": ("내밀어", "내미"), "뻗어": ("뻗어", "뻗으"), "접어": ("접어", "접으"),
"넣어": ("넣어", "넣으"), "거둬": ("거둬", "거두"), "펴": ("펴", "펴"), "벌려": ("벌려", "벌리"), "열어": ("열어", "여"),
"닫아": ("닫아", "닫으"), "오므려": ("오므려", "오므리"), "가져와": ("가져와", "가져오"), "갖고와": ("갖고 와", "갖고 오"),
"챙겨와": ("챙겨 와", "챙겨 오"), "가져다": ("가져다~", None), "갖다": ("갖다~", None), "놔": ("놔", "놓으"),
"내려놔": ("내려놔", "내려놓으"), "둬": ("둬", "두"), "올려놔": ("올려놔", "올려놓으"),
}
# endings: {a} the 반말 form, {s} the stem before -시-. Levels in order: 반말, friendly, 해요체, honorific, 하십시오체,
# 하게체, dialect (경상 / 전라 / 충청), written slips and suggestions
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} 주시면 감사하겠습니다",
"{s}세요", "{s}시겠어요?", "{s}실래요?", "{s}시죠",
"{a} 주십시오", "{a} 주시기 바랍니다", "{a} 주시겠습니까?", "{a} 주시길 바랍니다", "{a} 주실 수 있겠습니까?", "{s}십시오",
"{a} 주게", "{a} 주게나", "{a} 주시게", "{a} 주시겠소?", "{a} 주시오", "{s}시오",
"{a} 도", "{a} 주이소", "{s}이소", "{a} 줘 보소", "{a} 주소", "{a}라잉", "{a} 줘라잉", "{a} 주랑께", "{a} 줘유", "{a} 봐유",
"{a} 주이라",
"{a}조", "{a} 줘용", "{a} 주세여", "{a} 줘염", "{a} 주세염", "{a} 주시겠어여?", "{a} 주실래여?", "{a} 주떼여", "{a} 달라",
]
def _say(front, verb, end):
a, s = VERBS[verb]
aux = a.endswith("~")
a = a.rstrip("~")
if "{s}" in end and not s or aux and not any(w in end for w in ("{a} 주", "{a} 줘", "{a}줘", "{a} 줄", "{a} 도",
"{a} 달라")):
return None
return " ".join((front + end.format(a=a, s=s or "")).split())
BASIC = ["{a}", "{a} 줘", "{a} 봐", "{a} 줄래?", "{a} 봐 봐"] # what ko_plain turns most endings into
RAW_SHARE = 0.2 # share of fronts x verbs said with each ending ko_plain keeps as it is (each one embedded)
def _make(fronts, verbs, share=RAW_SHARE):
"""Every front x verb x ending; an ending ko_plain does not read as a BASIC one on a fixed `share` of them."""
from assistant import wording
out = []
for f, v in itertools.product(fronts, verbs):
basic = {wording.ko_plain(t) for t in (_say(f, v, e) for e in BASIC) if t}
for e in ENDS:
t = _say(f, v, e)
if t and (wording.ko_plain(t) in basic or zlib.crc32(t.encode()) % 1000 < share * 1000):
out.append(t)
return list(dict.fromkeys(out))
_OBJ = ["<obj> ", "<obj> 좀 ", "그 <obj> ", "저 <obj> ", "이 <obj> ", "<obj> 하나 ", "저기 있는 <obj> ",
"테이블 위에 있는 <obj> ", "테이블에 있는 <obj> "]
_SIDE = ["왼쪽에 있는 <obj> ", "오른쪽에 있는 <obj> ", "왼쪽 <obj> ", "오른쪽 <obj> ", "왼편에 있는 <obj> ",
"오른편에 있는 <obj> ", "앞에 있는 <obj> ", "가운데 있는 <obj> ", "옆에 있는 <obj> ", "제일 가까운 <obj> ",
"왼쪽에 놓인 <obj> ", "오른쪽에 놓인 <obj> "]
_TO = ["", "저한테 ", "나한테 ", "여기로 ", "이리 "]
_DIRS = ["앞으로 ", "뒤로 ", "왼쪽으로 ", "오른쪽으로 "]
_HOW = ["", "조금 ", "살짝 ", "약간 ", "1 meter ", "한 걸음 ", "좀 "]
INTENT = {
"pick": _make(_OBJ, ["집", "잡", "들어올려", "픽업"]) + _make(_SIDE, ["집", "잡"], share=0.05), # a side said:
# the bank finds the kind, the pick reader leaves it to the rules / LLM (the quick pick takes no side)
"fetch": _make([t + o for t in _TO for o in ["<obj> ", "그 <obj> ", "<obj> 하나 ", "<obj> 좀 "]] +
["왼쪽에 있는 <obj> ", "오른쪽에 있는 <obj> ", "테이블에 있는 <obj> "],
["가져와", "갖고와", "챙겨와", "가져다", "갖다"]),
"put": _make(["<obj> ", "그거 ", "이거 ", "들고 있는 거 ", "왼쪽 테이블에 ", "오른쪽 테이블에 ", "테이블 위에 ", "여기 ",
"저기 ", "바닥에 ", "왼쪽에 ", "오른쪽에 ", "앞에 ", "옆 테이블에 ", "그거 왼쪽에 ", "그거 오른쪽 테이블에 "],
["놔", "내려놔", "둬", "올려놔"]),
"go_to": _make(["<place>로 ", "<place>까지 ", "<place> 쪽으로 ", "<place>에 ", "<place> 앞으로 ", "<place> 방향으로 "],
["가", "이동"]),
"come": _make(["이리 ", "여기로 ", "이쪽으로 ", "나한테 ", "저한테 ", "제 쪽으로 ", "가까이 ", "제 앞으로 ", "내 옆으로 ",
"제 옆으로 ", "일로 ", "좀 더 가까이 "], ["와", "다가와"]),
"follow": _make(["", "저 ", "저를 ", "나 ", "날 ", "제 뒤를 ", "저희를 ", "우리 ", "뒤에서 ", "잘 "],
["따라와", "쫓아와"]),
"come_back": _make(["원래 자리로 ", "제자리로 ", "아까 그 자리로 ", "처음 자리로 ", "원위치로 ", "아까 있던 곳으로 ",
"원래 있던 데로 ", "출발한 곳으로 "], ["돌아와", "돌아가", "복귀"]),
"move": _make([d + h for d in _DIRS for h in _HOW], ["가", "이동", "움직"]),
"turn": _make([d + h for d in ["왼쪽으로 ", "오른쪽으로 "] for h in ["", "90 degrees ", "살짝 ", "몸 ", "조금 "]] +
["뒤로 ", "몸 뒤로 "], ["돌아", "회전"]),
"look": _make(["위 ", "위쪽 ", "아래 ", "아래쪽 ", "왼쪽 ", "오른쪽 ", "저를 ", "절 ", "여기 ", "이쪽 ", "정면 ", "천장 ",
"바닥 ", "제 얼굴 "], ["봐", "쳐다봐", "바라봐"]) +
_make(["고개 ", "고개를 ", "고개 좀 ", "고개 살짝 ", "머리 "], ["들어", "숙여"]) +
_make(["고개 왼쪽으로 ", "고개 오른쪽으로 ", "고개를 왼쪽으로 ", "고개를 오른쪽으로 "], ["돌려"]),
"lift": _make([b + h for b in ["몸 ", "몸을 ", "키 ", "키를 ", "몸통 ", "상체 "] for h in ["", "좀 ", "조금 ", "살짝 ", "더 "]],
["올려", "내려", "높여", "낮춰"]),
"wave": _make(["손 ", "손을 ", "손 좀 ", "손 한번 ", "저한테 손 ", "우리한테 손 ", "애들한테 손 ", "손님들한테 손 ",
"반갑게 손 "], ["흔들어"]) +
_make(["", "저랑 ", "나랑 ", "우리 "], ["악수"]) + _make(["손으로 ", "손 흔들어 "], ["인사"]),
"arm_reach": _make(["손 ", "손을 ", "팔 ", "팔을 ", "손 좀 ", "팔 좀 ", "팔 앞으로 ", "손 앞으로 ", "팔 쭉 ", "저한테 손 "],
["내밀어", "뻗어"]),
"arm_fold": _make(["팔 ", "팔을 ", "팔 좀 ", "팔 다시 ", "팔 이제 "], ["접어", "넣어", "거둬", "내려"]),
"arm_open": _make(["손 ", "손을 ", "손가락 ", "그리퍼 ", "그리퍼를 ", "집게 ", "집게를 ", "손 좀 ", "그리퍼 좀 "],
["펴", "벌려", "열어"]),
"arm_close": _make(["손 ", "손을 ", "손가락 ", "그리퍼 ", "그리퍼를 ", "집게 ", "집게를 ", "그리퍼 좀 "],
["닫아", "오므려"]) + _make(["주먹 ", "주먹 꽉 ", "손 꽉 "], ["쥐"]),
}
# "손 줘" (give me your hand) has no verb of its own here: its levels written out
INTENT["arm_reach"] += [f"{w}{e}" for w in ["손 ", "손 좀 ", "손 이리 ", "저한테 손 "]
for e in ["줘", "줘 봐", "주세요", "줘요", "주십시오", "주실래요?", "줄래?", "주이소", "도", "줘유", "주게",
"주시겠어요?", "주시겠습니까?", "주라", "줘라잉", "주소", "주랑께"]]
if __name__ == "__main__":
for k, v in INTENT.items():
print(f"{k:10} {len(v)}")
print("total", sum(map(len, INTENT.values())))
+182 -3
View File
@@ -247,9 +247,8 @@ QUICK = {
# a greeting with a question after it: the question decides
"안녕 루미 상 받은 거 있어", "안녕하세요 화장실 어디예요", "안녕 루미 날씨 어때",
"안녕 오늘 뭐 해",
# not known: the battery's lifetime in years, being another company's robot
"battery 수명 몇 년이에요", "배터리 수명이 몇 년이에요", "배터리 몇 년 써요", "배터리 교체 주기가 어떻게 돼요",
"how many years does the battery last", "when does the battery need replacing", "너 자카 로봇이야", "자카 거야",
# not known: being another company's robot (the battery's lifetime in years: quick_answers' guard)
"너 자카 로봇이야", "자카 거야",
"jaka에서 만들었어", "are you a jaka robot", "are you made by jaka", "너 중국 회사 로봇 맞지", "hello where is the toilet", "hi what's the weather",
"hello can you help me", "안녕하세요 질문 있어요", "hi i have a question",
],
@@ -477,3 +476,183 @@ QUICK["name_meaning"] = QUICK.get("name_meaning", []) + [
for e in ["이에요", "이야", "이니", "입니까", "이고", "이여", "인가요", "이죠"]] + [
"why is your name lumi", "why are you named lumi", "what does the name lumi mean", "why the name lumi",
"왜 루미라고 불러", "왜 이름이 루미야", "왜 루미예요", "왜 루미라고 지었어요"]
# night 5: guesses the answer puts right ("You're Siri, aren't you?", "너 2미터지?"); a Korean "맞지 / 아니야" check is
# quick_answers.OTHER's (the LLM), the "-지?" guess is this kind's
_GUESS = {
"name": ["you're siri aren't you", "your name is alexa right", "are you siri", "are you alexa", "is your name siri",
"you must be siri", "you're bixby right", "your name is bob isn't it", "they call you robbie right",
"your name's wall-e isn't it", "you're r2d2 right", "is it siri", "are you called alexa",
"너 시리지", "너 시리야", "너 빅스비지", "니 이름 알렉사지", "이름이 시리예요", "너 이름이 철수지", "너 이름 로봇이지",
"너 시리니", "혹시 시리세요", "시리십니까", "니 시리제", "니 이름 빅스비 아이가", "이름이 알렉사예요", "너 빅스비야",
"you siri yes", "you are alexa yes", "니 이름 siri지"],
"maker": ["samsung made you right", "you're made by samsung aren't you", "lg made you didn't it", "did samsung make you",
"are you a samsung robot", "are you made by lg", "were you made in china", "did google build you",
"you're a tesla robot right", "is this an lg robot", "you are from samsung yes", "hyundai made you right",
"너 LG 로봇이지", "너 삼성 거지", "삼성이 만들었지", "LG가 만들었지", "너 삼성 로봇이야", "삼성에서 만들었어요",
"LG 제품이에요", "현대가 만들었나요", "구글이 만들었어", "중국에서 만들었지", "삼성 로봇입니까", "니 삼성 끼가",
"삼성 꺼 아이가", "LG에서 만드셨어요", "너 테슬라 로봇이지", "samsung이 만들었어", "LG 꺼야"],
"age": ["you're brand new like a week old", "you must be at least ten years old", "you're about five right",
"are you one year old", "you're new aren't you", "are you older than ten", "you're very young right",
"are you a baby robot", "you look new are you", "are you ten years old",
"너 열 살쯤 됐지", "너 나보다 나이 많아", "너 나보다 어려", "너 한 살이지", "너 신상이지", "너 새로 나왔지", "너 열 살 넘었지",
"다섯 살쯤 됐어요", "너 아기 로봇이지", "갓 나온 로봇이에요", "올해 나온 거예요", "작년에 만들었어요", "니 열 살 넘었제",
"한 살이세요", "몇 년 안 됐지", "만든 지 얼마 안 됐지", "나온 지 오래됐어"],
"height": ["you're two meters tall right", "are you taller than two meters", "you must be about 180 cm", "are you over 2 m",
"you're shorter than me right", "are you as tall as a person", "you're like 1 meter right", "are you 150 cm",
"너 2미터지", "너 2미터 넘지", "너 180 넘지", "키 2미터예요", "키가 1미터쯤 돼요", "사람만 해", "키 150이야",
"니 2미터 넘제", "키가 2미터 되십니까", "너 키 크지", "키 180쯤 돼", "키가 사람만 해요", "너 1미터 넘어"],
"weight": ["you weigh like 20 kilos right", "over 200 kilos i bet", "are you heavier than 100 kg", "you're light aren't you",
"are you very heavy", "do you weigh a ton", "you must weigh 50 kg", "are you lighter than a person",
"200킬로 넘지", "너 100킬로 넘지", "너 가볍지", "너 엄청 무겁지", "너 20킬로야", "무게 50킬로예요", "너 1톤이야",
"사람보다 무거워요", "100킬로 넘습니까", "니 무겁제", "무게 100kg 넘어", "너 몸무게 많이 나가지"],
"speed": ["you're slower than a snail", "are you fast", "you can't go very fast can you", "are you faster than a person",
"you're pretty slow right", "can you go 10 km per hour", "do you go fast", "are you quick",
"너 빨리 달릴 수 있어", "시속 10킬로 나오지", "너 느리지", "너 빨라", "너 달팽이보다 느리지", "사람보다 빨라요",
"너 빨리 갈 수 있어요", "빨리 움직일 수 있으세요", "니 빠르나", "속도 빠르십니까", "너 엄청 느리네", "빨리 달릴 수 있나요"],
"battery_life": ["your battery dies after an hour right", "do you last a whole day", "can you run all day", "does your battery last long",
"you need charging every hour right", "can you go a week without charging", "does the battery last all day",
"일주일 동안 충전 안 해도 되지", "하루 종일 가나", "하루 종일 버텨요", "배터리 금방 닳지", "한 시간이면 배터리 다 닳지",
"배터리 오래 가요", "배터리 하루 가요", "하루 종일 움직일 수 있어요", "배터리 오래가나", "배터리 오래 가십니까",
"배터리 빨리 닳아", "배터리 하루는 가제", "온종일 일할 수 있어"],
"languages": ["you speak ten languages right", "do you speak many languages", "you only speak english right", "are you bilingual",
"can you speak every language", "do you speak japanese too", "are you multilingual",
"너 영어만 하지", "너 외국어 잘하지", "너 다섯 개 언어 하지", "일본어도 하지", "외국어 몇 개 해", "너 중국어도 해",
"영어 잘하세요", "외국말도 하십니까", "니 영어 할 줄 아나", "어떤 말을 알아듣습니까", "어떤 말 알아들어", "무슨 말 알아들어요",
"어떤 언어 알아들으세요", "말 몇 개 국어 알아들어"],
"robot": ["you're just a toy right", "you're remote controlled aren't you", "is someone controlling you", "are you a toy",
"is this a remote control toy", "someone's driving you right",
"너 리모컨으로 조종하는 장난감이지", "너 장난감이지", "누가 조종하지", "리모컨으로 움직이는 거지", "사람이 조종해요",
"누가 원격으로 조종하나요", "니 장난감 아이가", "원격 조종입니까"],
"date_today": ["today is christmas right", "today is monday right", "is it monday today", "is today the 23rd", "is it october already",
"is it the weekend", "is it saturday", "it's friday today isn't it",
"오늘 월요일이지", "오늘 23일이지", "벌써 10월이야", "오늘 주말이야", "오늘 크리스마스예요", "오늘 금요일입니까",
"오늘 토요일이제", "오늘 월요일이죠", "벌써 시월이에요"],
"time_now": ["it's midnight isn't it", "is it noon", "is it late", "is it morning now", "is it already evening", "it's about 3 right",
"지금 자정이지", "지금 점심때야", "지금 오전이에요", "벌써 저녁이야", "지금 세 시쯤 됐지", "지금 밤이에요", "지금 새벽이야"],
}
for _k, _w in _GUESS.items():
QUICK[_k] = QUICK.get(_k, []) + _w
# the month (the date answer names it), and "배터리 수명" = how long it lasts on a charge (years: quick_answers' guard)
QUICK["date_today"] = QUICK.get("date_today", []) + [
"what month is it now", "which month are we in", "remind me what month it is", "month please", "what's the month",
"do you know what month it is", "current month", "what month 이야", "month 뭐야 지금", "몇 월 date야"] + [
s + e for s in ["이번 달 ", "이번 달이 몇 월", "지금 몇 월", "오늘이 몇 월", "몇 월", "요번 달이 몇 월", "이번 달이 무슨 달"]
for e in ["알려 줘", "알려 주세요", "이야", "이에요", "이지", "입니까", "이고", "이여", "이니", "인가요", "이죠"]] + [
"오늘 무신 요일이고", "오늘 무슨 요일이고", "오늘 무신 요일이여", "오늘 머 요일이야", "오늘 뭔 요일", "요일 좀 알려 줘",
"what day of the week might it be", "what day of the week would it be", "which weekday is today", "day of the week please",
"date please", "today's date", "the date please", "date?", "today date what", "today is what date", "what date today"]
QUICK["time_now"] = QUICK.get("time_now", []) + [
s + e for s in ["시간이 어떻게 ", "지금 시간이 어떻게 ", "현재 시간이 어떻게 ", "몇 시나 "]
for e in ["됐어", "됐어요", "됐니", "됐습니까", "됐나요", "되나", "됐노", "됐어유", "됐지", "되셨어요"]] + [
"몇 시나 됐을까", "지금 몇 시쯤이야", "현재 몇 시입니까", "시간 좀 여쭤봐도 될까요", "지금 몇 시인가", "시방 몇 시여", "지금 멧 시고",
"what's the time now please", "got the time", "time now please", "what hour is it", "time?", "what time it is now"]
QUICK["days_to_christmas"] = QUICK.get("days_to_christmas", []) + [
s + e for s in ["크리스마스까지 며칠 남았", "크리스마스 며칠 남았", "성탄절까지 며칠 남았", "크리스마스까지 몇 일 남았", "크리스마스 얼마나 남았",
"성탄절 며칠 뒤", "크리스마스 며칠 뒤", "크리스마스까지 얼마나 남았"]
for e in ["어", "어요", "니", "습니까", "나요", "노", "어유", "지", "야", "예요", "이야"]] + [
"how many days till christmas", "how many days to christmas", "christmas in how many days", "how far is christmas",
"how soon is christmas", "how long is it until christmas", "days until christmas", "christmas countdown", "christmas 얼마나 남았어요",
"christmas 며칠 남았어", "크리스마스 d-day 며칠이야", "크리스마스 디데이 며칠이에요"]
QUICK["battery_life"] = QUICK.get("battery_life", []) + [
s + e for s in ["배터리 수명이 ", "배터리 수명 ", "배터리 수명은 "]
for e in ["어떻게 돼", "어떻게 돼요", "어떻게 되세요", "어떻게 됩니까", "어떻게 되노", "얼마야", "얼마예요", "얼마나 돼", "얼마나 돼요",
"얼마나 되세요", "얼마나 됩니까", "얼마나 되나요", "얼마나 되는가", "얼마고", "얼마여", "얼만가", "몇 시간이야", "몇 시간이에요",
"얼마인지 알려 주세요", "얼마인지 알려 줘", "얼마나 가", "얼마나 가요"]] + [
"how long do you keep going on a full charge", "how long can you keep going", "how long do you last", "how long do you run on one charge",
"how long can you work without charging", "how many hours do you work", "what's your runtime", "what's your operating time",
"battery life?", "battery life please", "how long does a full battery last", "how long before your battery runs out",
"배터리 얼마나 가는가", "배터리 몇 시간 가는가", "충전하면 얼마나 가는가", "배터리 얼마나 가노", "배터리 얼마나 가유",
"배터리 얼마나 버텨", "배터리 몇 시간 버티세요", "배터리 다 닳으면 얼마나 가", "한 번 충전에 몇 시간 일하십니까", "배터리 runtime 얼마예요",
"battery 몇 시간 가요", "배터리 지속 시간 얼마고", "완충하면 몇 시간 써"]
QUICK["name_meaning"] += [
s + e for s in ["이름이 무슨 뜻", "이름 무슨 뜻", "이름 뜻이 뭐", "네 이름 무슨 뜻", "니 이름 뜻이 뭐", "이름은 무슨 뜻", "이름에 무슨 뜻"]
for e in ["이야", "이에요", "이니", "입니까", "인가요", "이고", "이여", "이죠", "이냐", "임"]] + [
"이름은 어디서 왔어", "이름은 어디서 왔어요", "이름 누가 지었어", "이름 누가 지어 줬어요", "이름 왜 그렇게 지었어", "이름 유래가 뭐예요",
"이름의 의미가 뭐예요", "이름에 담긴 뜻이 뭐예요", "이름 어디서 따 왔어", "이름은 어떻게 지어졌습니까", "이름 무신 뜻이고", "이름 뭔 뜻이여",
"where does your name come from", "what does your name mean", "what's the meaning of your name", "how did you get your name",
"who named you", "why are you called that", "what's the story behind your name", "name meaning?", "your name means what",
"이름 meaning이 뭐야", "lumi 무슨 뜻이야"]
# the clock in 하게체 / short forms ("이보게 루미, 지금 몇 시인가?" was read as the age)
QUICK["time_now"] += [s + e for s in ["몇 시", "지금 몇 시", "현재 몇 시", "시방 몇 시"]
for e in ["인가", "인가요", "임", "이야", "예요", "냐", "니", "인고", "이여", "일까", "인지 알려 줘"]] + [
"몇씨야", "몇 씨야", "지금 몇씨야", "멧 시야", "몇 시게", "몇 시나 됐나", "시간 몇 시인가"]
QUICK["date_today"] += [s + e for s in ["오늘 며칠", "오늘 무슨 요일", "오늘 요일이 뭐", "오늘 날짜가 뭐", "오늘이 며칠", "오늘 몇 월 며칠", "무슨 요일"]
for e in ["인가", "인가요", "임", "이냐", "인고", "이여", "일까", "인지 알려 줘", "이니"]]
# what Lumi holds or does now (status), commands and fragments heard in the train sets' first words: never a fact kind
QUICK["no"] += [
s + e for s in ["손에 뭐 ", "손에 뭘 ", "그리퍼에 뭐 ", "집게에 뭐 ", "지금 손에 뭐 ", "손에 들고 있는 거 뭐"]
for e in ["있어", "있어요", "있니", "있나요", "있습니까", "있노", "이써", "들었어", "들고 있어", "쥐고 있어", "잡고 있어", "야", "예요"]] + [
"what's in your hand", "whats in you hand", "what do you have in your hand", "what you have in hand", "what is in the gripper",
"do you have anything in your hand", "are you holding something", "what did you pick up", "what did you grab", "what have you got there",
"핸드폰 어느 손에 있어", "phone 어느 손에 있어", "내 폰 어느 손에 있어", "what are you doing", "wat u doin", "what u doing", "지금 뭐 해",
"뭐 하는 중이야", "지금 뭐 하고 있어요", "what's your battery", "how's your battery", "배터리 어때", "배터리 괜찮아",
"how do you know", "how do you know that", "어떻게 알아", "어떻게 알았어", "어떻게 아세요", "언제", "언제요", "언제야", "when", "when is it",
"위험해", "위험하다", "조심해", "조심해요", "위험해요 비켜", "watch out", "careful",
"360도 돌아", "한 바퀴 돌아", "turn around 360", "spin around", "raise yourself", "lift yourself up", "lift up", "올라가", "리프트 올려",
"please wave hello", "wave hello", "say hello", "손 흔들어", "손 좀 흔들어 주세요", "손 내밀어", "손 줘", "악수하자", "stop the robot",
"stop", "멈춰", "그만", "speak slower", "please speak more slowly", "please you speak more slow", "천천히 말해", "speak louder",
"let's walk together", "같이 걸어요", "같이 가요", "같이 걷자", "선물 받았어요", "선물이에요", "take the elevator", "엘리베이터 타고 가",
"can you take the elevator", "엘리베이터 탈 수 있어", "2층으로 올라갈 수 있어", "can you go to the second floor"]
# night 5, round 2: Konglish nouns (에이지, 웨이트, 스피드, 하이트, 메이커, 필링 ...), 하게체 / dialect endings and
# non-native English frames ("now time what?", "you how heavy?"), from the r9 / r8 train misses
_ASK_N = ["야", "예요", "에요", "니", "입니까", "인가요", "인가", "고", "여", "임", "유", "이야", "이에요", "인데", "일까요"]
_HOW_MUCH = ["얼마야", "얼마예요", "얼마니", "얼마입니까", "얼만가", "얼마고", "얼마여", "얼마임", "얼마유", "몇이야", "몇이에요", "몇이니",
"몇입니까", "몇인가", "몇이고", "몇이여", "몇임", "how much", "얼마나 돼", "얼마나 돼요", "얼마나 되세요", "얼마나 되는가"]
_WHAT = ["뭐야", "뭐예요", "뭐에요", "뭐니", "뭡니까", "무엇입니까", "뭔가요", "뭔가", "무엇인가", "뭐고", "뭐꼬", "뭐여", "뭐임", "머야",
"뭔데", "뭐유", "뭔지 알려 줘", "무엇인지 알려 주십시오", "무엇인지 알려 주시겠습니까", "어떻게 되세요", "어떻게 돼"]
QUICK["age"] += _ko(["에이지가 ", "에이지 ", "너 에이지 ", "니 에이지 ", "너 age ", "age가 "], _HOW_MUCH) + _ko(
["너 에이지 몇 살", "에이지 몇 살", "너 몇 살", "나이가 몇 살", "몇 살"], ["이에요", "이야", "인가", "인가요", "이유", "이고", "입니까", "이여", "임"]) + [
"your age is", "you age is", "your age what", "how many year you", "how many years you are", "you how old", "age please",
"나이 무엇입니까", "나이가 어떻게 되는가", "몇 살이신가", "몇 살 잡수셨어요", "연세가 어떻게 되시는가"]
QUICK["weight"] += _ko(["웨이트가 ", "웨이트 ", "너 웨이트 ", "너 weight ", "weight가 ", "너 무게 ", "무게가 ", "몸무게 ", "몸무게가 "], _HOW_MUCH) + _ko(
["몇 킬로", "너 몇 킬로", "몇 kg", "너 몇 키로"], ["유", "야", "예요", "인가", "입니까", "고", "여", "임", "이야", "이에요"]) + [
"how heavy 해요", "how heavy 해", "how heavy 이에요", "you how heavy", "how heavy you", "your weight how much", "weight please",
"you weight how much", "how many kilo you", "how many kilogram you are"]
QUICK["speed"] += _ko(["스피드가 ", "스피드 ", "맥스 스피드 ", "너 speed ", "speed가 ", "너 스피드 ", "최고 속도 ", "최고 속도가 ", "속도 ", "속도가 "],
_HOW_MUCH) + [
"your speed how much", "you speed how much", "how fast you go", "you how fast", "how fat can you drive", "how fat do you move",
"how fsat do you move", "max speed please", "speed?", "your speed what", "how fast 해요", "how fast 가요", "how fast 이에요"]
QUICK["height"] += _ko(["하이트가 ", "하이트 ", "너 하이트 ", "너 height ", "height가 ", "키 ", "키가 ", "너 키 ", "니 키 "], _HOW_MUCH) + _ko(
["너 몇 센티", "몇 센티", "키가 몇 센티", "몇 cm"], ["유", "야", "예요", "인가", "입니까", "고", "여", "임", "이야", "이에요"]) + [
"how tall 이에요", "how tall 이야", "how tall 해요", "키 how much", "키 how tall", "you how tall", "your height how much",
"your height what", "what is height of you", "height please", "how much tall you"]
QUICK["name"] += _ko(["네임이 ", "네임 ", "너 네임 ", "니 네임 ", "이룸이 ", "이룸 ", "이름이 ", "이름 ", "너 이름 ", "네 이름 ", "니 이름 "], _WHAT) + [
"you name is", "your name is", "name of you", "what is name of you", "your name what", "you name what", "what you name",
"이름이 what이에요", "name이 뭐야", "너 name 뭐야"]
QUICK["maker"] += _ko(["메이커가 ", "메이커 ", "너 메이커 ", "너 메이드 바이 ", "메이드 바이 ", "너 만든 회사 ", "너 만든 외사 ", "너 만든 company ",
"만든 회사 ", "만든 데가 ", "제조 회사 ", "제조사 "], ["어디야", "어디예요", "어디니", "어디입니까", "어딘가", "어디고", "어디여",
"어디임", "어디유", "어디당가", "어디요", "어디인가요", "어디 있어"]) + _ko(
["누가 너를 만들었", "누가 널 만들었", "어느 회사가 너를 만들었", "어느 회사가 널 만들었", "누가 너 만들었"],
["어", "어요", "니", "습니까", "나요", "나", "냐", "는교", "남유", "노", "어유", "는가", "지"]) + [
"who make you", "you made by which company", "made by which company", "which company make you", "who is your maker",
"made by who", "you made by who", "who makes you", "maker?", "your maker what"]
QUICK["robot"] += _ko(["리얼 휴먼", "너 리얼 휴먼", "진짜 사람", "너 진짜 사람"], ["이야", "이에요", "이니", "입니까", "인가", "이유", "이고", "임"]) + _ko(
["필링 있", "너 필링 있", "감정 있", "너도 감정 있", "필링이 있"], ["어", "어요", "니", "나요", "으세요", "습니까", "는가", "는교", "나"]) + _ko(
["살아 있", "너 살아 있", "혹시 살아 있"], ["는가", "는교", "나", "어", "어요", "니", "습니까", "남유"]) + [
"are you a rela person", "are you a real person", "you are alive", "you have feeling", "you have feelings", "you are human",
"are you real human", "you real person", "you alive"]
QUICK["model"] += _ko(["너 AI ", "너 AI가 ", "쓰는 AI 모델 ", "들어 있는 인공지능 ", "들어있는 인공지능 ", "탑재된 인공지능 ", "들어 있는 AI ",
"너 인공지능 ", "니 AI ", "쓰는 인공지능 "], _WHAT) + [
"your ai what", "you use which ai", "which ai you use", "your ai is what", "ai model what"]
QUICK["chatgpt"] += ["yuor ai is chatgpt", "your ai is chatgpt", "you are chatgpt", "you use chatgpt", "chatgpt inside you",
"you chatgpt", "inside is chatgpt"]
QUICK["languages"] += _ko(["할 수 있는 언어 ", "말할 수 있는 언어 ", "하는 언어 ", "할 줄 아는 언어 ", "알아듣는 언어 ", "너 언어 "], _WHAT) + [
"you speak which language", "which language you speak", "you speak what language", "language you speak what",
"korean 알아들어", "english 알아들어", "korean 할 줄 알아", "한국말 알아들어", "영어 알아들어요"]
QUICK["battery_life"] += _ko(["한 번 충전하면 사용 시간 ", "배터리 사용 시간 ", "충전하면 사용 시간 ", "사용 시간 "], _HOW_MUCH + ["얼마인지 알려 주시겠어요"]) + [
"battery how long", "batetry how long", "your battery how long", "battery how many hours", "how long battery", "how long 베터리 가요",
"how long 배터리 가요", "battery life 얼마야", "battery 얼마나 가요", "how many hurs can you run on one charge"]
QUICK["time_now"] += ["do you have the time", "what time now", "now time what", "time now what", "now what time", "what is time now",
"tell me time now", "time what now", "지금 타임 몇 시야"]
QUICK["date_today"] += ["today what day", "today what date", "what day today", "today day what", "date today what", "what is date today"]
# round 3: Konglish date / day, dialect -유 for the clock, words run together
QUICK["date_today"] += _ko(["투데이 데이트 ", "투데이 date ", "today 데이트 ", "오늘 데이트 ", "투데이 무슨 데이", "투데이 무슨 요일", "오늘 무슨 데이"],
["며칠이야", "며칠이에요", "뭐야", "뭐예요", "몇 일이야", "언제야", "야", "예요", "입니까", "고", "임"]) + [
"today date what", "tody date what", "tday date what", "date of today what", "today is which date", "today day what"]
QUICK["time_now"] += _ko(["몇 시", "지금 몇 시", "시방 몇 시"], ["유", "여유", "래유", "인감", "이당가"]) + [
"몇시입니까", "지금몇시야", "몇시임", "지금몇시예요", "몇시야", "지금몇시입니까", "몇시예요"]
QUICK["height"] += ["몇센티임", "너몇센티임", "키얼마유", "키가얼마유", "키 얼마나 된당가", "너 키 얼마나 된당가", "키howmuch"]
QUICK["weight"] += ["howheavy해요", "너무게얼마인지알려주시겠어요", "무게얼마인지알려주세요"]
+151 -31
View File
@@ -257,9 +257,10 @@ COMPANY_TALK = re.compile(r"\b(cutshion|company|companies|firm|ceo|founder|start
# the company example bank goes with company talk only: "tell me more" about the lidar got "which part of Cutshion?"
def _examples(text, k=None, on_task=False):
def _examples(text, k=None, on_task=False, world=False):
"""A few replies Lumi gave to similar words (assistant/talk_examples.py; on a task also
assistant/interrupt_examples.py), as a guide to tone and variety."""
assistant/interrupt_examples.py), as a guide to tone and variety. world: a question about a subject of its own
(Brain.world_talk): only world-knowledge examples ("윤초는 뭐예요?" was shown "이름이 뭐예요?" and the like)."""
from assistant import action_examples, interrupt_examples, talk_examples
try:
from assistant import company_examples # questions about Cutshion Company and its robots
@@ -270,6 +271,8 @@ def _examples(text, k=None, on_task=False):
if on_task:
bank += [("task", "ko" if HANGUL.search(u) else "en", u, r)
for _, _, u, d, r in interrupt_examples.EXAMPLES if d in ("answer", "refuse_redirect")]
if world:
bank = [e for e in bank if e[0] in WORLD_EXAMPLES]
picked = talk_examples.pick(text, "ko" if language(text) == "Korean" else "en", k=k or EXAMPLES_K, bank=bank)
if not picked:
return ""
@@ -279,6 +282,9 @@ def _examples(text, k=None, on_task=False):
f"now in your own words):\n{lines}\n\n")
WORLD_EXAMPLES = {"settled_fact", "off_topic"} # example kinds shown for a world question (talk / action_examples)
def _notes(hits):
"""The note chunks for the prompt. A chunk that goes on a section repeats the section's lead ("How fast I move: My
base drives ... … I can climb"): left out when a chunk of that section is shown already (fewer tokens)."""
@@ -678,11 +684,11 @@ 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"
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}).*(집어서|들고).*가서"
r"|가져와|가져다|갖다|가지고 ?와|갖고 ?(?:와|오)|챙겨 ?오|가져 ?오실|가저 ?(?:와|다)|에서.*\b(?:bring|fetch|brign|fech)\s*해|가져 ?오(?:세요|십시오|시오|너라|거라|게|라|실래요|시겠어요)|가지고 ?오(?:세요|십시오|시오|너라|거라|게|라|실래요|시겠어요)|챙겨 ?와|에서.*(옮겨|가져)" rf"|({_OBJ}).*(집고|들고|가지고).*(와|줘)"),
r"|가져와|가져다|갖다|가지고 ?와|갖고 ?(?:와|오)|챙겨 ?오|가져 ?오실|가저 ?(?:와|다)|에서.*\b(?:bring|fetch|brign|fech)\s*해|가져 ?오(?:세요|십시오|시오|너라|거라|게|라|실래요|시겠어요)|가지고 ?오(?:세요|십시오|시오|너라|거라|게|라|실래요|시겠어요)|챙겨 ?와|에서.*(옮겨|가져)" rf"|({_OBJ}).*(집고|들고|가지고).*(와|줘)|({_OBJ})\S*\s.*\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|이리 ?(?:좀 ?)?(?:돌아 ?)?(?:와|오세요|오십시오|올래)|"
r"(?:여기로|이쪽으로) ?(?:좀 ?)?(?:돌아 ?)?(?:와|오세요|오십시오)|가까이 ?(?:좀 ?)?(?:와|오세요)|"
r"나한테 ?(?:돌아 ?)?와"),
("go_home", r"\bgo (back )?(home|to (the |your )?(dock(?!2)|charger|charging))|\bhead (back )?to (the |your )(dock(?!2)|charger)\b|\bgo (re)?charge|충전하러|집(?:에|으로) ?가|충전기로"),
("go_home", r"\bgo (back )?(home|to (the |your )?(dock(?!2)|charger|charging))|\bhead (back )?to (the |your )(dock(?!2)|charger)\b|\bgo (re)?charge|충전하러|차지하러|집(?:에|으로) ?가|충전기로"),
("go_point", r"\b(?:go|drive|move|head|come|return|walk|roll|run|proceed|navigate|travel|hurry|make your way|get|take yourself)"
r"(?: back)?(?: over| on| ahead)?(?: to| too| 2|to) (?:the )?(?:point |marker )?([a-z][a-z0-9_]*|[가-힣][가-힣0-9_]*?)\b|(\d+)\s*번\s*(?:으로|포인트)"
r"|^\W*(?:(?:루미야?|lumi|hey lumi)\W*)?(?:[a-z][a-z0-9_]*\s*말고\s+)?(?:좀\s*)?(?:point\s+)?([a-z][a-z0-9_]*|[가-힣][가-힣0-9_]*?)\s*(?:포인트\s*)?(?:앞|쪽|방향|지점|위치)?\s*"
@@ -730,7 +736,10 @@ INTENTS = [ # (action, pattern) checked in order on what the visitor said
r"(\d+(?:\.\d+)?)\s*m\s*(?:만\s*)?(뒤로|앞으로)\s*(?:좀\s*)?(?:가|와|이동|움직|후진)|(?:(\d+(?:\.\d+)?)\s*m\s*(?:만\s*)?)?(후진)|"
r"(앞으로|뒤로|왼쪽으로|오른쪽으로)\s*(?:조금만?|좀|살짝)?\s*(\d+(?:\.\d+)?)?\s*(?:미터|m)?\s*(?:만\s*)?(?:가|와|이동|움직)"),
("put", r"\bput (it|that|this|the \w+) (back|down)\b|\bput (it|that|this|the \w+) (on|onto) the table\b"
r"|제자리에 ?(놓|둬|놔)|다시 ?(놓|둬|놔)|내려 ?(놓|둬|놔)|" + PUT_BACK),
r"|제자리에 ?(놓|둬|놔)|다시 ?(놓|둬|놔)|내려 ?(놓|둬|놔)|" + PUT_BACK +
rf"|\b(?:put|set|place|leave|drop) (?:it|that|this|the (?:\w+ )?(?:{_OBJ})s?) (?:off |down )?(?:at|on|in|by) (?!(?:the )?(?:floor|ground)\b)"
rf"|(?:{_OBJ}|그거|그것|그걸|이거|이걸|저거)(?:을|를)?\s*(?:좀\s*)?(?:[가-힣a-z0-9 ]+(?:에|에다가?)\s*)?(?:갖다\s*|올려\s*|내려\s*)?(?:놔|놓아|둬)(?!\s*(?:가|와|버려|봐))"),
# ^ "컵 놔", "그거 놔 줘" (put down: never an open hand that drops it), "컵 p2에 놔", "put the cup at p3" (a fetch there)
("move_object", rf"\b(?:move|shift|slide) (?:the |that |this |a )?(?:({_COL}) )?({_OBJ})s?\b"
rf"|(?:({_COL})\s*)?({_OBJ})\s*(?:을|를)?\s*옮겨"),
("pick", rf"\b(?:pick up|pick|take|grab|get|lift|hold|scoop up|scoop|snag|nab|seize|(?:take|get|grab) hold of) (?:up )?(?:me )?(?:the |that |this |a |an |my |your )?(?:({_COL}) )?({_OBJ})s?\b"
@@ -848,7 +857,7 @@ GREET_ONLY = re.compile( # a hello and a name, nothing asked: never a wave by
r"(?:(?:lumi|loomi|robot|there|everyone|buddy|루미야?|루미 ?씨|로봇아?|로봇 ?씨)\W*)*$", re.I)
CALLING = re.compile(r"^\W*(?:(?:hey|hi|okay|ok|so|um+|uh+|alright|please|well|now|저기요?|혹시|음+|자|야|어+|그럼|이제)\W+)*"
r"(?:(?:lumi|루미 ?씨|루미야?|루미|로봇아|로봇 ?씨|robot)\W+)?(?:(?:저기요?|혹시|음+|자|그럼|이제|now)\W+)*", re.I) # words that call Lumi or fill, before the request itself
_NOT_A_NAME = (r"Lumi|Okay|Ok|Yes|No|Wait|Well|Hey|Hi|So|Oh|Please|Sorry|Thanks|Now|Look|Wow|Alright|Great|Sure|Right|Hello|"
_NOT_A_NAME = (r"Lumi|Okay|Ok|Yes|No|Yo|Kindly|Robot|Buddy|Wait|Well|Hey|Hi|So|Oh|Please|Sorry|Thanks|Now|Look|Wow|Alright|Great|Sure|Right|Hello|"
r"Come|Go|Then|And|But|Also|Here|There|Yeah|Nope|Cool|Nice|Maybe|Seoul|Korea|Um+|Uh+|Uhm|Er+m?|Hmm+|Ah+|"
r"Excuse|Actually|First|Just|Stop|Turn|Move|Take|Pick|Bring|Put|Give|Follow|Wave|Lift|Raise|Lower|Open|"
r"Close|Hold|Grab|Look|Let|Fine|Good|Thank|Booth|Hall|Gate|Point|Stage|Exit|Home|Dock|Room|Table|Info|"
@@ -956,7 +965,8 @@ ASKED = re.compile( # a question, not an order: "and when you carry a cup?", "
r"(?<!줄 )(?<!주실 )(?<!줘 )(?<!놓을 )(?<!받을 )수 ?있(?:어|나|니|을까|습니까)\S*\s*\?*\s*(?:궁금\S*)?\s*$|"
r"\b(?:can|could) (?:it|the robot|lumi)\b|(?:돌|가|움직이|들)(?:아|어)?도 ?(?:돼|되)(?:요|나요|니)?\s*\??\s*$|거 보여", re.I)
IDIOMS = re.compile(r"\bmove (?:forward|on|ahead) with\b|\bon hold\b|^\W*(?:okay,? |sure,? |yes,? )?go ahead\W*$|"
r"\bback me up\b|\bput (?:yourself|myself) in\b|\bturn (?:it|this|that) (?:around|over) for\b|"
r"\bback me up\b|\bput (?:yourself|myself) in\b|"
r"^\W*chin up\W*(?:(?:buddy|bro|pal|mate|friend|lumi|little guy|kiddo|okay|ok)\W*)*$|\bturn (?:it|this|that) (?:around|over) for\b|"
r"(?:택시|차|자리|기회|균형|중심|택배|범인|날짜|약속|시간|방)\s*(?:을|를)?\s*(?:좀\s*)?잡", re.I)
# "move forward with the plan", "put that thought on hold", "택시 잡아": no motion meant
CANT_GO = re.compile(r"\b(?:stairs|upstairs|downstairs|staircase|steps up|escalators?)\b|계단|에스컬레이터", re.I)
@@ -988,12 +998,19 @@ 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?")."""
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"
return bool(to_someone_else(t) or CANT_GO.search(t) or DRINK.search(t) or IDIOMS.search(t) or CONDITION.search(t) or REMARK.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
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
ABOUT_IT.search(t) or LATER_SAID.search(t))
WAIT_UNTIL = re.compile(r"\b(?:until|till) (?:someone|somebody|anyone|a person|the person|they|people|a guest|the guests?) "
r"(?:gives?|hands?|brings?|passes?)\b|(?:누가|누군가|사람이|손님이)\s+(?:\S+\s+){0,2}"
r"(?:줄|건네줄|가져다 ?줄|갖다 ?줄) 때까지", re.I)
# ^ "wait until someone gives you the cup", "누가 컵 줄 때까지 기다려": the wait is the order, not a condition on it
_TAKE_BACK = (r"아니(?:야|에요|요|오)?|아냐|아닐세|됐네|됐소|아닙니다|아니다|됐어|됐어요|됐습니다|됐다|괜찮아|괜찮아요|괜찮습니다|"
r"장난(?:이야|이에요|입니다|이다|임)?|농담(?:이야|이에요|입니다|이다|임)?|취소(?:할게|할게요|하겠습니다|해)?|"
r"하지 ?마(?:세요|십시오)?|하지 않으셔도 (?:돼요|됩니다)|안 ?(?:해도|하셔도) (?:돼|돼요|됩니다)|그만|"
@@ -1028,7 +1045,7 @@ _KO_ORDER = re.compile(
r"습니까)?|줄 수 있(?:어|어요|니|나요)?|해|해요|하세요|하십시오|하시오|해라|하게|하시게|하거라|하렴|봐|봐요|보세요|"
r"보십시오|보시오|보거라|보게|가|가요|가세요|가십시오|가시오|가라|가거라|가게|가자|와|와요|오세요|오십시오|오시오|와라|오너라|"
r"오게|돌아|돌아요|돌려|흔들어|올려|내려|놔|놓아|둬|집어|들어|멈춰|서|비켜|따라와|따라오세요|켜|꺼|줘봐|해봐|가봐|와봐|"
r"(?:볼|할|갈|올|줄|해 줄|가 줄)래요?\s*\?|주시겠소|하시겠소|겠소|하시오|주시오|[가-힣]시오|[가-힣](?:아|어|여|라|게|렴|자|세요|십시오|시오|요))(?:\s*(?:요|좀|빨리|얼른|please|now|제발))*"
r"(?:볼|할|갈|올|줄|해 줄|가 줄)래요?\s*\?|주시겠소|하시겠소|겠소|하시오|주시오|[가-힣]시오|[가-힣](?:아|어|여|라|게|렴|자|세요|십시오|시오|요)|[가-힣]?(?:려|춰|워|쳐|켜|겨|져))(?:\s*(?:요|좀|빨리|얼른|please|now|제발))*"
r"\s*[.!~?]*$")
_KO_NOT = re.compile(r"(?:다|네|지|걸|데|니까|는데|던데|군|구나|더라|더니|대|래|잖아|거야|거예요|건데|까|까요|니|냐|나요|"
r"는지|ㄹ게|을게|할게|갈게|볼게)\s*[.!~?]*$|(?:^|\s)우리\s.*자\s*[.!~?]*$")
@@ -1044,7 +1061,7 @@ _KO_TAIL = re.compile(r"(?:\s+(?:루미야?|로봇아?|lumi|robot|please|plz|pls
_KO_NOUN_ORDER = re.compile(r"(?:회전|이동|정지|출발|후진|전진|쭉|move|turn|go|grab|pick|wave|come|stop|rotate|please|plz)\W*$", re.I)
_KO_ASK_ORDER = re.compile(r"(?:줄래|주실래|줄 수|주실 수|주시겠|줘|주세요|볼래|할래|해 줄|가 줄|갈래|올래|주시죠|주실까요|줄까|실래|"
_KO_ASK_ORDER = re.compile(r"(?:줄래|주실래|줄 수|주실 수|주시겠|줘|주세요|볼래|할래|해 줄|가 줄|갈래|올래|주시죠|주실까요|줄까|실래|을래|둘래|릴래|"
r"(?:놓을|놔 줄|내려놓을|해 줄|가 줄) 수 있)[가-힣 ]*\?$") # "가 줄래?", "주시겠어요?"; not "봤어?"
_KO_DIALECT = re.compile(r"(?:이소|보이소|주이소|가이소|하이소|온나|오이라|주시기 바랍니다|바랍니다|드려|드려요|드리세요|"
r"낮춰|맞춰|멈춰|내려|올려|벌려|돌려|비켜|켜|꺼|봐|와|놔|둬|줘|바꿔|세워|키워|펴|접어)(?:\s*(?:요|좀|please|now))*\s*[.!~]*$")
@@ -1072,13 +1089,14 @@ def _clause_order(c, alone=True):
if not c:
return False
if HANGUL.search(c) and (not re.match(r"[a-z]", c, re.I) or _KO_ORDER.search(c) or _KO_DIALECT.search(c) or
re.search(r"(?<=[가-힣\s])(?:다|요|어|아|여|지|네|해|줘|봐|라|게|자|까|니)\W*$", c)):
re.search(r"(?<=[가-힣\s])(?:다|요|어|아|여|지|네|해|줘|봐|라|게|자|까|니|래)\W*$", c)):
return _ko_clause(c) or alone and len(c.split()) <= 5 and "?" not in c and not ko_told(c) and \
not re.search(r"[가-힣](?:어|아|여|다|요|지|네|려|워)\W*$", c)
if c.endswith("?"):
return bool(re.match(rf"(?:please\s+)?(?:(?:{_VERBS})\b(?!s\b)(?!.*\b(?:or|is|are)\b)|you can {_YOU_CAN}\b(?!.*\b(?:or|by yourself|alone)\b)|(?:can|could|would|will|wo?n'?t) "
r"(?:you|u)\b|would you mind\b|mind \w+ing\b|can i (?:have|get) (?:it|that|this|the)\b|can i take (?:it|that|this)\W*$|"
r"why don'?t you\b|how about (?:you\b|\w+ing\b)|is it possible (?:for you )?to\b|could i trouble you\b)", c, re.I) or
r"why don'?t you\b|how about (?:you\b|\w+ing\b)|(?:is|would|will) it be possible (?:for you )?to\b|is it possible (?:for you )?to\b|"
r"could i trouble you\b)", c, re.I) or
re.search(r"\b(?:okay|ok|alright|please)\s*\?$", c, re.I) and not _SUBJECT.match(c))
if _EN_ORDER.match(c) or re.match(r"(?:can|could|would|will) u\b|off you go\b|i need you\b|i said\b|"
r"can i (?:have|get) (?:it|that|this|the)\b|i'?ll take (?:it|that|this)\b|"
@@ -1103,7 +1121,8 @@ def direct_order(text):
short fragment command ("booth A", "faster", "left a bit", "회전"). Only then may a keyword rule act; anything else
(a statement, a story, a plan between people, a question about ability or habit) is read by the LLM with the talk
before it. Each sentence / clause is checked; one order in it is enough (not_an_order weeds out the rest)."""
t = re.sub(_LEAD, "", unfill(wording.ko_plain(text or "")).strip(), flags=re.I) # every speech level as 반말
t = re.sub(_LEAD, "", unfill(wording.ko_plain(_MAY_NOT.sub(" 줘", text or ""))).strip(), flags=re.I) # every
# speech level as 반말
t = re.sub(r"[\s~]*(?:[ㅋㅎ]{2,}|ㅠ+|ㅜ+)[\s~]*$|~+(?=\s*[?!.]*\s*$)", "", t) # "가 줄래~?", "고개 내려 ㅎㅎ"
t = re.sub(r"^(?:(?:hey |hi |ok |okay |yo |어이 )?(?:mister robot|lumi|loomi|rumi|robot|buddy|bro|dude|yeah|yes|yep|right|"
r"(?:[루누류]미|루비|로봇)\s*(?:야|아|씨|님|군|선생님?|양반)?)[\s,!]+)+", "", t, flags=re.I)
@@ -1252,8 +1271,28 @@ def held_back(text):
return bool(HELD_BACK.search(text or ""))
def _put_there(t, markers):
"""A thing named and put / delivered at a marker ("exit에 컵 갖다 놔", "컵을 p2 테이블에 놔", "put the cup at p3")."""
m = _mentions(t, markers)
return bool(m.get("object") and isinstance(m.get("dest"), dict) and m.get("finish") == "place")
def intent(text, markers=()):
"""(action, target) for clear requests, or None. Backs up the LLM's ACTION line."""
"""(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 반말."""
rule = _intent(text, markers)
if rule is None and HANGUL.search(text or ""):
plain = re.sub(r"줘\s*\?+\s*$", "줘", wording.ko_plain(_MAY_NOT.sub(" 줘", text))) # "놔 줘?": a request asked
if plain != text:
rule = _intent(plain, markers)
return rule
_MAY_NOT = re.compile(r"(?<=[가-힣]) ?주(?:시)?면 안 (?:될까요|되나요|되겠습니까|되겠어요|돼요|돼|될까|되니)\s*\?*")
# ^ "놔 주시면 안 될까요?": a polite request (wording.ko_plain keeps it as it is)
def _intent(text, markers=()):
held = not_an_order(text, asked=False) or held_back(text) # "민수야 이리 와 봐": to a friend; "she said follow me"
text = instead_of(text)
text = re.sub(r"(에|로|으로|까지)\s*가서\s*(?:거기서?\s*)?(?:좀\s*)?(?:서|기다려|대기해)\s*(?:있(?:어|게|으십시오|으세요|어요)?)?"
@@ -1261,7 +1300,7 @@ def intent(text, markers=()):
text = re.sub(r"\bgo (?:and )?(?:stand|wait) (?:at|by|near) ", "go to ", text, flags=re.I) # "go and stand at p10": the trip
t = _norm(text, markers) # "point five" -> "point 5"
asks = re.search(r"^\s*(how(?! about (?:you|we) (?!\w+ing\b)\w)|why(?! don'?t you\b)|what if)\b|\b(how do you|how can you|can you carry|are you able)\b|"
r"\b(can|could) you (pick( up)?|lift|hold|grab|take) (a|an|any)\b|" # "can you pick up a bottle?"
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?"
rf"({_OBJ})(은|는)\s.*수 ?있|(루미가|로봇이)\s.*수 ?있|는 ?거 ?(돼|되나|가능)|" # "물컵은 가져다줄 수 있어요?"
r"어떻게|왜|혼자|스스로|\bby yourself\b|\bsomeone\b|줄 ?알아|[을를] 줄 ?아(?:세요|십니까|시나요|나요?|니|노|요)?\s*\?|할 ?줄|\bcome here often\b|"
@@ -1277,6 +1316,9 @@ def intent(text, markers=()):
continue
if held and action not in ("quiet", "stop", "weather", "search", "sing"):
return None # a motion named, none ordered now
if action == "go_point" and re.search(rf"\bwith (?:the|a|an|this|that|my) (?:\w+ )?(?:{_OBJ})s?\b|"
rf"(?:{_OBJ})\s*(?:이랑|랑|하고|과|와) (?:같이|함께)", t):
return ("fetch", text) # "go to exit with the cup": the cup taken there
if action not in ("quiet", "stop", "weather", "search", "sing", "fetch") and _other_order(t, m, markers) and not (
action in ("pick", "move_object") and any(_resolve(p, markers) not in (None, "here")
for p in re.finditer(_place_re(markers), t))):
@@ -1323,6 +1365,8 @@ def intent(text, markers=()):
return None # "don't stop talking"
if action == "quiet" and re.search(r"손|흔들", t) and not re.search(r"조용|말하지|말 ?그만|시끄러|\bquiet\b|\btalking\b", t):
return None # "아직 손 인사 하지 마": about the wave, not the voice
if action in ("put", "fetch") and not re.search(r"제자리|원래|\bback\b", t) and _put_there(t, markers):
return ("fetch", text) # "exit에 컵 갖다 놔", "put the cup at p3": taken there, put down
if action == "fetch" and re.search(r"(?:갖다|가져다) ?(?:놓|놔|둬|두)|들고 ?있어|들고 ?계세요", t):
continue # "원래 자리에 갖다 놔": put back; "내 컵 들고 있어 줘": hold it
if action == "come" and re.search(r"\bcome (?:down|up)\b|\b(?:lower|higher|taller|shorter)\b", t):
@@ -1483,11 +1527,15 @@ def intent(text, markers=()):
else "reach")
if action == "grip_close" and re.search(rf"(?<![a-z])(?:{_OBJ})s?(?![a-z])", t):
continue # "the cup. grab it.": from the table or my hand? not a fist
if action == "grip_open" and any(_resolve(p, markers) not in (None, "here") for p in re.finditer(_place_re(markers), t)):
continue # "drop it at p3": a carry there, never an open hand here
if action in ("grip_open", "grip_close"):
return ("arm", action[5:])
if action == "put":
return ("put", "back" if re.search(r"\bback\b|\breturn\b|\bwhere (?:it was|you)\b|\bits (?:spot|place)\b|제자리|다시|원래|원위치|있던|도로", t)
else "down")
if action == "pick" and re.search(r"\b(?:grab|get|fetch|pick up|take) me\b", t):
return ("fetch", text) # "go grab me a cup": brought to me, not only picked
if action in ("pick", "move_object") and far:
return ("fetch", text) # "get me an orange at gate one": a trip there, not a pick here
if action in ("pick", "move_object"):
@@ -1712,6 +1760,21 @@ def unfill(t):
return re.sub(r"\b(the|a|to) \1\b", r"\1", t)
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"기달려", "기다려"), (r"기달리", "기다리"), (r"(?<![가-힣])들구(?=\s|$)", "들고"),
(r"가저(?=와|다|가|오)", "가져"), (r"(?<![가-힣])날라(?=\s*(?:줘|주|다|$))", "옮겨"), (r"((?:갖다|가져다)\s?)도(?=\W*$)", r"\1줘"), (r"놓(?:그라|거라)", "놔"),
]
def ko_slips(t):
""""컵 테이크해서" -> "컵 집어서", "드랍해 줘" -> "놔 줘", "기달려" -> "기다려", "갖다 도" -> "갖다 줘"."""
if HANGUL.search(t):
for said, same in KO_SLIPS:
t = re.sub(said, same, t)
return t
def _norm(text, markers=()):
"""Lower case, marker names and numbers as written (wording.py: "피쓰리" -> "p3", "point one" -> "p1", with the
map's markers "table front" -> "table_front")."""
@@ -1721,6 +1784,7 @@ def _norm(text, markers=()):
# metre; "레지스트레이션", "에이 부스": the map's names
for word, digit in NUMBER_WORDS.items(): # "one of them" -> "1 of them"
t = re.sub(rf"\b{word}\b", digit, t)
t = ko_slips(t)
t = re.sub(r"(?<![가-힣])송(?=에\s*(?:좀\s*)?(?:올려|놔|놓|줘)|\s*(?:을\s*)?(?:(?:좀|앞으로|이리|한번|쫙|꽉)\s*)*(?:내밀|내미|뻗|줘|주|치워|흔들|흔드|펴|쥐|닫|열어|거둬|내려|인사|넣어|도\b))",
"손", t) # whisper's 송 for 손: "송 앞으로 내밀어", "저한테 송 주십시오"
return t
@@ -1752,6 +1816,9 @@ _AT_OBJ_EN = rf"\b(?:{_OBJ})s?,? (?:that'?s |that is |which is |sitting |lying |
_AT_OBJ_KO = (rf"\s*(?:(?:테이블|탁자|책상|table)\s*)?(?:(?:위|쪽)\s*)?(?:에|의)\s*(?:(?:있는|있던|놓인|놓여\s*있는|둔|올려\s*둔|올려진|올라간|올라가\s*있는)\s*)?"
rf"{_OBJ_ADJ}(?:{_OBJ})|\s*(?:(?:에|의)\s*)?(?:있는|있던|놓인|놓여\s*있는|둔)\s*(?:거|것|걸)")
# ^ where the thing is ("the cup on p2", "p2에 있는 빨간 컵", "피원 컵", "p1의 컵"): the source, not where it goes
_PUT_AT_EN = rf"\b(?:put|place|set|leave|drop|deliver|drop off)\s+(?:the |that |this |a |an |my |your )?(?:(?:{_COL}) )?(?:{_OBJ})s?(?: down| off)? (?:(?:on|onto) (?:the )?(?:\w+ )?(?:{_TABLE}) )?(?:on|at|in|by|near|to) (?:the )?$"
_PUT_KO = r"(?:갖다|가져다)\s*(?:놔|놓|둬|두|줘|주|드려|드리)|(?<![가-힣])(?:내려\s*)?(?:놔|놓아|둬)|올려\s*(?:놔|놓)"
# ^ a put / deliver: "<place>에 <thing> 갖다 놔" names where it goes (not "p2에 있는 컵 가져와": where it is)
def _mentions(text, markers):
@@ -1767,7 +1834,12 @@ def _mentions(text, markers):
after_obj = objs[-1].end() if objs else 0
for m in re.finditer(_place_re(markers), t):
before, after, place = t[:m.start()], t[m.end():], _resolve(m, markers)
if re.search(r"\bfrom (the )?$", before) or re.match(r"\s*에서", after) \
if place == "here" and isinstance(out.get("dest"), dict):
continue # "put the cup at exit for me": "me" is not where it goes
if re.search(_PUT_AT_EN, before) or re.search(_PUT_KO, t) and re.match(r"\s*(?:테이블|탁자|책상)?\s*(?:위)?\s*(?:에다가?|에)\s+"
r"(?!있|놓|둔|올려|올라)", after):
out["dest"] = _as_place(place) # "put the cup at p3", "exit에 컵 갖다 놔": where it goes, not where it is
elif re.search(r"\bfrom (the )?$", before) or re.match(r"\s*에서", after) \
or (re.search(r"\b(go|drive|head|come) (over )?(to )?(the )?$", before) # "go (to) p1 and get the cup"
and re.match(r"\s*(,|and|then)\s*(get|fetch|take|pick|grab|bring)", after)) \
or (re.match(r"\s+(?:까지\s*)?가서", after) and objs and m.start() < objs[-1].start()) \
@@ -1777,7 +1849,7 @@ def _mentions(text, markers):
out["source"] = _as_place(place)
elif re.search(r"\b(to|into) (the )?$|\b(bring|fetch|give|get)( it| that| this)? $", before) \
or re.search(r"\b(go|drive|head|walk|carry it|take it|bring it)( over)? (the )?$", before) \
or re.match(r"\s*(?:(?:포인트|point|지점|테이블|탁자|책상)\s*(?:위\s*)?)?(으로|로|에다|에|한테)(?!서)", after) or place == "here" \
or re.match(r"\s*(?:(?:포인트|point|지점|테이블|탁자|책상)\s*(?:위\s*)?)?(으로|로|에다|에|한테|까지(?!\s*가서))(?!서)", after) or place == "here" \
or re.match(r"\s+(?:까지\s*)?(?:가(?:서|요|\s*줘|\s*주세요)?|이동)(?![가-힣])", after):
# ^ "and go exit point", "exit 가서", "exit 까지 가 줘": a drive there, said without "to" / 로
out["dest"] = _as_place(place)
@@ -1791,7 +1863,8 @@ def _mentions(text, markers):
if m.start() > after_obj and "dest" not in out and not re.match(rf"{_TABLE}|{_place_re(markers)}", t[m.start(1):]) \
and m.group(1) not in ("put", "place", "hold", "give", "keep", "bring", "leave"):
out["dest"] = None
if "dest" not in out and re.search(r"\b(bring|get|fetch|give) (it |that |this )?(to )?me\b|\bto me\b|가져와|가지고 ?와|갖고 ?와|갖다 ?줘|가져다 ?(?:줘|주세요|줄래)", t):
tk = t + " | " + wording.ko_plain(t) if HANGUL.search(t) else t # "가져오십시오", "놓으세요" read as 반말 too
if "dest" not in out and re.search(r"\b(bring|get|fetch|give|grab) (it |that |this )?(to )?me\b|\bto me\b|가져와|가지고 ?와|갖고 ?와|갖다 ?줘|가져다 ?(?:줘|주세요|줄래)", tk):
out["dest"] = "here"
if "dest" not in out and (re.search(r"\b(?:bring|fetch)(?:ing)?\b", t) and isinstance(out.get("source"), dict)
and not re.search(r"\b(?:to|for) (?!me\b|us\b)\w", t)
@@ -1800,8 +1873,9 @@ def _mentions(text, markers):
re.findall(r"([가-힣]+?)\s*(?:한테|에게|께)(?!서)", t))):
out["dest"] = "here" # "fetch the cup from p2", "p2에서 컵 갖다 주시겠어요?": to the one who asks, not to
# "Minsu" ("민수한테 갖다 줘", "bring it to Minsu": a person is asked about)
if re.search(rf"\b(put|place|leave|set) (it|that|this|the \w+)\b.*\b(on|onto) (the )?({_TABLE})\b|\bplace\b"
rf"|놔|놓아|놓고|둬", t):
if re.search(rf"\b(put|place|leave|set) (it|that|this|the \w+)\b.*\b(on|onto) (the )?({_TABLE})\b|\bplace\b|{_PUT_AT_EN[:-1]}"
rf"|\b(?:put|set|leave) (?:it|that|this|the (?:\w+ )?\w+) down\b|\bleave (?:it|that|this) (?:there|on|at)\b"
rf"|놔|놓아|놓고|놓(?=을|으)|둬", tk):
out["finish"] = "place"
elif re.search(r"\b(just )?(hold|keep) (it|that|this|on to it|onto it)\b|\bhold\b|들고 ?(있어|기다려)", t):
out["finish"] = "hold"
@@ -1864,9 +1938,22 @@ def place_problem(text, markers):
return f"Did you mean {place_said(close[0])}?", f"{place_said(close[0])} 말씀이세요?"
if re.fullmatch(r"p\d+", word) and not close:
return no_place_say(word, markers)
for m in _GO_KO.finditer(_norm(text, markers)): # "출구로 가": a Korean word that is no marker (never
word = m.group(1) # translated into one: asked)
if len(word) > 1 and word not in _NOT_PLACE_KO and not re.search(r"(?:쪽|편|방향|자리|위치|곳|데|미터|센티|미리|바퀴|하러|한테|에게|께)$", word) and \
not re.fullmatch(_place_re(markers), word):
return no_place_say(word, markers, m.group(0).strip())
return None
_GO_KO = re.compile(r"(?<![가-힣a-z0-9_])([가-힣]+?)\s*(?:으로|(?<!으)로|까지)\s*(?:좀\s*)?(?:어서\s*)?(?:가(?![가-힣])|가서|가 ?줘|가요|가세요|"
r"가 ?주|가자|이동|돌아가|가져가|가지고 ?가|갖고 ?가|들고 ?가|와(?![가-힣])|와 ?줘|오세요)")
_NOT_PLACE_KO = {"앞", "뒤", "왼쪽", "오른쪽", "옆", "위", "아래", "이쪽", "저쪽", "그쪽", "여기", "저기", "거기", "이리", "저리", "집",
"홈", "제자리", "원래", "충전기", "충전소", "도크", "밖", "안", "가운데", "중앙", "정면", "처음", "나", "저", "너",
"사람", "그분", "저분", "손님", "천천히", "빨리", "조금", "똑바로", "직진", "후진", "반대로", "거꾸로", "다시",
"그대로", "이대로", "나한테", "저한테", "내게", "제게", "엄마", "아빠", "친구", "아까", "방금", "출발점", "시작점"}
def fetch_problems(task):
"""'object' / 'place' (source) / 'dest': what is still missing or unknown in a task."""
return [p for p, f in (("object", "object"), ("place", "source"), ("dest", "dest")) if task.get(f) is None]
@@ -1945,7 +2032,7 @@ def spoken(sentence, lang):
HELD_GIVE = re.compile(r"\b(give|hand)\b|\bbring it\b|줘|주세요|건네", re.I)
HELD_PLACE = re.compile(r"\b(put|place|set)\b|놔|놓|둬", re.I)
HELD_PLACE = re.compile(r"\b(put|place|set)\b|\b(?:drop|leave) (?:it|that|this|the \w+)(?: off| down)? (?:at|on|by)\b|놔|놓|둬", re.I)
def fetch_from_text(text, markers=()):
@@ -2065,7 +2152,7 @@ def held_command(text):
it on wins ("bring it to p5 and put it on the table" is a place)."""
if HELD_PLACE.search(text) and place_on(text):
return "place"
if HELD_GIVE.search(text):
if HELD_GIVE.search(re.sub(r"(?:놔|놓아|둬|올려|내려|(?<![갖다])가|가져가|들고 가|옮겨|와|이동해)\s*(?:좀\s*|쫌\s*)?(?:줘|주|드려|드리)", "놔", text)): # "그거 놔 줘": 줘 helps the put
return "give"
if HELD_PLACE.search(text):
return "place"
@@ -2328,6 +2415,22 @@ def held_place(text, markers=()):
return bool(PLACE_HELD_EN.search(t) or PLACE_HELD_KO.search(t))
CARRY_HELD = re.compile(r"\b(?:take|bring|carry|move|get) (?:it|that|this|them|the \w+)(?: over| along)? (?:to|towards?) |"
r"\b(?:drop|leave|put|set) (?:it|that|this|them|the \w+)(?: off| down)? (?:at|by|near|on) |"
r"(?:으로|로|에|까지)\s*(?:좀\s*)?(?:가져가|가지고 ?가|갖고 ?가|들고 ?가|옮겨|가져다 ?놔|가 ?줘|가)", re.I)
def held_carry(text, markers=()):
"""With something in the hand: the words ask to take it to a marker ("take it to p5", "p5로 가져가 주세요",
"그거 p5로 옮겨 줘"); a direct order that names a place on this map."""
text = _MAY_NOT.sub(" 줘", text or "")
if not text or not_an_order(text) or held_back(text) or not direct_order(text):
return False
t = _norm(wording.ko_plain(text) if HANGUL.search(text) else text, markers)
return bool(CARRY_HELD.search(t) and any(_resolve(m, markers) not in (None, "here")
for m in re.finditer(_place_re(markers), t)))
def give_clause(text):
"""The words without a clause about the person it is for ("give it to him, he's going to Gate A3" -> "give it
to him"): where that person goes is never where Lumi drives."""
@@ -2448,7 +2551,9 @@ def hand_request(text, holding, b=None, markers=(), whole=True):
return None # "놔", "drop it" with the hand empty: open it (intent)
if (PLACE_EN.search(t) or PLACE_KO.search(t)) and "팔" not in t and not re.fullmatch(r"\W*leave (?:it|that|this)\W*", t) and \
not re.search(r"손\s*(?:을\s*)?(?:(?:좀|쫌|쪼까|쪼끔|조금|살짝|얼른|이제|다시|빨리|어서)\s*)*(?:내려|거둬)", t) and \
not BODY_PART.search(t) and not re.search(r"\barms?\b", t): # "손쫌내려줘유", "you put down arm please"
not BODY_PART.search(t) and not re.search(r"\barms?\b", t) and \
not re.search(r"(?:아래로|밑으로|위로)\s*(?:좀\s*|쫌\s*)?(?:내려|올려)(?!\s*(?:놔|놓|둬))", t): # "손쫌내려줘유", "you
# put down arm please"; "20cm 아래로 내려 줘": the lift
# not "팔 거둬" / "팔 내려" (the arm), not a bare "leave it" (never mind)
if named and not holding:
return None # "put the cup on the table": the put intent / a mission
@@ -2665,7 +2770,9 @@ FORCED_LANG = {} # {"lang": "en"|"ko"} set by lumi.py from the
def now_line():
"""The date and time for the prompt, also written the Korean way: with the English form alone the model
said "10월 21일" on 20 October."""
return f"{web.now_text()} ({time.strftime('%Y년 %-m월 %-d일 %H시 %M분')})"
t = time.localtime() # Korean the way it is said: "오후 10시 45분" (was "22시 45분" in replies)
return (f"{web.now_text()} ({t.tm_year}년 {t.tm_mon}월 {t.tm_mday}일 {'월화수목금토일'[t.tm_wday]}요일 "
f"{'오전' if t.tm_hour < 12 else '오후'} {t.tm_hour % 12 or 12}시 {t.tm_min}분)")
def reply_language(text):
@@ -2873,6 +2980,12 @@ _PRONOUN_KO = r"그거|이거|저거|그것|이것|저것|거기|여기|저기|
OWN_SUBJECT = re.compile(rf"(?<=\S )(?!I\b|Lumi\b|OK\b|Okay\b)[A-Z][a-z]+|(?<![가-힣A-Za-z])(?!(?:{_PRONOUN_KO})(?:은|는|이|가)(?![가-힣]))"
r"[가-힣A-Za-z]{2,}(?:은|는|이|가)(?=[\s?!.~,]|요|$)")
# a short question that names its own subject ("BTS는 언제 데뷔했어요?", "Who was Sejong?")
NOT_SUBJECT_KO = re.compile(r"(?:으로|적으로|에서|에|까지|부터|보다|한테|에게)는$")
# "공식적으로는", "옛날에는", "서울에서는": a time / place / manner, not the subject
WHAT_IS = re.compile(r"(?:뭐|무엇|뭔|머)(?:예요|에요|야|이야|입니까|인가요|이에요|가요|죠|지|냐|고|여|임|래요|래)?\W*$|"
r"^\W*what(?:'s| is| are| does)\b", re.I) # "X는 뭐예요?", "What is X?": a definition
THAT_ONE_KO = re.compile(rf"(?<![가-힣A-Za-z])(?!(?:{_PRONOUN_KO})\s)([가-힣A-Za-z]{{2,}})\s+(?:그거|그게|그건|이거|이게|이건|저거|저게|저건)")
# "경복궁 그거 언제 지었노?": the palace is the subject (said without 은 / 는)
EN_SUBJECT = re.compile(r"\b(?i:do|does|did|can|could|are|is|were|was|will|would)\s+(?:the\s+|an?\s+)?"
r"(?!(?:you|i|we|they|he|she|it|people|there|this|that|these|those|your|my|our|me|not|so|very)\b)"
r"([a-z]{3,})\b") # "Why do whales sing?": the whales (world_talk; lower case, so not OWN_SUBJECT)
@@ -2979,12 +3092,15 @@ class Brain:
elif follow and about_answer(text) and len(hits) > 1: # "really?" / "why?": the answer is in the talk, its
notes = _notes(hits[:1]) # reason in the best chunk (~200 tokens less, ~0.25 s)
elif world: # "부엉이는 고개를 몇 도까지 돌려요?": notes on Lumi's own head
notes = "(none needed: not about you)" # turned the owl into Lumi ("제 고개는 180도까지")
notes = "(none needed: general knowledge, not about you)" # turned the owl into Lumi ("제 고개는 180도까지")
if len(world) > 1: # "심장은 몇 개고?" after the octopus: the octopus's hearts
world = [f"{world[0]} (its {', '.join(world[1:])}, when that is a part or a kind of it)"]
world = (f"(This is about {', '.join(world)}, not about you: never answer it with your own head, eyes, arms or "
f"body.)\n") if world else "" # "부엉이 목 그거 을매나 돌아가노?" got "제 머리는 180도까지" with no notes
messages.append({"role": "user", "content": f"Reference notes:\n{notes}\n\n{_examples(about, k=2 if follow else None, on_task=bool(now) and 'not doing any task' not in now)}"
f"body. What stays the same (what it is, how or why, who made it, its history) you answer yourself at "
f"once, ACTION none; search only what changes: news, prices, scores, who holds an office now.)\n"
) if world else "" # "부엉이 목 그거 을매나 돌아가노?" got "제 머리는 180도까지" with no notes;
# without the second sentence "윤초는 뭐예요?" was searched
messages.append({"role": "user", "content": f"Reference notes:\n{notes}\n\n{_examples(about, k=2 if follow else None, on_task=bool(now) and 'not doing any task' not in now, world=bool(world))}"
f"{follow}"
f"Now it is {now_line()}.\n\n" + memory.turn_lines(self, text) +
f"Visitor: {text}\n\n" + self._fragment_hint(text) + world +
@@ -3140,10 +3256,13 @@ class Brain:
"""The words (or the question they follow) name a subject of their own that is not Lumi, its parts or the
companies ("부엉이는 ...?", "How high is Mount Fuji?"): Lumi's notes are left out. A subject that is one of
Lumi's own things ("속도는 얼마예요?", "이름이 뭐예요?") keeps them. Returns those subjects, the question before first ([] when none)."""
def named(t):
return [m.group(0) for m in OWN_SUBJECT.finditer(core(t))] + [m.group(1) for m in EN_SUBJECT.finditer(core(t))]
def named(t): # "공식적으로는 언제로 쳐요?" names no subject (an adverb + 는)
return [m.group(0) for m in OWN_SUBJECT.finditer(core(t)) if not NOT_SUBJECT_KO.search(m.group(0))] + \
[m.group(1) for m in EN_SUBJECT.finditer(core(t))] + [m.group(1) for m in THAT_ONE_KO.finditer(core(t))]
qs = [topic_turn(self.history)[0]] + [h[0] for h in reversed(self.history[-3:])] if self.history else [""]
q = next((x for x in qs if named(x)), qs[0]) # "문어 피는?" "왜?" "심장은?": the octopus, two turns back
if named(text) and WHAT_IS.search(core(text)):
q = "" # "윤초는 뭐예요?" after a birthday: a new subject, alone
both = re.sub(r"(?<=[A-Za-z])(?=[가-힣])", " ", f"{text} {q}") # "Gemma는": the word for LUMI_TOPIC
if LUMI_TOPIC.search(both) or COMPANY_TALK.search(both):
return []
@@ -3252,8 +3371,9 @@ class Brain:
if (LOOKUP_MORE.search(text) or FOLLOW_UP.search(text) or AND_ALSO.match(text) or REPAIR.search(text) or
SHORT_Q.search(text) and len(text.split()) <= 6) \
and not re.search(r"cutshion|쿳션", text, re.I) and not ABOUT_YOU.search(text) \
and not NOW_Q.search(text): # "Where?", "몇 살이야?", "who's the CEO?" after a lookup
return {"action": "search", "target": f"{last_q} {text}"}
and not NOW_Q.search(text) and not (WHAT_IS.search(core(text)) and OWN_SUBJECT.search(core(text))):
return {"action": "search", "target": f"{last_q} {text}"} # "Where?", "몇 살이야?", "who's the CEO?" after a
# lookup; "윤초는 뭐예요?" names its own subject: the model's
return header
def _redo(self, text):
+10 -2
View File
@@ -57,12 +57,15 @@ def _restated(words, before):
if not said or len(said) > 3 or not re.fullmatch(r"[가-힣]{2,}|[가와]", said[-1]):
return False
last = said[-1]
return any(last == w or len(w) > 1 and (w.startswith(last) or last.startswith(w))
return any(last == w or len(w) > 1 and len(last) > 1 and (w.startswith(last) or last.startswith(w)) # "가" is no "가지고"
for w in re.findall(r"\w+", wording.ko_plain(before)) if re.fullmatch(r"[가-힣]+", w))
def _rule(words, markers):
"""brain.intent of a part, also of a Korean -고 form ("나 보고" read as "나 봐")."""
words = re.sub(r"^\W*(?:first(?:ly)?|then|next|after that|and then|and|lastly|finally|먼저|그다음에?|그리고)\W+", "", words,
flags=re.I) or words # "first look me, then follow me"
words = re.sub(r"\blook me\b", "look at me", words, flags=re.I)
rule = brain.intent(words, markers)
ko = _KO_AND.sub(lambda m: _KO_ORDER[m.group(1)], words.strip())
if not rule and ko != words.strip():
@@ -95,6 +98,10 @@ def parts(text):
return [p for p in out if p and not re.fullmatch(rf"(?:{_FILL.pattern}|\W)+", p, re.I)]
CALL_ONLY = re.compile(r"\W*(?:(?:excuse me|hey|hi|hello|yo|okay|ok|lumi|robot|buddy|루미 ?씨|루미야?|로봇아?|야|어이|저기요?|"
r"이보게)\W*)+", re.I)
def plan(text, markers=(), cant=None):
"""See the module's doc. cant: a regex of orders Lumi can't do ("dance", "jump"): answered, the rest done."""
from assistant import intent_bank
@@ -113,7 +120,8 @@ def plan(text, markers=(), cant=None):
return None # "turn around and look": the head looks behind
out = []
for p in ps:
if SELF_PROMISE.search(p) or out and _restated(p, out[-1][1]) or brain.GREET_ONLY.match(p): # "hello robot, …"
if SELF_PROMISE.search(p) or out and _restated(p, out[-1][1]) or brain.GREET_ONLY.match(p) or CALL_ONLY.fullmatch(p):
# "hello robot, …", "야 루미, …", "excuse me robot, …": the call, no part
continue # "흰색 머그컵 잡아!, 아 잡아 줄 수 있어요?": the order once
got, unread = steps.rules(p, markers)
rule = _rule(p, markers)
+37 -14
View File
@@ -63,7 +63,8 @@ NOT_TO_LUMI = re.compile(
r"are asked|are requested)\b|\bare (?:kindly )?(?:asked|requested) to\b|안내 ?말씀|(?<![가-힣])여러분(?!한테|에게|께)|"
r"관람객|방문객|승객|" # announcements
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*[!.~]*$", re.I)
r"\blove how\b|[가-힣](?:네|네요|구나|군요|더라|던데)\s*[!.~]*$|[가-힣](?<!니)다\s*[!.~]*$|"
r"(?:좋|멋지|예쁘|이쁘|귀엽|크|작|길|세|대단하|신기하|웃기)(?:네|네요|구나|군요)(?=[\s,.!~])", re.I)
# 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|"
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)|"
@@ -89,6 +90,9 @@ SEVERAL = re.compile(r"\b(?<!hundred )and\b(?! a half\b)|\bwait\w*|\bcorrection\
# several requests or a stay ("go to p3 and wait", "가서 기다려", "p3에 가 있어"): steps.read's
HAND_WORDS = re.compile(r"\byou(?:'re| are) holding\b|\b(?:in|from) my hand\b|\bhere'?s\b|\bhanding\b|\bi'?ll give\b|"
r"\bhold this\b|\bfrom me\b|\bmy hand\b|\bhand ?에|\bhand it (?:over|to me)\b|\bhand over\b|내 손|제 손|손에 ?(?:줘|놔|주세요|쥐어)|\bi'?m holding\b|\bi am holding\b|들고 있는|손에 있는|받아|드릴게|줄게|가져가세요", re.I) # the hand reader's (brain.hand_request)
GROUP_CALL = re.compile(r"(?:^|[,:;.!?]\s*)(?:(?:hey|ok|okay|alright|so|come on)\s+)?(?:(?:you )?guys|folks|y'?all|"
r"you all|everyone|everybody|team|kids|people|ladies|gentlemen)\s*(?:[,:;!.]|$)|"
r"얘들아|애들아|친구들아|여러분[,\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
NOT_A_NAME = {"lumi", "loomi", "rumi", "okay", "ok", "please", "hey", "hi", "hello", "so", "well", "now", "alright",
"yes", "yeah", "no", "sorry", "um", "uh", "oh", "wait", "look", "then", "first", "also", "and", "but",
@@ -750,7 +754,7 @@ def guarded(text):
return "length"
for name, rx in (("negation", NEGATION), ("later", LATER), ("ability", ABILITY), ("question", QUESTION),
("self", SELF_TALK), ("several", SEVERAL), ("hand", HAND_WORDS), ("other sense", OTHER_SENSE),
("repeat", REPEAT), ("past", PAST_EN), ("tag", TAG), ("wonder", WONDER), ("not to lumi", NOT_TO_LUMI)):
("repeat", REPEAT), ("group", GROUP_CALL), ("past", PAST_EN), ("tag", TAG), ("wonder", WONDER), ("not to lumi", NOT_TO_LUMI)):
if rx.search(t):
return name
if brain.LATER.search(t):
@@ -859,6 +863,7 @@ CARRY = (r"\b(?:bring(?! yourself)|fetch|deliver|carry)\b|\bget me\b|\b(?:to|for
COME_SAID = (r"\bcome\b|\bcum\b|\bkum\b|\bget over\b|\bapproach|\bcloser\b|\bhither\b|\bnear me\b|"
r"\bget closer\b|\broll over\b|\bdrive over\b|\bmy side\b|\bnext to me\b|\bto me\b|와|오세요|오십시오|오시|올래|"
r"(?<![가-힣])컴(?= ?히어|(?![가-힣]))") # Konglish "컴 히어 해 줘", "이리 컴"
HOME_SAID = r"\b(?:home|dock|charger|charging)\b|집|충전|도크|홈" # brain.named_place also reads a bare "go back" as home
LIFT_SAID_MAX_M = 0.3 # m; a longer lift amount said is no lift request ("grow to three meters tall")
LIFT_BODY = (r"\b(?:yourself|your (?:body|torso|upper body)|body|make you|taller|shorter|smaller|small|tall|high|lift|rise|grow|"
r"shrink|come down|go up|go down|move up|move down|raise up|lower down|come up|sink down|elevate|squat|height|"
@@ -867,13 +872,13 @@ LIFT_BODY = (r"\b(?:yourself|your (?:body|torso|upper body)|body|make you|taller
MOVE_VERB = (r"\b(?:move|go|step|back up|backup|scoot|slide|shift|drive|roll|reverse|inch|come|forward|backward|ahead|"
r"moov|moove|bak)|가|이동|물러|비켜|후진|와|빠져|걸음|발짝|move|back|go") # a bare "왼쪽으로" may be a look
r"moov|moove|bak)|가|이동|움직|물러|비켜|후진|와|빠져|걸음|발짝|move|back|go") # a bare "왼쪽으로" may be a look
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|바닥|땅|아래|밑"}
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|(?:제|내) 얼굴|나한테|저한테|쳐다봐|(?:^|\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 "
@@ -1016,7 +1021,8 @@ def _slot(kind, text, markers, holding):
not re.search(rf"(?<![a-z0-9]){re.escape(named[0].lower())}(?![0-9])", said):
return None # "exit a" with only Exit_B, "booth 13" with Booth_12: asked
return ("go_to", named[0])
if kind == "come" and (re.search(CARRY + r"|따라", t) or not re.search(COME_SAID, t)):
if kind == "come" and (re.search(CARRY + r"|따라|\bover there\b|\bpoint(?:ing|ed)?\b|\bthat way\b|저기|저쪽|거기|가리키", t) or
not re.search(COME_SAID, t)):
return None # "나한테 가져와", "이리 줘": not a trip to the person
if kind == "come" and re.search(r"\bwith (?:me|us)\b|함께|같이", t):
return ("follow", "") # "just come with me": walk along
@@ -1024,9 +1030,10 @@ def _slot(kind, text, markers, holding):
n, exact = driving.amount(t) # drive (A2)
return ("move", f"forward {n:g}") if exact and driving.MOVE_MIN_M <= n <= brain.MOVE_MAX_M else None
if kind == "come_back" and (re.search(r"\bpose\b|\barm\b|\bhead\b|팔|고개|\bpick|\bput\b|\bit\b|그거|놓|놔", t) or
any(brain.named_place(text, m, markers) for m in markers)):
any(brain.named_place(text, m, markers) for m in markers
if m != "home" or re.search(HOME_SAID, t))):
return None # "go back to your dock", "go back to your look pose": not here
if kind == "come_back" and re.search(r"\bhere\b|\bto me\b|이리|여기|나한테|저한테", t):
if kind == "come_back" and re.search(r"\b(?:back|over|right|come|get) here\b|\bto me\b|이리|여기|나한테|저한테", t):
return ("come", "") # "come back here": to the person, not to the old spot
if kind == "follow" and (re.search(r"\bfollow (?:you|him|her|them|it|that)\b", t) or not re.search(FOLLOW_WORD, t)):
return None # "follow you": not "follow me"; "가자 이제": let's go, where?
@@ -1062,7 +1069,7 @@ def _slot(kind, text, markers, holding):
not re.search(r"\bface\b|\bother (?:side|way)\b|\d+\s*(?:degrees?|도)", t.replace("360", "")) and \
said_amount(text)[1] in (None, 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"\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")
d = [x for x in _dirs(t) if x in ("left", "right")]
if not d and said_amount(text)[1] == 180:
@@ -1130,8 +1137,9 @@ def _slot(kind, text, markers, holding):
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 \
not re.search(CARRY, t) and re.search(r"\bfrom\b|\bgo get\b|에서", t) or \
(holding() if callable(holding) else holding):
return None # "put the banana on the table", "hold this apple": the hand's
(holding() if callable(holding) else holding) or re.search(r"\breturn\b|돌려|반납|반환", t):
return None # "put the banana on the table", "hold this apple": the hand's;
# "return the cup", "컵 돌려줘": give back, not a pick
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):
return None # "컵 좀 줘": bring it to me, a mission (pick, then give)
@@ -1142,8 +1150,11 @@ def _slot(kind, text, markers, holding):
return None # "from the cafeteria" (not on the map), "go home, bring it": asked
return ("fetch", text)
if got.get("source") or got.get("dest") or any(brain.named_place(text, m, markers) for m in markers) or \
re.search(r"\b(?:to|at|ask|tell|say|pass\w*|want|need|is on|are on)\b|있는|옮겨|에게|한테|께", t):
return None # "take the cup to p4", "I want the mug, the one at the entrance"
re.search(r"\b(?:to|at|ask|tell|say|pass\w*|want|need|is on|are on)\b|(?<!테이블에 )(?<!위에 )(?<!저기 )"
r"(?<!거기 )(?<!^)있는|옮겨|에게|한테|께", t) or got.get("prefer"):
return None # a side or size said ("왼쪽 컵", "the smaller one"): the
# quick pick takes none, the rules / LLM read it;
# "take the cup to p4", "I want the mug, the one at the entrance"
return ("pick", f"{got['colour']} {got['object']}" if got.get("colour") else got["object"])
if kind == "put":
if not (holding() if callable(holding) else holding):
@@ -1174,7 +1185,7 @@ def read(text, markers=(), holding=False):
return ("fetch", said) if got and got[0] == "fetch" else got
PICK_VERB = re.compile(r"집|잡|들어|들고|가져|갖다|챙겨|\b(?:pick|grab|take|get|fetch|bring|hold)\b", re.I)
PICK_VERB = re.compile(r"집|잡|들어|들고|가져|갖다|갖고|챙겨|픽업|\b(?:pick|grab|take|get|fetch|bring|hold)\b", re.I)
LOOK_VERB = re.compile(r"봐|보세|쳐다|바라|\b(?:look|see|watch)\b", re.I)
PUT_VERB = re.compile(r"놓|놔|둬|두|내려|\b(?:put|place|drop|set|leave)\b", re.I)
BACK_VERB = re.compile(r"돌아|복귀|컴백|리턴|가|와|\b(?:return|go|come|head|back)\b", re.I)
@@ -1198,6 +1209,13 @@ def _verb_conflict(kind, text, holding):
return True # "라이트로 살짝 가 줘": a drive
if kind == "arm_reach" and (HAND_SHAPE.search(text) or COME_VERB.search(text) and not ARM_WORD.search(text)):
return True # "손 펴 주시겠어요" (open), "할머니한테 와 줘" (come)
if kind == "look" and re.search(r"\bcome\b(?! on\b)|오세요|오십시오|(?<![가-힣])와(?: ?줘| ?주|\s|$)", text, re.I) and \
not HEAD_WORD.search(text):
return True # "I'd love to see you come this way": come, not a look
if kind in ("arm_reach", "arm_fold") and BODY_WORD.search(text) and not ARM_WORD.search(text):
return True # "you must straighten your waist": the waist, not the arm
if kind == "arm_open" and not OPEN_WORD.search(text) or kind == "arm_close" and not CLOSE_WORD.search(text):
return True # "grip immediately": no open word, no gripper opening
if kind == "wave" and not WAVE_VERB.search(text):
return True # "손 벌려 줘", "손 쥐어 빨리", "손 좀 주이소"
return holding and kind in ("arm_open", "arm_fold", "arm_reach", "arm_close")
@@ -1209,7 +1227,12 @@ GO_VERB = re.compile(r"(?<![가-힣])가(?: ?줘| ?주|$|\s)|이동|움직|무
HAND_SHAPE = re.compile(r"펴|펼|쥐|주먹|넣|접|내려|오므|놔|놓|\b(?:open|close|fist|tuck|fold|lower)\b", re.I)
COME_VERB = re.compile(r"(?<![가-힣])와(?![가-힣])|와 ?(?:줘|주)|오세요|오십시오|\bcome\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", re.I)
WAVE_VERB = re.compile(r"흔들|흔드|악수|인사|빠이|바이|웨이브|하이|\b(?:wave|waving|hello|hi|hey|shake|greet|bye)\b|"
r"handshake|shaking|goodbye", re.I)
OPEN_WORD = re.compile(r"펴|펼|벌려|벌리|열|오픈|풀어|놔|놓|\b(?:open|release|let go|loosen|unclench|spread|relax|widen|"
r"opn|apart)", re.I)
CLOSE_WORD = re.compile(r"쥐|닫|오므|모아|모으|주먹|클로즈|꽉|잡|\b(?:close|clos|shut|grip|clench|fist|squeeze|tighten|grasp|curl|"
r"pinch|together)", re.I)
if __name__ == "__main__":
+5 -4
View File
@@ -134,7 +134,8 @@ WAKE = re.compile(rf"\b(hi|hey|hello|okay|ok|hai|high|{WAKE_UP_EN})?[\s,.!]*(lum
WAKE_REPLY = {"en": "Yes? How can I help?", "ko": "네? 무엇을 도와드릴까요?"}
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|"
r"머+엄*춰|머+엄*추(?:세요|십시오)|멈춰|그만|정지|스톱|미션 ?취소|작업 ?취소|거기 ?서(?=[\s!.~,]*$)|움직이지 ?마|"
r"머+엄*춰|머+엄*추(?:세요|십시오)|멈춰|멈추(?:게|시게|게나|시오|어라)|그만|정지|스톱|스땁|스떱|미션 ?취소|작업 ?취소|"
r"거기 ?서(?: ?봐| ?있어)?(?=[\s!.~,]*$)|움직이지 ?마|\bemergency stop\b|\b(?:stay|hold|keep) still\b|"
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_PLACE = re.compile(r"\b(put|place|set) (it|that|this|the \w+) (down|on the table)\b|테이블에 ?(놔|놓|둬)|내려 ?(놔|놓)", re.I)
@@ -3241,7 +3242,7 @@ NOT_STOP = re.compile( # a stop word that orders no stop: negated, about someo
r"\bstop-motion\b|\bone-stop\b|\bwhy(?:'d| did| do| does)? (?:you|it|lumi) (?:freeze|stop|halt)|\b(?:would|should|could|might|will) stop\b|\blet'?s stop (?:at|for|by)\b|"
r"\bstop (?:for|at the|at a) (?:coffee|lunch|a (?:bit|while|break)|the \w+ (?:place|shop|store|cafe))|"
r"\b(?:when|if|once|whenever|after) [^,]{1,40},?\s*(?:you )?stop\b|"
r"그만(?:두|뒀|둘)|그만 ?(?:먹|마시|자|놀|울|웃|싸우|뛰)|"
r"그만(?:두(?!세요|십시오|시오|어라|라|게)|뒀|둘)|그만 ?(?:먹|마시|자|놀|울|웃|싸우|뛰)|" # "회사 그만뒀어"; "그만두세요" stops
r"(?<![가-힣])(?!루미|로봇|누미|아야|말이야|얘야)(?:엄마|아빠|얘들아|형|언니|누나|오빠|[가-힣]{1,3}야|[가-힣]{1,3}아)\s+(?:좀\s+|거기\s+)?(?:그만|멈춰|정지)|"
r"(?-i:\b(?!(?:Lumi|Loomi|Rumi|Robot|Hey|Hi|Okay|Ok|No|Please|Now|Wait|Hello|So|Oh|Yo)\b)[A-Z][a-z]+), stop \w+ing\b", re.I)
# also: another meaning, someone else told off ("엄마 그만 찍어", "Jake, stop touching the robot!"), a condition
@@ -3273,7 +3274,7 @@ STOP_PAD = re.compile(r"^(?:\W*(?:hey|hi|yo|oh|okay|ok|so|um+|uh+|listen|right|a
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)
STOP_ONLY = re.compile( # a whole sentence that only says stop / enough / stay (after calls and fillers): stop at once
r"(?:(?:sto+p|stahp|stob|top it|enough|that'?s enough|that is enough|no more|quit it|cut it out|knock it off|whoa,? there|whoa(?:,? whoa)+|kill it|abort|"
r"(?:(?:sto+p|stahp|stob|top it|emergency stop|enough|that'?s enough|that is enough|no more|quit it|cut it out|knock it off|whoa,? there|whoa(?:,? whoa)+|kill it|abort|"
r"stop (?:everything|driving|moving|it|that|the robot|right there|right now)|enough (?:music|of that)|"
r"hold it(?: (?:right )?(?:there|here))?|stop 해|그만|그만해|그만해요|그만하세요|그만하십시오|그만해 ?줄래요?|"
r"그만해 ?주세요|그마내|그만둬|멈춰|멈쳐|멈처|멈추라고|멈춰 ?봐|거기까지|고마 ?(?:서라|해라|해|하이소)|서|don'?t go|가지 ?마|그마+안|"
@@ -3502,7 +3503,7 @@ def read_mission(text, markers):
if unread and got and ({s["do"] for s in got} & steps.MISSION_ONLY or steps.is_mission(got)):
got, unread, by = steps.read(text, markers) # clearly several steps: the LLM may read it
elif unread and got and any((brain_mod.intent(u, markers) or ("",))[0] not in ("", "weather", "search", "fetch")
or NOT_A_STEP.match(u) for u in unread):
or NOT_A_STEP.match(u) or brain_mod.place_problem(u, markers) for u in unread):
return got, unread, by # "go to the stage and wave": no task step, asked, never half done
elif unread:
return None # "come here, I need help": the old paths (rules, the LLM) answer it
+20 -19
View File
@@ -1,6 +1,7 @@
"""Marker names said in other ways than wording.py reads them: the other language ("information desk" for 안내데스크,
"레지스트레이션" for Registration), the words of a two-word name the other way round ("에이 부스" for booth_A, "삼 번 부스"
for 부스3), letters and numbers as said ("booth bee", "부스 십이", "gate won"), and whisper's spellings ("hole A", "카패").
"""Marker names said in other ways than wording.py reads them: as they sound in the other language ("인포 데스크"
for info_desk, "레지스트레이션" for Registration; never a translation: 출구 is no "exit"), the words of a two-word
name the other way round ("에이 부스" for booth_A, "삼 번 부스" for 부스3), letters and numbers as said ("booth bee",
"부스 십이", "gate won"), and whisper's spellings ("hole A", "카패").
apply(t, markers) writes them as the marker's written name (wording.written) in text already normalised by
wording.norm, so every reader after it (brain.named_place, the go rules, the intent bank) sees the marker.
@@ -14,23 +15,22 @@ import sys
from assistant import wording
EN_KO = { # an English word of a name -> how it is said in Korean, and other spellings
"registration": ["레지스트레이션", "레지스트레이숀", "등록"], "gallery": ["갤러리", "겔러리", "갤러리이"],
"information": ["인포메이션", "안내"], "info": ["인포", "information", "인포메이션", "안내"],
EN_KO = { # an English word of a name -> how it sounds in Korean, and other spellings. Never a translation: "출구" is
# not "exit" (the owner, 2026-10-26: a word that only means the place is asked about, never mapped to a marker)
"registration": ["레지스트레이션", "레지스트레이숀"], "gallery": ["갤러리", "겔러리", "갤러리이"],
"information": ["인포메이션"], "info": ["인포", "information", "인포메이션"],
"desk": ["데스크", "대스크", "데스끄"], "cafe": ["카페", "카패", "까페", "café"], "coffee": ["커피", "코피"],
"corner": ["코너"], "elevator": ["엘리베이터", "엘레베이터", "엘베"], "lift": ["리프트"], "entrance": ["엔트런스", "입구"],
"exit": ["엑시트", "엑싯", "출구"], "stage": ["스테이지", "무대"], "main": ["메인"], "booth": ["부스", "boot", "bootH"],
"hall": ["홀", "hole", "hol"], "gate": ["게이트", "gait"], "photo": ["포토", "foto", "사진"], "zone": ["존", "zon"],
"lounge": ["라운지", "휴게실"], "lobby": ["로비"], "bar": ["바"], "table": ["테이블", "table"], "front": ["프론트", "프런트", "앞"],
"restroom": ["화장실"], "toilet": ["화장실"], "meeting": ["미팅", "회의"], "room": ["룸", "실"], "shop": ["샵", "숍"],
"gift": ["기프트", "기념품"], "dock": ["도크", "독"], "demo": ["데모"], "lab": ["랩"], "office": ["오피스", "사무실"],
"corner": ["코너"], "elevator": ["엘리베이터", "엘레베이터", "엘베"], "lift": ["리프트"], "entrance": ["엔트런스"],
"exit": ["엑시트", "엑싯", "엑짓", "이그짓", "익싯", "익시트", "에그짓"], "stage": ["스테이지"], "main": ["메인"], "booth": ["부스", "boot", "bootH"],
"hall": ["홀", "hole", "hol"], "gate": ["게이트", "gait"], "photo": ["포토", "foto"], "zone": ["존", "zon"],
"lounge": ["라운지"], "lobby": ["로비"], "bar": ["바"], "table": ["테이블", "table"], "front": ["프론트", "프런트"],
"restroom": ["레스트룸"], "toilet": ["토일렛"], "meeting": ["미팅"], "room": ["룸"], "shop": ["샵", "숍"],
"gift": ["기프트"], "dock": ["도크", "독"], "demo": ["데모"], "lab": ["랩"], "office": ["오피스"],
}
KO_EN = { # a Korean word of a name -> how it is said in English
"안내": ["information", "info", "인포", "인포메이션"], "데스크": ["desk", "대스크"], "커피": ["coffee"], "코너": ["corner"],
"포토": ["photo", "foto"], "존": ["zone"], "입구": ["entrance", "엔트런스"], "출구": ["exit", "엑시트"],
"무대": ["stage", "스테이지"], "휴게실": ["lounge", "break room", "rest area", "라운지"], "회의실": ["meeting room", "conference room"],
"화장실": ["restroom", "toilet", "bathroom", "washroom"], "앞": ["front"], "부스": ["booth"], "라운지": ["lounge"],
"기념품점": ["gift shop", "souvenir shop"], "로비": ["lobby"], "카페": ["cafe", "café", "카패"], "갤러리": ["gallery"],
KO_EN = { # a Korean word of a name -> how it sounds in English (and its spellings); never a translation
"인포": ["info"], "인포메이션": ["information"], "데스크": ["desk", "대스크"], "커피": ["coffee"], "코너": ["corner"],
"포토": ["photo", "foto"], "존": ["zone"], "엔트런스": ["entrance"], "스테이지": ["stage"], "라운지": ["lounge"],
"부스": ["booth"], "로비": ["lobby"], "카페": ["cafe", "café", "카패"], "갤러리": ["gallery"], "홀": ["hall"],
}
LETTER = {"a": ["a", "에이", "ay", "에이에"], "b": ["b", "bee", "be", "비", "삐"], "c": ["c", "see", "sea", "씨"],
"d": ["d", "dee", "디"], "e": ["e", "이"]}
@@ -74,7 +74,8 @@ def _patterns(markers):
continue
parts = ["(?:" + "|".join(sorted({re.escape(a).replace(r"\ ", r"\s?") for a in _alts(t, len(toks) == 1)},
key=len, reverse=True)) + ")" for t in toks]
orders = [parts] + ([parts[::-1]] if len(parts) == 2 else [])
orders = [parts] + ([parts[::-1]] if len(parts) == 2 else [parts[1:] + parts[:1]] if len(parts) > 2 else [])
# ^ "에이 부스" for booth_A, "비 세븐 게이트" for Gate_B7: the first word said last
body = "|".join(SEP.join(p) for p in orders)
out.append((m, re.compile(rf"(?<![a-z0-9_가-힣])(?:the )?(?:{body})(?![a-z0-9_])(?:(?<=[a-z0-9])|{wording._KO_END})")))
return out
+131 -9
View File
@@ -268,6 +268,11 @@ NO = [t for t in NO if t not in _said] # a wording
CAMERA = re.compile(r"\b(?:see|seeing|saw|look(?:s|ing)?|watch|camera|wearing|holding|in front of|behind|colou?r|"
r"recogni[sz]e|remember)\b|보여|보이|보니|(?<!해 )(?<!해)(?<!쭤 )(?<!쭤)(?<!여쭈어 )봐(?!도 ?(?:돼|되|될|괜찮))|봤|입었|들고|색|카메라|앞에|뒤에|알아봐|기억", re.I)
SPEC = re.compile(r"\b(?:what|which|how many|what kind of|what type of|what sort of) (?:depth )?cameras?\b|\bcameras? (?:do you (?:have|use)|"
r"model|brand|type|range|resolution)\b|\b(?:recogni[sz]e|remember) (?:faces|people|anyone|who people are)\b|"
r"\bface recognition\b|카메라(?:가|는|를)? ?(?:몇 ?개|몇 ?대|뭐 ?써|뭘 ?써|뭐 ?쓰|어떤 ?거|기종|모델|종류|제품|사양|스펙)|"
r"얼굴 ?(?:인식|알아보|알아봐|기억)", re.I)
# the cameras and face recognition as facts ("what cameras do you have?", "얼굴 인식 돼요?"), not what they see now
ABOUT_ME = re.compile(r"\b(?:(?<!can )(?<!could )(?<!may )i(?! (?:call|address) you\b)(?! (?:talk|speak|chat) (?:to|with) you\b)|i'm|am i|my|"
r"(?<!tell )(?<!give )(?<!let )(?<!show )me|mine)\b|(?:^|\s)(?:나|내|제|저|난|전)(?:는|가|를|의)?\s", re.I)
FRAGMENT = re.compile(r"^\W*(?:and|so|but|then|or|also|why|really|seriously|wait|what about|how about|how come|are you sure)\b|"
@@ -275,18 +280,39 @@ FRAGMENT = re.compile(r"^\W*(?:and|so|but|then|or|also|why|really|seriously|wait
r"\b(?:that|(?<!is )(?<!was )(?<!is it )(?<!how's )(?<!how is )it(?! is (?:now|today))|they|them|"
r"(?<!hello )(?<!hi )(?<!hey )(?<!is )(?<!are )there(?! (?:is|are)\b)|this one)\b|"
r"그거|그건|거기|그분|그 회사|걔", re.I) # not the clock's "it": "what day is it?"
OTHER = re.compile(r"\b(?:lift|carry|hold|items?|(?<!this )things?|stuff|price|cost)\b|들 ?수|(?<!만)(?<!알아)(?<!뭐 )들어|물건|"
r"^(?!.*(?:키|무게|체중|신장|속도|시간|나이|높이|길이|크기)).*얼마(?:야|예요)|"
OTHER = re.compile(r"\b(?:lift|carry|hold|items?|(?<!this )things?|stuff|price|cost)\b|들 ?수|(?<!만)(?<!알아)(?<!뭐 )들어(?! ?있)|물건|"
r"^(?!.*(?:키|무게|체중|신장|속도|시간|나이|높이|길이|크기|수명|배터리|하이트|웨이트|스피드|에이지|height|weight|speed|age|battery|life))"
r".*얼마(?:야|예요)|"
r"맞(?:아|지|죠|나|습니까)|아니(?:야|에요|죠)", re.I) # what it can hold, the price, a check: the LLM
SEVERAL = re.compile(r"\band\b(?!\s+(?:built|made|\w+ed)\s+(?:you|lumi|this robot)\b)|\bthen\b|그리고|[??].+\S|하고\s|랑\s|"
r"[가-힣](?<![최광참사창공경재원라])(?<!그리)고\s+(?!싶|있|계)", re.I) # "고개 숙이고 몇 시야?", "보고 시간 알려 줘"
EVENT_TIME = re.compile(r"\b(?:what time|what day|which day|what date) (?:does|do|did|will|is|are|was|were|should|can)\b"
r"(?!\s+(?:it|today)\b)|몇 ?시(?:에|부터|까지|쯤에)|며칠(?:에|까지|부터)|무슨 요일(?:에|까지|부터)|"
r"\b(?:open|close)\b(?!\s+(?:a|the|my|your|this|that|doors?)\b)|\b(?:start|end|begin|finish)\b|열어요|닫아요|시작|끝나", re.I) # an event's time: the LLM
OTHER_FIRM = re.compile(r"\b(?:openai|google|samsung|apple|lg|microsoft|tesla|nvidia|hyundai|naver|kakao|meta|amazon|sony)\b|"
r"오픈 ?ai|오픈에이아이|구글|삼성|애플|엘지|마이크로소프트|테슬라|엔비디아|현대|네이버|카카오|메타|아마존|소니", re.I)
OTHER_ROBOT = re.compile(r"\b(?:jaka|jacka|k1[wl]?|kargo|peitian|tusk)\b|자카|작카|节卡|페이톈|페이티엔|터스크", re.I)
NAMES_LUMI = re.compile(r"\b(?:you|your|yourself|u|ur|lumi)\b|(?:^|\s)(?:너|넌|니|네|당신|루미|본인|자기)", re.I)
_bank = None
_named = None # (kind names, int code per bank row) for intent_bank._top
_named = None
_exact_kinds = None
def _squeezed(t):
return re.sub(r"[\s,.!?~]", "", t).lower()
def _exact():
"""{wording without spaces: kind} of the wordings only one kind has: speech written without spaces (whisper does it
in Korean) found as the wording it is."""
global _exact_kinds
if _exact_kinds is None:
seen = {}
for t, k in examples():
seen.setdefault(_squeezed(t), set()).add(k)
_exact_kinds = {t: ks.pop() for t, ks in seen.items() if len(ks) == 1}
return _exact_kinds # (kind names, int code per bank row) for intent_bank._top
def examples():
@@ -307,20 +333,54 @@ def _load():
ASKING = re.compile(r"^\W*(?:(?:hang on|wait|okay|ok|so|um+|uh+|hey|excuse me|sorry|just out of curiosity|out of curiosity|"
r"i(?:'m| am) curious|quick question|one question|let me ask(?: (?:it|you|him|her))?|i bet (?:it'?s|you'?re) \w+|"
r"(?:may|can|could|might) i (?:ask|know)(?: you)?|i(?:'d| would) like to know|i want(?:ed)? to (?:ask|know)|"
r"i wonder|do you mind (?:telling me|if i ask)|(?:(?:can|could|would|will) you )?tell me|might i trouble you for|could i trouble you for|잠깐(?:만)?|저기(?:요|유|예)?|이보게|자네|보소|"
r"i wonder|i was wondering|i'?m wondering|i'?d love to know|(?:would|do) you mind (?:telling me|if i ask)|"
r"(?:could|can|would) you let me know|let me know|i have a question|may i know|please tell me|tell me please|(?:(?:can|could|would|will) you )?tell me|might i trouble you for|could i trouble you for|잠깐(?:만)?|저기(?:요|유|예)?|이보게|자네|보소|"
r"야야|궁금한 ?게 있는데(?:요)?|하나 여쭤봐도 될까요\??|여쭤봐도 될까요\??|궁금한데(?:요)?|궁금해서(?:요)?|"
r"하나 물어봐도 (?:돼|될까)요?|여쭤봐도 될까요|물어볼게(?:요)?|질문(?: 하나)?(?: 있어요| 있는데요?)?)"
r"\b[\s,.!?~:-]*)+", re.I)
# "May I ask your age?", "Hang on, let me ask it. What's your name?", "궁금한데, 몇 살이에요?": the question after
OPENER = re.compile(r"^\W*(?:(?:hello|hi|hllo|helo|hey|excuse me|well|okay|ok|oh|ah|g'?day|oppa|grabe|so like|dear|buddy|mate|"
r"sir|ma'?am|my (?:new )?friend|little robot|big robot|mr\.? robot|"
r"어이|이보게|여보게|야야|아야|우리|애기야|브로|bro|큰 로봇아|(?:오빠|언니|이쁜이|선배님|사장님|기사님|아가씨|로봇 양반|양반)(?=\s*,)|"
r"얘|쟤|마|야|저기|저기요|잠깐(?:만)?|대박|사와디캅|참|아 맞다|맞다|"
r"(?:야|아야|우리|이보게|어이|야야) ?(?:루미야|루미|로봇아|로봇)|실례합니다|실례지만|실례할게요|하나 묻겠습니다|하나 물을게(?:요)?|루미루미|누미야|"
r"루미 ?(?:님|군|상|씨|언니|오빠|누나|형)|루미야|루미|로봇(?:아|님|씨)?|robot|lumi)(?![\w가-힣])[\s,.!?~:-]*)+", re.I)
# calling words before the question ("hello robot, ...", "루미 님, ...", "실례합니다. ..."): left out of the meaning
REMARK = re.compile(r"(?:quick question|just (?:curious|wondering|asking)|(?:i'?m )?curious|i want to know|i'd like to know|"
r"please|thanks?|thank you|tell me(?: please)?|any idea|ㅎ+|ㅋ+|\^+|그냥 궁금해서(?:요)?|궁금하다|궁금해(?:요)?|"
r"궁금하네(?:요)?|궁금합니다|알고 싶어(?:요)?|알고 싶습니다|(?:좀 )?(?:알려|말해|가르쳐) ?(?:줘|줄래|줄래요|주세요|"
r"주실래요|주시겠어요|주시겠습니까|주십시오|봐)|진짜 궁금해(?:요)?|"
r"(?:하나 ?|뭐 ?하나 ?|질문 ?하나 ?)?(?:여쭤|여쭈어|물어) ?(?:봐|바|보)도 ?(?:될까요|돼요|되나요|됩니까|될까|돼)|"
r"질문 ?(?:하나 ?)?(?:해도 ?(?:될까요|돼요|되나요)|있어요|있습니다|있는데요?)|궁금한 ?게 ?있(?:는데요?|어요|습니다)|"
r"하나 ?묻겠습니다|실례합니다|실례지만|(?:may|can|could) i ask (?:you )?(?:something|a question)|"
r"i have a question|one question)", re.I)
# a sentence that only asks to be told or says why: "Christmas 얼마나 남았어요? 알고 싶어요."
SENTENCES = re.compile(r"(?<=[??!])\s*|(?<=\.)\s+")
def _tidy(text):
"""Stutters and words said twice taken out ("키가 얼— 얼마예요?", "너 너 몇 살이야"), laughs at the end."""
t = re.sub(r"(?<![\w])(\w{1,4})[—–-]+\s*(?=\1)", "", text or "")
t = re.sub(r"\b(\w+)(?:[\s,]+\1\b)+", r"\1", t)
return re.sub(r"(?<=\S)[\s~^ㅎㅋ]+(?=[??!.]*$)|(?<=[??!.])[\s~^ㅎㅋ]+$", "", t).strip()
def _core(text):
from assistant import brain
t = ASKING.sub("", brain.CALLING.sub("", brain.unfill(text or "")).strip()).strip() or text or ""
t = brain.unfill(text or "")
rest = OPENER.sub("", t)
if len(rest.split()) >= 2 or re.search(r"[가-힣]{4}", rest): # "hello there", "hi lumi" stay whole
t = rest
t = ASKING.sub("", brain.CALLING.sub("", t).strip()).strip() or text or ""
if not re.search(r"\b(?:is|was|name|named|called)\s+lumi\W*$", t, re.I): # the subject: "How wide is Lumi?"
t = re.sub(r"[\s,]*(?:lumi|루미야|루미)?[\s,.!?~]*$", "", t, flags=re.I).strip()
if re.fullmatch(r"(?:무슨|뭔|무엇의?) ?뜻\S*", t) and "루미" in (text or ""):
t = "루미 " + t # "루미 무슨 뜻이에요?": what the name means
t = re.sub(r"\b(?:do|have) you (?:have|got) the time\b", "what time is it", t, flags=re.I) # the clock, not "free?"
t = re.sub(r"([가-힣])인지 (?:궁금|알고 싶|알려|말해|알 수 있|여쭤)\S*(?: \S+)?$",
lambda m: m.group(1) + ("이에요" if (ord(m.group(1)) - 0xAC00) % 28 else "예요"), t)
t = re.sub(r"(?<=[가-힣])는지 (?:궁금|알고 싶|알려|말해|알 수 있|여쭤)\S*(?: \S+)?$", "나요", t) # "몇 살인지 궁금해요"
t = re.sub(r"(?:뭔가|무엇인가)$", "뭐예요", re.sub(r"(?<=[가-힣])(?:는교|남유|는감)$", "나요", t)) # 하게체, dialect
t = re.sub(r"얼만가$", "얼마예요", re.sub(r"(?<=[가-힣])는가$", "나요", re.sub(r"(?<=[가-힣])인가$", "인가요", t)))
return t or (text or "").strip(" ,.!?~") # 하게체 questions ("키 얼만가", "얼마나 되는가") as 해요체
@@ -333,7 +393,7 @@ def guarded(text, history=()):
return "length"
if re.search(r"\b(?:good ?bye|bye|see you|farewell)\b|잘 ?가|안녕히|다음에 봐", t, re.I):
return "closing" # "goodbye" is never a hello
if CAMERA.search(t):
if CAMERA.search(SPEC.sub(" ", t)):
return "camera"
if ABOUT_ME.search(t):
return "about the visitor"
@@ -351,13 +411,72 @@ def guarded(text, history=()):
return "other"
if EVENT_TIME.search(t) and not re.search(r"\bwhen did\b", t, re.I): # "when did Cutshion start?": a founding
return "event time"
if re.search(r"타워|빌딩|건물|(?<![가-힣])탑|에펠|남산|한라산|백두산|\b(?:tower|building|mountain|bridge|skyscraper)\b", t, re.I):
return "another thing" # "롯데타워 하이트 얼마야?": not Lumi's height
if OTHER_ROBOT.search(t):
return "another robot" # JAKA's / PEITIAN's: the LLM with its notes
if OTHER_FIRM.search(t) and re.search(r"대표|사장|회장|창업자|설립자|\b(?:ceo|boss|founder|chairman|president|head)\b", t, re.I):
return "another company" # "오픈AI 대표 누군가?": a lookup, never Lumi's model or maker
if re.search(r"환율|달러|원화|엔화|유로|위안|비트코인|주가|\b(?:dollars?|euros?|yen|exchange rate|bitcoin|stocks?)\b", t, re.I):
return "lookup" # "1달러에 원화로 얼만가?": not the price of Lumi
if re.search(r"배터리|battery", t, re.I) and re.search(r"몇 ?년|\byears?\b|교체|replace", t, re.I):
return "battery lifetime" # how many years it lasts is not known; "배터리 수명" alone is hours
if history and not NAMES_LUMI.search(t):
return "in a talk, not naming Lumi" # "how old?" / "몇 살이에요?" after the company: about that
return None
def kind_of(text, history=()):
"""The kind of question, when sure; else None."""
ASKS = re.compile(r"[??]\W*$|\b(?:what|who|whom|whose|how|where|when|why|which)\b|^\W*(?:can|could|do|does|did|are|is|was|"
r"will|would|may|have|has)\b|뭐|뭔|무엇|무슨|누구|누가|어디|언제|왜|몇|얼마|어떻게|어떤|어느|"
r"(?:까|니|냐|나요|가요|래|죠)\W*$", re.I) # words that ask something
ORDER = re.compile(r"^\W*(?:please\s+)?(?:go|come|turn|take|bring|pick|put|give|follow|wave|look|move|lift|raise|lower|stop|sing|"
r"dance|fold|reach|grab|show|open|close|hold|drive|walk|fly|speak|say|tell|let'?s|wait|stand|sit)\b|"
r"(?:줘|줘요|주세요|주십시오|주시오|주라|해라|하자|가자|와라|봐라|내밀어|흔들어|돌아|돌려|들어|내려|접어|펴|가|와|멈춰|그만)\s*[!.~…]*$", re.I)
# a command (said before a question, or as one sentence of several): never left out for the question
CORRECTION = re.compile(r"(?:^|[\s,.])(?:아 아니|아니 아니|아니 그러니까|아니다|아니 잠깐|no wait|wait no|i mean|scratch that|sorry i mean)"
r"(?=[\s,.])[\s,.]*", re.I)
CONNECT = re.compile(r"^\W*(?:(?:아|어|오|음|oh|ah|um+|uh+)\W+)?(?:그리고|그러면|그럼|근데|그런데|그건 그렇고|그나저나|참|아 맞다|맞다|"
r"and|so|then|but|also|anyway|by the way|btw|next test|quick one|one more)\b[\s,.:!-]*", re.I)
# a connective at the start of a first question: "그러면 키가 몇이에요?", "아 그리고 몇 개 국어 해?"
def kind_of(text, history=(), _whole=True):
"""The kind of question, when sure; else None. Several sentences: those that only call Lumi, ask to be told or say
something without asking are left out; what is left must be one question, or the same question said twice ("Do
robots have names? What's yours?" stays with the LLM, "얘 몇 살일까? 너 몇 살이야?" is the age). Not sure of the
whole: the question after a connective ("그러면 키가 몇이에요?") or after the last comma when the words before it
ask nothing ("셀카 찍을 거니까, 너 몇 살이야?", "형 비켜 봐, 키가 몇이에요?")."""
text = _tidy(text)
fix = list(CORRECTION.finditer(text))
if fix and len(text[fix[-1].end():].split()) >= 2:
text = text[fix[-1].end():] # "배터리, 아 아니, 지금 뭐 해?": what is said after the correction
parts = [p for p in SENTENCES.split(text) if p.strip() and not REMARK.fullmatch(p.strip(" ,.!??~"))
and OPENER.sub("", p).strip(" ,.!??~")]
if len(parts) > 1:
if any(ORDER.search(p) for p in parts):
return None # "fold it! your arm!", "손! 손 내밀어!": a command, the rules'
asked = [p for p in parts if ASKS.search(p)]
kinds = {kind_of(p, history) for p in asked}
return kinds.pop() if len(kinds) == 1 else None
if parts and parts[0] != text:
return kind_of(parts[0], history)
got = _kind(text, history)
if got or not _whole:
return got
m = CONNECT.match(text)
rest = text[m.end():] if m else text
if rest != text and len(rest.split()) >= 2 and ASKS.search(rest):
got = kind_of(rest, history, False)
if got:
return got
head, comma, tail = rest.rpartition(",")
if comma and len(tail.split()) >= (2 if re.search(r"[가-힣]", tail) else 3) and ASKS.search(tail) and \
not ASKS.search(head) and not ORDER.search(head): # "Your voice, what program?": the head is the topic
return kind_of(tail, history, False)
return None
def _kind(text, history):
if guarded(text, history):
return None
from assistant import knowledge
@@ -374,7 +493,10 @@ def kind_of(text, history=()):
_named = ([str(n) for n in names], codes)
best, top, margin, agree, _ = intent_bank._top(vecs @ q, _named, k=AGREE_K)
sure = top >= SIM_MIN and margin >= MARGIN or agree and top >= SIM_AGREE and margin >= MARGIN_AGREE
if best == "no" or not sure:
core = _core(text)
if not sure: # "누가너를만들었습니까": a wording run together (whisper)
best = _exact().get(_squeezed(core)) if re.fullmatch(r"\S*[가-힣]{4}\S*", core) else None
if best in (None, "no"):
return None
if best == "hello" and history:
return None # hello in the middle of a talk: the LLM
+3
View File
@@ -1477,6 +1477,9 @@ def answer(text, lang="en", frames=None, slow_line=None):
elif _last["thing"] is None or last not in SEE_KINDS or re.search(r"\bit\s+(?:to|from)\b", t, re.I) or \
not (IT.search(t) or FAR_BARE.match(t)):
return None # "how far is Seoul?": not about the cameras
from assistant import quick_answers
if not last and quick_answers.kind_of(text):
return None # "머리에 컴퓨터 있어?", "Is it safe to stand next to you?": a fact
_last["kind"], _last["asked"], _last["at"] = kind, (kind, t), time.time()
frames = _look(frames, asked_at)
if not frames:
+41 -18
View File
@@ -39,7 +39,8 @@ _FILL = (r"(?:(?:저기 |그 )?(?:이보게(?: 루미)?|어이(?: 로봇아?|
r"루미 ?(?:님|씨|군|양)(?:께서|께)?|로봇 ?씨|여보세요|실례지만|실례합니다|죄송한데요?|죄송하지만|죄송합니다만|"
r"번거로우시겠지만)|" # calls of every level ("이보게 루미", "루미 님께서") before "루미" alone
r"please|let'?s|lets|hey lumi|hi lumi|hey|hi|lumi|loomi|rumi|okay|ok|alright|all right|so|well|real quick|if you can|if you could|자|저기|저기요|혹시|instead|um+|uh+|er|hmm|thank you|thanks|now|then|and|also|first|next|"
r"finally|after that|there|for me|for us|again|carefully|slowly|could you|can you|would you|will you|lumi야|루미야|루미|음|응|어|야 로봇|로봇아|로봇야|"
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"pls|plz|yo|would it be possible to|is it possible to|could i ask you to|would you mind|lumi야|루미야|루미|음|응|어|야 로봇|로봇아|로봇야|"
r"감사합니다|고마워요|고마워|고맙습니다|좀|먼저|우선|일단|그다음|그 다음|마지막으로|다시|lastly|first of all|"
r"(?: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|"
@@ -55,7 +56,7 @@ _SPLIT_KO = re.compile(r"(?<=[가-힣](?:고|서))(?<!라고)(?<!다고)(?<!자
def _norm(text, markers=()):
"""Lower case, marker names and numbers as written (assistant/wording.py: "피쓰리로" -> "p3로", "half a meter" ->
"0.5 m", "오십 센치" -> "0.5 m", "table front" -> "table_front" on a map with it), titles without their dot."""
t = re.sub(r"\b(mr|mrs|ms|dr|prof)\. ", r"\1 ", wording.durations(brain.unfill(wording.norm(text, markers))) + " ")
t = re.sub(r"\b(mr|mrs|ms|dr|prof)\. ", r"\1 ", wording.durations(brain.unfill(brain.ko_slips(wording.norm(text, markers)))) + " ")
t = re.sub(r"\b(?:take|pick up|pick|grab)\s?(?:해서|하고)", "집어서", t) # "컵 take해서": mixed
t = re.sub(r"(?<=[가-힣])고\s*나서(?=[\s,]|$)", "고", t) # "가고 나서" = "가고"
t = re.sub(r"(?<![가-힣])(집었|잡았)다가(?=[\s,]|$)", lambda m: m.group(1)[0] + "고", t) # "컵 집었다가" = "컵 집고"
@@ -73,6 +74,9 @@ _SAME = [ # wordings read as the plain one (the blind mission sets, 2026-10-22
(r"\bmake a (left|right) turn\b", r"turn \1"),
(r"\bturn (\d+(?:\.\d+)?) degrees? (?:to (?:the |your )?)?(left|right)\b", r"turn \2 \1"),
(r"\breverse (?=\d)", "move back "), (r"\bkeep it in your hands?\b", "hold it"),
(r"\b((?:take|bring|carry) (?:it|that|this|the \w+|a \w+)) (?:with you|along)\b", r"\1"), # "take the cup with you to p5"
(r"^(?:go|head|drive)(?: over)? to (\S+) with (the|a|this|that) ((?:\w+ )?\w+)\s*$", r"take \2 \3 to \1"), # "go to
# exit with the cup": the cup taken there
(r"\bcome back to where (?:i am|you are|we are)\b", "come back"),
(r"\buntil (?:someone|somebody|they|i|we) (?:says?|tells? you)(?: to)? (?:go on|continue|move on)\b"
r"|\buntil you(?:'re| are) told to (?:go on|continue|move on)\b", "until i tell you to go on"),
@@ -456,7 +460,7 @@ def _wait(c, markers, after):
m = re.fullmatch(rf"(?:go (?:and )?)?(?:wait|stay|remain)(?: for me)? (?:at|by|in|near) (?:the )?(.+?)(?: for {_DUR})?(?: for me)?", c)
if m and _at_place(m.group(1), markers):
return [{"do": "go", "to": _at_place(m.group(1), markers)}, {"do": "wait", "s": _secs(m.group(2), m.group(3))}]
m = re.fullmatch(rf"(.+?)(?:에서|에)\s*(?:가\s*)?{_KO_WAIT}(?:\s*줘)?", c)
m = re.fullmatch(rf"(.+?)(?:에서|에)\s*(?:가\s*)?(?:(?:나|저|날|나를|저를|우리를?)\s*)?{_KO_WAIT}(?:\s*줘)?", c) # "p5에서 나 기다려"
if m and _at_place(m.group(1), markers):
return [{"do": "go", "to": _at_place(m.group(1), markers)}, {"do": "wait", "s": None}]
if re.fullmatch(rf"{_STAY_EN}(?: (?:right )?(?:there|here))? (?:for|until) (?:my|our) (?:call|signal|word|go)", c):
@@ -728,7 +732,11 @@ def _clause_steps(c, markers, after=None):
return []
if re.fullmatch(r"(?:(?:it'?s |this is )?from|on behalf of) [a-z][a-z'-]+|[가-힣 ]+(?:이|가) (?:보내는|보낸) (?:거야|건데)", c):
return []
m = re.fullmatch(rf"(?:(?:pass|hand|give|get|bring|fetch) me|(?:can|could|may) i (?:have|get|grab|take)|lemme have|let me have|"
m = re.fullmatch(r"(.+\s받아)\s*(?:와|와 ?줘|오너라|오게)", c)
if m and (got := _clause_steps(m.group(1), markers, after)) and got[-1]["do"] == "receive":
return got + [{"do": "go", "to": "here"}] # "사라한테 컵 받아 와": taken from her, then brought back here
c = re.sub(r"^go (?:and )?(?=(?:grab|get) me\b)", "", c) # "go grab me a cup"
m = re.fullmatch(rf"(?:(?:pass|hand|give|get|grab|bring|fetch) me|(?:can|could|may) i (?:have|get|grab|take)|lemme have|let me have|"
rf"(?:would you )?mind (?:passing|handing|giving) me) (?:the |that |this |a |an |one )?"
rf"(?:({COL}) )?({OBJ})s?(?: (?:on|from|off) the table| over(?: here)?| there| please)?"
rf"|(?:(?:나|저)(?:한테|에게)?\s*)?(?:({COL})\s*)?({OBJ})\s*(?:을|를)?\s*(?:하나만?\s*)?(?:(?:나|저)(?:한테|에게)\s*)?"
@@ -751,11 +759,16 @@ def _clause_steps(c, markers, after=None):
c = re.sub(r"\bstraight ahead\b", "forward", c)
c = re.sub(r"\bthe gripper\b", "your hand", c)
c = c.replace("그리퍼", "손")
m = re.fullmatch(r"(.+?)에 (?:있는|계신) (?:사람|분|손님)(?:한테|에게|께)\s*(?:(?:갖다|가져다|건네) ?(?:줘|주고|주세요|드려|드리고)?|"
r"줘|주고|드려|드리고)", c)
if m:
to = _places(m.group(1), markers)
return to and len(to) == 1 and [{"do": "go", "to": to[0]}, {"do": "give"}] or None
m = re.fullmatch(r"(?:(?:(?P<col>" + COL + r")\s*)?(?P<obj>" + OBJ + r")(?:을|를)?\s+)?(?P<at>.+?)에 (?:있는|계신) (?:사람|분|손님|[가-힣]{1,4}(?: ?(?:님|씨))?)"
r"(?:한테|에게|께)\s*(?:(?:갖다|가져다|건네) ?(?:줘|주고|주세요|드려|드리고)?|줘|주고|드려|드리고)|"
r"(?:bring|take|carry|deliver|give) (?:the |a |an |this |that )?(?:(?P<col2>" + COL + r") )?(?P<obj2>" + OBJ +
r")s? to (?:the |a )?(?:person|people|guests?|someone|somebody|whoever is|boss|man|woman|lady|guy|gentleman|kid|"
r"child|staff|teacher|manager|customer|visitor|host)s? (?:at|in|by|near) (?:the )?(?P<at2>.+)", c)
if m: # "컵 p5에 있는 사람한테 갖다 줘", "bring the cup to the person at p5"
to = _places(m["at"] or m["at2"], markers)
obj = m["obj"] or m["obj2"]
pick = [dict(zip(("do", "object", "colour"), ("pick",) + tuple(_thing(m["col"] or m["col2"], obj))))] if obj else []
return to and len(to) == 1 and pick + [{"do": "go", "to": to[0]}, {"do": "give"}] or None
m = re.fullmatch(rf"(?:the|a) (?:({COL}) )?({OBJ})s?", c) # "Kim sends the bottle": that one, picked here
if m and c != raw:
obj, col = _thing(m.group(1), m.group(2))
@@ -777,6 +790,9 @@ def _clause_steps(c, markers, after=None):
s = _wait(c, markers, after)
if s is not None:
return s
s = after and after["do"] in ("pick", "receive") and _place_at(c, markers, after)
if s:
return s # "컵 집어서 | exit에 갖다 줘": delivered there, not only a drive
for f in (_go, _move, _turn, _give, _hold, _arm):
s = f(c, markers) if f is _go else f(c)
if s:
@@ -797,7 +813,7 @@ def _clause_steps(c, markers, after=None):
m = re.fullmatch(r"(.+?)(?:으로|로|에) (?:가져가|가지고 가|갖고 가|들고 가)(?:서| 줘)?", c)
if m and (to := _places(m.group(1), markers)) and len(to) == 1:
return [{"do": "go", "to": to[0]}] # "피사로 가져가": as "take it to p4"
s = _place_at(c, markers) or _fetch_clause(c, markers)
s = _place_at(c, markers, after) or _fetch_clause(c, markers)
if s:
return s
s = _place_step(c) or _say(c)
@@ -808,7 +824,7 @@ _PUT_KO = r"(?:놔|놓아|놓고|내려놔|내려 ?놓고|둬|두고|놔두고|
_GIVE_AT_KO = r"(?:갖다 ?주고|갖다 ?줘|가져다 ?주고|가져다 ?줘|갖다 ?드리고|갖다 ?드려|전해 ?주고|전해 ?줘|배달해 ?주고|배달해)"
def _place_at(c, markers):
def _place_at(c, markers, after=None):
""""put it on p3", "deliver the cup to p5", "컵을 p5에 갖다 놓고", "p3에 갖다 줘": (the named thing picked here,) a
drive there, then put down (put / leave / 놔) or handed over (deliver / 갖다 줘). None otherwise."""
m = re.fullmatch(rf"(put|place|set|leave|drop|deliver|drop off) (?:it|that|this|the ((?:(?:{COL}) )?(?:{OBJ}))s?)"
@@ -816,12 +832,19 @@ def _place_at(c, markers):
if m:
verb, thing, where = m.groups()
else:
m = re.fullmatch(rf"(?:(?:이거|그거|이걸|그걸|((?:(?:{COL})\s*)?(?:{OBJ}))(?:을|를)?)\s+)?(.+?)(?:에다가?|에|로|으로) "
rf"(?:(갖다|가져다|가져가서) ?)?({_PUT_KO}|{_GIVE_AT_KO})(?: 줘| 주고)?", c)
if not m or (m.group(4) in ("갖다 줘", "갖다줘", "가져다 줘", "가져다줘") and not m.group(1)):
return None # "p3에 갖다 줘" alone: a fetch / give, not this
thing, where = m.group(1), m.group(2)
verb = "put" if re.fullmatch(_PUT_KO, m.group(4)) else "deliver"
thing = rf"(?:이거|그거|이걸|그걸|(?P<{{}}>(?:(?:{COL})\s*)?(?:{OBJ}))(?:을|를)?)"
m = re.fullmatch(rf"(?:{thing.format('a')}\s+)?(?P<where>.+?)(?:에다가?|에|로|으로) (?:{thing.format('b')}\s+)?"
rf"(?:(?:갖다|가져다|가져가서) ?)?(?P<verb>{_PUT_KO}|{_GIVE_AT_KO})(?: 줘| 주고)?", c) # "exit에 컵 갖다 놔" too
if not m or (m["verb"] in ("갖다 줘", "갖다줘", "가져다 줘", "가져다줘") and not (m["a"] or m["b"]) and
not (after and after["do"] in ("pick", "receive"))):
return None # "p3에 갖다 줘" alone: a fetch / give, not this (after
# "컵 집어서" / "받아서": the thing in hand, delivered there)
thing, where = m["a"] or m["b"], m["where"]
verb = "put" if re.fullmatch(_PUT_KO, m["verb"]) else "deliver"
on = None
sup = re.fullmatch(rf"(.+?)\s+((?:(?:{COL})\s*)?(?:{_SUP_KO}))(?:\s*위)?|((?:(?:{COL}) )?(?:{_SUP})s?) (?:at|in|by|near) (?:the )?(.+)", where)
if sup and verb == "put": # "exit 테이블에 놔", "put it on the table at p3": there, on that
where, on = sup.group(1) or sup.group(4), _support("on the " + sup.group(3) if sup.group(3) else sup.group(2))
to = _places(where, markers)
if not to or len(to) != 1 or to == ["here"]:
return None
@@ -830,7 +853,7 @@ def _place_at(c, markers):
t = re.fullmatch(rf"(?:({COL})\s*)?({OBJ})", thing.strip())
obj, col = _thing(t.group(1), t.group(2))
pick = [{"do": "pick", "object": obj, "colour": col}]
return pick + [{"do": "go", "to": to[0]}, {"do": "give"} if verb == "deliver" else {"do": "place", "on": None}]
return pick + [{"do": "go", "to": to[0]}, {"do": "give"} if verb == "deliver" else {"do": "place", "on": on}]
_FETCH_VERB = re.compile(r"\b(?:bring|fetch|get|carry|move)\b|가져|갖다|가지고|갖고|옮겨")