Improve side reaches, quick answers and Korean typed commands

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 02:11:27 +09:00
co-authored by Claude Opus 5.5
parent d72eb52f66
commit 3f392343bf
22 changed files with 630 additions and 120 deletions
+124
View File
@@ -366,6 +366,7 @@ RECEIVE += [
"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",
"이거 받아 주게나", "이거 받아 주세유", "이거 가지고 있어", "이거 들고 계세요", "이거 쥐고 있어 줘", "이것 좀 맡아 줘",
"이거 맡아 주세요", "자 이거", "옛다", "받으세유", "받아 주시길 바랍니다",
"이거 받게", "이거 받게나", "이 <obj> 받게", "<obj> 받게", "이 <obj> 받으시게", "이거 받으시오", "이거 받으소", "이거 받아 두게",
]
NO += [
"왼쪽에 놔둔 컵 누구 거야?", "오른쪽에 둔 거 뭐야?", "왼쪽에 내려놨어?", "오른쪽에 놓을까?", "왼쪽에 놓으면 돼?",
@@ -376,5 +377,128 @@ NO += [
"왼쪽에 컵 있어?", "오른쪽에 뭐 있어?", "옆에 컵 있네", "앞에 컵 있다",
]
# ---------- dialects (제주, 경상, 전라, 충청), 하오체 / 하게체, honorific receivers, glued slips ----------
DIALECT = [" 줍서", " 주십서", " 도고", " 도가", " 주이소 예", " 주이소마", " 주씨요", " 주쇼 잉", " 줘 잉", " 주랑께요",
" 주셔유", " 주시유", " 줘 봐유", " 봐 도고", " 주라 마", " 주소 마", " 주게 자네", " 주시구려", " 주구려",
" 주오", " 주시오 그려", " 주시게나", " 주겠는가?", " 주시겠는가?"]
DIALECT_CORES = [ # (list, stems)
(WAVE, ["손 흔들어", "악수해", "손 인사 해", "팔 흔들어", "손 흔들어서 인사해"]),
(ARM_REACH, ["손 내밀어", "팔 뻗어", "손 이리 내밀어", "손 줘"]),
(ARM_FOLD, ["팔 접어", "팔 거둬", "손 내려", "팔 넣어"]),
(ARM_OPEN, ["손 펴", "손가락 펴", "그리퍼 열어"]),
(ARM_CLOSE, ["주먹 쥐어", "손 쥐어", "그리퍼 닫아"]),
(PICK, ["<obj> 집어", "<obj> 잡아", "<obj> 들어"]),
(FETCH, ["<obj> 가져다", "<obj> 갖다"]),
]
for _list, _stems in DIALECT_CORES:
_list += _ko(_stems, DIALECT)
WAVE += [
"손 흔들어 주시구려", "악수 한번 하시구려", "악수나 한번 하세", "자네 악수 한번 하세", "악수 한번 합세", "손 한번 흔드시오",
"할머님께 손 한번 흔들어 드리시게", "어르신들께 손 흔들어 드리십시오", "아버님께 악수 청해 보세요", "교수님께 손 흔들어 드려라",
"손 흔들어 줍서", "손 흔들어 도고", "악수 하입시더 예", "악수 하자 잉", "악수 혀 봐유", "악수 하드래요",
"손흔들어줘요", "손흔들어봐", "손 흔들어줘", "악수하자요", "악수해요루미", "손흔드러", "손 흔드러 줘요", "악수 해 조요",
"웨이브해줘", "웨이브해주세요", "쉐이크핸드해줘", "핸드쉐이크해줘", "wave해줘", "wave해주세요", "악수해줄래",
"wave to grandpa please", "say hi to grandpa with your hand", "wave at mommy", "wave at daddy", "wave to teacher",
"wave to the teacher please", "go on wave to mister kim", "wave hi to everybody here", "wave to all of us",
"handshake me please robot", "you shake hand with my father", "please you give me handshake", "shake hand with me ok",
"shake hands ok", "wave ok", "wave okay?", "you can wave please", "wave for me robot friend",
]
ARM_REACH += [
"손 좀 내밀어 주시구려", "손 한번 내미시오", "팔 한번 뻗어 보시게나", "자네 손 좀 내밀어 보게", "손 내밀어 줍서", "손 도고",
"손 이리 도고", "손 내밀어 도고", "팔 뻗어 보래이 마", "손 줘 잉", "손 줘 봐유", "손 이리 주셔유",
"손내밀어봐", "손줘봐", "손좀줘", "팔뻗어봐", "손 내밀어줘요", "손 쭉내밀어", "팔쭉뻗어줘", "핸드줘", "핸드 내밀어줘",
"reach out to grandma", "hold your hand out to my son", "give your hand to my daughter", "reach out to the kid",
"give grandpa your hand", "hold out your hand to the lady", "you give hand to my mom", "hand to grandma please",
]
ARM_FOLD += [
"팔 거두시구려", "팔 접으시구려", "팔 좀 거두시게나", "자네 팔 좀 접게", "팔 접어 줍서", "팔 접어 도고", "팔 거둬 잉",
"팔 접어 주셔유", "팔 넣어 도고", "팔접어줘요", "팔거둬", "팔거둬줘", "팔넣어줘", "손내려줘", "팔 내려줘요", "팔 접어줘요",
"arm back please robot friend", "ok arm in now", "put your arm back now please", "arm back in place",
]
ARM_OPEN += ["손 펴 주시구려", "손 좀 펴 보시게나", "손 펴 줍서", "손 펴 도고", "손펴줘요", "손가락펴", "손가락펴줘요",
"그리퍼열어", "그리퍼열어줘"]
ARM_CLOSE += ["주먹 쥐어 주시구려", "손 좀 쥐어 보시게나", "주먹 쥐어 줍서", "주먹 쥐어 도고", "주먹쥐어줘요", "손쥐어줘",
"그리퍼닫아줘", "손 꽉쥐어"]
PICK += ["<obj> 집어 주시구려", "<obj> 좀 집어 보시게나", "<obj> 집어 줍서", "<obj> 집어 도고", "<obj>집어줘요",
"<obj>잡아줘", "<obj>들어줘", "<obj> 집어줘", "<obj> 잡아줘요", "<obj>좀집어줘"]
FETCH += ["<obj> 가져다 주시구려", "<obj> 좀 가져오시게나", "<obj> 가져다 줍서", "<obj> 갖다 도고", "<obj> 가 온나 마",
"<obj>가져다줘요", "<obj>갖다줘", "<obj>좀가져와", "<obj> 가져와줘요"]
NO += [
"손 흔들어 주면 사탕 줄게", "if you wave i'll clap", "손 흔들면 사진 찍어 줄게", "악수하면 친구 하는 거야", "악수하자고 했잖아",
"손 흔들어 달라고 했는데 안 했어", "손 흔들어 준 거 고마워", "악수해 줘서 고마워요", "thanks for the wave", "thanks for shaking my hand",
"that was a good handshake", "i liked your wave", "your wave was too slow", "can you wave faster next time",
"팔 접는 게 왜 이렇게 느려?", "손 펴는 거 신기하다", "주먹 쥐는 거 귀엽네", "컵 집는 거 다시 보고 싶다",
"민수야 컵 가져와",
]
# ---------- English depth: indirect, kids, elderly, non-native, slang ----------
WAVE += [
"it would make her day if you waved", "a wave would make his day",
"say goodbye to us with a wave", "wave us farewell", "give us a goodbye wave", "a goodbye wave please",
"wavey wave for the baby", "robot wave hi hi", "do the bye bye", "do bye bye with your hand", "bye bye hand please",
"hand bye bye", "hand hello please", "hello hand please", "you do hand hello", "make bye bye", "make the wave",
"wave it", "wave it up", "wave that hand", "wave that arm", "wave that thing", "flap that hand at me",
"yo wave at me", "yo, shake my hand", "bro, shake hands", "dude, wave", "come shake hands", "c'mon, shake",
"lemme shake your hand", "lemme get a wave", "gimme a handshake real quick", "quick wave", "quick handshake",
"if it's no trouble, a wave", "would you mind giving us a wave", "could you do me a wave", "would it be possible to wave",
"please, a handshake", "kindly greet us by waving", "please greet my grandmother with a wave",
"you wave hand hello for grandma", "you make handshake grandma", "please doing wave", "doing handshake please",
"you waving please", "waving please", "waving hand please", "shaking hand please",
]
ARM_REACH += [
"can the baby touch your hand, hold it out",
"hold it out so she can touch it", "hold your hand out so we can see it", "put your hand out for the photo",
"stick your hand out for the picture", "hand out for the photo please", "reach out so i can touch your hand",
"let her touch your hand", "your hand, let me touch it", "touch hands with me", "high hand please",
"robot hand out", "robot hand to me", "you hand to me", "hand me hand", "stretch stretch", "arm long long",
"make arm go out", "arm go out", "arm go forward please", "hand go forward", "yo, hand out", "c'mon, gimme your hand",
"if it's no trouble, hold out your hand", "would it be possible to extend your arm", "kindly extend your hand",
"please extend your hand towards me", "please, your hand",
]
ARM_FOLD += [
"you can stop holding your arm out", "you don't need your arm out anymore, fold it", "no more arm out, fold it",
"enough with the arm, put it away", "we're done with the arm", "done, arm back", "finished, put your arm away",
"the photo is done, arm down", "photo's done, you can lower your arm", "arm go back", "arm come back",
"hand come back", "hand go back", "make arm small", "arm small please", "yo, arm in", "c'mon, put your arm away",
"if it's no trouble, fold your arm", "would it be possible to lower your arm", "kindly retract your arm",
"please return your arm to its resting position", "please put your arm back to rest",
"bring your hand home", "bring your hand home now", "would you please bring your hand home", "hand home please",
"bring your hand back home", "bring the hand home", "bring your hands home",
]
ARM_OPEN += [
"open your hand for the photo", "show us your open hand", "open open hand", "hand open open", "make hand open",
"make the fingers open", "yo, open your hand", "if it's no trouble, open your hand", "kindly open the gripper",
"would it be possible to open your gripper",
]
ARM_CLOSE += [
"close your hand for the photo", "make your hand closed", "close close hand", "hand close close", "make hand close",
"make the fingers close", "yo, close your hand", "if it's no trouble, close your hand", "kindly close the gripper",
"would it be possible to close your gripper",
]
PICK += [
"pick up the <obj> for the kids",
"show the kids, pick up the <obj>", "pick up the <obj> so we can see", "robot pick <obj>", "<obj> pick robot",
"you <obj> pick up", "<obj> you grab please", "yo, grab the <obj>", "c'mon, pick up the <obj>",
"if it's no trouble, pick up the <obj>", "kindly lift the <obj>", "would it be possible to pick up the <obj>",
"please take hold of the <obj>",
]
FETCH += [
"my son wants the <obj>, bring it", "bring the <obj> to my son", "grandma needs the <obj>, fetch it", "robot bring <obj>",
"<obj> bring robot", "you <obj> bring me", "yo, bring me the <obj>", "c'mon, fetch the <obj>",
"if it's no trouble, bring me the <obj>", "kindly fetch the <obj>", "would it be possible to bring me the <obj>",
]
NO += [
"my son waved at you", "the kids want to wave at you", "my daughter wants to shake your hand later",
"can my son shake your hand", "can i touch your hand", "may i shake your hand", "should i wave back",
"is it ok if i wave", "wave if you can hear me", "if you can hear me, wave", "wave when i say go",
"don't wave yet", "not yet, don't reach out", "wait, don't pick it up yet", "you don't need to fold your arm",
"no need to open your hand", "your hand doesn't need to close", "i don't want the cup", "i don't need the bottle",
"the photo was great, thanks", "nice wave, thank you", "great handshake, thanks", "that handshake was firm",
"wave hello to my friend on the phone, no wait, never mind", "pick it up? no, leave it",
]
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}
+86 -4
View File
@@ -425,10 +425,13 @@ QUICK_KINDS["mics"] = ([
"where are your microphones", "how far can you hear", "can you tell where a voice comes from",
"소리는 무엇으로 들으십니까", "소리는 뭘로 들어요", "마이크 몇 개예요", "마이크 있어요", "마이크가 어디 있어", "얼마나 멀리서 들려요",
"귀가 어디야", "어떻게 들어요", "소리 어떻게 들어",
], {"en": ["I hear with a ring of six microphones in my head, from about 3 to 5 metres away, and I can tell where a voice comes from.",
"Six microphones in my head: they hear people 3 to 5 metres away and tell me which direction a voice comes from."],
"ko": ["머리에 있는 마이크 6개로 들어요. 3에서 5미터 거리까지 듣고, 목소리가 어느 쪽에서 오는지도 알 수 있어요.",
"머리에 마이크가 6개 있어요. 3~5미터 떨어진 목소리를 듣고 방향도 알아요."]})
], {"en": ["I hear with a ring of six microphones in my head, from about 3 to 5 metres away, and I can tell where a voice comes from. "
"Visitors can also talk to me through a small wireless clip microphone.",
"Six microphones in my head: they hear people 3 to 5 metres away and tell me which direction a voice comes from. "
"In a noisy place a small wireless clip microphone helps."],
"ko": ["머리에 있는 마이크 6개로 들어요. 3에서 5미터 거리까지 듣고, 목소리가 어느 쪽에서 오는지도 알 수 있어요. "
"작은 무선 클립 마이크로 말씀하셔도 돼요.",
"머리에 마이크가 6개 있어요. 3~5미터 떨어진 목소리를 듣고 방향도 알아요. 시끄러운 곳에서는 무선 클립 마이크를 쓸 수 있어요."]})
QUICK["no"] += ["can you hear me", "do you hear me", "들려", "내 말 들려요", "제 말 들리세요", "hello can you hear me",
"are you listening", "듣고 있어"]
QUICK["no"] += [
@@ -656,3 +659,82 @@ QUICK["time_now"] += _ko(["몇 시", "지금 몇 시", "시방 몇 시"], ["유"
"몇시입니까", "지금몇시야", "몇시임", "지금몇시예요", "몇시야", "지금몇시입니까", "몇시예요"]
QUICK["height"] += ["몇센티임", "너몇센티임", "키얼마유", "키가얼마유", "키 얼마나 된당가", "너 키 얼마나 된당가", "키howmuch"]
QUICK["weight"] += ["howheavy해요", "너무게얼마인지알려주시겠어요", "무게얼마인지알려주세요"]
QUICK["tts"] = QUICK.get("tts", []) + _ko(["너 목소리 real person", "목소리 진짜 사람", "너 목소리 진짜 사람", "목소리 사람 목소리", "목소리 녹음한 거",
"그 목소리 사람"], ["이야", "이에요", "이니", "입니까", "인가요", "이고", "임"]) + [
"is your voice a real person", "is that a real person's voice", "is your voice recorded", "whose voice is that",
"is your voice real", "is that voice real", "your voice is a real person", "목소리 누구 거야", "목소리 누구 목소리예요"]
# round 4: the small kinds at every Korean level and in more English frames (same meanings, same answers)
_N = ["야", "예요", "에요", "니", "입니까", "인가요", "고", "여", "임", "냐", "유", "일까요", "인지 알려 줘", "인지 알려 주세요"] # after 뭐 / 어디 / 몇 개
_USE = ["써", "써요", "쓰니", "쓰세요", "쓰십니까", "씁니까", "쓰나요", "쓰노", "써유", "쓰냐", "쓰시나요", "쓰는지 알려 주세요"]
_HAVE = ["있어", "있어요", "있니", "있나요", "있습니까", "있으세요", "있으십니까", "있노", "있어유", "있냐", "있나"]
_BE = ["돼", "돼요", "되니", "되나요", "됩니까", "되세요", "되십니까", "되노", "돼유", "되냐", "되나"]
_WHO_KO = ["", "너 ", "루미 ", "이 로봇 "]
QUICK["mics"] = QUICK.get("mics", []) + [w + x for w in _WHO_KO for x in _ko(["마이크 몇 개", "마이크가 몇 개", "마이크는 몇 개"], _N) +
_ko(["마이크 ", "마이크가 ", "귀 "], _HAVE) + _ko(["마이크 뭐 ", "마이크 어떤 거 "], _USE)] + _ko(
["얼마나 멀리서 들려", "몇 미터까지 들려", "멀리서도 들려"], ["", "요", "?", "니", "요?"]) + _ko(
["소리 나는 방향 알", "목소리 방향 알 수 있", "누가 말하는지 방향 알"], ["아", "아요", "니", "습니까", "아유"]) + [
"how many microphones do you have", "how many mics do you have", "do you have microphones", "do you have a microphone",
"what microphones do you use", "where are your microphones", "how far away can you hear", "how far can you hear",
"can you tell where a voice comes from", "can you tell which direction a voice is from", "how do you hear", "what do you hear with",
"do you have ears", "where are your ears", "mic 몇 개야", "마이크 how many", "how many mic you have"]
QUICK["stt"] = QUICK.get("stt", []) + [w + x for w in _WHO_KO[:3] for x in _ko(["음성 인식 뭐 ", "음성 인식은 뭐 ", "음성 인식 엔진 뭐 ", "STT 뭐 ",
"위스퍼 ", "음성 인식 모델 뭐 "], _USE) +
_ko(["음성 인식 엔진이 뭐", "음성 인식 모델이 뭐", "STT 모델이 뭐", "말 알아듣는 프로그램이 뭐"], _N)] + _ko(
["말은 어떻게 알아들", "말을 어떻게 알아들", "내 말 어떻게 알아들", "사람 말 어떻게 알아들"],
["어", "어요", "으세요", "으십니까", "습니까", "니", "나요", "노", "어유", "냐"]) + [
"what speech recognition do you use", "which speech recognition model do you use", "how do you understand speech",
"how do you understand what people say", "what's your speech to text", "which stt do you use", "what stt model do you use",
"do you use whisper", "is it whisper", "speech recognize what model", "speech to text what model", "how do you turn speech into text",
"what model listens to people", "음성 인식 what model", "speech recognition 뭐야"]
QUICK["tts"] = QUICK.get("tts", []) + [w + x for w in _WHO_KO[:3] for x in _ko(["음성 합성 뭐 ", "TTS 뭐 ", "목소리 프로그램 뭐 ", "목소리 엔진 뭐 "], _USE) +
_ko(["목소리 프로그램이 뭐", "음성 합성 엔진이 뭐", "TTS 엔진이 뭐", "목소리 엔진이 뭐"], _N)] + _ko(
["목소리는 어떻게 내", "목소리 어떻게 만들", "말소리는 어떻게 내", "목소리는 뭘로 내", "목소리 어떻게 나와"],
["", "요", "니", "세요", "십니까", "나요", "노", "유", "냐"]) + [
"what text to speech do you use", "which tts do you use", "what tts engine do you use", "how do you speak", "how do you make your voice",
"what makes your voice", "is your voice synthesized", "is your voice a computer voice", "your voice what program",
"what program is your voice", "voice engine what", "what's your voice engine", "tts 뭐야", "voice 뭘로 만들어요"]
QUICK["reply_time"] = QUICK.get("reply_time", []) + _ko(
["대답하는 데 얼마나 걸려", "답하는 데 몇 초 걸려", "대답까지 얼마나 걸려", "말하면 얼마 만에 대답해", "질문하면 몇 초 만에 대답해"],
["", "요", "?", "니", "요?", "유"]) + _ko(
["대답하는 데 얼마나 걸리", "대답까지 몇 초 걸리"], ["세요", "십니까", "나요", "노", "니", "냐"]) + _ko(
["반응 속도가 ", "대답 속도가 ", "응답 시간이 ", "응답 속도가 "], ["얼마야", "얼마예요", "얼마입니까", "얼마나 돼", "얼마나 돼요", "어떻게 되세요",
"어때", "어때요", "얼마고", "몇 초야", "몇 초예요"]) + [
"how long does it take you to answer", "how long do you need to reply", "how quick are your answers", "how fast are your replies",
"what's your reaction time", "how many seconds to answer", "response time?", "how fast you answer", "answer speed 얼마야"]
QUICK["used_where"] = QUICK.get("used_where", []) + _ko(
["어디에 쓰", "어디서 쓰", "어디에 쓰려고 만들", "어떤 데서 쓰"], ["여", "여요", "이니", "입니까", "이나요", "이노", "여유", "이세요"]) + _ko(
["용도가 뭐", "너 용도가 뭐", "쓰임새가 뭐", "주 용도가 뭐", "무슨 용도"], _N) + _ko(
["어디서 일하", "어디에서 일하", "주로 어디서 일하"], ["", "니", "세요", "십니까", "나요", "노", "냐"]) + [
"what are you used for", "what's your purpose", "what is this robot for", "where would i use you", "what kind of places use you",
"where do robots like you work", "what job were you built for", "what can you be used for", "use case?", "your use case what",
"어디 쓰는 로봇이에요", "너 어디에 써먹어", "이 로봇 뭐에 써요", "어디다 써요", "이거 뭐에 쓰는 거예요"]
QUICK["internet"] = QUICK.get("internet", []) + [w + x for w in _WHO_KO[:3] for x in _ko(["인터넷 ", "인터넷 연결 ", "와이파이 ", "클라우드 "], _USE) +
_ko(["인터넷 ", "인터넷 연결 ", "인터넷에 연결 "], _BE)] + [
"are you online", "are you connected to the internet", "do you use the internet", "do you need the internet", "do you use the cloud",
"can you work offline", "do you work without internet", "are you on wifi", "internet 돼요", "인터넷 없이도 움직여요", "오프라인으로도 돼요"]
QUICK["computer"] = QUICK.get("computer", []) + [w + x for w in _WHO_KO[:3] for x in _ko(["컴퓨터 뭐 ", "무슨 컴퓨터 ", "어떤 컴퓨터 ", "칩 뭐 ",
"GPU 뭐 ", "프로세서 뭐 "], _USE) +
_ko(["컴퓨터가 뭐", "두뇌가 뭐", "뇌가 뭐", "컴퓨터 사양이 뭐", "GPU가 뭐"], _N)] + _ko(
["머리에 컴퓨터 ", "안에 컴퓨터 ", "몸에 컴퓨터 "], _HAVE) + [
"what computer do you have inside", "what's your brain", "what chip do you use", "what gpu do you have", "what processor do you use",
"is there a computer in your head", "what hardware runs you", "do you use nvidia", "is it a jetson", "computer 뭐 써요", "jetson이에요"]
QUICK["operator"] = QUICK.get("operator", []) + _ko(["누가 관리", "누가 운영", "누가 담당"], ["해", "해요", "하니", "하세요", "하십니까", "합니까", "하나요",
"하노", "해유", "하냐"]) + _ko(
["관리자가 누구", "담당자가 누구", "책임자가 누구", "운영자가 누구", "주인이 누구"], ["야", "예요", "에요", "니", "입니까", "인가요", "고", "여", "임", "냐"]) + [
"who looks after you", "who is your owner", "who owns you", "who is responsible for you here", "who manages you", "who's your operator",
"who takes care of this robot", "owner 누구야"]
QUICK["estop"] = QUICK.get("estop", []) + _ko(["비상 정지 버튼 어디 ", "비상 버튼 어디 ", "정지 버튼 어디 ", "빨간 버튼 어디 ", "비상 스위치 어디 "], _HAVE) + _ko(
["비상 정지 버튼이 어디", "비상 버튼이 어디", "정지 버튼이 어디", "비상 스위치가 어디"], _N) + _ko(
["위험하면 어떻게 멈춰", "급할 때 어떻게 세워", "비상시에 어떻게 멈춰"], ["", "요", "?", "요?", "야 돼", "야 돼요"]) + [
"where's the e-stop", "how do i stop the robot in an emergency", "is there a kill switch", "where is the kill switch",
"how can someone stop you quickly", "emergency stop button where", "e-stop 어디야"]
QUICK["dof"] = QUICK.get("dof", []) + _ko(["관절이 몇 개", "관절 몇 개", "자유도가 몇", "자유도 몇", "축이 몇 개", "모터가 몇 개"], _N) + [
"how many degrees of freedom do you have", "how many dof do you have", "how many joints do you have", "how many axes do you have",
"how many motors do you have", "dof?", "degrees of freedom?", "자유도 how many"]
QUICK["safety"] = QUICK.get("safety", []) + _ko(["너 안전한 로봇", "안전한 로봇"], ["이야", "이에요", "이니", "입니까", "인가요", "이고", "임"]) + [
"is it dangerous to be near you", "can you hurt people", "do you hurt people", "are robots like you safe", "safe?"]
QUICK["no"] += ["한 번에 몇 초 걸려", "몇 초 걸려", "몇 초나 걸려요", "how many seconds does it take", "how long does one take",
"how long does it take", "얼마나 걸려요", "시간 얼마나 걸려"]
QUICK["mics"] += ["clip mic 있어요", "클립 마이크 있어요", "무선 마이크 있어요", "시끄러우면 마이크 써", "시끄러우면 마이크 씀", "do you have a clip mic",
"is there a wireless microphone", "can i use a microphone", "마이크 따로 있어요"]
+24 -5
View File
@@ -2420,6 +2420,12 @@ CARRY_HELD = re.compile(r"\b(?:take|bring|carry|move|get) (?:it|that|this|them|t
r"(?:으로|로|에|까지)\s*(?:좀\s*)?(?:가져가|가지고 ?가|갖고 ?가|들고 ?가|옮겨|가져다 ?놔|가 ?줘|가)", re.I)
def object_ko(name):
""""흰 컵" -> "흰 컵을", "물병" -> "물병을", "사과" -> "사과를": a Korean object with its object particle."""
c = name[-1:]
return name + ("을" if "가" <= c <= "힣" and (ord(c) - 0xAC00) % 28 else "를")
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."""
@@ -2717,7 +2723,8 @@ LOOKUP_MORE = re.compile(r"\b(he|she|him|his|her|they|them|their|there|it|that)\
SPEAK_IN = re.compile(r"(english|영어|korean|한국어)\s?로\s*(?:다시\s*|좀\s*|한 ?번\s*)*(?:말|얘기|소개|대답|답|설명|자기소개|"
r"해\s*(?:줘|주|봐))(?!.*(?:해도|도 ?돼|할 ?수|할 ?줄))|"
r"\b(?:speak|talk|answer|reply|introduce yourself)\b.*\bin (english|korean)\b", re.I)
SHORT_Q = re.compile(r"\?|^\W*(?:where|who|what|when|how|which|why)\b|몇|어디|누가|누구|뭐|언제|왜|얼마|어떻게", re.I)
SHORT_Q = re.compile(r"\?|^\W*(?:where|who|what|when|how|which|why)\b|몇|어디|어딘|누가|누구|누군|뭐|뭔|무엇|무슨|어느|언제|언젠|"
r"왜|얼마|어떻게|어떤", re.I) # 하게체 / no "?" from the voice: "그게 언젠가", "공을 꺼낸 방법 무엇인가"
ABOUT_YOU = re.compile(r"\b(?:you|your|yourself|lumi)\b|너|네가|니가|넌|루미|당신", re.I) # a follow-up about Lumi itself
FOLLOW_UP = re.compile(r"\b(more|why|how come|details?|explain|elaborate|and then|what else|tell me more)\b|자세히|더 알려|왜|그리고", re.I)
_CLOSE_WORD = (r"(ok(ay)?|okay then|thanks?( you)?( very much)?( a lot)?|cheers|thank you( so much)?|got it|alright|all right|"
@@ -2986,6 +2993,9 @@ WHAT_IS = re.compile(r"(?:뭐|무엇|뭔|머)(?:예요|에요|야|이야|입니
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 은 / 는)
OF_THING_KO = re.compile(rf"(?<![가-힣A-Za-z])(?!(?:{_PRONOUN_KO})(?:의)?\s)([가-힣A-Za-z]{{2,}}?)(?:의)?\s+"
r"(?:이름|나이|키|높이|무게|속도|가격|크기|색|색깔|모양|뜻)(?:은|는|이|가|도)?(?![가-힣])")
# "블루투스 이름은 왜 그렇게 지었나?": Bluetooth's name, not Lumi's
EN_SUBJECT = re.compile(r"\b(?i:do|does|did|can|could|are|is|were|was|will|would)\s+(?:the\s+|an?\s+)?"
r"(?!(?:you|i|we|they|he|she|it|people|there|this|that|these|those|your|my|our|me|not|so|very)\b)"
r"([a-z]{3,})\b") # "Why do whales sing?": the whales (world_talk; lower case, so not OWN_SUBJECT)
@@ -3136,7 +3146,7 @@ class Brain:
not other_latin_language(text): # 26b called short or broken but clear words unclear ("fr?")
stream.close()
retried, header, buf, full = True, None, "", ""
messages[-1]["content"] += UNCLEAR_RETRY
messages[-1]["content"] += self._unclear_retry()
stream = _stream(messages)
continue
muted = bool(header.pop("held", None)) # a motion the words did not order: talk only
@@ -3168,7 +3178,7 @@ class Brain:
if not said and not retried and len(parts) > 1 and self._asks_again(header, parts[0], text):
stream.close() # "Sorry, I didn't catch that." to clear words: once more
retried, skip_head, buf, full = True, True, "", ""
messages[-1]["content"] += UNCLEAR_RETRY
messages[-1]["content"] += self._unclear_retry()
stream = _stream(messages)
continue
for sentence in parts[:-1]:
@@ -3200,7 +3210,7 @@ class Brain:
buf = buf.partition("\n")[2]
if not said and not retried and buf.strip() and self._asks_again(header, buf, text):
try: # a one-sentence "say it again?" to clear words
again = _chat(messages[:-1] + [dict(messages[-1], content=messages[-1]["content"] + UNCLEAR_RETRY)])
again = _chat(messages[:-1] + [dict(messages[-1], content=messages[-1]["content"] + self._unclear_retry())])
again = "\n".join(ln for ln in again.splitlines() if not re.match(r"\s*\**ACTION", ln)).strip()
if again and not ASKS_AGAIN.search(again):
buf = full = again
@@ -3234,6 +3244,14 @@ class Brain:
first.endswith("?") or re.search(r"궁금|\bwonder|good question|좋은 질문", first, re.I) \
else {"action": "none", "target": ""} # the query written out, "궁금하시군요." then "잠시만요": a lookup
def _unclear_retry(self):
"""UNCLEAR_RETRY, and in a talk what the words most likely ask about: "why prison?", "누가 그랬는가?" right after
an answer were asked to be said again even on the retry (r13 train, 2026-10-27)."""
last = " ".join(ln for ln in topic_turn(self.history)[1].splitlines()
if not re.match(r"\s*\**ACTION", ln)).strip() if self.history else ""
return UNCLEAR_RETRY + (f"\n(Most likely they ask about your answer \"{last[:FRAGMENT_CHARS * 2]}\": answer that "
f"question about it, in a sentence or two.)" if last else "")
def _asks_again(self, header, sentence, text):
"""The model talks (action none) but asks to hear clear words again ("I'm not sure what you mean, could you
say it again?" to "Why the 15th?"): it is asked once more with UNCLEAR_RETRY."""
@@ -3258,7 +3276,8 @@ class Brain:
Lumi's own things ("속도는 얼마예요?", "이름이 뭐예요?") keeps them. Returns those subjects, the question before first ([] when none)."""
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))]
[m.group(1) for m in EN_SUBJECT.finditer(core(t))] + [m.group(1) for m in THAT_ONE_KO.finditer(core(t))] + \
[m.group(1) for m in OF_THING_KO.finditer(core(t))]
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)):
+3 -3
View File
@@ -15,7 +15,7 @@ QUICK = {"look", "lift", "wave", "arm", "go_to", "come", "come_back", "follow",
DRIVES = {"go_to", "come", "come_back", "follow", "move", "turn"} # after a failed step these depend on where Lumi is
_KO_ORDER = {"보": "봐", "흔들": "흔들어", "흔드": "흔들어", "돌": "돌아", "도": "돌아", "올리": "올려", "내리": "내려",
"높이": "높여", "낮추": "낮춰", "들": "들어", "드": "들어", "숙이": "숙여", "커지": "커져", "작아지": "작아져",
"낮아지": "낮아져", "높아지": "높아져", "돌리": "돌려", "오": "와", "따라오": "따라와", "가": "가"}
"낮아지": "낮아져", "높아지": "높아져", "돌리": "돌려", "오": "와", "따라오": "따라와", "가": "가", "하": "해", "알리": "알려"}
# "나 보고 ..." -> "나 봐", "고개 들고 ..." -> "고개 들어", "저를 보시고 ..." -> "저를 봐", "왼쪽으로 도시고" -> "왼쪽으로 돌아"
_KO_AND = re.compile(r"(" + "|".join(sorted(_KO_ORDER, key=len, reverse=True)) + r")(?:시)?고$")
ASK = re.compile(r"\?\s*$|^\W*(?:(?:also|and|then|so|ok|okay|robot|please|first|now|plus|oh|ah|um|uh|lumi)\W+)*"
@@ -23,7 +23,7 @@ ASK = re.compile(r"\?\s*$|^\W*(?:(?:also|and|then|so|ok|okay|robot|please|first|
r"would|should|time|day|date|year|old|much|many|far|long|about|kind|your|you|made|built|created|"
r"invented|owns|makes)\b)|why\b|is|are|do|does|did|tell me|explain|describe)\b|"
r"\b(?:tell|telling) (?:me|us)\b|\bintroduce yourself\b|\b(?:say|tell me) your name\b|"
r"몇 ?시|몇|뭐|무엇|어때|알려|언제|어디|누구|왜|얼마|날씨|설명해|말해 ?줘|말하|얘기해|소개", re.I)
r"몇 ?시|몇|뭐|무엇|어때|알려|알리(?=고)|날짜|언제|어디|누구|왜|얼마|날씨|설명해|말해 ?줘|말하|얘기해|소개", re.I)
_SPLIT = re.compile(steps._SPLIT.pattern, re.I)
FETCHING = re.compile(r"\b(?:bring|fetch|deliver|carry)\b|가져|갖다", re.I) # a part that carries something somewhere
_FILL = re.compile(rf"(?:{steps._FILL}|루미야?|lumi|hey|do me a favou?r|부탁(?:해|해요|할게)?|dear|sir|ma'?am|madam|buddy|"
@@ -70,7 +70,7 @@ def _rule(words, markers):
ko = _KO_AND.sub(lambda m: _KO_ORDER[m.group(1)], words.strip())
if not rule and ko != words.strip():
rule = brain.intent(ko, markers)
m = not rule and re.fullmatch(r"(?:(나|저|날|나를|저를)\s+)?([a-z][a-z ]*?)\s*(?:하고|해|해요|해 ?줘)?", words.strip())
m = not rule and re.fullmatch(r"(?:(나|저|날|나를|저를)\s+)?([a-z][a-z ]*?)\s*(?:하고|해|해요|해 ?줘|해 ?주세요|해 ?주십시오|해 ?줄래요?\??|해 ?주실래요?\??|해 ?봐)?", words.strip())
if m: # Konglish: "나 look 하고" -> "look at me", "wave 해" -> "wave"
en = m.group(2) + ((" at me" if m.group(2) == "look" else " me") if m.group(1) else "")
rule = brain.intent(en, markers)
+14 -2
View File
@@ -121,13 +121,25 @@ def _task(base):
def _pieces(r):
"""The reply's text pieces. An empty thought block the model writes itself ("<|channel>thought\n<channel|>",
the turn's NO_THINKING once more) is dropped: it was said as the whole reply once (r13 check, 2026-10-27)."""
thinking = False
with r:
for line in r:
if not line.startswith(b"data: "):
continue
d = json.loads(line[6:])
if d.get("content"):
yield d["content"]
piece, out = d.get("content") or "", ""
while piece:
if thinking:
_, end, piece = piece.partition("<channel|>")
thinking = not end
else:
said, start, piece = piece.partition("<|channel>")
out, thinking = out + said, bool(start)
piece = out
if piece:
yield piece
if d.get("stop"):
return
+10 -4
View File
@@ -1177,7 +1177,7 @@ class Lumi:
status = self.fetch_status()
if status == "holding":
from tasks import fetch
self.fetch_say(f"I'm holding {fetch.held_name()}, where should I put it first?", "뭔가 들고 있어요. 먼저 어디에 둘까요?")
self.fetch_say(f"I'm holding {fetch.held_name()}, where should I put it first?", f"{brain_mod.object_ko(fetch.held_name('ko'))} 들고 있어요. 먼저 어디에 둘까요?")
return
if status == "running":
self.end_run(text)
@@ -1510,12 +1510,13 @@ class Lumi:
f"try another way, or go back.",
f"{name}(으)로 가다가 길이 막혀서 멈췄어요. 다시 가거나, 다른 길로 가거나, 돌아갈 수 있어요.")
elif held:
en, ko = f"I'm holding {held} and waiting for what to do with it.", "물건을 들고 다음 지시를 기다리고 있어요."
en, ko = f"I'm holding {held} and waiting for what to do with it.", f"{brain_mod.object_ko(fetch.held_name('ko'))} 들고 다음 지시를 기다리고 있어요."
else:
return ("I'm talking with you. I'm not doing any task right now, and my hand is empty.",
"지금은 이야기하고 있어요. 하고 있는 일은 없고, 손도 비어 있어요.")
if held and (running or self.traveling()):
en += f" I'm holding {held}."
ko += f" {brain_mod.object_ko(fetch.held_name('ko'))} 들고 있어요."
return en, ko
# ---------- several commands in one sentence (assistant/chain.py) ----------
@@ -1685,7 +1686,7 @@ class Lumi:
from tasks import fetch
ko = fetch.OBJECTS.get(name, "물건")
if held:
self.fetch_say(f"My hand is full, I'm holding {fetch.held_name()}.", "손에 이미 물건을 들고 있어요.")
self.fetch_say(f"My hand is full, I'm holding {fetch.held_name()}.", f"손에 이미 {brain_mod.object_ko(fetch.held_name('ko'))} 들고 있어요.")
return
if self.arm_off():
return
@@ -1764,7 +1765,12 @@ class Lumi:
return
if action == "put":
back = target == "back"
said = ("Okay, putting it back.", "네, 제자리에 놓을게요.") if back else ("Okay, putting it down.", "네, 내려놓을게요.")
from tasks import fetch # the held thing named when it is known ("the white cup")
what = (fetch.held_name(), fetch.held_name("ko")) if (safe(fetch.state) or {}).get("holding") else ("it", "")
what = what if what[0] != "something" else ("it", "")
ko = brain_mod.object_ko(what[1]) + " " if what[1] else ""
said = (f"Okay, putting {what[0]} back.", f"네, {ko}제자리에 놓을게요.") if back else \
(f"Okay, putting {what[0]} down.", f"네, {ko}내려놓을게요.")
done = ("Done.", "다 했어요.")
run = lambda: skills.put_down(back=back)
else:
+34 -15
View File
@@ -56,12 +56,12 @@ KINDS = {
"누구야", "넌 누구니", "누구세요", "당신은 누구예요", "너 뭐야", "자기소개 해 줘", "자기소개 좀 해 주세요", "소개해 주세요",
"어떤 로봇이에요", "이 로봇은 뭐예요", "이건 무슨 로봇이야", "루미가 뭐야", "니 누고", "누구당가", "넌 뭐 하는 애야",
"여기서 뭐 하는 로봇이에요", "who are you 너", "넌 who야",
], {"en": ["I'm Lumi, a mobile robot assistant developed by Cutshion Company.",
], {"en": ["I'm Lumi, a mobile robot assistant developed by Cutshion Company. I talk with visitors, go to places and pick up and bring things.",
"I'm Lumi, a robot assistant made by Cutshion Company. I can talk, see, drive around and use my arm.",
"My name is Lumi. I'm a mobile robot assistant from Cutshion Company."],
"ko": ["저는 루미예요. 쿳션이 개발한 모바일 로봇 어시스턴트예요.",
"My name is Lumi. I'm a mobile robot assistant from Cutshion Company: I answer questions, guide people and bring things."],
"ko": ["저는 루미예요. 쿳션이 개발한 모바일 로봇 어시스턴트예요. 대화하고, 여러 곳에 가고, 물건을 집어서 가져다드려요.",
"저는 쿳션이 만든 로봇 어시스턴트 루미예요. 대화하고, 보고, 움직이고, 팔도 쓸 수 있어요.",
"루미라고 해요. 쿳션에서 개발한 모바일 로봇이에요."]}),
"루미라고 해요. 쿳션에서 개발한 모바일 로봇이에요. 질문에 대답하고, 길을 안내하고, 물건도 가져다드려요."]}),
"age": ([
"how old are you", "what is your age", "what's your age", "how old r u", "how old is lumi", "when were you born",
"when were you made", "when were you built", "how old is this robot", "are you old", "are you new", "your age?",
@@ -291,7 +291,11 @@ EVENT_TIME = re.compile(r"\b(?:what time|what day|which day|what date) (?:does|d
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)
OTHER_ROBOT = re.compile(r"\b(?:jaka|jacka|k1[wl]?|kargo|peitian|tusk)\b|자카|작카|节卡|페이톈|페이티엔|터스크|"
r"\b(?:that|the other|other|another|those) robots?\b|(?:저|그|옆에|옆의|옆|다른) ?로봇", re.I)
OTHER_DAY = re.compile(r"\b(?:tomorrow|yesterday|next (?:week|month|year|monday|tuesday|wednesday|thursday|friday|saturday|sunday)|"
r"last (?:week|month|year))\b|내일|어제|모레|그저께|글피|다음 ?주|지난 ?주|다음 ?달|지난 ?달|내년|"
r"(?:크리스마스|성탄절?)(?:가|는|이|은)? ?(?:무슨|몇) ?요일|\b(?:what|which) day (?:is|was|will be) christmas\b", re.I)
NAMES_LUMI = re.compile(r"\b(?:you|your|yourself|u|ur|lumi)\b|(?:^|\s)(?:너|넌|니|네|당신|루미|본인|자기)", re.I)
_bank = None
@@ -341,7 +345,7 @@ ASKING = re.compile(r"^\W*(?:(?:hang on|wait|okay|ok|so|um+|uh+|hey|excuse me|so
# "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"어이|이보게|여보게|야야|아야|우리|애기야|브로|bro|큰 로봇아|그려|옳지|잘 들어|자|(?:오빠|언니|이쁜이|선배님|사장님|기사님|아가씨|로봇 양반|양반)(?=\s*,)|"
r"얘|쟤|마|야|저기|저기요|잠깐(?:만)?|대박|사와디캅|참|아 맞다|맞다|"
r"(?:야|아야|우리|이보게|어이|야야) ?(?:루미야|루미|로봇아|로봇)|실례합니다|실례지만|실례할게요|하나 묻겠습니다|하나 물을게(?:요)?|루미루미|누미야|"
r"루미 ?(?:님|군|상|씨|언니|오빠|누나|형)|루미야|루미|로봇(?:아|님|씨)?|robot|lumi)(?![\w가-힣])[\s,.!?~:-]*)+", re.I)
@@ -372,7 +376,8 @@ def _core(text):
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?"
if not re.search(r"\b(?:is|was|name|named|called)\s+lumi\W*$|이름(?:이|은|을)?\s*루미", t, re.I): # "How wide is Lumi?",
# "왜 이름이 루미야?": the subject
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
@@ -413,6 +418,14 @@ def guarded(text, history=()):
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 re.search(r"날씨|날시|비 ?(?:와|오|올|온)|눈 ?(?:와|오|올)|미세 ?먼지|황사|우산|기온|덥|춥|\b(?:weather|rain|raining|snow|"
r"forecast|temperature|umbrella|sunny|cloudy)\b", t, re.I):
return "weather" # "오늘 미세먼지 어때?": the weather lookup, never how Lumi is
if re.search(r"충전\S*\s*(?:\S+\s+)?(?:얼마나|몇\s*시간|몇\s*분)\s*(?:\S+\s+)?걸|완충|충전\s*시간|"
r"\b(?:how long|how many hours)\b.*\b(?:to charge|charging|recharge|full charge take)\b|\bcharg\w* time\b", t, re.I):
return "charging time" # "충전하는 데 얼마나 걸려?": not known (the LLM says so), not the battery life
if OTHER_DAY.search(t):
return "another day" # "내일 며칠이야?", "크리스마스가 무슨 요일이야?": the LLM
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):
@@ -435,8 +448,10 @@ ORDER = re.compile(r"^\W*(?:please\s+)?(?:go|come|turn|take|bring|pick|put|give|
# 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)
ASIDE = re.compile(r"(?<=[가-힣])(?:니까|으니까|는데|인데|라서|이라서|라고 생각하고|동안)\s+|:\s+")
# the end of a remark said before the question, without a comma
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: "그러면 키가 몇이에요?", "아 그리고 몇 개 국어 해?"
@@ -461,19 +476,23 @@ def kind_of(text, history=(), _whole=True):
if parts and parts[0] != text:
return kind_of(parts[0], history)
got = _kind(text, history)
if got or not _whole:
if 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):
if not got and 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 not comma: # "셀카 찍을 거니까 너 몇 살이야?", "My move: why are you called Lumi?"
m = list(ASIDE.finditer(rest))
head, comma, tail = (rest[:m[-1].start()], ",", rest[m[-1].end():]) if m else (rest, "", "")
if comma and len(tail.split()) >= (2 if re.search(r"[가-힣]", tail) else 3) and ASKS.search(tail) and \
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
last = kind_of(tail, history, False)
if got and last and last != got:
return None # "저기 평가 항목, 루미, 오늘 무슨 요일이야?" read whole as another kind
return got or last
return got
def _kind(text, history):
+5 -2
View File
@@ -422,7 +422,9 @@ def _wait(c, markers, after):
g = m.groups()
obj = next((x for x in g if x in brain.OBJECTS), None)
num = next((x for x in g if x and re.fullmatch(r"[\d.]+", x)), None)
return [{"do": "receive", "object": brain.OBJECTS[obj] if obj else None, "wait_s": float(num) if num else WAIT_GIVE_S}]
col = next((brain.COLOURS[g[i - 1]] for i, x in enumerate(g) if x == obj and i and g[i - 1] in brain.COLOURS), None)
return [{"do": "receive", "object": brain.OBJECTS[obj] if obj else None, "wait_s": float(num) if num else WAIT_GIVE_S,
**({"colour": col} if col else {})}] # the colour said: told back, the person gives what they give
m = re.fullmatch(rf"(?:(.+?)에서\s*)?(?:(\d+(?:\.\d+)?) s\s*(?:동안|정도|만)?\s*)?{_KO_GIVER}\s*(?:({COL})\s*)?({OBJ}|물건|뭔가|무언가|그거|뭐|무엇을|뭘|이거)?\s*"
r"(?:을|를)?\s*(?:주면|건네주면|건네면|갖다주면|가져다주면|가져다 주면|줄 때까지|건네줄 때까지|줄 거야|"
r"줄 거예요|가져올 거야)\s*(?:기다렸다가|기다려서|기다리고|기다려|기다려요)?\s*"
@@ -430,7 +432,8 @@ def _wait(c, markers, after):
if m and (m.group(1) is None or _at_place(m.group(1), markers)):
obj = brain.OBJECTS.get(m.group(4) or "")
return ([{"do": "go", "to": _at_place(m.group(1), markers)}] if m.group(1) else []) + \
[{"do": "receive", "object": obj, "wait_s": float(m.group(2)) if m.group(2) else WAIT_GIVE_S}] + \
[{"do": "receive", "object": obj, "wait_s": float(m.group(2)) if m.group(2) else WAIT_GIVE_S,
**({"colour": brain.COLOURS[m.group(3)]} if m.group(3) else {})}] + \
([{"do": "go", "to": "here"}] if re.fullmatch(r"받아 ?(?:가지고 ?)?와", m.group(5) or "") else [])
if after and re.fullmatch(r"(?:거기|여기)(?:서|에서)", c):
return [] # "p3로 가서 | 거기서 | 기다려": the place of the next step