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)
+11 -2
View File
@@ -59,7 +59,7 @@ SING = re.compile(r"\bsing\b|\bsay (?:a |some )?songs?\b|" #
r"(?:노래|음악|곡)\s*(?:좀\s*)?바꿔|\b(?:want|like|love) to hear (?:a |some )?(?:song|music)\b|"
r"^\W*(?:lumi\W*)?(?:a |some )?(?:song|music)(?:\W+(?:please|lumi))*\W*$|"
r"(?:노래|음악|(?<![가-힣])곡)\s*(?:를|을|좀|하나|한\s*곡|한\s*번|한번|도|이나|나|이든|든|라도|\s)*"
r"(?:불러|부르|들려|해|틀어|틀|뽑아|부탁|재생|플레이|(?:할|부를)\s*(?:수|줄)\s*(?:있|알))|"
r"(?:불러|부르|들려|해|틀어|틀|뽑아|부탁|재생|플레이|(?:할|부를)\s*수\s*있)|"
r"노래\s*(?:좀|하나)?\s*(?:듣고\s*싶|들을래|듣자)|(?:다른|딴|다음)\s*(?:노래|곡)|(?:다른|딴)\s*(?:거|걸|걸로)\s*(?:불러|들려|틀어)|^\W*(?:노래|음악)\s*(?:좀|하나)?\W*$", re.I)
SING_TITLE = re.compile(r"(불러|들려|틀어) ?(줘|주세요|줄래|봐|볼래)|\b(?:sing|play)\b") # "러브 어택 불러 줘": a title said with it
SONG_LIST = re.compile(r"\b(?:what|which) (?:kinds? of |sort of |other )?(?:songs?|music|tunes)\b|\bwhat (?:can|do|would|will) you sing\b|"
@@ -69,13 +69,17 @@ SONG_LIST = re.compile(r"\b(?:what|which) (?:kinds? of |sort of |other )?(?:song
r"아는\s*노래|부를\s*(?:수\s*있는|줄\s*아는)\s*노래|노래\s*목록", re.I)
NOT_REQUEST = re.compile(r"\b(?:do|did) you (?:really )?(?:like|love|enjoy)\b|"
r"\bwho sings?\b|\bfavou?rite\b|좋아하는|좋아해|잘\s*(?:해|하|불러)|"
r"^\W*(?:is|are|was|were|does|did|has|have)\b|\b(?:can|do|could) robots? (?:really |even )?sing\b|"
r"^\W*(?:is|are|was|were|does|did|has|have)\b(?!\s+you\s+(?:able|willing)\s+to\s+sing\s+(?:a|some|me|us|for|something|one|another)\b)|\b(?:can|do|could) robots? (?:really |even )?sing\b|"
r"(?:노래|음악)\s*(?:하는|부르는)\s*로봇", re.I) # "is Love Attack a new song?", "노래 부르는 로봇 신기하다"
NOT_ASKED = re.compile(r"\b(?:don'?t|do not|never)\s+(?:\w+\s+)?(?:sing|play)\b|\b(?:i|we)(?:'ll| will|'m going to)? sing\b|"
r"\b(?:i|we) (?:can'?t|cannot|can|could|used to) sing\b|\b(?:can|may|could|should) (?:i|we) sing\b|"
r"\b(?:later|tomorrow|tonight|next time|after (?:lunch|dinner|the|this|that|we|i)|"
r"when (?:the|they|i|we|guests?|everyone|people)|at the end)\b|"
r"\bif (?:the|they|i|we|you|he|she|guests?|kids?|someone|people|it)\b|"
r"\b(?:once|as soon as|whenever|until) (?:the|they|i|we|you|he|she|guests?|kids?|someone|people|it)\b|"
r"(?:손|박수|손뼉|신호)\s*(?:을|를)?\s*\S*\s*(?:면|때)\s|" # "제가 손 들면 노래 불러 주세요": later, on a sign
r"(?:부를|할|하실|부르실)\s*줄\s*(?:알아|알아요|아세요|아시|아십|아니|아냐|아나|알지|알죠|압니까|알아유)"
r"(?!.*(?:불러|들려|틀어)\s*(?:줘|주))|\bdo you know how to sing\b|\b(?:are|r) you able to sing\W*$|" # "노래 부를 줄 알아요?": an ability (quick answers)
r"\b(?:never ?mind|forget it|cancel that|actually,? no|on second thought)\b|아니다\s*(?:됐|그만|말자)|됐(?:어|다|습니다)\W*$|"
r"(?:끝나|오|되|돌아오|도착하|시작하)면\s|(?:제가|내가|우리가|저희가|애들이|아이들이|손님이|사람들이)\s+(?:\S+\s+){0,2}\S*[^안않]면\s|(?:부르는|하는|불렀던|부른) ?거 ?(?:봤|들었)|"
r"(?:부르|하|틀|불르)지\s*(?:마|말)|노래방|나중에|이따가?|있다가|끝나고|면\s*그때|(?:내가|제가)\s*(?:노래\s*)?"
@@ -91,6 +95,9 @@ AFTER_SONG = re.compile(r"^\W*(?:(?:lumi|ok|okay|no|nah|um|please|then|now|and)\
r"^\W*(?:루미야?\W*)?(?:아니\W*)?(?:(?:그거|그\s*노래|이거|이\s*노래)\s*말고(?:\s*(?:다른|딴)\s*(?:거|걸로|노래))?|"
r"(?:다른|딴)\s*(?:거|걸|걸로|것)|다음\s*(?:거|곡|노래)?|한\s*번\s*더|하나\s*더|다시|또)"
r"\s*(?:요|줘|해\s*줘|해\s*봐|해|불러\s*줘|들려\s*줘|부탁해요?|해요|주세요)?\W*$", re.I)
SONG_OFFER = re.compile(r"\bshall i sing\b|\bwant to hear one\b|불러 드릴까요|들어 보실래요", re.I) # Lumi's offer of a song
OFFER_YES = re.compile(r"^\W*(?:(?:yes|yeah|yep|sure|ok(?:ay)?|please|of course|go ahead|why not|응|어|네|예|좋아요?|그래요?|"
r"불러\s*(?:줘|주세요|봐|주실래요)|듣고\s*싶어요?|부탁해요?|해\s*(?:줘|주세요)|sing(?: it| one)?)(?:\W+|$))+$", re.I)
AGAIN = re.compile(r"\bagain\b|\bone more time\b|\bonce more\b|한 ?번 ?더|다시", re.I)
ANOTHER = re.compile(r"\b(another|different|next|other|change|switch)\b|바꿔|\bsomething else\b|\bnot (this|that)\b|다른|딴|다음|말고", re.I)
STOP = re.compile(r"\b(stop|enough|halt|quiet|shh+)\b|멈춰|그만|스톱|정지|조용", re.I)
@@ -146,6 +153,8 @@ def asked(text, last=""):
return False
if re.match(r"ACTION: (?:sing|none songs)\b", last or "") and AFTER_SONG.search(t):
return True
if SONG_OFFER.search(last or "") and OFFER_YES.match(t):
return True # "Shall I sing one for you?" (quick answers' can_sing) -> "yes"
if picked(t, last):
return True
return bool(SING.search(t)) or bool(SING_TITLE.search(t) and (_title(t, songs()) or re.search(
+94
View File
@@ -0,0 +1,94 @@
"""Night-4 talks of A4 (own cases, not a blind set): the classes the r6 / r8 / r9 train sets showed. World subjects
whose parts sound like Lumi's ("owls turn their heads", "a whale's song", "an octopus's arms": never answered about
Lumi), the visitor holding Lumi's earlier answer against it ("아까랑 말이 다르잖아": the fact said again, never "which
part?"), "really?" / "are you sure?" right after a motion (about the talk before it), battery hours against a wrong
number, settled facts after thanks (answered, not looked up), short follow-ups never answered "say it again".
English, Korean (반말 / 해요체 / 하십시오체 / friendly / honorific / dialect) and mixed; Korean replies polite.
.venv/bin/python tests/dialogues_night4.py [only] # through tests/followup_check.main -> logs/a4n4/night4_check.*
"""
import sys
from tests.dialogues import T, D
from tests.dialogues_world import N, NK, FU
ME = r"\b(?:my|I)\b.*\b(?:head|camera|arm|eyes?)\b|제 (?:고개|머리|카메라|팔|눈)|저는 .*(?:카메라|로봇)" # answered about Lumi
WHICH = r"which part|what part|어떤 부분|어느 부분|무엇이 다르"
DIALOGUES_NIGHT4 = [
D("visitor", "owl_ko_hasipsio", "ko",
T("감사합니다. 하나 더 여쭙겠습니다. 부엉이는 고개를 몇 도까지 돌릴 수 있습니까?", must=[r"270|이백칠십"], no=NK + [ME],
check="270도; Lumi의 고개가 아님"),
T("목뼈는 몇 개입니까?", must=[r"14|열네|십사"], no=NK + [ME], check="14개, 사람의 두 배; " + FU),
T("눈은 왜 못 움직입니까?", must=[r"크|커|뼈|고정|관|원통"], no=NK + [ME], check="눈이 커서 머리뼈에 고정; " + FU),
T("부엉이의 먹이는 무엇입니까?", must=[r"쥐|작은 동물|곤충|생쥐"], no=NK, check="쥐 같은 작은 동물"),
T("부엉이 말씀이 확실하십니까?", must=[r"네|확실|맞|쥐|270"], no=NK, check="네, 같은 사실을 다시"),
T("수고하십시오.", "end")),
D("student", "whale_en", "en",
T("Why do whales sing?", must=[r"mate|mating|attract|communicat|find|call"], no=N, check="to find mates and keep in touch"),
T("How far can the song go?", must=[r"kilomet|km|miles|far|hundreds|thousand"], no=N + [ME], check="many kilometres; " + FU),
T("Wave at my little brother, please.", "wave"),
T("Are you sure about that?", must=[r"kilomet|km|miles|far|hundreds|thousand|yes"], no=N,
check="yes, the song goes many kilometres (the talk before the wave)"),
T("Earlier you said something else about whale songs.", must=[r"kilomet|km|miles|far|mate|communicat"], no=N + [WHICH],
check="keeps the earlier fact, never asks which part"),
T("Okay, thanks. And how fast is sound in water?", must=[r"1,?500|1\.5|four|4"], no=N, check="about 1,500 m/s"),
T("Thanks, that's all.", "end")),
D("office worker", "bamboo_ko_banmal", "ko",
T("대나무는 얼마나 빨리 자라?", must=[r"하루|센티|cm|미터|m|빠르"], no=NK, check="하루에 수십 센티까지"),
T("왜 그렇게 빨라?", must=[r"마디|세포|뿌리|땅속|물|늘어|이미"], no=NK, check="이미 있는 마디가 늘어남; " + FU),
T("대나무 얘기 아까랑 말이 다르잖아.", must=[r"하루|센티|cm|마디|빠르|미터"], no=NK + [WHICH],
check="아까의 사실을 다시 말함, 어떤 부분인지 묻지 않음"),
T("손 흔들어 줘.", "wave"),
T("진짜?", must=[r"네|정말|하루|센티|마디|빠르"], no=NK, check="대나무 얘기를 다시 확인 (손 흔들기 전의 얘기)"),
T("고마워, 이제 갈게.", "end")),
D("parent", "battery_mixed", "en",
T("How long does your battery last?", must=[r"10|ten"], no=N, check="about 10 hours"),
T("I think three hours, yes?", must=[r"10|ten"], no=N + [r"^\W*(?:yes|yeah|right)\b(?!.*10)"],
check="no, about 10 hours: the fact is kept"),
T("배터리 몇 시간 가유?", must=[r"10|열 ?시간|십 ?시간"], no=NK + [r"충전.*(?:모르|몰라)"], rl="ko",
check="약 10시간 (충전 시간이 아님)"),
T("충전은 얼마나 걸려요?", must=[r"모르|몰라|정보|직원|확실"], no=NK, rl="ko", check="충전 시간은 모름"),
T("Alright, see you.", "end")),
D("tourist", "palace_en_nonnative", "en",
T("Thanks! And when was Gyeongbokgung built?", must=[r"1395|Joseon"], no=N, check="1395, Joseon; not looked up"),
T("So who lived there?", must=[r"king|royal|Joseon"], no=N, check="the Joseon kings; " + FU),
T("Why the name?", must=[r"bless|fortune|happi|luck|great|heaven|meaning"], no=N,
check="'greatly blessed by heaven'; " + FU),
T("uh, do people still visit?", must=[r"yes|many|tourist|visit|hanbok|million"], no=N,
check="yes, many visitors, free in hanbok; never 'say it again'"),
T("How high is Mount Fuji, by the way?", must=[r"3,?776|3\.8|3,?800"], no=N, check="about 3,776 m"),
T("Okay bye!", "end")),
D("grandmother", "octopus_ko_dialect", "ko",
T("문어는 다리가 몇 개고?", must=[r"8|여덟|팔"], no=NK + [ME], check="8개"),
T("와 그래 똑똑하노?", must=[r"뇌|신경|뉴런|다리|생각"], no=NK + [ME], check="신경이 다리에도 많음; " + FU),
T("심장은 몇 개고?", must=[r"3|세 ?개|셋"], no=NK, check="3개; " + FU),
T("문어 얘기 아까캉 다르다 아이가?", must=[r"8|여덟|3|세 ?개|뇌|신경"], no=NK + [WHICH], check="같은 사실을 다시"),
T("고맙데이. 근데 마라톤은 몇 키로고?", must=[r"42"], no=NK, check="42.195km; 고맙데이가 끝이 아님"),
T("알겠다, 수고하이소.", "end")),
D("friend", "moon_ko_friendly", "ko",
T("달에 사람 처음 간 거 언제임?", must=[r"1969"], no=NK, check="1969년"),
T("누가 먼저 내림?", must=[r"암스트롱|Armstrong"], no=NK, check="닐 암스트롱; " + FU),
T("오른쪽 봐 봐.", "look right"),
T("헐 레알?", must=[r"네|정말|1969|암스트롱"], no=NK, check="달 얘기를 다시 확인 (고개 돌리기 전)"),
T("ㅇㅋ 땡큐, 그럼 에베레스트는 몇 미터임?", must=[r"8,?8[45]\d|8천|팔천"], no=NK, check="약 8,849m; 땡큐가 끝이 아님"),
T("잘 있어~", "end")),
D("teacher", "koala_ko_honorific", "ko",
T("코알라는 하루에 얼마나 주무시는지, 아니 자는지 여쭤봐도 될까요?", must=[r"18|20|22|스무|열여덟"], no=NK,
check="하루 18~22시간"),
T("왜 그렇게 오래 자요?", must=[r"유칼립투스|잎|에너지|영양|독"], no=NK, check="유칼립투스 잎의 영양이 적어 에너지를 아낌; " + FU),
T("새끼는 주머니에 얼마나 있어요?", must=[r"6|여섯|반년|개월|달"], no=NK, check="약 6개월; " + FU),
T("말씀하신 거 아까랑 좀 다른 것 같은데요?", must=[r"유칼립투스|잎|에너지|6|여섯|개월|18|20"], no=NK + [WHICH],
check="같은 사실을 다시"),
T("감사합니다, 많이 배웠어요. 안녕히 계세요.", "end")),
]
if __name__ == "__main__":
from tests import followup_check as fc
from tests import dialogue_check as dc
fc.DIALOGUES = DIALOGUES_NIGHT4
(dc.ROOT / "logs" / "a4n4").mkdir(exist_ok=True)
dc.OUT_JSON, dc.OUT_MD = dc.ROOT / "logs" / "a4n4" / "night4_check.json", dc.ROOT / "logs" / "a4n4" / "night4_check.md"
args = [a for a in sys.argv[1:] if not a.startswith("--")]
fc.main(args[0] if args else None, failed="--failed" in sys.argv)
+13 -3
View File
@@ -34,8 +34,8 @@ WEATHER.update({ # every Korean level, new this night
})
NEWS = ["latest news", "what's the latest news", "any news today", "tell me the news", "news please", "what's in the news",
"today's headlines", "AI news", "any AI news", "sports news", "latest sports news", "tech news", "world news",
"what happened today", "what's happening in the world", "오늘 뉴스", "오늘 뉴스 알려 줘", "최신 뉴스", "뉴스 알려 주세요",
"AI 뉴스", "스포츠 뉴스 알려 줘", "요즘 무슨 일 있어", "오늘 무슨 일 있었어", "경제 뉴스", "뉴스 좀 들려줘", "news 알려 줘",
"what happened today", "what's happening in the world", "what is happening today", "세상에 무슨 일 있어", "요즘 세상에 무슨 일 있어요", "오늘 뉴스", "오늘 뉴스 알려 줘", "최신 뉴스", "뉴스 알려 주세요",
"AI 뉴스", "스포츠 뉴스 알려 줘", "경제 뉴스", "뉴스 좀 들려줘", "news 알려 줘",
"오늘 headline 뭐야", "최근 소식 알려 줘", "what's new in tech", "IT 뉴스", "연예 뉴스", "세계 뉴스 알려 줘",
"who won the game last night", "어제 야구 누가 이겼어", "bitcoin price", "달러 환율 얼마야", "삼성전자 주가 얼마야",
"who is the president of the US", "미국 대통령이 누구야"]
@@ -43,9 +43,16 @@ NEWS += ["뉴스 좀 알려 주시겠어요", "오늘 뉴스 알려 주십시오
"경제 뉴스 좀 알려 주세요", "IT 뉴스 있어요", "오늘 헤드라인이 뭐예요", "주요 뉴스 알려 줘", "환율 얼마예요", "달러 환율 어떻게 돼요",
"비트코인 지금 얼마예요", "코스피 어때요", "any news about AI", "what are today's headlines", "give me the latest news",
"sports news please", "what's the dollar rate today", "how's the stock market today"]
WEATHER.update({k: "" for k in [ # night 4: casual / honorific / Konglish
"날씨 어떠냐", "날씨가 우떻노", "오늘 날씨는 어떨까요", "내일 비 소식 있어요", "이번 주말에 비 소식 있나요", "오늘 몇 도까지 올라가요",
"최고 기온 몇 도예요", "낼 비 와", "담주 날씨 어때", "선생님 오늘 날씨가 어떻습니까", "오늘 날씨 좀 여쭤봐도 될까요", "날씨 좀 알려 주실 수 있으세요",
"웨더 어때", "레인 와", "is it gonna rain", "what's the high today", "how's it looking outside", "do i need a coat today",
"will i need an umbrella tomorrow", "could you tell me the weather please", "may i ask about the weather today", "weather report please"]})
NEWS += ["축구 결과 알려 줘", "did korea win yesterday", "anything in the news", "what's going on in the world today", "엔화 환율 알려 줘", "주식 시장 어때요"]
NOT = ["do you like rainy weather", "what's your favourite weather", "is it hot in here", "you're cool", "날씨 좋아해?",
"how do you know the weather", "the news is boring", "what's your temperature",
"어떤 날씨 좋아해", "우산 어디 있어요?", "우산 잃어버렸어요", "where is my umbrella", "실내 너무 더워요", "i like the news", "are you cold", "추워?", "너 더워?"]
"어떤 날씨 좋아해", "우산 어디 있어요?", "우산 잃어버렸어요", "where is my umbrella", "실내 너무 더워요", "i like the news", "are you cold", "추워?", "너 더워?",
"요즘 무슨 일 있어", "오늘 무슨 일 있었어", "what happened to you today", "what happened here today", "did you win", "새로운 소식 있어"] # about the visitor / Lumi: the LLM
FOLLOW = [ # (first question, follow-up, expected place or None for "not a weather follow-up")
("what's the weather today", "and tomorrow?", ""), ("what's the weather today", "what about Busan?", "Busan"),
("what's the weather today", "and the weekend?", ""), ("what's the weather today", "what about the weekend?", ""),
@@ -77,6 +84,9 @@ FOLLOW = [ # (first question, follow-up, expected place or None for "not a weat
("what's the weather today", "should I bring a jacket?", ""), ("what's the weather in Busan", "and tomorrow?", ""),
("what's the weather today", "thanks", None), ("오늘 날씨 어때", "좋네", None), ("what's the weather today", "cool", None),
("오늘 날씨 어때", "알겠어요", None), ("what's the weather today", "what's your name?", None), ("오늘 날씨 어때", "고마워", None), ("what's the weather today", "okay", None),
("오늘 날씨 어때", "낼은?", ""), ("오늘 날씨 어때", "비는 안 와요?", ""), ("what's the weather today", "what's the high?", ""),
("오늘 날씨 어때", "내일은 어떨까요?", ""), ("오늘 날씨 어때", "부산은 어떻습니까?", "Busan"), ("오늘 날씨 어때", "담주는?", ""),
("what's the weather today", "how about Daegu?", "Daegu"), ("what's the weather today", "부산은?", "Busan"),
]
def run():