Improve talk answers, quick answers, weather and song requests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 10:15:14 +09:00
co-authored by Claude Opus 5.5
parent 1411676269
commit d223ff475f
9 changed files with 261 additions and 13 deletions
+44
View File
@@ -189,6 +189,50 @@ _BANK = {
("팔 접어 주세요.", "arm fold", "네, 팔을 접을게요."),
],
},
# settled knowledge that never changes is answered at once, never looked up (a lookup only for what changes:
# news, prices, today's scores, who holds an office now); also after thanks or other words around it
"settled_fact": {
"en": [
("When did people first land on the Moon?", "none", "In July 1969, with Apollo 11."),
("Okay, and who was first?", "none", "Neil Armstrong stepped out first, then Buzz Aldrin."),
("Thanks! And how high is Mount Fuji?", "none", "You're welcome! Mount Fuji is about 3,776 metres high."),
("When was Gyeongbokgung built?", "none", "In 1395, at the start of the Joseon dynasty."),
("So who lived there?", "none", "The kings of Joseon and their royal family."),
("How do bees tell each other where flowers are?", "none", "With a waggle dance: its angle and length show the way and the distance."),
("How long does a worker bee live?", "none", "Only about five to six weeks in summer."),
("How tall is Mount Everest?", "none", "About 8,849 metres, the highest mountain on Earth."),
("Um, when did the dodo die out?", "none", "By the late 1600s, on the island of Mauritius."),
("What do owls eat?", "none", "Mostly mice and other small animals, some eat insects or fish."),
("How fast is sound under water?", "none", "About 1,500 metres a second, some four times faster than in air."),
("Who painted the Mona Lisa?", "none", "Leonardo da Vinci, in the early 1500s."),
("How many bones does a baby have?", "none", "About 300; some grow together, so adults have 206."),
("Wait, how long is a marathon?", "none", "42.195 kilometres."),
("When was the Eiffel Tower built?", "none", "It was finished in 1889, for the World's Fair in Paris."),
("What's the capital of Australia?", "none", "Canberra, not Sydney."),
("Who's the president of France right now?", "search", "Let me check."),
("What's the score of today's Dodgers game?", "search", "Let me check."),
],
"ko": [
("사람이 달에 처음 간 게 언제야?", "none", "1969년 7월, 아폴로 11호 때예요."),
("그럼 누가 먼저 내렸어?", "none", "닐 암스트롱이 먼저 내렸고, 버즈 올드린이 뒤따랐어요."),
("고마워요! 근데 후지산은 얼마나 높아요?", "none", "천만에요! 후지산은 약 3,776미터예요."),
("경복궁은 언제 지어졌습니까?", "none", "1395년, 조선 초에 지어졌습니다."),
("거기 누가 살았어요?", "none", "조선의 왕과 왕실 가족이 살았어요."),
("벌은 꽃 위치를 어떻게 알려 줘?", "none", "엉덩이춤을 춰서 방향과 거리를 알려 줘요."),
("일벌은 얼마나 살아요?", "none", "여름에는 5주에서 6주쯤밖에 못 살아요."),
("에베레스트 높이가 얼마야?", "none", "약 8,849미터로, 세계에서 제일 높은 산이에요."),
("도도새는 언제 멸종했어요?", "none", "1600년대 후반에 모리셔스섬에서 사라졌어요."),
("부엉이의 먹이는 무엇입니까?", "none", "주로 쥐 같은 작은 동물을 먹습니다."),
("물속에서 소리 속도 몇임?", "none", "초속 약 1,500미터로, 공기 중보다 네 배쯤 빨라요."),
("모나리자 누가 그렸노?", "none", "레오나르도 다빈치가 1500년대 초에 그렸어요."),
("아기 뼈는 몇 개나 되나요?", "none", "약 300개예요. 자라면서 붙어서 어른은 206개가 돼요."),
("마라톤은 몇 킬로입니까?", "none", "42.195킬로미터입니다."),
("에펠탑은 언제 세워지셨는지 여쭤봐도 될까요?", "none", "1889년 파리 만국박람회 때 완공됐어요."),
("호주 수도가 어디게?", "none", "캔버라예요. 시드니가 아니에요."),
("지금 프랑스 대통령 누구야?", "search", "확인해 볼게요."),
("오늘 야구 결과 어떻게 됐어요?", "search", "확인해 볼게요."),
],
},
}
EXAMPLES = [(cat, lang, said, reply, action)
+18 -2
View File
@@ -253,9 +253,9 @@ QUICK_KINDS = {
"ko": ["컵, 머그, 유리잔, 병, 사과, 오렌지, 바나나를 탁자 높이에서 집을 수 있어요. 바닥에 있는 건 못 집어요. 실제로 집어 본 건 컵이에요.",
"탁자 높이에 있는 컵, 유리잔, 병, 그리고 사과, 오렌지, 바나나 같은 과일을 집어요. 바닥은 팔이 안 닿아서 못 집어요."]}),
"operator": ([
"who operates you", "who's in charge of you", "who takes care of you", "who looks after you", "who controls you",
"who operates you", "who's in charge of you", "who takes care of you", "who looks after you",
"who is responsible for you", "who runs you here", "is there a staff member",
"누가 관리해요", "관리자가 누구예요", "누가 운영해요", "누가 조종해요", "담당자가 누구예요",
"누가 관리해요", "관리자가 누구예요", "누가 운영해요", "담당자가 누구예요",
"책임자가 누구야", "관리는 누가 하십니까", "누가 관리하노", "manager 누구예요", "담당 staff 누구예요",
], {"en": ["Cutshion Company operates me here. If you need help with something I can't do, please ask a staff member."],
"ko": ["여기서는 쿳션이 저를 운영해요. 제가 못 하는 일은 직원에게 물어봐 주세요."]}),
@@ -376,3 +376,19 @@ for _kind, (_ko_n, _en_n) in HAVES.items():
QUICK_KINDS[_kind][0].extend(f.format(n) for f in EN_HAVE for n in _en_n)
QUICK_KINDS["dance"][0].append("춤 출 수 있어") # quick_answers.NO lists it for the LLM; it is this kind's now
QUICK_KINDS["arm"][0].extend(["팔 길이가 얼마야", "how long is your arm"])
# night 4: wordings the dev eval missed, at every level
for _kind, _texts in {
"size": ["how wide is lumi", "how wide is the robot", "how wide is this robot", "how big is lumi", "루미 폭이 얼마예요", "로봇 폭이 몇이야"],
"stairs": [s + e for s in ["계단도 올라가", "계단 올라가", "계단도 올라가실 수 있"] for e in ["니", "나요", "요", "", "노", "습니까", "세요"]],
"grow": ["최대 몇 센티까지 커져", "최대 몇 센티까지 커져요", "제일 높이 몇 센티까지 올라가", "얼마나 높아질 수 있어요", "how tall can you get",
"what's your tallest height", "몇 센티까지 늘어나요", "최대 높이가 몇이에요"],
"navigation": ["are you self-driving", "are you autonomous", "is this robot autonomous", "do you drive yourself", "자율주행 로봇이에요",
"혼자 다닐 수 있어", "혼자 다니세요", "스스로 운전해요"],
"software": ["is your code python", "are you programmed in python", "is lumi written in python", "파이썬으로 만들었어요", "코드 파이썬이야"],
"detector": ["do you run yolo", "is it yolo", "do you use yolo for detection", "욜로 써요", "YOLO 돌려요", "물체 인식 YOLO야"],
"touch": ["is it ok to touch the robot", "is it okay to touch lumi", "may people touch the robot", "are visitors allowed to touch you",
"로봇 만져도 돼요", "루미 만져도 되나요", "이 로봇 만져도 됩니까"],
"operator": ["who operates this robot", "who runs this robot", "who is in charge of this robot", "이 로봇 누가 운영해요", "이 로봇 관리자 누구예요"],
}.items():
QUICK_KINDS[_kind][0].extend(_texts)
+35 -1
View File
@@ -372,7 +372,6 @@ _MORE = {
"외로움 느껴", "너 살아 있어", "살아 있는 거 맞아", "생각할 줄 알아",
],
"no": [
"몇 년도에 세웠어", "언제 세웠어요", "언제 설립했어", "설립 연도가 언제예요", "회사 언제 세워졌어요",
"요즘 무슨 일 있어", "요즘 경제가 어때요", "요즘 경제 어때", "경기가 어때요", "요즘 뉴스 뭐 있어",
"how heavy can you lift", "can i lift you", "내가 너 들 수 있어", "are you taller than me", "are you taller than my dad",
"could you beat me in a race", "나랑 달리기 하면 누가 이겨", "who is faster you or me",
@@ -443,3 +442,38 @@ QUICK["no"] += [
"how much longer will you wait", "how long are you waiting", "how long will you wait", "what's the job", "what's your task now",
"introduce yourself then turn to your left", "자기소개하고 왼쪽 봐", "고개 숙이고 이름 알려 줘", "오른쪽 보고 나이 말해 줘",
]
# "노래 부를 줄 알아요?": an ability question, answered; the song comes on "yes" / "불러 줘" (brain.DO_IT, SING_ASK).
# A request ("노래 불러 줘", "can you sing?", "노래 부를 수 있어?") is audio/sing.asked's and never reaches this kind.
_SING_KO = [s + e for s in ["노래 부를 줄 ", "노래 할 줄 ", "노래할 줄 ", "노래도 할 줄 ", "노래도 부를 줄 ", "너 노래 할 줄 ", "루미 노래 부를 줄 ",
"노래 하실 줄 ", "노래 부르실 줄 ", "혹시 노래 부를 줄 "]
for e in ["알아", "알아요", "아니", "아세요", "아십니까", "압니까", "아나", "아나요", "알아유", "아노", "알지", "알죠"]]
QUICK_KINDS["can_sing"] = (_SING_KO + [
"do you know how to sing", "are you able to sing", "is singing something you can do", "do you sing", "can robots like you sing",
"do you know how to sing songs", "are you able to sing at all", "is lumi able to sing", "do you know any singing",
"노래 부를 줄은 알아", "노래는 할 줄 알아요", "노래 부르는 거 할 줄 알아", "singing 할 줄 알아", "sing 할 줄 알아요",
], {"en": ["Yes, I can sing! I have a few songs of my own. Shall I sing one for you?",
"I can! I know some songs of my own. Want to hear one?"],
"ko": ["네, 노래할 수 있어요! 제 노래가 몇 곡 있어요. 한 곡 불러 드릴까요?",
"할 줄 알아요! 제 노래가 있는데, 한 곡 들어 보실래요?"]})
QUICK["no"] += ["노래 불러 줘", "노래 불러 줄래", "노래 한 곡 불러 주세요", "sing a song", "sing me a song", "sing for me",
"노래 좋아해", "노래 잘해", "do you like singing", "what songs can you sing", "무슨 노래 할 줄 알아", "부를 줄 아는 노래 뭐야",
"춤 출 줄 알아", "요리할 줄 알아", "수영할 줄 알아", "거짓말 할 줄 알아", "can you cook", "do you know how to swim"]
# whose robot Lumi is ("너 어느 회사 거야?", "어디 회사 거예요?"): the maker, not the company's place (co_hq) or what it does (co_what)
QUICK["maker"] = QUICK.get("maker", []) + [
s + e for s in ["너 어느 회사 거", "어느 회사 거", "어디 회사 거", "너 어디 회사 거", "루미 어디 회사 거", "이 로봇 어느 회사 거", "이 로봇 어디 회사 거",
"어느 회사 제품", "어디 제품", "어느 회사 로봇", "너 어디 제품", "어디서 나온 로봇"]
for e in ["야", "예요", "에요", "니", "입니까", "인가요", "고", "여", "냐", "임", "이야", "이에요"]] + [
"who designed and built you", "who built and designed you", "who made and programmed you", "what company built you",
"which company built you", "what company created you", "which company designed you", "whose robot are you",
"whose robot is this", "which brand are you", "what brand is this robot",
]
QUICK["who"] = QUICK.get("who", []) + ["tell me about you", "tell me something about you", "tell me a bit about you", "what do you do",
"what do you do exactly", "what is it you do", "what's your job here", "what's your role", "너에 대해 알려 줘", "너에 대해 말해 줘",
"너에 대해 알려 주세요", "루미에 대해 알려 주세요", "당신에 대해 소개해 주세요"]
QUICK["height"] = QUICK.get("height", []) + ["how tall is this thing", "how tall is this machine", "how tall is the robot", "how high is lumi",
"이거 키가 얼마야", "이 기계 키 몇이에요"]
QUICK["name_meaning"] = QUICK.get("name_meaning", []) + [
s + e for s in ["루미 무슨 뜻", "루미가 무슨 뜻", "루미는 무슨 뜻", "루미라는 이름 무슨 뜻", "루미 뜻", "루미란 이름은 무슨 뜻"]
for e in ["이에요", "이야", "이니", "입니까", "이고", "이여", "인가요", "이죠"]] + [
"why is your name lumi", "why are you named lumi", "what does the name lumi mean", "why the name lumi",
"왜 루미라고 불러", "왜 이름이 루미야", "왜 루미예요", "왜 루미라고 지었어요"]
+5 -3
View File
@@ -267,7 +267,7 @@ _said = {t for texts, _ in KINDS.values() for t in texts}
NO = [t for t in NO if t not in _said] # a wording listed for a kind is that kind's
CAMERA = re.compile(r"\b(?:see|seeing|saw|look(?:s|ing)?|watch|camera|wearing|holding|in front of|behind|colou?r|"
r"recogni[sz]e|remember)\b|보여|보이|보니|(?<!해 )(?<!해)봐|봤|입었|들고|색|카메라|앞에|뒤에|알아봐|기억", re.I)
r"recogni[sz]e|remember)\b|보여|보이|보니|(?<!해 )(?<!해)(?<!쭤 )(?<!쭤)(?<!여쭈어 )봐|봤|입었|들고|색|카메라|앞에|뒤에|알아봐|기억", re.I)
ABOUT_ME = re.compile(r"\b(?: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|"
@@ -307,7 +307,8 @@ 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|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"야야|궁금한 ?게 있는데(?:요)?|하나 여쭤봐도 될까요\??|여쭤봐도 될까요\??|궁금한데(?:요)?|궁금해서(?:요)?|"
r"하나 물어봐도 (?:돼|될까)요?|여쭤봐도 될까요|물어볼게(?:요)?|질문(?: 하나)?(?: 있어요| 있는데요?)?)"
r"\b[\s,.!?~:-]*)+", re.I)
# "May I ask your age?", "Hang on, let me ask it. What's your name?", "궁금한데, 몇 살이에요?": the question after
@@ -317,7 +318,8 @@ def _core(text):
from assistant import brain
t = ASKING.sub("", brain.CALLING.sub("", brain.unfill(text or "")).strip()).strip() or text or ""
t = re.sub(r"[\s,]*(?:lumi|루미야|루미)?[\s,.!?~]*$", "", t, flags=re.I).strip()
return t or (text or "").strip(" ,.!?~")
t = re.sub(r"얼만가$", "얼마예요", re.sub(r"(?<=[가-힣])는가$", "나요", re.sub(r"(?<=[가-힣])인가$", "인가요", t)))
return t or (text or "").strip(" ,.!?~") # 하게체 questions ("키 얼만가", "얼마나 되는가") as 해요체
def guarded(text, history=()):
+39
View File
@@ -1878,6 +1878,45 @@ FOLLOWUPS += [
]
# Night 4: the visitor says Lumi's earlier answer was different (every Korean level, English): the same facts said
# again, never "which part?"; and parts of animals and things that sound like Lumi's own (a head, eyes, arms, a song)
# are about that animal or thing, never about Lumi.
FOLLOWUPS += [
("ko", "대나무는 얼마나 빨리 자라?", "어떤 대나무는 하루에 수십 센티미터씩 자라요.",
"대나무 얘기 아까랑 말이 다르잖아.", "아까도 하루에 수십 센티미터씩 자란다고 말씀드렸어요. 그 사실은 그대로예요."),
("ko", "코알라는 하루에 얼마나 자요?", "하루에 18시간에서 22시간쯤 자요.",
"코알라 얘기 아까캉 다르다 아이가?", "아니에요, 아까도 하루 18시간에서 22시간쯤 잔다고 말씀드렸어요."),
("ko", "인삼은 왜 그늘에서 키워요?", "인삼은 햇빛에 약해서 그늘막 아래에서 키워요.",
"야 인삼 아까랑 말 바뀐 거 같은데?", "바뀐 건 없어요. 인삼은 햇빛에 약해서 그늘에서 키운다고 말씀드렸어요."),
("ko", "고래 노래는 얼마나 멀리 가요?", "수십에서 수백 킬로미터까지 퍼질 수 있어요.",
"고래 노래 얘기 아까랑 말이 다르잖아요.", "아까도 수십에서 수백 킬로미터까지 간다고 말씀드렸어요. 물속에서는 소리가 멀리 가요."),
("ko", "연어는 어떻게 고향 강을 찾습니까?", "태어난 강의 냄새를 기억해서 찾아갑니다.",
"앞서 하신 말씀과 다르지 않습니까?", "같은 말씀을 드렸습니다. 연어는 태어난 강의 냄새를 기억해서 돌아옵니다."),
("ko", "코알라 새끼는 주머니에 얼마나 있어요?", "약 6개월 동안 주머니 안에서 자라요.",
"말씀하신 게 아까랑 좀 다르신 것 같은데요?", "아까와 같아요. 새끼는 약 6개월 동안 주머니 안에서 자라요."),
("en", "How far can a whale song travel?", "Many kilometres, sometimes hundreds, because sound travels far in water.",
"Earlier you said something else about whale songs.", "No, I said the same: many kilometres, sometimes hundreds."),
("en", "Why do owls turn their heads so far?", "Their eyes are fixed in the skull, so they turn the head instead, up to 270 degrees.",
"That's not what you said before.", "It is: owls turn their heads up to 270 degrees because their eyes can't move."),
("en", "How many hearts does an octopus have?", "Three: two for the gills and one for the body.",
"You changed your answer, didn't you?", "No, it's still three hearts: two for the gills and one for the body."),
# parts of an animal or a thing are its own, not Lumi's
("ko", "부엉이는 고개를 몇 도까지 돌릴 수 있습니까?", "약 270도까지 돌릴 수 있습니다.",
"목뼈는 몇 개입니까?", "부엉이의 목뼈는 14개로, 사람의 두 배입니다."),
("ko", "부엉이는 고개를 몇 도까지 돌릴 수 있습니까?", "약 270도까지 돌릴 수 있습니다.",
"눈이 고정된 이유가 무엇입니까?", "부엉이의 눈은 아주 커서 머리뼈 안에 꽉 끼어 있기 때문입니다."),
("ko", "부엉이 눈은 왜 그렇게 커요?", "밤에 빛을 많이 모으려고 커요.",
"혈관에 문제가 생기지 않아요?", "목의 혈관에 여유 공간이 있어서 고개를 돌려도 피가 잘 흘러요."),
("ko", "문어는 다리가 몇 개고?", "8개예요.",
"와 그래 똑똑하노?", "신경세포의 상당수가 다리에 있어서 다리마다 따로 생각하듯 움직여요."),
("en", "Why do owls turn their heads so far?", "Their eyes are fixed in the skull, so they turn the head instead.",
"And their eyes, why so big?", "To catch as much light as possible when they hunt at night."),
("en", "How do elephants use their trunks?", "To breathe, smell, drink and pick things up.",
"How strong is the arm, I mean the trunk?", "Very strong: an elephant's trunk can lift a few hundred kilograms."),
("en", "Why do whales sing?", "Mostly to find mates and to keep in touch over long distances.",
"Can you hear it?", "People hear it with underwater microphones called hydrophones."),
]
def pick_followup(said, before_q, before_a, lang, k=2):
"""Up to k FOLLOWUPS closest to this follow-up: the follow-up's own words count most (a "why?" shows a "why?"),
then the talk before it; same language first."""
+2 -2
View File
@@ -132,10 +132,10 @@ DAY_BEFORE = re.compile(r"\bthe day before\b(?! yesterday)|그 ?전 ?날", re.I)
FIXED_DAY = re.compile(r"\bday after tomorrow\b|\bday before yesterday\b|내일 ?모레|글피|그저께|그제|모레|"
r"(?<![a-z])(?:today|tonight)(?![a-z])|\b(?:this |in the )?(?:morning|afternoon|evening)(?![a-z])|"
r"\bright now\b|\bnow\b|오늘|지금|(?<![a-z])tomorrow(?![a-z])|내일|(?<![a-z])yesterday(?![a-z])|어제|"
r"아침|오전|오후|저녁|(?<![가-힣])밤(?:에는|에|은|엔|이)?(?![가-힣])", re.I) # "tomorrow는?", "저녁에는?": English
r"아침|오전|오후|저녁|(?<![가-힣])밤(?:에는|에|은|엔|이)?(?![가-힣])|(?<![가-힣])낼(?=[은는도]|\s|\W|$)", re.I) # "tomorrow는?", "저녁에는?": English
# words next to Korean ones have no \b; a part of the day alone is today's
FIXED_OFFSET = {"day after tomorrow": 2, "day before yesterday": -2, "내일모레": 2, "내일 모레": 2, "글피": 3,
"그저께": -2, "그제": -2, "모레": 2, "tomorrow": 1, "내일": 1, "yesterday": -1, "어제": -1}
"그저께": -2, "그제": -2, "모레": 2, "tomorrow": 1, "내일": 1, "낼": 1, "yesterday": -1, "어제": -1}
IN_DAYS = re.compile(r"\bin (\d+|one|two|three|four|five|six|seven) days?\b|(\d+|이틀|사흘|나흘) ?(?:일)? ?(?:후|뒤)", re.I)
WEEKDAY = re.compile(r"(?<![a-z])(monday|tuesday|wednesday|thursday|friday|saturday|sunday)s?(?![a-z])|([월화수목금토일])요일", re.I)
WEEKEND = re.compile(r"(?<![a-z])weekend(?![a-z])|주말", re.I)