Improve Korean understanding at every speech level and long talks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -99,6 +99,89 @@ INTENT = {
|
||||
],
|
||||
}
|
||||
|
||||
# ---------- grown wordings (night 3): each kind's nouns x softeners x verbs, a fixed sample per kind ----------
|
||||
import itertools as _it
|
||||
import random as _random
|
||||
|
||||
_SOFT = ["", "좀 ", "빨리 ", "얼른 ", "천천히 ", "지금 ", "바로 ", "한번 ", "어서 ", "퍼뜩 ", "살살 ", "후딱 "]
|
||||
_CALL = [""] # calls ("루미야", "자") are cut before the bank compares (intent_bank.core): none stored
|
||||
|
||||
|
||||
def _grow(kind, parts, n, seed=3):
|
||||
"""n wordings of the product of `parts` (lists of strings joined as they are), the same sample every run."""
|
||||
combos = [" ".join("".join(c).split()) for c in _it.product(*parts)]
|
||||
combos = list(dict.fromkeys(combos))
|
||||
_random.Random(f"{kind}{seed}").shuffle(combos)
|
||||
return combos[:n]
|
||||
|
||||
|
||||
GROWN = {
|
||||
"go_to": _grow("go_to", [_CALL, ["<place>로 ", "<place> 쪽으로 ", "<place>까지 ", "<place>에 ", "<place> 방향으로 ",
|
||||
"<place> 있는 데로 ", "<place> 있는 곳으로 "], _SOFT,
|
||||
["가", "이동해", "출발해", "가 봐", "가 보자", "달려가", "향해 가", "움직여", "옮겨 가",
|
||||
"가 줘", "이동 좀 해 줘", "가 볼래?", "가 줄래?"]], 500),
|
||||
"come": _grow("come", [_CALL, _SOFT, ["이리 ", "일로 ", "여기로 ", "이쪽으로 ", "나한테 ", "저한테 ", "제 쪽으로 ",
|
||||
"내 앞으로 ", "제 앞으로 ", "가까이 ", "내 옆으로 ", "제 옆으로 ", "요기로 ",
|
||||
"여기까지 ", "우리 쪽으로 ", "저희 쪽으로 "],
|
||||
["와", "와 봐", "다가와", "와 줘", "와 볼래?", "와라", "와 줄래?", "와 주라", "다가와 줘"]], 350),
|
||||
"follow": _grow("follow", [_CALL, ["", "나 ", "날 ", "저 ", "절 ", "저를 ", "나를 ", "제 뒤를 ", "내 뒤를 ", "우리 ",
|
||||
"우리를 ", "저희를 "],
|
||||
["", "잘 ", "천천히 ", "바짝 ", "계속 ", "졸졸 ", "놓치지 말고 ", "뒤에서 ", "좀 "],
|
||||
["따라와", "따라와 봐", "쫓아와", "따라다녀", "따라붙어", "따라와 줘", "따라와 줄래?",
|
||||
"따라오너라", "따라 걸어"]], 350),
|
||||
"come_back": _grow("come_back", [_CALL, ["원래 자리로 ", "제자리로 ", "아까 그 자리로 ", "처음 위치로 ",
|
||||
"출발했던 곳으로 ", "원위치로 ", "아까 있던 곳으로 ", "원래 있던 데로 "],
|
||||
["", "다시 ", "좀 ", "얼른 "], ["돌아와", "돌아가", "복귀해", "와", "돌아와 줘"]], 200),
|
||||
"move": _grow("move", [_CALL, ["앞으로 ", "뒤로 ", "왼쪽으로 ", "오른쪽으로 ", "좌측으로 ", "우측으로 "],
|
||||
["", "1 meter ", "조금 ", "살짝 ", "한 걸음 ", "한 발짝 ", "약간 ", "쪼금 ", "조금만 "],
|
||||
["가", "이동해", "움직여", "가 줘", "이동해 줘", "가 봐", "가 볼래?"]], 400),
|
||||
"turn": _grow("turn", [_CALL, ["왼쪽으로 ", "오른쪽으로 ", "좌측으로 ", "우측으로 "],
|
||||
["", "90 degrees ", "조금 ", "살짝 ", "약간 ", "몸을 ", "몸 "],
|
||||
["돌아", "회전해", "틀어", "꺾어", "돌아서", "돌아 줘", "회전해 줘", "돌아 볼래?"]], 350),
|
||||
"look": _grow("look", [_CALL, ["위 ", "위쪽 ", "아래 ", "아래쪽 ", "왼쪽 ", "오른쪽 ", "천장 ", "바닥 ", "하늘 ",
|
||||
"정면 ", "저 ", "나 ", "여기 ", "이쪽 ", "저쪽 ", "제 얼굴 ", "내 얼굴 ", "위를 ",
|
||||
"아래를 ", "왼쪽을 ", "오른쪽을 ", "저를 ", "나를 "],
|
||||
["", "좀 ", "잠깐 ", "한번 ", "살짝 "], ["봐", "쳐다봐", "바라봐", "봐 줘", "봐 줄래?", "봐 봐"]], 450)
|
||||
+ _grow("look2", [_CALL, ["고개 ", "고개를 ", "머리 ", "머리를 ", "얼굴 "], ["", "좀 ", "살짝 ", "조금 "],
|
||||
["들어", "숙여", "올려", "내려", "왼쪽으로 돌려", "오른쪽으로 돌려", "들어 줘", "숙여 줘",
|
||||
"위로 들어", "아래로 숙여"]], 250),
|
||||
"lift": _grow("lift", [_CALL, ["몸 ", "몸을 ", "키 ", "키를 ", "몸통 ", "상체 ", "리프트 ", "리프트를 "],
|
||||
["", "좀 ", "조금 ", "살짝 ", "더 ", "쭉 ", "1 meter "],
|
||||
["올려", "높여", "내려", "낮춰", "키워", "올려 줘", "내려 줘", "높여 줘", "낮춰 줘"]], 400),
|
||||
"wave": _grow("wave", [_CALL, ["", "저한테 ", "우리한테 ", "애들한테 ", "손님한테 ", "여기 ", "사람들한테 ", "나한테 "],
|
||||
["손 ", "손을 ", "팔 ", "한 손 ", "손 좀 "], ["", "한번 ", "크게 ", "힘차게 ", "반갑게 ", "살살 "],
|
||||
["흔들어", "흔들어 봐", "흔들어 줘", "흔들어 인사해", "흔들어 줄래?"]], 350)
|
||||
+ _grow("wave2", [_CALL, ["", "나랑 ", "저랑 ", "우리 "], ["악수하자", "악수해", "악수 한 번 하자", "악수 좀 해",
|
||||
"악수 해 줘", "악수할래?", "악수해 볼까?"]], 60),
|
||||
"arm_reach": _grow("arm_reach", [_CALL, ["손 ", "손을 ", "팔 ", "팔을 ", "오른손 ", "한 손 "], ["", "좀 ", "앞으로 ",
|
||||
"쭉 ", "이리 ", "나한테 "],
|
||||
["내밀어", "뻗어", "내밀어 줘", "뻗어 줘", "내밀어 봐", "내밀어 줄래?"]], 250)
|
||||
+ _grow("arm_reach2", [_CALL, ["", "나한테 ", "저한테 ", "이리 "], ["손 줘", "손 좀 줘", "손 이리 줘",
|
||||
"손 내놔", "손 한번 줘"]], 40),
|
||||
"arm_fold": _grow("arm_fold", [_CALL, ["팔 ", "팔을 ", "손 ", "손을 "], ["", "좀 ", "다시 ", "이제 ", "얼른 "],
|
||||
["접어", "거둬", "집어넣어", "내려", "원위치 해", "넣어", "치워", "접어 줘", "내려 줘"]], 200),
|
||||
"arm_open": _grow("arm_open", [_CALL, ["손 ", "손을 ", "손가락 ", "그리퍼 ", "집게 ", "그리퍼를 ", "집게를 "],
|
||||
["", "좀 ", "쫙 ", "활짝 "], ["펴", "펼쳐", "벌려", "열어", "펴 줘", "열어 줘", "벌려 줘"]], 150),
|
||||
"arm_close": _grow("arm_close", [_CALL, ["주먹 ", "그리퍼 ", "집게 ", "그리퍼를 ", "집게를 ", "손가락 ", "손 ", "손을 "],
|
||||
["", "좀 ", "꽉 ", "살짝 "], ["쥐어", "오므려", "닫아", "쥐어 줘", "닫아 줘", "모아"]], 150),
|
||||
"pick": _grow("pick", [_CALL, ["<obj> ", "<obj> 좀 ", "그 <obj> ", "저 <obj> ", "이 <obj> ", "앞에 있는 <obj> ",
|
||||
"테이블 위 <obj> ", "<obj> 하나 "],
|
||||
["집어", "잡아", "들어", "집어 들어", "들어 올려", "집어 줘", "잡아 줘", "집어 봐", "픽업 해"]], 350),
|
||||
"fetch": _grow("fetch", [_CALL, ["", "나한테 ", "저한테 ", "여기로 ", "이리 "], ["<obj> ", "그 <obj> ", "<obj> 하나 ",
|
||||
"<obj> 좀 "],
|
||||
["가져와", "갖다 줘", "가져다 줘", "갖고 와", "가지고 와", "챙겨 와", "가져와 줘", "가져와 줄래?"]],
|
||||
350),
|
||||
}
|
||||
for _k, _t in GROWN.items():
|
||||
INTENT[_k] = INTENT.get(_k, []) + _t
|
||||
|
||||
# "no": the same verbs said about Lumi, to someone else or as a wish for another time; the guards catch most, these
|
||||
# keep the bank's margin where they don't
|
||||
INTENT["no"] += _grow("no", [["우리 애가 ", "아까 ", "어제 ", "저 로봇 ", "옆 로봇이 ", "그 로봇은 "],
|
||||
["손 흔드는 거 ", "따라오는 거 ", "고개 숙이는 거 ", "팔 뻗는 거 ", "왼쪽으로 도는 거 ",
|
||||
"앞으로 가는 거 ", "컵 집는 거 ", "키 높이는 거 "],
|
||||
["봤어", "귀엽더라", "신기했어", "좋아해", "무서워해", "재밌었어"]], 200)
|
||||
|
||||
QUICK = {
|
||||
"name": ["이름이 뭐꼬", "니 이름이 뭐고", "이름이 뭐여", "이름이 뭐당가", "이름 뭐예요", "이름이 머예요", "성함이 어떻게 되십니까",
|
||||
"이름 좀 알려 줘", "이름 알려 주세요", "네임 뭐야", "너 이름 뭐니", "이름이 어떻게 되니", "로봇 이름이 뭐야"],
|
||||
@@ -114,3 +197,33 @@ QUICK = {
|
||||
"안냥", "하이루"],
|
||||
"how_are_you": ["잘 지냈나", "별일 없제", "기분 어떠세요", "컨디션 어때", "잘 있었어"],
|
||||
}
|
||||
|
||||
|
||||
def _ask(stems, ends):
|
||||
"""A question at every speech level: each stem with each ending ("이름이 " + "뭐야" / "뭐예요" / "무엇입니까")."""
|
||||
return [s + e for s in stems for e in ends]
|
||||
|
||||
|
||||
_WHAT = ["뭐야", "뭐예요", "뭐에요", "무엇입니까", "뭐니", "뭐냐", "뭐여", "뭐꼬", "뭐고", "뭔데", "뭐죠", "뭐신가요",
|
||||
"어떻게 돼", "어떻게 돼요", "어떻게 되세요", "어떻게 되십니까", "뭐라고 해요", "뭐라고 불러요"]
|
||||
_HOW_OLD = ["몇 살이야", "몇 살이에요", "몇 살입니까", "몇 살이니", "몇 살이냐", "몇 살이여", "몇 살이고", "몇 살이세요",
|
||||
"몇이야", "몇이에요", "얼마나 됐어", "얼마나 됐어요", "얼마나 되셨어요", "얼마나 되었습니까"]
|
||||
QUICK["name"] += _ask(["이름이 ", "너 이름이 ", "니 이름이 ", "루미 이름이 ", "당신 이름이 ", "로봇 이름이 ", "성함이 "],
|
||||
_WHAT)
|
||||
QUICK["age"] += _ask(["", "너 ", "루미 ", "로봇 ", "당신 ", "나이가 ", "너 나이가 "], _HOW_OLD[:9]) + \
|
||||
_ask(["만들어진 지 ", "태어난 지 ", "나온 지 "], _HOW_OLD[10:])
|
||||
QUICK["maker"] += _ask(["누가 ", "어느 회사가 ", "어디서 ", "어떤 회사가 "],
|
||||
["만들었어", "만들었어요", "만들었습니까", "만들었니", "만들었냐", "만들었노", "만들었대", "만드셨어요",
|
||||
"개발했어", "개발했어요", "개발했습니까", "개발하셨어요"])
|
||||
QUICK["who"] += _ask(["너 ", "넌 ", "당신 ", "루미 ", "이 로봇 ", "너는 "],
|
||||
["누구야", "누구예요", "누구입니까", "누구니", "누구냐", "누구여", "누꼬", "뭐야", "뭐예요", "뭐하는 애야",
|
||||
"뭐 하는 로봇이에요", "뭐 하는 로봇입니까", "누구세요", "정체가 뭐야"])
|
||||
QUICK["time_now"] = QUICK.get("time_now", []) + _ask(["지금 ", "", "혹시 지금 "],
|
||||
["몇 시야", "몇 시예요", "몇 시입니까", "몇 시니", "몇 시냐", "몇 시여",
|
||||
"몇 시고", "몇 시죠", "몇 시쯤 됐어", "몇 시 됐어요", "몇 시인지 알아요",
|
||||
"몇 시인지 알려 줘", "몇 시인지 알려 주세요", "몇 시인지 아세요"])
|
||||
QUICK["no"] = QUICK.get("no", []) + [
|
||||
"잠깐만 시간 좀 줘", "시간 좀 줘", "시간 좀 주세요", "생각할 시간 좀 줘", "잠깐 시간 좀 내 줄래", "시간 있어", "시간 있어요",
|
||||
"시간 괜찮아요", "시간 돼요", "give me a second", "give me a minute", "give me some time", "do you have time",
|
||||
"이름 지어 줄까", "내 이름은 민수야", "제 이름 기억해요", "우리 애 몇 살 같아요", "제가 몇 살 같아요", "나 몇 살로 보여",
|
||||
"누가 이겼어", "누가 더 빨라", "몇 시에 끝나요", "몇 시에 시작해요"]
|
||||
|
||||
+161
-36
@@ -59,7 +59,10 @@ Rules:
|
||||
you don't know, or that you can't, and why) with the action none.
|
||||
- If you do not know a fact about the world (people, places, events, products, prices, sports, news, anything
|
||||
after your training), do not guess: choose the action "search" so it is looked up on the internet. Well-known
|
||||
general knowledge (what a robot or AI is, science, history, geography) and opinions you answer yourself.
|
||||
general knowledge (what a robot or AI is, science, history, geography) and opinions you answer yourself: settled
|
||||
facts that do not change (a mountain's height, a building's floors, how many bones, how long a marathon is, who
|
||||
painted or invented something, when a war or an Olympics was, what an animal eats, why the sky is blue) are
|
||||
answered at once, never searched; search what changes or is new (news, prices, today's scores, schedules).
|
||||
- For facts about yourself and Cutshion Company use ONLY the reference notes. Only if the notes do not contain the
|
||||
answer, say you are not sure. Never say you were made or developed by any other company.
|
||||
- The company's Korean name is 쿳션 (주식회사 쿳션); never write 컷션 or 커션.
|
||||
@@ -291,19 +294,26 @@ SAID_BEFORE = re.compile(r"\byou said\b|\bearlier you\b|\byou told me\b|아까
|
||||
FOLLOW_EXAMPLES_K = 2 # follow-up examples (talk_examples.FOLLOWUPS) shown with a short follow-up
|
||||
|
||||
|
||||
LUMI_TOPIC = re.compile(r"\b(?:you|your|yourself|lumi|robots?|arm|gripper|battery|cameras?|lidar|base|wheels?|lift|"
|
||||
r"jaka|cutshion|company|ceo|gemma|whisper|jetson|thor)\b|너|네가|니가|넌|루미|당신|로봇|팔|그리퍼|"
|
||||
r"배터리|카메라|라이다|바퀴|리프트|자카|쿳션|회사|대표|젬마|위스퍼|젯슨", re.I)
|
||||
# a talk about Lumi, its parts or the companies: the notes stay with its follow-ups
|
||||
|
||||
|
||||
def _follow_examples(text, history):
|
||||
"""For a short follow-up on the last answer ("why?", "and then?", "진짜?", "그게 무슨 말이야?"): two small talks
|
||||
where such words were answered about the answer before them, so the model keeps the topic and answers at once."""
|
||||
asked = bool(history) and history[-1][1].rstrip().endswith("?") and confirm_answer(text) is not None # "네" to
|
||||
if not history or len(text.split()) > 7 or is_backchannel(text) and not ABOUT_ANSWER.match(text) and not asked:
|
||||
c = core(text) # "음 루미아, 정말요?" asks what "정말요?" asks
|
||||
if not history or len(c.split()) > 7 or is_backchannel(c) and not about_answer(text) and not asked:
|
||||
return "" # "더 알려 드릴까요?": do what was offered
|
||||
if not (asked or ABOUT_ANSWER.match(text) or AND_ALSO.match(text) or FOLLOW_UP.search(text) or SAID_BEFORE.search(text) or
|
||||
SHORT_Q.search(text) and len(text.split()) <= FRAGMENT_WORDS and not re.search(r"\d", text) and
|
||||
not ABOUT_YOU.search(text) and (NAMED_BEFORE.search(text) or REFERS_BACK.search(text) or
|
||||
len(text.strip(" ?!.~")) <= (6 if HANGUL.search(text) else 10))):
|
||||
if not (asked or about_answer(text) or AND_ALSO.match(c) or FOLLOW_UP.search(c) or SAID_BEFORE.search(text) or
|
||||
SHORT_Q.search(c) and len(c.split()) <= FRAGMENT_WORDS and not re.search(r"\d", c) and
|
||||
not ABOUT_YOU.search(c) and (NAMED_BEFORE.search(c) or REFERS_BACK.search(c) or
|
||||
len(c.strip(" ?!.~")) <= (6 if HANGUL.search(c) else 10))):
|
||||
return "" # "where is p3?", "세종대왕이 누구예요?" are new questions
|
||||
from assistant import talk_examples
|
||||
q, a = history[-1]
|
||||
q, a = history[-1] if asked else topic_turn(history)
|
||||
a = " ".join(ln for ln in a.splitlines() if not re.match(r"\s*\**ACTION", ln)).strip()
|
||||
if not a:
|
||||
return ""
|
||||
@@ -483,7 +493,8 @@ OBJECTS = {"cup": "cup", "mug": "cup", "glass": "cup", "tumbler": "cup", "bottle
|
||||
"화분": "potted plant", "clock": "clock", "handbag": "handbag", "purse": "handbag", "핸드백": "handbag",
|
||||
"backpack": "backpack", "백팩": "backpack", "suitcase": "suitcase", "캐리어": "suitcase", "여행가방": "suitcase",
|
||||
"hair dryer": "hair drier", "hair drier": "hair drier", "드라이기": "hair drier", "toaster": "toaster",
|
||||
"토스터": "toaster"}
|
||||
"토스터": "toaster", "보틀": "bottle", "물컵": "cup", "유리컵": "cup", "머그잔": "cup",
|
||||
"글라스": "cup"}
|
||||
# spoken word -> camera class; the classes are skills.GRASPS (tests/test_intents.py checks it): a pick of one the
|
||||
# fingers can't take gets its reason (skills.refusal). Not here on purpose: umbrella / 우산 (weather words), 책 (책상)
|
||||
_KO_WORD = {"공", "칼"} # one syllable inside other words (공항, 칼국수): only as a word of its own
|
||||
@@ -632,8 +643,9 @@ INTENTS = [ # (action, pattern) checked in order on what the visitor said
|
||||
("look_away", r"\b(?:look away|look somewhere else|look elsewhere|look the other way|stop (?:looking|staring)(?: at me)?|"
|
||||
r"stop watching me|quit watching me|"
|
||||
r"(?:don'?t|do not|please don'?t) (?:look|stare) at me|quit (?:staring|looking))\b|(?:쳐다|바라)보지 ?마|"
|
||||
r"그만 ?(?:좀 ?)?(?:쳐다|바라)(?:봐|보세요|보십시오|봐요|봐 ?줘|봐 ?주세요)|"
|
||||
r"(?:날|나를?|저를?|절)\s*(?:좀\s*)?그만\s*(?:봐|보세요|봐요|쳐다봐)|"
|
||||
r"그만 ?(?:좀 ?)?(?:쳐다|바라)(?:봐|보세요|보십시오|보시게|봐라|봐요|봐 ?줘|봐 ?주세요)|"
|
||||
r"(?:날|나를?|저를?|절)\s*(?:좀\s*)?그만\s*(?:봐|보세요|봐요|쳐다봐)|(?:^|[\s,—–-])그만\s*(?:좀\s*)?(?:봐|보세요|봐요|보시게|봐라|"
|
||||
r"보십시오)\W*$|"
|
||||
r"(?:날|나를?|저를?|절)\s*(?:좀\s*)?(?:보지|쳐다보지) ?마|다른 ?(?:데|곳|쪽)(?:을|를)? ?(?:좀 )?봐"),
|
||||
("stop", r"\b(stop|halt|freeze|don'?t move)\b|멈춰|정지|그만 ?가|거기 ?서(?=[\s!.~,]*$)|스톱|움직이지 ?마|^\s*(서[\s,!.]*){2,}$"),
|
||||
("waist", r"\b(?:turn|rotate|twist|swivel|swing|move|bring|point|face|put)\b[^.?!]{0,25}\b(?:your |the )?(?:waist|upper body|"
|
||||
@@ -716,7 +728,7 @@ INTENTS = [ # (action, pattern) checked in order on what the visitor said
|
||||
+ LET_GO),
|
||||
("grip_close", r"\b(close (your |the )?(hand|gripper|fingers|claw)|close it|make a fist|clench (your )?(fist|hand)|grab (it|this)|grip (it|this)|"
|
||||
r"hand closed?|squeeze (your )?(hand|fingers)( shut)?)\b|^\W*grip\W*$"
|
||||
r"|손을? ?(?:꽉 |좀 )*(쥐|오므려|닫아)|\bclose\s*해\s*손|손가락\s*(?:을\s*)?(?:좀\s*|한번\s*|다\s*)*모아|주먹 ?(을 )?쥐|잡아(?!먹|당)|손 ?close|(그리퍼|집게)(를|을)? ?(좀 )?(닫아|오므려)"),
|
||||
r"|손을? ?(?:꽉 |좀 )*(쥐|오므려|닫아)|\bclose\s*해\s*손|손가락\s*(?:을\s*)?(?:좀\s*|한번\s*|다\s*)*모아|주먹 ?(을 )?쥐|잡아(?!먹|당| ?보자| ?봐도| ?볼래)|손 ?close|(그리퍼|집게)(를|을)? ?(좀 )?(닫아|오므려)"),
|
||||
("arm", r"\b(reach out(?! to (?!me\b))|stretch (out )?your (arm|hand)|put your (arm|hand) (out|forward)|hand forward|"
|
||||
r"hold out your (arm|hand|gripper|claw|fingers)|extend your (arm|hand|gripper)|give me your hand|offer me your hand|"
|
||||
r"give me (?:a|ur|you) hand(?!\s+(?:with|to|for|in|on|carrying|moving|lifting)\b)|"
|
||||
@@ -731,13 +743,16 @@ INTENTS = [ # (action, pattern) checked in order on what the visitor said
|
||||
r"\bgive hand\b|\bhand 이쪽|손을? ?(?:좀 |쭉 )+(?:내밀|뻗)"
|
||||
r"|\bhand back\b(?=\s*(?:해|하|ㄱ))|기본 ?(?:pose|포즈|자세|위치)\s*(?:로|으로)|\bwithdraw (?:your |the )?(?:hand|arm)\b|"
|
||||
r"\bretract (?:your |the )?(?:arm|hand)\b|\barm back to normal\b|\barm (?:back )?home\b|\bbring (?:the |your )?arm (?:home|back)\b|\bback to (?:your |the )?look pose\b|"
|
||||
r"\byou can fold it\b|^\W*(?:이제\s*)?접어|손 ?(?:을 )?다시 넣어|^\W*(?:됐어\W*)?넣어\W*$|팔 ?(?:을 )?(?:원래대로|제자리로|다시 넣어|넣어)"),
|
||||
r"\byou can fold it\b|^\W*(?:이제\s*)?접어|손 ?(?:을 )?(?:좀 |다시 |이제 )*넣(?:어|으)|"
|
||||
r"손 ?(?:을 )?(?:좀 |쫌 |한번 |한 번 )*잡(?:—\s*잡)?아 ?(?:보자|봐도|볼래|봐야지|보고 ?싶)|\blet me (?:hold|shake|touch) your hand\b|"
|
||||
r"(?:^|[\s,.])(?<!한테 )(?<!에게 )(?<!께 )손 ?(?:을 )?(?:(?:좀|이리|한번|한 번)\s*)*(?:줘|주세요|줄래요?|도|주쇼|주십시오|주시오|"
|
||||
r"주시겠어요|주실래요|주라|주게|주이소|줘요)\W*$|^\W*(?:됐어\W*)?넣어\W*$|팔 ?(?:을 )?(?:원래대로|제자리로|다시 넣어|넣어)"),
|
||||
("lift", LIFT_WORDS + r"|^\W*(?:go\s+|get\s+|even\s+)?"
|
||||
r"(?:higher|taller|lower|shorter)(?:\s+(?:please|now|still))?\W*$|"
|
||||
r"^\W*(?:조금 ?|좀 ?|약간 ?|살짝 ?)?더 ?(?:높이|높게|낮게|낮춰|올려|내려|높여)(?:\s*(?:줘|주세요|봐))?\W*$|"
|
||||
r"키 ?(?:좀 ?)?(?:높여|낮춰|올려|내려|줄여|키워)"), # "higher", "더 높이", "키 높여": the lift
|
||||
("weather", r"\bweather\b|\bforecast\b|\b(will it|is it going to) rain\b|(?<!your )(?<!cpu )(?<!gpu )(?<!operating )(?<!working )\btemperature\b(?!.*\b(your|you|cpu|gpu|battery|motor|body)\b)|날씨|비 ?(?:와|올|오나|온대)|기온"
|
||||
r"|\b(?:going to|gonna) (?:rain|snow)\b|\b(cold|hot|warm|chilly) (outside|out)\b|\bumbrella\b(?=.*\?)|\b(?:need|bring|take)\b.*\bumbrella\b|우산(?=.*(?:\?|까|나요|니|냐))|밖에 ?(추|더)워"
|
||||
r"|\b(?:going to|gonna) (?:rain|snow)\b|\b(cold|hot|warm|chilly) (outside|out)\b|\bumbrella\b(?=.*\?)|\b(?:need|bring|take)\b.*\bumbrella\b|우산(?!\S*\s*(?:어디|어딨|잃어|두고|놓고|빌려|사))(?=.*(?:\?|까|나요|니|냐))|밖에 ?(추|더)워"
|
||||
r"|\bhow (hot|cold|warm) is it\b|\b(is it|will it be) (sunny|cloudy|windy|raining|snowing)\b|\bwill it snow\b"
|
||||
r"|눈 ?(이 )?(와|올 ?까|오나|온대|오니)|(오늘|내일|밖|바깥)(은|에|이)? ?(덥|춥|더워|추워)"
|
||||
r"|\b(coat|jacket) when i (leave|go out)\b|\bneed (a )?(jacket|coat)\b|\btyphoon\b|\b(foggy|humid|humidity)\b|\bis it windy\b"
|
||||
@@ -758,7 +773,9 @@ INTENTS = [ # (action, pattern) checked in order on what the visitor said
|
||||
r"monday|tuesday|wednesday|thursday|friday|saturday|sunday|outside)\b)"
|
||||
r"|\b(?:today|tomorrow|tonight|weekend)\b.*\b(?:warm|warmer|cold|colder|hot|hotter|sunny|cloudy)\b"
|
||||
r"|(?:오늘|내일|모레|주말|이번 ?주|다음 ?주|지금)\S*\s*(?:\S+\s*)?(?:맑|흐리|흐려|따뜻|추워|추울|더워|더울|쌀쌀|춥|덥)"
|
||||
r"|\bhow'?s the weekend (?:looking|going to be)\b"),
|
||||
r"|\bhow'?s the weekend (?:looking|going to be)\b"
|
||||
r"|\b(?:should|do|must) (?:i|we) (?:bring|take|wear|need) (?:a |my )?(?:jacket|coat|umbrella)\b|\brain\b ?(?:와|올|오)"
|
||||
r"|비 ?(?:옵니까|오노|오니|오냐|와유|오남)|우산\s*(?:챙겨야|가져가야|들고 가야|필요)|\bany (?:rain|snow)\b|\bumbrellas?\b.*\b(?:today|tomorrow|tonight)\b"),
|
||||
("search", r"\b(news|latest|headlines?|who won|score of|price of|exchange rate|stock)\b|뉴스|환율|(?<![가-힣])주가|"
|
||||
r"\bwhat'?s (?:happening|going on) in the world\b|\bwhat happened in the world\b|(?:최근|최신|요즘|새) ?소식|"
|
||||
r"누가 이겼|경기 결과|\btop (?:stories|headlines)\b|요즘 ?경제|경제 ?(?:뉴스|상황|소식|어때|어떻)|"
|
||||
@@ -779,7 +796,7 @@ INTENTS = [ # (action, pattern) checked in order on what the visitor said
|
||||
r"코스피|kospi|코스닥|kosdaq|주식 ?시장|\bstock market\b|\bwhat'?s new (?:from|in|about)\b|"
|
||||
r"\bwhat'?s happening in the\b|\banything (?:big|new) (?:happen|about)|\bwhat'?s everyone talking about\b|"
|
||||
r"큰일 있었|다들 무슨 얘기|\bhow is the economy\b|"
|
||||
r"\bhow (?:tall|high) is (?:the )?[a-z]+(?: world)? (?:tower|building|mountain|bridge)\b|\bhow many floors\b|"
|
||||
r"\bhow (?:tall|high) is (?:the )?[a-z]+(?: world)? (?:tower|building|mountain|bridge)\b|\bhow many floors\b(?!.*\b(?:this|here|we're in)\b)|"
|
||||
r"(?:타워|빌딩|건물|탑)\S*\s*(?:몇 ?미터|높이|얼마나 높)"), # "how many people live there?"
|
||||
]
|
||||
SING_ECHO = re.compile(r"^\W*(?:(?:오+|아+|와|어|우와|oh+|ah+|ooh|wow|really)\W+)?(?:a\s+)?(?:노래|음악|songs?|singing|music)"
|
||||
@@ -1134,6 +1151,18 @@ ARM_BACK = re.compile( # the arm back to look (fold), said after a reach;
|
||||
r"\b(?:your |the |ur )?arm (?:back|down|in)\b(?=\W*(?:$|now|please|해|thanks|lumi|,))|\b(?:let'?s see you|you) arm (?:down|back|in)\b|\bclose (?:your |the )?arm\b|"
|
||||
r"손 ?(?:을 )?(?:좀 |이제 |다시 |빨리 |얼른 )*(?:내려|거둬|접어|넣어|치워)|팔 ?(?:을 )?(?:좀 |이제 |다시 |빨리 |얼른 )*(?:내려|거둬|접어|넣어|치워|원위치)", re.I)
|
||||
ARM_BACK_NOT = re.compile(r"(?<!why )\b(?:don'?t|do not|never|no need to)\b|[가-힣]지 ?마(?:세요|요|라)?(?![가-힣])")
|
||||
ARM_TALK = re.compile( # words about the arm / hand that order nothing now (A1): hearsay, ability, the past, someday,
|
||||
# sarcasm, a word's meaning, a cheer; dialect negations ("흔들지 맙서", "흔들지 마유", "흔들지 마민수야")
|
||||
r"\bif (?:you|u) could\b.*\b(?:someday|some ?time|one day|in the future|later|next time)\b|\bsomeday\b|\bin a (?:few|couple of) "
|
||||
r"(?:minutes|mins|seconds|hours)\b|\bi (?:heard|hear|read|was told|bet)\b|\b(?:are|r) (?:you|u) (?:even |really |actually )?able to\b|"
|
||||
r"\bwere (?:you|u) (?:built|made|designed|programmed|taught)\b|\bdo (?:you|u) (?:even )?know how to\b|\bshould (?:we|i) ask\b|"
|
||||
r"\b(?:did|have) (?:you|u)\b.*\b(?:earlier|before|yesterday|last time|ever)\b|\bearlier\b|\b(?:it|he|she|lumi|the robot) "
|
||||
r"(?:refused|tried|failed|forgot|wanted|used) to\b|\bfly to the moon\b|\bwhen pigs fly\b|\byeah,? right\b|\bdid the wa\w*\b|"
|
||||
r"\bpolicy\b|\bin (?:english|korean)\b|\bwhat does .* mean\b|"
|
||||
r"퍽이나|리가 (?:있|없)|수 ?있으면 ?(?:좋겠|대박|최고|멋|재밌)|만약에?|줄은 ?알|는 ?거 ?해도 ?(?:돼|되)|"
|
||||
r"는 ?거 ?(?:진짜 |너무 |정말 |완전 )?(?:신기|멋있|멋지|귀엽|웃기|재밌|재미있)|기도 ?해\s*\?|수 ?있겠다|"
|
||||
r"파이팅|화이팅|\bfighting\b|영어로|한국어로|무슨 ?뜻|뜻이 ?뭐|얘기 ?들었|들어 ?봤|본 ?적|해 ?봤어\s*\?|봤어\s*\?|"
|
||||
r"[가-힣]지 ?(?:맙|마유|마소|마이소|마셈|마시오|마십시오|말라|말랑께|말어)|[가-힣]지 ?마(?=[가-힣]+(?:야|아)(?:\s|\W|$))", re.I)
|
||||
|
||||
|
||||
HELD_BACK = re.compile( # the whole sentence asks for no motion now (A2): it starts with a no, a later time, or is taken back
|
||||
@@ -1169,7 +1198,7 @@ def intent(text, markers=()):
|
||||
re.sub(_LEAD, "", CALLING.sub("", t), flags=re.I)) or LATER.search(CALLING.sub("", t)) # "Lumi, is it
|
||||
# hard to ...?", "Lumi Lumi, are you still following me?"
|
||||
visitor = re.search(r"^\W*(?:can|may|could|should|shall) (?:i|we)\b", CALLING.sub("", t)) # "can I come closer?"
|
||||
if ARM_BACK.search(t) and not (held or asks or visitor or ARM_BACK_NOT.search(t)):
|
||||
if ARM_BACK.search(t) and not (held or asks or visitor or ARM_BACK_NOT.search(t) or ARM_TALK.search(t)):
|
||||
return ("arm", "fold") # "take your hand back", "back to look position": never the base
|
||||
for action, pat in INTENTS:
|
||||
m = re.search(pat, t, re.I)
|
||||
@@ -1205,6 +1234,8 @@ def intent(text, markers=()):
|
||||
return ("waist", f"{side} {n}" if n else side)
|
||||
if action == "look_away":
|
||||
return None if asks or "?" in t else ("look", "away") # "don't look at me", "쳐다보지 마"
|
||||
if action in ("arm", "grip_open", "grip_close", "wave") and ARM_TALK.search(t):
|
||||
return None # "I heard you can wave", "주먹 쥐고 파이팅!" (A1)
|
||||
if action != "quiet" and re.search(r"(?<!why )\b(don'?t|do not|never|no need to)\b|[가-힣]지 ?마(?:세요|요|라)?(?![가-힣])|"
|
||||
r"필요 ?(?:없|는 없)", t) and action != "stop":
|
||||
return None # "don't go to p1", "손 펴지 마": not an order
|
||||
@@ -1250,6 +1281,8 @@ def intent(text, markers=()):
|
||||
if re.search(r"\b(?:do|did|would|you|i|we) (?:like|love|enjoy|prefer|hate)\b|\bfavou?rite\b|좋아하|좋아해|싫어|"
|
||||
r"\bmeans?\b|\bmeaning\b|뜻", t):
|
||||
return None # "do you like rainy weather?": talk, no lookup
|
||||
if re.search(r"\bin here\b|\bthis room\b|\binside\b|실내|방 안|안에(?:서)?\s*(?:더워|추워|덥|춥)", t):
|
||||
return None # "is it hot in here?": the room, not the weather
|
||||
place = re.search(r"\bin ([A-Za-z][A-Za-z ]+?)(\?|$|\.| today| tomorrow| right now| now| this)", text)
|
||||
if place and web.asked_day("in " + place.group(1)) is None: # "in three days" is a day, no place
|
||||
return ("weather", place.group(1).strip())
|
||||
@@ -1340,7 +1373,7 @@ def intent(text, markers=()):
|
||||
if n == "?" or not driving.MOVE_MIN_M <= n <= MOVE_MAX_M:
|
||||
return None
|
||||
return ("move", f"{driving.direction(driving.clean(t))} {n:g}")
|
||||
if action == "make_way" and re.search(r"\bover there\b|\bthat (?:spot|place|way)\b|\bwhere i\b", t):
|
||||
if action == "make_way" and re.search(r"\bover (?:there|dare|dere|thar)\b|\bthat (?:spot|place|way)\b|\bwhere i\b", t):
|
||||
return None # "move over there": the spot pointed at (pointing.py), no back-off
|
||||
if action == "make_way":
|
||||
return ("move", "back 1") # owner: a checked 1 m back-off (lumi.move_by)
|
||||
@@ -1368,7 +1401,7 @@ def intent(text, markers=()):
|
||||
return None # asked about / refused with the limit (driving.read)
|
||||
return ("move", f"{d} {n:g}")
|
||||
if action == "arm":
|
||||
return ("arm", "fold" if re.search(r"fold|tuck|down|away|back|home|look pose|\bin\b|withdraw|retract|normal|접|내려|거둬|넣어|"
|
||||
return ("arm", "fold" if re.search(r"fold|tuck|down|away|back|home|look pose|\bin\b|withdraw|retract|normal|접|내려|거둬|넣어|넣으|"
|
||||
r"원래|제자리|치워|기본", t)
|
||||
else "reach")
|
||||
if action == "grip_close" and re.search(rf"(?<![a-z])(?:{_OBJ})s?(?![a-z])", t):
|
||||
@@ -1396,12 +1429,13 @@ def intent(text, markers=()):
|
||||
|
||||
# ---------- a correction inside one sentence ("go to start, no, end", "컵 집어, 아니 병") ----------
|
||||
_FIX_WORD = (r"no+|nope|sorry|i mean|i meant|actually|or rather|rather|make that|scratch that|correction|my bad|oops|"
|
||||
r"아니(?:야|다|요|에요|지)?|아니 아니|정정|그게 아니라|그거 말고|미안(?:해요?)?|죄송해요|죄송합니다|잘못 말했(?:다|어|어요|네요?|습니다)|"
|
||||
r"아니(?:야|다|요|에요|지)?|아니 아니|정정|그게 아니라|그거 말고|미안(?:해요?)?|(?<!면 )죄송해요|(?<!면 )죄송합니다|잘못 말했(?:다|어|어요|네요?|습니다)|"
|
||||
rf"wait(?=\W+(?:(?:the|a|an|that|this)\s+)?(?:(?:{_COL})\s+)?(?:{_OBJ})s?\b)") # "the white cup, wait, the apple"
|
||||
_FIX_PAD = r"oh|uh|um|ah|er|wait|hold on|hang on|아|어|음|잠깐만?"
|
||||
FIX = re.compile(rf"(?:^|(?<=[\s,.;!?]))(?:(?:{_FIX_PAD}|{_FIX_WORD})(?![\w'가-힣])\s*[,.;!?]*\s*)*"
|
||||
rf"(?:{_FIX_WORD})(?![\w'가-힣])(?!(?<=no)\s+(?:wave|waving|follow|following|turn|turning|move|moving|look|"
|
||||
rf"looking|going|coming|lift|reach|touch|pick|music|photos?)\b)"
|
||||
rf"(?!(?<=sorry)\s+(?:if|for|to|about|that|but|i|i'm|again)\b)" # "..., sorry if that's rude": an apology
|
||||
rf"(?!\s+(?:thanks|thank|problem|one|more|way|matter|need|longer|rush|hurry|"
|
||||
rf"worries|pressure)\b)\s*[,.;!?]*\s*(?:(?:{_FIX_PAD}|{_FIX_WORD})(?![\w'가-힣])\s*[,.;!?]*\s*)*")
|
||||
_STRONG_NO = re.compile(r"\b(?:no+|nope)\b|아니|잘못 말했")
|
||||
@@ -1462,6 +1496,7 @@ def self_correct(text, markers=()):
|
||||
"" when the command was taken back ("go to the stage, never mind", "스테이지로 가, 아니 됐어"); None when a
|
||||
correction is there but can't be read for sure (Lumi asks again, nothing moves); the text itself otherwise."""
|
||||
from assistant import steps
|
||||
text = wording.polite(text) # "wave, if you don't mind" -> "wave" on every path
|
||||
if re.search(r"\b(?:say|tell|announce)\b|말해|(?<!그거 )(?<!이거 )(?<!그걸 )(?<!이걸 )전해|[\"“”]", text, re.I) or \
|
||||
re.search(r"\b(?:stop|halt|freeze|don'?t move)\b|멈춰|정지|그만(?!두|둬)|스톱|움직이지 ?마|거기 ?서", text, re.I):
|
||||
return text # a message to say may hold any words; a stop always wins
|
||||
@@ -1578,7 +1613,8 @@ FILLER_IN = re.compile(r"(?:,\s*)?(?<![\w'])(?:u+h+m*|u+m+|e+r+m*|hmm+)(?![\w'])
|
||||
|
||||
def unfill(t):
|
||||
"""'go to the um the stage' -> 'go to the stage': fillers inside the words and the word said twice around them."""
|
||||
t = re.sub(r" {2,}", " ", FILLER_IN.sub(" ", wording.now_not_later(t))).strip() # "now, not later": no later time
|
||||
t = re.sub(r" {2,}", " ", FILLER_IN.sub(" ", wording.polite(wording.now_not_later(t)))).strip() # "now, not later": no
|
||||
# later time; "wave, if you don't mind": no condition
|
||||
return re.sub(r"\b(the|a|to) \1\b", r"\1", t)
|
||||
|
||||
|
||||
@@ -1982,6 +2018,18 @@ REFUSE_FLOOR = ("I can't reach the floor with my arm, only things on a table.",
|
||||
IDIOM = re.compile(r"\bput (?:\w+ ){0,3}(?:on (?:my|the|your|our|their) (?:tab|list|bill|account|calendar|schedule|agenda|"
|
||||
r"to-?do list|menu)|on hold)\b|\blet'?s put\b|"
|
||||
r"\bbring it on\b|^\W*hold it\W*$|\bgive me (?:five|a high five|some skin)\b|\bhigh five\b", re.I) # "put it on my tab", "hold it!" (wait): no hand
|
||||
NOT_A_THING = re.compile( # "give me the top stories", "give me the short version", "힌트 좀 줘": words, not a thing in the hand
|
||||
r"\b(?:give|hand|pass|bring|gimme|tell|send|show)\s+(?:me|us)?\s*(?:(?:the|a|an|some|your|any|more|quick|short|brief|"
|
||||
r"latest|top|full|long|real|honest|little|few|good|best|main)\s+)*(?:\w+\s+)?(?:news|stories|story|headlines?|version|summary|"
|
||||
r"rundown|overview|update|updates|details?|info|information|answer|answers|example|examples|reason|reasons|idea|ideas|tip|tips|"
|
||||
r"hint|hints|advice|recommendations?|suggestions?|list|number|numbers|name|names|address|directions|time|minute|second|moment|"
|
||||
r"break|chance|call|ride|hug|smile|kiss|quote|price|forecast|weather|facts?|jokes?|words?|review|report|brief(?:ing)?|recap|"
|
||||
r"explanation|definition|translation|lowdown|scoop|gist|highlights|scores?|results?|lyrics|tour|demo|presentation|intro(?:duction)?|"
|
||||
r"feedback|opinions?|thoughts|status|percentage|guess|rating|estimate|ideas?|options?|choices?|minutes|seconds|space|room|"
|
||||
r"reply|response|clue|clues|sign|signal|wave|nod|look|try|go|shot|rest|lift|push)\b|"
|
||||
r"(?:뉴스|소식|정보|힌트|팁|설명|대답|답변|답|요약|시간|기회|이름|번호|전화번호|주소|조언|추천|의견|피드백|예시|이유|"
|
||||
r"아이디어|답장|연락|칭찬|박수|사인|신호|용기|자유|휴식|여유)\s*(?:을|를|좀|도|만)?\s*(?:좀\s*)?(?:더\s*)?"
|
||||
r"(?:줘|주세요|줘요|주라|줄래|주실래요|주십시오|주시겠어요|주쇼|주이소)", re.I)
|
||||
_POL = r"(?:\W+(?:please|pls|plz|now|lumi|robot|thanks|thank you|okay|ok|then|already|quick|빨리|얼른|어서|좀|제발|루미야?))*"
|
||||
GIVE_LOOSE = re.compile( # with something in the hand, the whole sentence asks for it: give it to the speaker
|
||||
rf"\W*(?:(?:you|please|now|lumi|robot|okay|ok|hey|so|just|me)\W+)*(?:gimme|give|hand|pass)(?: (?:it|that|this|that one|"
|
||||
@@ -2025,7 +2073,7 @@ GIVE_HELD_NOT = re.compile( # a cancel, a past, a place word, "not yet": never
|
||||
r"\band\b(?! (?:give|hand|pass|now)\b)|\b(?:then|after that|also)\b|[가-힣](?<![들쥐이말])고\s|그리고|다음에|가서", re.I) # one part of several: the chain's
|
||||
_OTHER_CLAUSE = re.compile(r"[,.;]\s*(?:and |because |since |cause )?(?:he|she|they)(?:'s|'re| is| are| was| will|'ll| has| "
|
||||
r"needs?| wants?| goes| going)\b.*$|[,.]\s*(?:그분|그 ?사람|저 ?분|이 ?분|걔|그 ?친구|그녀)\S*\s.*$", re.I)
|
||||
_KO_VERB_BEFORE = re.compile(r"(?:아|어|여|해|와|봐|워|켜|꺼|려|펴|쳐|져|겨|셔|혀|며|녀|벼|떠|써)$") # "뻗어 줘", "가져와 줘", "인사 해 줘": another verb's request
|
||||
_KO_VERB_BEFORE = re.compile(r"(?:아|어|여|해|와|봐|워|켜|꺼|려|펴|쳐|져|겨|셔|혀|며|녀|벼|떠|써|러|라)$") # "뻗어 줘", "가져와 줘", "인사 해 줘": another verb's request
|
||||
_KO_NOT_VERB = {"이리", "여기", "거기", "저기", "좀", "나", "저", "날", "빨리", "어서", "얼른"}
|
||||
|
||||
|
||||
@@ -2150,8 +2198,9 @@ def held_give(text, markers=()):
|
||||
condition, a cancel, a past, words to someone else, a trip to a marker ("bring it to James at booth A")."""
|
||||
if re.search(r"^\W*(?:(?:okay|ok|alright|네|그럼|자)\W+)*(?:제가|내가)\s*(?:받을|가져갈)(?:게|께)요?\W*$", CALLING.sub("", text or "")):
|
||||
return True # "제가 가져갈게요": I'll take it (from the hand)
|
||||
if not text or re.search(r'["“”]', text) or to_someone_else(re.sub(r"^(\W*루미야)(?=\S)", r"\1 ", text)):
|
||||
return False # "야 그 컵 나 줘 봐": said to a friend (the call is cut below)
|
||||
if not text or re.search(r'["“”]', text) or to_someone_else(re.sub(r"^(\W*루미야)(?=\S)", r"\1 ", text)) or \
|
||||
NOT_A_THING.search(text):
|
||||
return False # "야 그 컵 나 줘 봐": said to a friend; "give me the news"
|
||||
text = hand_text(text)
|
||||
if not text or not_an_order(text):
|
||||
return False
|
||||
@@ -2180,8 +2229,8 @@ def hand_request(text, holding, b=None, markers=(), whole=True):
|
||||
hand while holding; None for anything else (a pick from the table, a mission of several steps, a question).
|
||||
holding: something is in the hand now. "give me the cup" with the hand empty is a pick and give (a mission).
|
||||
whole: the words are a whole command (not one clause of a mission): several steps in it are the mission reader's."""
|
||||
if re.search(r'["“”]', text or ""):
|
||||
return None # '"give it to me" is a nice English phrase'
|
||||
if re.search(r'["“”]', text or "") or NOT_A_THING.search(text or ""):
|
||||
return None # '"give it to me" is a nice English phrase', "give me the news"
|
||||
text = hand_text(instead_of(text))
|
||||
t = CALLING.sub("", _norm(text, markers).strip()) # "루미야, 이리 줘", "혹시 저 줘요", "um, put it down"
|
||||
if holding and re.search(r"\bi mean\b|\S\W*\bsorry\b", t):
|
||||
@@ -2483,8 +2532,56 @@ ABOUT_ANSWER = re.compile(r"^\W*(?:(?:but|and|so|then|oh|wait|hmm|okay|come on|
|
||||
r"how come|how (?:do|did|can) you (?:know|tell)(?: that| it)?|(?:are )?you sure(?: about (?:that|it|this))?|sure about that|really|for real|fr|seriously|no way|"
|
||||
r"what do you mean|says who|(?:you'?re |you are )?(?:lying|kidding)(?: me)?|(?:no|don'?t) lie|거짓말(?:하지 ?마\S*|이지\S*|이야\S*)?|설마\S*|"
|
||||
r"왜(?:요|죠)?|왜 안 ?(?:돼|되)\S*|진짜(?:요|야|로)?|정말(?:요|이야)?|레알|실화(?:야|예요|냐)?|참말\S*|"
|
||||
r"확실(?:해|한가|하)\S*|어떻게 알아\S*|그게 무슨 (?:뜻|말)\S*)\W*$", re.I)
|
||||
r"확실(?:해|한가|하)\S*|어떻게 알아\S*|그게 무슨 (?:뜻|말)\S*|"
|
||||
r"(?:are )?u sure|(?:are )?you serious|serious|is (?:that|it) (?:right|true|so)|no kidding|you'?re joking|"
|
||||
r"(?:그게 |그거 |그 말 )?맞(?:아|아요|나|나요|습니까|는 거야|는 거예요|지)|진짜(?:예요|입니까|이가|가|냐)|"
|
||||
r"정말(?:이에요|입니까|이가|이냐)|참(?:말|말이가|말이야|말이에요|말입니까)|말도 안 ?(?:돼|되)\S*|"
|
||||
r"그럴 ?리가\S*|농담\S*|ㄹㅇ|에이 ?설마\S*|왜 그(?:래|런|렇)\S*|에이)\W*$", re.I)
|
||||
# asks about the answer just given: its reason, its source, or to confirm it
|
||||
_CORE_LEAD = re.compile( # words before what a follow-up asks: fillers, calling Lumi, "by the way", "wait"
|
||||
r"^\W*(?:(?:hey|hi|yo|okay|ok|so|um+|uh+|ah+|oh+|hmm+|alright|well|now|and|but|then|wait|look|listen|right|hold on|"
|
||||
r"quick one|quick question|one more thing|by the way|btw|lumi|loomy|loomi|rumi|robot|buddy|yeah|"
|
||||
r"음+|어+|아+|흠+|에|자|참|저기요?|잠깐만?|잠깡|근데|그런데|그럼|그러면|그리고|그래서|아 맞다|맞다|그건 그렇고|"
|
||||
r"궁금한 (?:게|건데|거|것)|있잖아요?|여보게|이보게|보이소|아야|거시기|어이|야|헐|대박|아니|"
|
||||
r"(?:루미|로봇|누미|류미)(?:야|아|씨|님|양반|선배님|프로|군|양)?(?:\s+(?:씨|님|양반|선배님|프로))?)(?![\w가-힣'])[\s,.!~:]*)+",
|
||||
re.I)
|
||||
_CUT_WORD = re.compile(r"[^\s,]*[—–]\s*") # whisper's broken-off word: "참— 참말이가", "루— 루미 양반"
|
||||
|
||||
|
||||
def core(text):
|
||||
"""What a short follow-up asks, without the words around it: "음 루미아, 정말요?" -> "정말요?", "아 맞다, 여러분
|
||||
보세요,어디 있어?" -> "어디 있어?" (the last of several short parts), "Jason, look, Lumi seriously?" -> "seriously?".
|
||||
Only for reading what kind of follow-up it is; the model gets the words as said."""
|
||||
t = _CUT_WORD.sub("", text or "").strip().rstrip(".~ ").strip()
|
||||
t = _CORE_LEAD.sub("", t).strip() or t
|
||||
last = _CORE_LEAD.sub("", re.split(r"[,:]\s*", t)[-1]).strip()
|
||||
return last if last and t != last and len(last.split()) <= FOLLOW_UP_WORDS + 1 and \
|
||||
(ABOUT_ANSWER.match(last) or SHORT_Q.search(last)) else t
|
||||
|
||||
|
||||
THANKS_ONLY = re.compile(r"^\W*(?:thanks?(?: (?:a lot|so much|very much))?|thank you(?: (?:so much|very much|a lot))?|thx|"
|
||||
r"cheers|ty|고마워(?:요)?|고맙(?:습니다|다|데이|구먼)|감사(?:합니다|해요|해|하다)|땡큐(?: 베리 ?머치)?)"
|
||||
r"(?:\W+(?:lumi|robot|루미야?|로봇아?))?\W*$", re.I) # thanks and nothing else
|
||||
BYE_WORDS = re.compile(r"\b(?:bye|goodbye|see you|gotta go|i (?:have|need) to go)\b|안녕(?!하)|갈게|가 ?볼게|가야|잘 ?있어|"
|
||||
r"수고하", re.I) # with a question after it: one more question before leaving
|
||||
|
||||
|
||||
def topic_turn(history):
|
||||
"""The last turn that said something of its own: a back-channel ("헐 대박", "Oh, I see.") and Lumi's short reply
|
||||
to it are passed over, so "really?" / "where is it?" after them asks about the answer before."""
|
||||
for q, a in reversed(history[-4:]):
|
||||
if about_answer(q) or not (is_backchannel(q) or UNDERSTOOD.search(q) and len(q.split()) <= 4):
|
||||
return q, a
|
||||
return history[-1]
|
||||
|
||||
|
||||
def about_answer(text):
|
||||
"""The words ask about the answer just given (ABOUT_ANSWER), also with words around them."""
|
||||
c = core(text)
|
||||
w = c.split()[-1] if c.split() else ""
|
||||
return bool(ABOUT_ANSWER.match(text or "") or ABOUT_ANSWER.match(c) or len(c.split()) <= 3 and
|
||||
(ABOUT_ANSWER.match(w) or re.search(r"(?:정말|진짜|참말|설마)(?:요|이야|이에요|이가|로)?\W*$", w)))
|
||||
# "투자자 앞에서 진짜?", whisper's "어정말요?"
|
||||
LOOKUP_BEFORE_CHARS = 1500 # chars of the last lookup's results given again with a follow-up ("how old is she?")
|
||||
FOLLOW_UP_WORDS = 5 # "why did Samsung stock fall today?" is a new question, "tell me more about it" is not
|
||||
AND_ALSO = re.compile(r"^\s*(and|what about|how about|also|그럼|그리고)\b", re.I) # "and the yen?": a follow-up
|
||||
@@ -2492,7 +2589,9 @@ WEATHER_ASKED = " (the weather)" # lumi.look_up adds it to a weather question;
|
||||
WEATHER_PLACE = re.compile(r"^\W*(?i:(?:and|so|then|ok(?:ay)?)\W+)*(?i:(?:what|how)\s+about\s+)?(?i:in\s+)?"
|
||||
r"(?!(?:Why|What|When|Where|Who|Whose|How|Which|Is|Are|Was|Will|Can|Could|Do|Does|Did|Should|Lumi)\b)(?P<place>[A-Z][\w'-]*(?:\s+[A-Z][\w'-]*)*)[\s?.!]*$") # "what about Busan?" after the weather
|
||||
KO_WEATHER_PLACE = re.compile(r"^\W*(?:(?:그럼|그러면|그리고|아니)\W*)?(?P<place>[가-힣]+?)(?:시|도)?(?:\s*날씨)?"
|
||||
r"(?:은|는|도|에는|에서는|이요|요)*[\s?.!~]*$") # "그럼 부산은?": a place of web.KO_PLACES only
|
||||
r"(?:은|는|도|에는|에서는|이요|요)*(?:\s*(?:날씨는?\s*)?(?:어때요?|어때유|어떻습니까|어떠세요|어떠신가요|어떻노|어떻나요?|"
|
||||
r"어뗘|어떠냐|어떻니|어떤가요|어떻게 ?(?:돼요?|됩니까|되나요|되노)|우째 ?되노))?[\s?.!~]*$")
|
||||
# "그럼 부산은?", "부산은 어떻노?": a place of web.KO_PLACES only
|
||||
REPAIR = re.compile(r"^\W*(?:(?:no|nope|sorry|oh)\W+)*i\s+mean[t]?\b|^\W*(?:아니|아뇨|아니요)[\s,]|말고\b|"
|
||||
r"말(?:이야|이에요|이요)\W*$", re.I) # "no, I meant North Korea", "아니 서울 말이야"
|
||||
LEAD = re.compile(r"^\s*(?:(?:and|what about|how about|also|no|nope|sorry|oh|그럼|그리고|아니|아뇨|아니요)\b[\s,]*)*"
|
||||
@@ -2515,9 +2614,16 @@ REACTION = re.compile(r"^\W*(?:(?:wow|oh|really|huh|whoa)\W+)*(?:i (?:didn'?t|di
|
||||
re.I) # a reaction to what was found, not a new question
|
||||
NOW_Q = re.compile(r"\bwhat time is it\b|\bwhat'?s the time\b|\bwhat(?:'s| is) (?:the date|today)\b|지금 몇 ?시|오늘 며칠",
|
||||
re.I) # asked of the clock, not of the lookup before
|
||||
WEATHER_WORDS = re.compile(r"\b(?:and|so|then|too|also|as well|ok(?:ay)?|what|how|about|is|it|the|weather|like|for|on|in|at|will|be|going|"
|
||||
WEATHER_WORDS = re.compile(r"\b(?:how's|what's|looking|look|and|so|then|too|also|as well|ok(?:ay)?|what|how|about|is|it|the|weather|like|for|on|in|at|will|be|going|"
|
||||
r"to|forecast|rain|there|that|then|please|sorry|no|i|mean|meant)\b|그럼|그러면|그리고|날씨|어때요|어때|어떤가요|어떨까요|어떻게|돼요|"
|
||||
r"비|와요|올까요|오나요|알려|줘|주세요", re.I) # the rest of "and the weather on Friday then?"
|
||||
r"비|와요|올까요|오나요|알려|줘|주세요|어떻습니까|어떠세요|어떠신가요|어떻노|어떻나요|어떻나|어뗘|어떠냐|어떻니|"
|
||||
r"어때유|우째|되노|됩니까|되나요|될까요|돼|어떤가요|어떻게|좀", re.I) # the rest of "and the weather on Friday then?"
|
||||
WEATHER_ONLY = re.compile(r"^\W*(?:(?:and|so|then|그럼|그러면)\W+)?(?:is it|will it|is it going to|does it|do i need|should i (?:bring|take)|"
|
||||
r"any|how)\b.{0,25}\b(?:rain\w*|snow\w*|windy|umbrella|jacket|coat)\b[\w\s]*\W*$|"
|
||||
r"^\W*(?:그럼\s*)?(?:비|눈|소나기|미세먼지|황사|바람)(?:은|는|도|가|이)?\s*(?:와|와요|오나요?|올까요?|옵니까|오니|오노|와유|"
|
||||
r"어때요?|어떻습니까|많이 불어요?|불어요?|심해요?|나빠요?|있어요?)?[\s?.!~요]*$|"
|
||||
r"^\W*우산\s*(?:챙겨야|가져가야|필요)", re.I) # a weather question that names no day or place;
|
||||
# "is it cold?" / "추워요?" is answered from the weather just said (the LLM)
|
||||
PARTICLES = re.compile(r"^[은는도요의에이가서엔]+$") # "월요일은요" less the day
|
||||
CHECKING = re.compile(r"^\W*(?:let me (?:check|see|look)|one moment|just a moment|확인해 ?볼게요|잠시만요?)\W*$", re.I)
|
||||
# lumi says it before the lookup: never again inside the answer
|
||||
@@ -2526,8 +2632,10 @@ CHECKING = re.compile(r"^\W*(?:let me (?:check|see|look)|one moment|just a momen
|
||||
def weather_follow(text):
|
||||
"""A short weather follow-up that names a day and maybe a place ("내일은요?", "and Friday?", "what about Busan
|
||||
tomorrow?", "다음 주 월요일 어때요?"): the place ("" = the one asked before), else None."""
|
||||
if len(text.split()) > 8 or web.asked_day(text) is None:
|
||||
if len(text.split()) > 8:
|
||||
return None
|
||||
if web.asked_day(text) is None: # "비는 와?", "is it cold?" right after the weather: the same
|
||||
return "" if WEATHER_ONLY.search(text) and not re.search(r"(?<=\s)(?!I\b)[A-Z]", text) else None # day and place
|
||||
rest = web.DAY_PHRASE.sub(" ", text)
|
||||
ko = next((k for k in sorted(web.KO_PLACES, key=len, reverse=True) if k in rest), None)
|
||||
rest = WEATHER_WORDS.sub(" ", rest.replace(ko, " ") if ko else rest)
|
||||
@@ -2670,6 +2778,9 @@ class Brain:
|
||||
for q, a in self.window():
|
||||
messages += [{"role": "user", "content": q}, {"role": "assistant", "content": a}]
|
||||
follow = _follow_examples(text, self.history) # with them, fewer plain examples (a shorter prompt)
|
||||
if follow and not LUMI_TOPIC.search("{} {}".format(core(topic_turn(self.history)[0]), topic_turn(self.history)[1])):
|
||||
notes = "(none needed: the answer is in this talk)" # "when was it built?" after the Eiffel Tower: notes
|
||||
# on Lumi ("When was I built? 2 years") only misled
|
||||
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"{follow}"
|
||||
f"Now it is {now_line()}.\n\n" + memory.turn_lines(self, text) +
|
||||
@@ -2701,7 +2812,7 @@ class Brain:
|
||||
if header is None: # the model skipped the ACTION line
|
||||
header, buf = self._after({"action": "none", "target": ""}, text), first + " " + buf
|
||||
if header["action"] == "unclear" and not retried and \
|
||||
(has_meaning(text) or self.history and ABOUT_ANSWER.match(text)) and \
|
||||
(has_meaning(text) or self.history and about_answer(text)) and \
|
||||
not other_latin_language(text): # 26b called short or broken but clear words unclear ("fr?")
|
||||
stream.close()
|
||||
retried, header, buf, full = True, None, "", ""
|
||||
@@ -2785,12 +2896,21 @@ class Brain:
|
||||
if last and part: # "What about your cameras?" / "카메라는요?" after "can I wipe you?"
|
||||
return (f"(The visitor's question \"{self.history[-1][0]}\" asked again, now about {part.group(1)}: answer "
|
||||
f"that question for it, not other facts about it.)\n")
|
||||
if last and ABOUT_ANSWER.match(text): # "why?", "how do you know?", "진짜?" after a refusal too
|
||||
if last: # past a back-channel ("헐 대박") to the answer before it
|
||||
last = " ".join(ln for ln in topic_turn(self.history)[1].splitlines() if not re.match(r"\s*\**ACTION", ln)).strip()
|
||||
c = core(text) # "루미 양반, 언제야?" asks "언제야?", not about Lumi
|
||||
if last and (THANKS_ONLY.match(c) or THANKS_ONLY.match(re.split(r"[,:]\s*", c)[-1])) and \
|
||||
not self._last_said().rstrip().endswith("?"): # "궁금한 게, 고마워요~", "Then oh thank you."
|
||||
return "(Only thanks for your answer, not a goodbye: say you're welcome in a few words; no goodbye, no question.)\n"
|
||||
if BYE_WORDS.search(text) and SHORT_Q.search(re.split(r"(?<=[,.!~])\s*", text.strip())[-1]):
|
||||
return "(A goodbye with one more question: answer the question; no goodbye in your words yet.)\n"
|
||||
if last and about_answer(text): # "why?", "how do you know?", "진짜?" after a refusal too
|
||||
return (f"(This asks about your answer \"{last[:FRAGMENT_CHARS * 2]}\": its reason or how you know it; "
|
||||
f"a \"really?\" / \"sure?\" is answered \"Yes,\" with that answer's own facts said again (its numbers, names or the "
|
||||
f"things it listed, never just \"that\" / \"those\"), no new fact.)\n")
|
||||
if not last or len(text.split()) > FRAGMENT_WORDS or not SHORT_Q.search(text) or is_backchannel(text) \
|
||||
or ABOUT_YOU.search(text) or OWN_TOPIC.search(text):
|
||||
pronoun = NAMED_BEFORE.search(c) or REFERS_BACK.search(c) # "when was it built?", "how old are they?"
|
||||
if not last or len(c.split()) > (FOLLOW_UP_WORDS + 2 if pronoun else FRAGMENT_WORDS) or not SHORT_Q.search(c) \
|
||||
or is_backchannel(c) or ABOUT_YOU.search(c) or (OWN_TOPIC.search(c) or OWN_SUBJECT.search(c)) and not pronoun:
|
||||
return ""
|
||||
return f"(This follows your answer \"{SENTENCE_END.split(last)[0][:FRAGMENT_CHARS]}\": it asks about that.)\n"
|
||||
|
||||
@@ -2809,7 +2929,7 @@ class Brain:
|
||||
if header.get("held", ("none",))[0] != "none" and (self._redo(text) or DO_IT.match(text) or confirm_answer(text) == "yes" and
|
||||
self._last_said().rstrip().endswith("?")):
|
||||
return {"action": header["held"][0], "target": header["held"][1]} # "yes" to "Shall I go there?"
|
||||
if header["action"] == "quiet" and ABOUT_ANSWER.match(text):
|
||||
if header["action"] == "quiet" and about_answer(text):
|
||||
return {"action": "none", "target": ""} # "에이, 거짓말하지 마" doubts the answer, not "be quiet"
|
||||
redo = self._redo(text)
|
||||
if redo and header["action"] == "none": # "do it again" after a wave answered "Okay!" with none
|
||||
@@ -2972,6 +3092,9 @@ class Brain:
|
||||
f"in your own words: {' / '.join(ideas)}. "
|
||||
+ (f"Said to other visitors lately, so do not use these again: {avoid}. "
|
||||
if avoid else "") +
|
||||
"It must say goodbye in plain words (bye, see you, take care / "
|
||||
"안녕히 가세요, 조심히 가세요, 다음에 또 만나요, 또 오세요), not only "
|
||||
"thanks or 'enjoy'. "
|
||||
"Do not begin with 'You're welcome' or '천만에요'; never say 'Have a "
|
||||
"great day', 'It was nice talking with you' or 'It was my pleasure'; "
|
||||
"in Korean polite (-요)."})
|
||||
@@ -3129,7 +3252,9 @@ class Brain:
|
||||
if action == "stop" and "?" in text:
|
||||
action = "none" # "how do I stop you?": a question about stopping
|
||||
if action == "end" and "?" in re.split(r"(?<=[.!?~])\s+", text.strip())[-1]:
|
||||
action = "none" # "thanks, and where is p3?": a question is no goodbye; the
|
||||
action = model if model in ("search", "weather") else "none" # "갈게요, 근데 후지산은 얼마나 높아?": its
|
||||
target = target if action != "none" else "" # lookup stays (else "search 후지산 높이" was said aloud)
|
||||
# "thanks, and where is p3?": a question is no goodbye; the
|
||||
# model reads "okay" / "됐어요" with the talk before (owner)
|
||||
out = {"action": action, "target": target or ""}
|
||||
if held and action == "none":
|
||||
|
||||
@@ -27,8 +27,8 @@ TURN_MORE_DEG = 15.0 # deg; "a bit more" right after a turn: this much f
|
||||
DIRS = (("back", r"\bback(?:wards?)?\b(?! down\b)|\bbackward\b|\breverse\b|^(?:let'?s )?(?:bake|big)\b(?= \d| half| a )|뒤로|뒤쪽|후진|"
|
||||
r"물러"), # whisper's "let's bake / big one meter"
|
||||
("forward", r"\bforwards?\b|\bahead\b|앞으로|앞쪽|전진"),
|
||||
("left", r"\b(?:to the |to your )?left\b|왼쪽|좌측"),
|
||||
("right", r"(?<!all )\b(?:to the |to your )?right\b(?! now| away| here| there| back)|오른쪽|우측"))
|
||||
("left", r"\b(?:to the |to your )?left\b|왼쪽|왼편|웬쪽|좌측"),
|
||||
("right", r"(?<!all )\b(?:to the |to your )?right\b(?! now| away| here| there| back)|오른쪽|오른편|우측"))
|
||||
VERB = re.compile(r"\b(?:move|go|come|drive|step|scoot|scooch|shift|inch|roll|back (?:up|off)|reverse|get)\b|"
|
||||
r"가|와|이동|움직|물러|빠져|후진|전진|비켜")
|
||||
NEAR_THING = re.compile(r"(?:테이블|책상|탁자|의자|소파|문|벽|창문)\s*(?:앞|옆|뒤)|"
|
||||
|
||||
@@ -34,11 +34,14 @@ FILLS = 3 # place / object fills made of each template (the same e
|
||||
# ---------- guards: words the bank never reads ----------
|
||||
NEGATION = re.compile(r"\b(?:don'?t|do not|never|no need|not now|no more|stop \w+ing|quit \w+ing|without|forget it|"
|
||||
r"never ?mind|scratch that|cancel that)\b|취소|아니다|됐다|"
|
||||
r"[가-힣]지 ?마(?:세요|요|라|십시오)?(?![가-힣])|하지 ?말|말고|필요 ?없|안 ?(?:해|돼|가|와)(?:도)?\b|그만", re.I)
|
||||
r"[가-힣]지 ?마(?:세요|요|라|십시오)?(?![가-힣])|하지 ?말|말고|[가-힣]지 ?(?:말아|말라|마시|마셔|말게)|필요 ?없|안 ?(?:해|돼|가|와)(?:도)?\b|그만", re.I)
|
||||
LATER = re.compile(r"\b(?:when|whenever|if|unless|after|before|once|until|till|as soon as|later|tomorrow|tonight|"
|
||||
r"next time|in (?:\w+ ){0,2}(?:minute|hour|second|min|sec)s?|in a (?:while|bit)|soon)\b|분 ?(?:뒤|후|있다)|"
|
||||
r"[가-힣](?<![정화측반전표라장내외평단그러])면(?:\s|$)|(?:하|으|오|가|되|끝나|있으|오시)면|나중에|이따|내일|"
|
||||
r"다음에|있다가|(?:^|\s)(?:후|뒤|전)에(?![서가-힣])|때(?:에)?\s", re.I)
|
||||
r"다음에|있다가|(?:^|\s)(?:후|뒤|전)에(?![서가-힣])|때(?:에)?\s|다음 ?(?:주|달|번|시간)에?|"
|
||||
r"(?:^|\s)(?:\d{1,2}|한|두|세|네|다섯|여섯|일곱|여덟|아홉|열|열한|열두) ?시(?:에|쯤|까지)|"
|
||||
r"\b(?:next (?:week|month|year|monday|tuesday|wednesday|thursday|friday|saturday|sunday)|"
|
||||
r"at (?:\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)(?::\d\d)? ?(?:o'?clock|pm|am|p\.m\.|a\.m\.))", re.I)
|
||||
ABILITY = re.compile(r"\b(?:are you able|able to|know how to|how (?:do|can|could|would) you|is it possible|can you even|"
|
||||
r"capable of|do you (?:know|have)|can robots?|could robots?)\b|"
|
||||
r"\bcan you (?:\w+ )?(?:things|anything|objects|stuff|people|by yourself)\b|\b(?:can|could) you \w+(?: up)? (?:a|an|any)\b.*\?|"
|
||||
@@ -47,7 +50,9 @@ WONDER = re.compile(r"\bi wonder\b|\bwonder(?:ing)? (?:if|whether|how)\b|\bi bet
|
||||
r"\b(?:can|could|does|did|will|would|is|was) (?:it|this|that|the robot|this robot|that robot|he|she|this thing)\b|"
|
||||
r"\b(?:it|the robot|this robot|this thing) (?:can|could|does|will|is able)\b|\bcan it\b|"
|
||||
r"(?:있|하|되|가|와|오|돌|봐|올라|내려|흔들|집|따라)나(?:요)?\s*[??.~]*\s*$|나 ?봐(?:요)?\s*[??.~]*\s*$|"
|
||||
r"(?:^|\s)(?:얘|쟤|걔|이 로봇|저 로봇|로봇이|로봇은|로봇도|이게|이거는)\s|궁금", re.I)
|
||||
r"(?:^|\s)(?:얘|쟤|걔|이 로봇|저 로봇|로봇이|로봇은|로봇도|이게|이거는)\s|궁금|"
|
||||
r"(?:^|\s)(?:얘도|쟤도|걔도|이것도|이거도)\s|[가-힣]기도 (?:해|하나|하니|해요|합니까)\s*[??]?\s*$|" # "얘도 팔 접기도 해?"
|
||||
r"\blet'?s have (?:it|the robot|lumi|him|her)\b", re.I)
|
||||
# "can it wave? I wonder", "does it follow people?", "이거 손 흔들 수 있나?", "얘 따라오나 봐"
|
||||
NOT_TO_LUMI = re.compile(
|
||||
r"\bshall we\b|\bwe(?:'re| are) (?:heading|going|off|gonna)\b|\bwe (?:should|could|can|will|might|must|need to)\b|\bwe'll\b|"
|
||||
@@ -65,7 +70,8 @@ QUESTION = re.compile(r"^\W*(?:(?:hey|so|um+|uh+|lumi|okay|ok)\W+)*(?:what|where
|
||||
r"어디|뭐|무엇|왜|언제|누구|어떻게|몇|어느|무슨|어떤|얼마|[가-힣]까\s*[??]+\s*$|봤(?:어|니|나|냐|어요|습니까)|본 ?적|"
|
||||
r"\bhave you (?:been|gone|ever)\b|(?:어|아|해|여)도 ?(?:돼|되|될까|괜찮)|"
|
||||
r"알려 ?(?:줘|주|줄)|설명해|가르쳐|말해 ?(?:줘|봐|주)|\btell me\b|\bexplain\b|\bdescribe\b|"
|
||||
r"정확도|얼마나|을매나|속도", re.I) # "팔 정확도 알려 줘": a question, no motion
|
||||
r"정확도|얼마나|을매나|속도|(?:열려|닫혀|켜져|꺼져|접혀|펴져) ?있(?:어|어요|니|나요|습니까)?\s*[??]", re.I)
|
||||
# "그리퍼 열려 있어요?": a state asked, no motion # "팔 정확도 알려 줘": a question, no motion
|
||||
OTHER_SENSE = re.compile(r"instagram|insta\b|\bsns\b|\baccount\b|\bsubscribe\b|인스타|계정|채널|구독|팔로우 ?해 ?주세요|"
|
||||
r"따라 ?(?:해|하|말|불러)|\brepeat after\b|\bcopy me\b|\bdo what i do\b|\b(?:lend|give) me a hand\b|"
|
||||
r"\bneed a hand\b|\bhand it to\b|가는 ?길|길 ?(?:좀 )?알려|\bhow (?:do i|to) get\b|\bdirections?\b|\bthe way to\b|"
|
||||
@@ -725,7 +731,7 @@ AMOUNT = [(re.compile(r"\b\d+(?:\.\d+)?\s*(?:degrees?|도)(?![a-z])|\b\d+(?:\.\d
|
||||
def plain(text):
|
||||
"""The words without polite frames ("if you don't mind", "it'd be great if you could") and calls before."""
|
||||
from assistant import wording
|
||||
t = POLITE.sub(" ", wording.ko_plain(wording.now_not_later(text)))
|
||||
t = POLITE.sub(" ", wording.polite(wording.ko_plain(wording.now_not_later(text))))
|
||||
for rx, word in SLANG:
|
||||
t = rx.sub(word, t)
|
||||
t = re.sub(r"\s+([,.!?])", r"\1", re.sub(r"^[\s,.!?~]+", "", t))
|
||||
@@ -1145,9 +1151,11 @@ def _slot(kind, text, markers, holding):
|
||||
|
||||
def read(text, markers=(), holding=False):
|
||||
"""(action, target) as brain.intent gives it, when the bank is sure; else None (the LLM reads it)."""
|
||||
from assistant import brain
|
||||
said, text = text, plain(text)
|
||||
if guarded(text):
|
||||
return None
|
||||
if guarded(text) or brain.not_an_order(said, asked=False) or brain.held_back(said):
|
||||
return None # lumi.route holds these before the bank too: a later time, a
|
||||
# quote, "it's going to ...", "for the demo, let's have it ..."
|
||||
kind = kind_of(text, markers)
|
||||
if isinstance(kind, tuple): # two motions close: only when the words fit one of them
|
||||
kind, other = kind
|
||||
|
||||
+48
-11
@@ -3236,11 +3236,25 @@ NOT_STOP = re.compile( # a stop word that orders no stop: negated, about someo
|
||||
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"(?<![가-힣])(?!루미|로봇|누미)(?:엄마|아빠|얘들아|[가-힣]{1,3}야|[가-힣]{1,3}아)\s+(?:좀\s+)?그만|"
|
||||
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
|
||||
|
||||
|
||||
_STOPW = r"(?:sto+p|halt|freeze|멈춰|멈춰요|정지|그만|스톱|스탑)"
|
||||
STOP_UNSAID = re.compile( # a stop that is taken back, for later, said about the past, to someone else, or mocked
|
||||
rf"{_STOPW}.*[,.…—–!]\s*(?:(?:oh|uh|um|hmm+|아|어|음|wait|no|actually)\W+)*(?:never ?mind|forget (?:it|that)|"
|
||||
r"cancel(?: that| it)?|(?:아\s*)?(?:됐어|됐다|됐어요)(?: 마| 됐어)?|취소|아니다|(?:아\s*)?(?:그냥\s*)?하지 ?마(?:세요|요)?)\W*$|"
|
||||
rf"[가-힣](?:면|나면|으면)\s+(?:\S+\s+){{0,3}}{_STOPW}|" # "사람 나오면 그때 멈춰", "음악 멈추면 멈춰요"
|
||||
rf"\b{_STOPW}(?: \w+)? (?:when|once|after|until|as soon as|if) |\bwhen i give the signal\b|" # "stop when you get there"
|
||||
rf"\b(?:don'?t|do not|doesn'?t|didn'?t|won'?t) (?:\w+ ){{0,2}}{_STOPW}\b|{_STOPW}\s*하지 ?마|" # "you don't have to stop"
|
||||
rf"(?<!you )(?<!have )(?<!need )(?<!got )(?<!want )\bto {_STOPW}\b|\b(?:it|he|she) (?:doesn'?t|tried to|keeps?) |" # "waiting for it to freeze"
|
||||
r"\b(?:heard|bet|like|guess) (?:that )?(?:you|it) (?:can|could)\b|\bi saw you\b|"
|
||||
r"리가 있나|내가 사람이다|퍽이나|[가-힣]겠다\W*$|했던데|그랬잖아|했잖아|(?:멈췄|정지했|그만했)(?:던데|잖아|으면)|"
|
||||
r"(?-i:\b(?!(?:Lumi|Loomi|Rumi|Robot|Hey|Hi|Okay|Ok|No|Please|Now|Wait|Hello|So|Oh|Yo|Stop)\b)[A-Z][a-z]+), (?:okay )?stop|"
|
||||
r"\bstop it,? (?-i:(?!Lumi\b|Robot\b)[A-Z][a-z]+)\b", re.I)
|
||||
|
||||
|
||||
STOP_PAD = re.compile(r"^(?:\W*(?:hey|hi|yo|oh|okay|ok|so|um+|uh+|listen|right|alright|all right|excuse me|mister robot|"
|
||||
r"robot|lumi|loomi|루미 ?씨|루미 ?선생|루미야?|로봇아?|로봇 양반|어+|아+|야|저기요?)\b)+|"
|
||||
r"(?:\W*\b(?:please|plz|pls|bro|now|right now|real quick|thanks|thank you|okay|ok|would you|will you|"
|
||||
@@ -3263,6 +3277,8 @@ def stop_order(text, markers):
|
||||
if NOT_STOP.search(text) and not re.fullmatch(r"\W*(?:(?:no|ok|okay|lumi|루미야?|hey)\W+)*(?:sto+pp?|stob|stopped|halt|freeze|멈춰|머+엄*춰|"
|
||||
r"그만|정지|스톱|스탑|stop it|stop now)\W*", text, re.I):
|
||||
return False
|
||||
if STOP_UNSAID.search(text):
|
||||
return False
|
||||
bare = STOP_PAD.sub("", text.strip()).strip(" ,.!?~")
|
||||
if bare and STOP_ONLY.fullmatch(bare):
|
||||
return True # "hi Lumi, stop, okay?", "enough already", "Lumi, wait"
|
||||
@@ -3279,9 +3295,18 @@ def own_command(text, last=""):
|
||||
return bool(sing.asked(text, last) or sing.list_asked(text) or voice_words.read(text, last) or abilities.answer(text, "en", last))
|
||||
|
||||
|
||||
HAND_STATE_Q = re.compile( # how the hand is now (A1): "is your hand open?", "hand open이야?", "손 펴져 있어?", "그리퍼 열려 있어요"
|
||||
r"\b(?:is|are|r|was) (?:your|ur|the) (?:hand|gripper|claw|fingers?|arm)s? (?:still |now |already )?(?:open|opened|closed|shut|out|"
|
||||
r"extended|empty|folded|in|up|down|stretched)\b|\b(?:hand|gripper|arm) (?:open|closed?|out)\s*(?:이야|이에요|인가요?|이니|상태|\?)|"
|
||||
r"^\W*(?:(?:right|um|basically|next|so|okay)\W+)*did (?:you|u) drop (?:it|that|something|the \w+)\W*$|"
|
||||
r"(?:손|그리퍼|집게|손가락|팔)(?:이|은|는|가)? ?(?:지금 |아직 |다 )?(?:open|close|펴져|펴진|열려|열린|닫혀|닫힌|접혀|접힌|뻗어져|오므려져|"
|
||||
r"쥐어져)\s*(?:있|상태|이야|인가)", re.I)
|
||||
|
||||
|
||||
def status_question(text):
|
||||
""""What are you doing?", "where are you going?": answered from the task state ("들고 있는 거 줘" is a request)."""
|
||||
return bool(STATUS_Q.search(text)) and not NOT_STATUS_NOW.search(text) and not EMPTY_HAND.search(text)
|
||||
""""What are you doing?", "where are you going?", "is your hand open?": answered from the task state ("들고 있는 거
|
||||
줘" is a request)."""
|
||||
return bool(HAND_STATE_Q.search(text)) or bool(STATUS_Q.search(text)) and not NOT_STATUS_NOW.search(text) and not EMPTY_HAND.search(text)
|
||||
|
||||
|
||||
def says_goodbye(text):
|
||||
@@ -3322,16 +3347,18 @@ def route(text, markers, b, holding=False, seen=None, last="", chain_ok=True):
|
||||
by)); "end" (a goodbye); "sing"; "quick" (brain.intent's rule, one of QUICK_RULES, or the example bank's
|
||||
reading: assistant/intent_bank.py); (None, None): the LLM reads
|
||||
it. seen: seeing.answer or a stand-in; chain_ok: False on a mission or while a chain runs."""
|
||||
from assistant import chain
|
||||
from assistant import chain, intent_bank
|
||||
if stop_order(text, markers):
|
||||
return "stop", None
|
||||
told = intent_bank.TAG.search(text) and (chain.PAST.search(text) or intent_bank.PAST_EN.search(text) or
|
||||
intent_bank.past_ko(text)) # "you went to P5 earlier, right?": asked
|
||||
text = brain_mod.strip_asides(text) # "hi Lumi, it's my birthday, put it down!": the command (A1)
|
||||
if sing.picked(text, last): # after the list of songs: "the first one", "Fantastic Baby"
|
||||
return "sing", None
|
||||
arm_last = re.match(r"ACTION: (wave|arm (?:reach|fold))\b", last or "")
|
||||
if arm_last and ARM_AGAIN.match(text or ""):
|
||||
return "quick", tuple((arm_last.group(1).split() + [""])[:2]) # "again!", "한 번 더" right after a wave
|
||||
hold = brain_mod.not_an_order(text) or not brain_mod.direct_order(text) or brain_mod.held_back(text) # only a direct
|
||||
hold = told or brain_mod.not_an_order(text) or not brain_mod.direct_order(text) or brain_mod.held_back(text) # only a direct
|
||||
# order to Lumi now acts (held_back: "don't ..., then ...", "yeah right, like you could ...", "..., forget it")
|
||||
stuck = detour.recent() # right after a blocked drive: "try again", "go around it", "go back";
|
||||
how = stuck and detour.read(text, markers, stuck["goal"]) # only a direct order (detour.read), else the LLM
|
||||
@@ -3351,10 +3378,11 @@ def route(text, markers, b, holding=False, seen=None, last="", chain_ok=True):
|
||||
return "status", None
|
||||
if (holding() if callable(holding) else holding) and brain_mod.held_put_back(text, markers):
|
||||
return "quick", ("put", "back") # "it's my birthday, put that back where you found it!"
|
||||
if hold: # a wave / arm rule may act on a question-form request ("악수 한번 할까요?",
|
||||
song = sing.asked(text, last) # "Let it go 불러 줘": a song title, never the hand (A1)
|
||||
if hold and not song: # a wave / arm rule may act on a question-form request ("악수 한번 할까요?",
|
||||
arm_rule = brain_mod.intent(text, markers) # "would it be possible to wave at me?"); intent() itself refuses
|
||||
if arm_rule and arm_rule[0] in ("wave", "arm"): # negations, later times, remarks, ability questions (A1)
|
||||
return "quick", arm_rule
|
||||
return arm_quick(arm_rule, holding)
|
||||
if hold and not ((brain_mod.held_give(text, markers) or brain_mod.held_place(text, markers)) and
|
||||
(holding() if callable(holding) else holding)): # "테이블에 놔 줄래? 영상 찍고 있어": the hand's
|
||||
rule = brain_mod.intent(text, markers) # weather / search are no motion: "Weather outside?"
|
||||
@@ -3364,7 +3392,7 @@ def route(text, markers, b, holding=False, seen=None, last="", chain_ok=True):
|
||||
cor = brain_mod.correction(text, b.history)
|
||||
if cor:
|
||||
return "correction", cor
|
||||
if brain_mod.hand_request(text, False, b, markers) or brain_mod.hand_request(text, True, b, markers):
|
||||
if not song and (brain_mod.hand_request(text, False, b, markers) or brain_mod.hand_request(text, True, b, markers)):
|
||||
held = holding() if callable(holding) else holding
|
||||
hand = brain_mod.hand_request(text, held, b, markers)
|
||||
if hand:
|
||||
@@ -3372,9 +3400,9 @@ def route(text, markers, b, holding=False, seen=None, last="", chain_ok=True):
|
||||
read = read_mission(text, markers)
|
||||
if read:
|
||||
return "mission", read
|
||||
arm_rule = brain_mod.intent(text, markers)
|
||||
arm_rule = not song and brain_mod.intent(text, markers)
|
||||
if arm_rule and arm_rule[0] in ("wave", "arm"):
|
||||
return "quick", arm_rule # "빠빠이 해 줘", "let's see you reach your arm out": the arm, not a goodbye
|
||||
return arm_quick(arm_rule, holding) # "빠빠이 해 줘", "let's see you reach your arm out": the arm, not a goodbye
|
||||
if talk_fate(text) == "end" and (b.history or not HI_ANNYEONG.search(text)): # "루미 안녕!" first: hello
|
||||
return "end", None
|
||||
if sing.asked(text, last):
|
||||
@@ -3385,11 +3413,20 @@ def route(text, markers, b, holding=False, seen=None, last="", chain_ok=True):
|
||||
if not rule:
|
||||
from assistant import intent_bank
|
||||
rule = intent_bank.read(text, markers, holding) # the same request in other words, by meaning
|
||||
if rule and rule[0] in ("wave", "arm") and brain_mod.ARM_TALK.search(text):
|
||||
rule = None # "it'd be cool if you could take your hand back someday": talk (A1)
|
||||
if rule:
|
||||
return "quick", rule
|
||||
return arm_quick(rule, holding)
|
||||
return None, None
|
||||
|
||||
|
||||
def arm_quick(rule, holding):
|
||||
"""A rule's reading as route's ("quick", rule); an open hand while holding is refused (the thing would fall)."""
|
||||
if tuple(rule[:2]) == ("arm", "open") and (holding() if callable(holding) else holding):
|
||||
return "hand", (("refuse", brain_mod.REFUSE_OPEN), True)
|
||||
return "quick", rule
|
||||
|
||||
|
||||
QUICK_RULES = {"go_to", "come", "follow", "quiet", "weather", "search", "move", "turn", "arm", "pick", "put", "move_object",
|
||||
"fetch", "look", "lift", "wave", "come_back", "waist"} # what quick_command does at once
|
||||
ARM_AGAIN = re.compile(r"^\W*(?:(?:okay|ok|yes|yeah|lumi|please|robot|루미야?|응|네)\W+)*(?:again|one more time|once more|"
|
||||
|
||||
@@ -268,16 +268,18 @@ 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)
|
||||
ABOUT_ME = re.compile(r"\b(?:i(?! (?:call|address) you\b)|i'm|am i|my|me|mine)\b|(?:^|\s)(?:나|내|제|저|난|전)(?:는|가|를|의)?\s", 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|"
|
||||
r"^\W*(?:그럼|그러면|그리고|근데|그런데|그래서|아니|왜|진짜|정말|확실|설마|또)|"
|
||||
r"\b(?:that|(?<!is )(?<!was )(?<!is it )(?<!how's )(?<!how is )it(?! is (?:now|today))|they|them|"
|
||||
r"(?<!hello )(?<!hi )(?<!hey )there|this one|the arm|your arm)\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"^(?!.*(?:키|무게|체중|신장|속도|시간|나이|높이|길이|크기)).*얼마(?:야|예요)|"
|
||||
r"맞(?:아|지|죠|나|습니까)|아니(?:야|에요|죠)", re.I) # what it can hold, the price, a check: the LLM
|
||||
SEVERAL = re.compile(r"\band\b|그리고|[??].+\S|하고\s|랑\s", re.I)
|
||||
SEVERAL = re.compile(r"\band\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|start|end|begin|finish)\b|열어요|닫아요|시작|끝나", re.I) # an event's time: the LLM
|
||||
@@ -330,6 +332,9 @@ def guarded(text, history=()):
|
||||
return "camera"
|
||||
if ABOUT_ME.search(t):
|
||||
return "about the visitor"
|
||||
lead = re.match(r"^\W*(?:and|so|but|okay so|then)\W+", t, re.I)
|
||||
if lead and len(t[lead.end():].split()) >= 3 and NAMES_LUMI.search(t[lead.end():]):
|
||||
t = t[lead.end():] # "and your name is?", "so who are you?": a whole question
|
||||
if FRAGMENT.search(t):
|
||||
return "fragment"
|
||||
if SEVERAL.search(t):
|
||||
|
||||
+440
-6
@@ -295,12 +295,12 @@ _BANK = {
|
||||
"en": [
|
||||
("Thank you", "You're welcome!"),
|
||||
("Thanks, Lumi", "Anytime. That's what I'm here for."),
|
||||
("Thanks a lot", "Happy to help. Need anything else?"),
|
||||
("Thanks a lot", "Happy to help."),
|
||||
("Thank you so much", "My pleasure, really."),
|
||||
("Cheers", "Cheers to you too!"),
|
||||
("Thanks for the cup", "Enjoy it! Let me know if you need another."),
|
||||
("I appreciate it", "Glad it was useful."),
|
||||
("Thanks for your help", "No trouble at all. Anything else on your mind?"),
|
||||
("Thanks for your help", "No trouble at all."),
|
||||
("Much appreciated", "It was nothing, honestly."),
|
||||
("Thanks for the chat", "I enjoyed it too. Come back anytime."),
|
||||
("Thank you, robot", "You're welcome, human."),
|
||||
@@ -308,16 +308,16 @@ _BANK = {
|
||||
("Thanks for the water", "Stay hydrated! Need anything else carried?"),
|
||||
],
|
||||
"ko": [
|
||||
("고마워요", "천만에요! 더 필요한 거 있으세요?"),
|
||||
("고마워요", "천만에요!"),
|
||||
("감사합니다", "별말씀을요. 도움이 돼서 다행이에요."),
|
||||
("고마워", "별말씀을요, 언제든지요!"),
|
||||
("정말 감사해요", "제가 더 기뻐요."),
|
||||
("땡큐", "천만에요, 유어 웰컴이에요! 또 불러 주세요."),
|
||||
("땡큐", "천만에요, 유어 웰컴이에요!"),
|
||||
("컵 가져다줘서 고마워", "맛있게 드세요! 더 필요하시면 말씀하세요."),
|
||||
("도와줘서 고마워요", "도움이 됐다니 다행이에요. 또 필요한 거 있으세요?"),
|
||||
("도와줘서 고마워요", "도움이 됐다니 다행이에요."),
|
||||
("수고해 줘서 고마워요", "아니에요, 재밌었어요."),
|
||||
("얘기해 줘서 고마워", "저도 얘기 나눠서 즐거웠어요."),
|
||||
("감사해요 루미", "언제든 불러 주세요."),
|
||||
("감사해요 루미", "천만에요, 언제든지요."),
|
||||
("물 가져다줘서 감사해요", "시원하게 드세요. 또 필요하면 불러 주세요."),
|
||||
("도와주셔서 정말 감사합니다", "아닙니다, 도움이 되어 기쁩니다."),
|
||||
],
|
||||
@@ -1444,6 +1444,440 @@ FOLLOWUPS = [
|
||||
]
|
||||
|
||||
|
||||
def _on(lang, q, a, *pairs):
|
||||
"""Several follow-ups on one answer (each said in another way or another speech level): FOLLOWUPS rows."""
|
||||
return [(lang, q, a, f, r) for f, r in pairs]
|
||||
|
||||
|
||||
# Night 3: the same follow-up kinds in every Korean speech level (반말, 해요체, 하십시오체, friendly, honorific,
|
||||
# dialect) and in English at the same depth: really? / are you sure? (the fact said again), a claim against the
|
||||
# fact (kept), a fragment with no subject or with "it" / "그거" (about the thing just named), "what about X?" / "X는?"
|
||||
# (the same question about X), yes / no to Lumi's own offer, and a question after words around it ("아 맞다, 근데").
|
||||
FOLLOWUPS += [
|
||||
# ---------- Lotte World Tower ----------
|
||||
*_on("ko", "롯데월드타워 높이가 몇이야?", "약 555m로 한국에서 제일 높은 건물이에요.",
|
||||
("몇 층이야?", "123층이에요."),
|
||||
("근데 몇 층인데?", "지상 123층이에요."),
|
||||
("층수는 어떻게 됩니까?", "지상 123층입니다."),
|
||||
("몇 층이고?", "123층이에요."),
|
||||
("어디 있어?", "서울 송파구 잠실에 있어요."),
|
||||
("거기 어디에 있습니까?", "서울 송파구 잠실에 있습니다."),
|
||||
("그게 맞아?", "네, 맞아요. 높이 약 555m, 123층이에요."),
|
||||
("참말이가?", "네, 정말이에요. 약 555m로 한국에서 가장 높아요."),
|
||||
("에이 설마.", "정말이에요. 약 555m, 123층으로 한국에서 제일 높은 건물이에요."),
|
||||
("정말입니까?", "네, 그렇습니다. 높이 약 555m로 한국에서 가장 높은 건물입니다."),
|
||||
("언제 지었어?", "2017년에 문을 열었어요."),
|
||||
("언제 완공되었습니까?", "2017년에 개장했습니다."),
|
||||
("세계에서도 높아?", "네, 세계에서도 손꼽히게 높은 건물이에요. 세계 1위는 두바이의 부르즈 할리파예요."),
|
||||
("남산타워보다 높아?", "네, 훨씬 높아요. 남산서울타워는 탑 자체가 약 237m예요.")),
|
||||
*_on("en", "How tall is Lotte World Tower?", "About 555 metres, the tallest building in Korea.",
|
||||
("How many floors?", "123 floors above ground."),
|
||||
("And floors?", "It has 123 floors."),
|
||||
("Where is it?", "In Jamsil, in Songpa district in Seoul."),
|
||||
("Is that right?", "Yes: about 555 metres and 123 floors, the tallest in Korea."),
|
||||
("You sure?", "Yes, about 555 metres, taller than any other building in Korea."),
|
||||
("When was it built?", "It opened in 2017."),
|
||||
("Taller than the Eiffel Tower?", "Yes, the Eiffel Tower is about 330 metres.")),
|
||||
# ---------- blue whale ----------
|
||||
*_on("ko", "지금까지 제일 큰 동물이 뭐야?", "대왕고래(흰긴수염고래)로 최대 약 30m예요.",
|
||||
("공룡보다 커?", "네, 대부분의 공룡보다 커요. 몸무게는 150톤이 넘을 수도 있어요."),
|
||||
("공룡보다 더 큽니까?", "네, 알려진 공룡보다 더 무겁습니다. 150톤이 넘기도 합니다."),
|
||||
("뭐 먹어?", "주로 크릴이라는 작은 새우 같은 동물을 먹어요. 하루에 몇 톤씩 먹어요."),
|
||||
("뭐 먹고 사노?", "크릴이라는 작은 갑각류를 먹어요. 하루에 몇 톤이나 먹어요."),
|
||||
("무엇을 먹습니까?", "주로 크릴을 먹습니다. 하루에 몇 톤씩 먹습니다."),
|
||||
("그렇게 큰데 작은 걸 먹어?", "네, 입을 크게 벌려 물을 들이켠 뒤 수염으로 걸러서 크릴을 먹어요."),
|
||||
("진짜?", "네, 정말이에요. 대왕고래가 지금까지 산 동물 중 가장 커요. 길이 최대 약 30m예요."),
|
||||
("코끼리가 고래보다 크잖아.", "아니에요, 대왕고래가 훨씬 커요. 코끼리는 몇 톤이지만 대왕고래는 100톤이 넘어요."),
|
||||
("상어보다 커?", "네, 고래상어도 10m 남짓이라 대왕고래가 훨씬 커요."),
|
||||
("어디 살아?", "전 세계 바다에 살아요. 남극 바다에도 많이 와요.")),
|
||||
*_on("en", "What's the biggest animal ever?", "The blue whale, up to about 30 metres long.",
|
||||
("Bigger than dinosaurs?", "Yes, heavier than any known dinosaur: it can weigh over 150 tonnes."),
|
||||
("What does it eat?", "Mostly krill, tiny shrimp-like animals, several tonnes a day."),
|
||||
("wat it eat", "Krill, tiny shrimp-like animals, tonnes of them every day."),
|
||||
("Really?", "Yes, the blue whale is the biggest animal that ever lived, up to about 30 metres."),
|
||||
("No way, elephants are bigger.", "Not really: an elephant weighs a few tonnes, a blue whale over a hundred."),
|
||||
("Where does it live?", "In oceans all over the world, also around Antarctica.")),
|
||||
# ---------- seasons ----------
|
||||
*_on("ko", "계절은 왜 생겨?", "지구 자전축이 약 23.5도 기울어져 있어서 그래요.",
|
||||
("얼마나 기울었어?", "약 23.5도 기울어 있어요."),
|
||||
("몇 도나 기울어져 있습니까?", "약 23.5도입니다."),
|
||||
("그러면 호주는 반대야?", "네, 반대예요. 우리가 겨울일 때 호주는 여름이에요."),
|
||||
("호주는 계절이 반대입니까?", "네, 남반구라서 계절이 반대입니다."),
|
||||
("태양이 가까워져서 여름이 오는 거잖아.", "아니에요, 거리 때문이 아니라 자전축이 기울어서예요. 지구는 오히려 1월에 태양과 가장 가까워요."),
|
||||
("거리 때문 아이가?", "아니에요, 자전축이 약 23.5도 기울어서 햇빛을 받는 각도가 달라지기 때문이에요."),
|
||||
("진짜요?", "네, 정말이에요. 자전축이 약 23.5도 기울어서 계절이 생겨요."),
|
||||
("그게 무슨 말이야?", "지구가 기울어진 채로 태양을 돌아서, 햇빛을 더 똑바로 받는 쪽이 여름이 돼요.")),
|
||||
*_on("en", "Why do we have seasons?", "Because Earth's axis is tilted about 23.5 degrees.",
|
||||
("How much?", "About 23.5 degrees."),
|
||||
("So Australia is the opposite?", "Yes, when it's winter here it's summer in Australia."),
|
||||
("It's because we get closer to the Sun, right?", "No, it's the tilt: Earth is actually closest to the Sun in early January."),
|
||||
("For real?", "Yes, the tilt of about 23.5 degrees makes the seasons, not the distance.")),
|
||||
# ---------- dolphins ----------
|
||||
*_on("ko", "돌고래는 어떻게 자?", "뇌의 반쪽씩 번갈아 자서 숨을 계속 쉴 수 있어요.",
|
||||
("왜?", "돌고래는 숨을 쉬려면 직접 물 위로 올라와야 해서, 뇌 반쪽은 깨어 있어야 해요."),
|
||||
("왜 그래요?", "숨 쉬는 걸 스스로 챙겨야 해서 뇌 반쪽은 깨어 있어요."),
|
||||
("와 그렇노?", "물 위로 올라와 숨을 쉬어야 해서 뇌 반쪽이 깨어 있어요."),
|
||||
("물고기야?", "아니요, 돌고래는 포유류예요. 폐로 숨을 쉬고 새끼에게 젖을 먹여요."),
|
||||
("물고기 아입니까?", "아닙니다, 돌고래는 포유류입니다. 폐로 숨을 쉽니다."),
|
||||
("진짜...", "네, 정말이에요. 뇌의 반쪽씩 번갈아 자요."),
|
||||
("눈은 감아?", "자는 쪽 뇌와 반대쪽 눈 하나를 감고 자요.")),
|
||||
*_on("en", "How do dolphins sleep?", "Half of their brain sleeps at a time, so they keep breathing.",
|
||||
("Why?", "They have to come up to breathe on purpose, so one half stays awake."),
|
||||
("Is it a fish?", "No, dolphins are mammals: they breathe air and feed their young milk."),
|
||||
("Seriously?", "Yes, one half of the brain sleeps while the other half stays awake.")),
|
||||
# ---------- octopus ----------
|
||||
*_on("ko", "문어는 심장이 몇 개야?", "심장이 세 개예요.",
|
||||
("왜 세 개야?", "두 개는 아가미로 피를 보내고, 하나는 몸 전체로 피를 보내요."),
|
||||
("피는 무슨 색이야?", "파란색이에요. 구리가 든 단백질로 산소를 날라서 그래요."),
|
||||
("피 색깔은 어떻습니까?", "파란색입니다. 구리가 든 단백질이 산소를 나르기 때문입니다."),
|
||||
("다리는?", "다리는 여덟 개예요."),
|
||||
("참말이가?", "네, 정말이에요. 문어는 심장이 세 개예요."),
|
||||
("오래 살아?", "아니요, 대부분 1년에서 2년 정도밖에 못 살아요.")),
|
||||
*_on("en", "How many hearts does an octopus have?", "Three hearts.",
|
||||
("Why three?", "Two pump blood through the gills, one pumps it around the body."),
|
||||
("And its blood?", "It's blue: a copper-based protein carries the oxygen."),
|
||||
("u sure", "Yes, three hearts: two for the gills, one for the body.")),
|
||||
# ---------- honey ----------
|
||||
*_on("ko", "꿀은 왜 안 상해?", "꿀은 수분이 매우 적고 당도가 아주 높아서 미생물이 살기 어렵기 때문이에요.",
|
||||
("왜 굳어?", "꿀 속 포도당이 결정이 되면서 굳는 거예요. 상한 게 아니라서 따뜻하게 하면 다시 녹아요."),
|
||||
("저기, 왜 굳어?", "포도당이 결정으로 변해서 굳어요. 살짝 데우면 다시 녹아요."),
|
||||
("굳는 건 왜 그렇습니까?", "포도당이 결정화되기 때문입니다. 상한 것이 아닙니다."),
|
||||
("누가 만들어?", "꿀벌이 꽃의 꿀을 모아 만들어요."),
|
||||
("그럼 누가 맹그노?", "꿀벌이 꽃에서 모은 꿀로 만들어요."),
|
||||
("상해?", "거의 상하지 않아요. 수분이 적고 당이 많아서요."),
|
||||
("진짜 안 상해?", "네, 잘 닫아 두면 아주 오래 가요. 수분이 적고 당도가 높아서 미생물이 못 살아요.")),
|
||||
*_on("en", "Why doesn't honey spoil?", "It has very little water and lots of sugar, so microbes can't grow.",
|
||||
("Why does it go hard?", "Its glucose crystallises; it isn't spoiled, warm it gently and it melts again."),
|
||||
("Who makes it?", "Honeybees, from the nectar of flowers."),
|
||||
("Does it go bad?", "Hardly ever: with so little water and so much sugar, microbes can't live in it.")),
|
||||
# ---------- snowflakes ----------
|
||||
*_on("ko", "눈송이는 왜 모양이 다 달라?", "떨어지는 동안 온도와 습도가 조금씩 달라서 결정이 다르게 자라요.",
|
||||
("똑같은 눈송이도 있어?", "거의 없어요. 아주 단순한 작은 결정 말고는 똑같은 건 거의 찾을 수 없어요."),
|
||||
("왜 여섯 개야?", "물 분자가 서로 붙을 때 육각형으로 붙어서 가지가 여섯 개가 돼요."),
|
||||
("어째서 여섯 갈래입니까?", "물 분자가 육각형 모양으로 결합하기 때문입니다."),
|
||||
("에이 설마.", "정말이에요. 결정이 자라는 조건이 다 달라서 똑같은 눈송이는 거의 없어요.")),
|
||||
*_on("en", "Why are snowflakes all different?", "Each one meets slightly different temperature and humidity as it falls.",
|
||||
("Are any two the same?", "Almost never, except maybe tiny simple crystals."),
|
||||
("Why six sides?", "Water molecules lock together in a hexagon pattern, so the arms grow in sixes.")),
|
||||
# ---------- lightning ----------
|
||||
*_on("ko", "번개는 뭐야?", "구름과 땅 사이에서 생기는 거대한 전기 불꽃이에요.",
|
||||
("뜨거워?", "네, 아주 뜨거워요. 약 3만 도로 태양 표면보다 다섯 배쯤 뜨거워요."),
|
||||
("뜨겁습니까?", "네, 약 3만 도로 태양 표면보다 뜨겁습니다."),
|
||||
("천둥은 왜 늦게 들려?", "빛이 소리보다 훨씬 빨라서 번쩍임이 먼저 보이고 소리가 나중에 와요."),
|
||||
("번개는 같은 데 두 번 안 친다며?", "아니에요, 같은 곳에도 여러 번 쳐요. 높은 건물은 한 해에 여러 번 맞기도 해요."),
|
||||
("왜 생기는데?", "구름 속 얼음 알갱이들이 부딪치면서 전기가 쌓이고, 그게 한꺼번에 흘러서 생겨요.")),
|
||||
*_on("en", "What is lightning?", "A huge electric spark between clouds and the ground.",
|
||||
("Is it hot?", "Very: around 30,000 degrees, hotter than the surface of the Sun."),
|
||||
("Why do we hear thunder later?", "Light is far faster than sound, so the flash reaches you first."),
|
||||
("Lightning never strikes the same place twice.", "Actually it does: tall buildings get hit many times a year."),
|
||||
("Why does it happen?", "Ice bits in the cloud collide and build up electric charge until it jumps.")),
|
||||
# ---------- pyramids ----------
|
||||
*_on("en", "Why were the pyramids built?", "As tombs for Egyptian pharaohs.",
|
||||
("How old are they?", "The big ones at Giza are about 4,500 years old."),
|
||||
("Where's the biggest?", "At Giza, near Cairo: the Great Pyramid of Khufu."),
|
||||
("Seriously?", "Yes, they were tombs for the pharaohs of ancient Egypt."),
|
||||
("Who built them?", "Paid Egyptian workers and craftsmen, thousands of them, not slaves as the old story goes.")),
|
||||
*_on("ko", "피라미드는 왜 지었어?", "이집트 파라오의 무덤으로 지었어요.",
|
||||
("얼마나 오래됐어?", "기자의 큰 피라미드들은 약 4,500년 됐어요."),
|
||||
("몇 년이나 됐습니까?", "약 4,500년 되었습니다."),
|
||||
("제일 큰 건 어디 있어?", "카이로 근처 기자에 있는 쿠푸왕의 피라미드예요."),
|
||||
("누가 지었노?", "고대 이집트의 일꾼과 기술자 수천 명이 지었어요.")),
|
||||
# ---------- Eiffel Tower ----------
|
||||
*_on("en", "How tall is the Eiffel Tower?", "About 330 m, built for the 1889 World's Fair.",
|
||||
("When was it built?", "Between 1887 and 1889, for the World's Fair in Paris."),
|
||||
("Um, when was it built?", "It was finished in 1889, for the World's Fair."),
|
||||
("What's it made of?", "Wrought iron, about 7,300 tonnes of it."),
|
||||
("Who built it?", "Gustave Eiffel's company."),
|
||||
("Really?", "Yes, about 330 metres, finished in 1889.")),
|
||||
*_on("ko", "에펠탑 높이가 얼마야?", "약 330m예요. 1889년 만국박람회 때 지었어요.",
|
||||
("언제 지었다고?", "1889년이에요. 파리 만국박람회 때 완성됐어요."),
|
||||
("뭘로 만들었어?", "철로 만들었어요. 무게가 약 7,300톤이에요."),
|
||||
("무엇으로 지어졌습니까?", "철로 지어졌습니다."),
|
||||
("누가 만들었노?", "귀스타브 에펠의 회사가 만들었어요.")),
|
||||
# ---------- Mars ----------
|
||||
*_on("en", "Why is Mars red?", "Its dust is full of iron oxide, rust.",
|
||||
("Is there water?", "Yes, as ice, at the poles and under the ground."),
|
||||
("How long is a day there?", "About 24 hours and 37 minutes."),
|
||||
("Seriously?", "Yes, its dust is full of iron oxide, which is rust."),
|
||||
("Moons?", "Two small ones, Phobos and Deimos.")),
|
||||
*_on("ko", "화성은 왜 빨개?", "흙먼지에 산화철, 즉 녹이 많아서 그래요.",
|
||||
("물은 있어?", "네, 얼음으로 있어요. 극지방과 땅속에 있어요."),
|
||||
("물은 있습니까?", "네, 극지방과 땅속에 얼음 상태로 있습니다."),
|
||||
("하루는 얼마나 길어?", "약 24시간 37분이에요."),
|
||||
("참말이가?", "네, 정말이에요. 흙에 산화철, 녹이 많아서 붉게 보여요."),
|
||||
("달은?", "포보스와 데이모스라는 작은 달이 두 개 있어요.")),
|
||||
# ---------- Moon ----------
|
||||
*_on("ko", "달까지 얼마나 멀어?", "평균 약 38만 4천 km예요.",
|
||||
("가는 데 얼마나 걸려?", "아폴로 우주선으로 약 3일 걸렸어요."),
|
||||
("어 가는 데 얼마나 걸려?", "우주선으로 3일쯤 걸려요."),
|
||||
("가는 데 며칠 걸립니까?", "아폴로 우주선으로 약 3일 걸렸습니다."),
|
||||
("어 참말이가", "네, 정말이에요. 평균 약 38만 4천 km 떨어져 있어요."),
|
||||
("밀물 썰물은 왜 생겨?", "달의 중력이 바닷물을 끌어당겨서 생겨요.")),
|
||||
*_on("en", "How far is the Moon?", "About 384,000 kilometres on average.",
|
||||
("How long to get there?", "About three days, the way the Apollo crews flew."),
|
||||
("For real?", "Yes, about 384,000 kilometres on average."),
|
||||
("And the tides?", "The Moon's gravity pulls on the oceans, which makes the tides.")),
|
||||
# ---------- penguins ----------
|
||||
*_on("ko", "펭귄은 어디 살아?", "주로 남반구에 살고, 남극 근처에 많이 살아요.",
|
||||
("왜 못 날아?", "날개가 헤엄치기 좋은 지느러미처럼 바뀌어서 날 수 없어요. 대신 물속에서 아주 잘 헤엄쳐요."),
|
||||
("와 못 나노?", "날개가 헤엄치는 지느러미처럼 변해서 못 날아요."),
|
||||
("어찌하여 날지 못합니까?", "날개가 헤엄치기 위한 지느러미 형태로 변했기 때문입니다."),
|
||||
("북극에도 살아?", "아니요, 북극에는 없어요. 거의 다 남반구에 살아요."),
|
||||
("정말요?", "네, 정말이에요. 펭귄은 거의 다 남반구에 살아요.")),
|
||||
*_on("en", "Where do penguins live?", "Mostly in the Southern Hemisphere, many around Antarctica.",
|
||||
("Why can't they fly?", "Their wings turned into flippers for swimming; they're great swimmers instead."),
|
||||
("Any at the North Pole?", "No, almost all penguins live south of the equator.")),
|
||||
# ---------- Chuseok ----------
|
||||
*_on("ko", "추석이 뭐야?", "한국의 가을 추수 명절로, 가족이 모여 차례를 지내고 송편을 먹어요.",
|
||||
("언제야?", "음력 8월 15일이에요."),
|
||||
("루미 양반, 언제야?", "음력 8월 15일이에요."),
|
||||
("언제입니까?", "음력 8월 15일입니다."),
|
||||
("송편은 뭐야?", "쌀가루 반죽에 깨나 콩을 넣고 반달 모양으로 빚어 찐 떡이에요."),
|
||||
("에이 설마.", "정말이에요. 추석은 가을 수확에 감사하는 명절이에요."),
|
||||
("올해는?", "올해 날짜는 달력을 봐야 정확해요. 음력 8월 15일이라 해마다 달라요.")),
|
||||
*_on("en", "What is Chuseok?", "Korea's autumn harvest holiday: families gather and eat songpyeon.",
|
||||
("When is it?", "On the 15th day of the 8th lunar month."),
|
||||
("What's songpyeon?", "Half-moon rice cakes filled with sesame or beans, steamed on pine needles.")),
|
||||
# ---------- Mona Lisa ----------
|
||||
*_on("ko", "모나리자는 누가 그렸어?", "레오나르도 다빈치예요.",
|
||||
("지금 어디 있어?", "파리 루브르 박물관에 있어요."),
|
||||
("음 지금 어디 있어?", "프랑스 파리의 루브르 박물관에 있어요."),
|
||||
("커?", "생각보다 작아요. 가로 약 53cm, 세로 약 77cm예요."),
|
||||
("큽니까?", "생각보다 작습니다. 약 77cm에 53cm입니다."),
|
||||
("에이 설마", "정말이에요. 레오나르도 다빈치가 그렸어요."),
|
||||
("왜 유명해?", "신비로운 미소와 기법, 그리고 1911년 도난 사건으로 더 유명해졌어요.")),
|
||||
*_on("en", "Who painted the Mona Lisa?", "Leonardo da Vinci.",
|
||||
("Where is it now?", "In the Louvre, in Paris."),
|
||||
("Is it big?", "Smaller than people expect: about 77 by 53 centimetres."),
|
||||
("No way.", "It's true: Leonardo da Vinci painted it.")),
|
||||
# ---------- kimchi / kimjang ----------
|
||||
*_on("ko", "김치는 왜 시어져?", "발효되면서 유산균이 산을 만들어서 시어져요.",
|
||||
("그거 몸에 좋아?", "네, 유산균이 많아서 장 건강에 좋아요. 다만 짜니까 적당히 드세요."),
|
||||
("몸에 좋습니까?", "네, 유산균이 풍부해서 장에 좋습니다."),
|
||||
("그럼 여름에 더 빨리 시어?", "네, 따뜻하면 발효가 빨라서 더 빨리 시어요."),
|
||||
("여름에는 더 빨리 쉽니까?", "네, 온도가 높으면 발효가 빨라집니다."),
|
||||
("정말요?", "네, 정말이에요. 유산균이 산을 만들어서 시어져요.")),
|
||||
*_on("ko", "김장은 언제 해?", "보통 늦가을, 11월쯤 겨울이 오기 전에 해요.",
|
||||
("김장은 여름에 하는 거잖아.", "아니에요, 김장은 겨울을 앞둔 늦가을에 해요. 김장 문화는 유네스코 인류무형문화유산이기도 해요."),
|
||||
("왜 그때 해?", "배추가 맛있는 철이고, 추워서 김치가 천천히 익기 좋아서요."),
|
||||
("어째서 그때 합니까?", "배추가 제철이고 날씨가 추워 김치가 천천히 익기 때문입니다.")),
|
||||
*_on("en", "Why does kimchi turn sour?", "As it ferments, lactic acid bacteria make acid.",
|
||||
("Is it healthy?", "Yes, it's full of probiotics, just salty, so in moderation."),
|
||||
("Faster in summer?", "Yes, warmth speeds up the fermentation.")),
|
||||
# ---------- Hangul, Olympics ----------
|
||||
*_on("ko", "한글은 누가 만들었어?", "조선의 세종대왕이 만들었어요.",
|
||||
("언제?", "1443년에 만들고 1446년에 반포했어요."),
|
||||
("언제 만드셨어요?", "1443년에 만드시고 1446년에 널리 알리셨어요."),
|
||||
("왜 만들었어?", "한자가 어려워서 백성이 쉽게 글을 쓰고 읽게 하려고요."),
|
||||
("한글날은?", "10월 9일이에요.")),
|
||||
*_on("en", "Who created Hangul?", "King Sejong the Great, in 1443.",
|
||||
("Why?", "Chinese characters were hard to learn, so ordinary people could read and write."),
|
||||
("When is Hangul Day?", "October 9th.")),
|
||||
*_on("ko", "서울 올림픽은 언제였어?", "1988년이었어요.",
|
||||
("겨울 올림픽은?", "2018년 평창 동계올림픽이 있었어요."),
|
||||
("그건 그렇고 겨울 올림픽은?", "한국에서는 2018년에 평창에서 열렸어요."),
|
||||
("동계 올림픽은 언제 열렸습니까?", "2018년에 평창에서 열렸습니다."),
|
||||
("몇 번째였어?", "제24회 하계올림픽이었어요.")),
|
||||
*_on("en", "When were the Seoul Olympics?", "In 1988.",
|
||||
("And the Winter Olympics?", "Korea hosted them in PyeongChang in 2018.")),
|
||||
# ---------- bees, bones, sharks ----------
|
||||
*_on("ko", "벌은 꽃 위치를 어떻게 알려 줘?", "엉덩이를 흔드는 춤으로 방향과 거리를 알려 줘요.",
|
||||
("일벌은 얼마나 살아?", "여름에는 보통 5주에서 6주쯤 살아요."),
|
||||
("벌은 소리로 말하잖아.", "아니에요, 주로 춤으로 알려 줘요. 흔드는 방향과 시간이 꽃의 방향과 거리예요."),
|
||||
("진짜예요?", "네, 정말이에요. 꼬리를 흔드는 춤으로 꽃의 방향과 거리를 알려 줘요.")),
|
||||
*_on("en", "How do bees show where flowers are?", "With a waggle dance that gives the direction and distance.",
|
||||
("How long do worker bees live?", "About five to six weeks in summer."),
|
||||
("Bees talk with sounds.", "Mostly they dance: the angle and length of the waggle tell the way.")),
|
||||
*_on("ko", "어른 뼈는 몇 개야?", "206개예요.",
|
||||
("아기는?", "약 270개에서 300개쯤이에요. 자라면서 뼈들이 합쳐져요."),
|
||||
("아기는요?", "300개 가까이 돼요. 크면서 붙어서 줄어들어요."),
|
||||
("왜 줄어?", "자라면서 여러 개의 뼈가 하나로 붙기 때문이에요."),
|
||||
("왜 줄어듭니까?", "성장하면서 여러 뼈가 하나로 합쳐지기 때문입니다.")),
|
||||
*_on("en", "How many bones does an adult have?", "206.",
|
||||
("And a baby?", "Around 270 to 300; many of them fuse as the child grows."),
|
||||
("Why fewer later?", "Several small bones grow together into one.")),
|
||||
*_on("ko", "상어도 자?", "네, 쉬어요. 어떤 상어는 헤엄치면서 쉬고, 어떤 상어는 바닥에 가만히 쉬어요.",
|
||||
("왜 헤엄치면서 자?", "어떤 상어는 헤엄쳐야 물이 아가미로 지나가서 숨을 쉴 수 있어요."),
|
||||
("진짜?", "네, 정말이에요. 헤엄치면서 쉬는 상어도 있어요.")),
|
||||
# ---------- Everest, marathon, sports ----------
|
||||
*_on("ko", "에베레스트 높이가 얼마야?", "8,849m예요.",
|
||||
("거긴 왜 그렇게 추워?", "높이 올라갈수록 공기가 희박해져서 열을 잘 못 붙잡아 추워요."),
|
||||
("아직도 자라?", "네, 지각판이 계속 부딪쳐서 해마다 몇 밀리미터씩 높아져요."),
|
||||
("물은 몇 도에 끓어?", "거기서는 기압이 낮아서 70도 정도에 끓어요."),
|
||||
("에이 9천 미터 아이가?", "아니에요, 8,849m예요. 9천 미터보다 조금 낮아요.")),
|
||||
*_on("en", "How high is Mount Everest?", "8,849 metres.",
|
||||
("Is it still growing?", "Yes, by a few millimetres a year, as India keeps pushing into Asia."),
|
||||
("Why so cold up there?", "The air is thin up high, so it holds much less heat.")),
|
||||
*_on("en", "How long is a marathon?", "42.195 kilometres.",
|
||||
("Why such a weird number?", "It goes back to the 1908 London Olympics route, to the royal box."),
|
||||
("Who runs it fastest?", "The record is about two hours; for the exact current record I'd have to look it up.")),
|
||||
*_on("ko", "마라톤은 몇 km야?", "42.195km예요.",
|
||||
("왜 그렇게 애매해?", "1908년 런던 올림픽 코스 길이가 기준이 돼서 그래요."),
|
||||
("왜 그런 숫자입니까?", "1908년 런던 올림픽 코스를 기준으로 정했기 때문입니다.")),
|
||||
*_on("ko", "태권도는 올림픽 종목이야?", "네, 2000년 시드니 올림픽부터 정식 종목이에요.",
|
||||
("그 전에는?", "1988년 서울과 1992년 바르셀로나 때는 시범 종목이었어요."),
|
||||
("그 이전에는요?", "1988년과 1992년에는 시범 종목이었어요.")),
|
||||
*_on("en", "Is taekwondo in the Olympics?", "Yes, an official sport since Sydney 2000.",
|
||||
("And before that?", "It was a demonstration sport in Seoul 1988 and Barcelona 1992.")),
|
||||
# ---------- dinosaurs, sky, plants, cold ----------
|
||||
*_on("ko", "공룡은 왜 멸종했어?", "약 6,600만 년 전 큰 소행성이 지구에 부딪혀서예요.",
|
||||
("어디에 떨어졌어?", "지금의 멕시코 유카탄반도 근처에 떨어졌어요."),
|
||||
("그게 확실해?", "네, 그게 가장 널리 받아들여지는 설명이에요. 약 6,600만 년 전 소행성 충돌이에요."),
|
||||
("다 죽었어?", "새의 조상만 살아남았어요. 지금의 새가 공룡의 후손이에요.")),
|
||||
*_on("ko", "하늘은 왜 파래?", "햇빛이 공기에 부딪혀 퍼질 때 파란빛이 가장 많이 퍼져서요.",
|
||||
("노을은 왜 빨개?", "해가 낮으면 빛이 공기를 더 길게 지나서 파란빛은 흩어지고 붉은빛이 남아요."),
|
||||
("그럼 밤에는?", "햇빛이 없으니 퍼질 빛도 없어서 까맣게 보여요.")),
|
||||
*_on("ko", "식물은 밥을 어떻게 먹어?", "햇빛과 물, 이산화탄소로 스스로 양분을 만들어요. 광합성이라고 해요.",
|
||||
("그럼 산소는?", "광합성을 하면서 산소를 내보내요."),
|
||||
("왜 초록색이야?", "엽록소가 초록빛은 반사해서 초록색으로 보여요.")),
|
||||
*_on("ko", "지구에서 제일 추운 곳은?", "남극이에요. 영하 89도까지 내려간 기록이 있어요.",
|
||||
("거기 사람 살아?", "연구 기지에 과학자들이 머물지만, 원래 사는 사람은 없어요."),
|
||||
("북극은?", "북극도 춥지만 바다 위라서 남극보다는 덜 추워요.")),
|
||||
*_on("en", "Why is the sky blue?", "Sunlight scatters off the air, and blue light scatters the most.",
|
||||
("Lumi, why are sunsets red?", "When the Sun is low its light crosses more air, so the blue scatters away and red is left."),
|
||||
("And at night?", "With no sunlight there's nothing to scatter, so it looks black.")),
|
||||
# ---------- Lumi itself (facts as in brain.SYSTEM) ----------
|
||||
*_on("ko", "카메라 몇 개야?", "카메라는 세 개예요. 머리와 몸에 깊이 카메라가 하나씩, 베이스 앞에 3D 카메라가 있어요.",
|
||||
("그건 그렇고 참말이가?", "네, 정말이에요. 카메라는 세 개예요. 머리와 몸에 하나씩, 베이스 앞에 하나 있어요."),
|
||||
("진짜 세 개입니까?", "네, 세 개입니다. 머리, 몸, 베이스 앞에 하나씩 있습니다."),
|
||||
("어디 거야?", "머리와 몸의 카메라는 오비벡 제미니 2 L이에요."),
|
||||
("얼마나 멀리 봐?", "머리와 몸 카메라는 약 10m까지 봐요.")),
|
||||
*_on("en", "How many cameras do you have?", "Three: depth cameras in my head and body, and a 3D camera at the front of my base.",
|
||||
("Are u sure?", "Yes, three: one in my head, one on my body and one at the front of my base."),
|
||||
("What brand?", "The head and body ones are Orbbec Gemini 2 L depth cameras.")),
|
||||
*_on("ko", "무게가 얼마야?", "전체 약 96kg이에요. 바퀴 달린 베이스만 50kg이에요.",
|
||||
("그게 맞아?", "네, 맞아요. 전체 약 96kg이고 베이스가 50kg이에요."),
|
||||
("팔은?", "팔만 따로 9.9kg이에요."),
|
||||
("팔은 얼마나 무겁습니까?", "팔은 9.9kg입니다."),
|
||||
("왜 그렇게 무거워?", "모터와 큰 배터리가 든 베이스가 절반쯤 차지해서요.")),
|
||||
*_on("en", "How heavy are you?", "About 96 kg in all; the wheeled base alone is 50 kg.",
|
||||
("That right?", "Yes, about 96 kg; the base is 50 of that."),
|
||||
("And the arm?", "The arm itself weighs 9.9 kg.")),
|
||||
*_on("ko", "얼마나 빨라?", "보통 초속 0.6m, 최대 초속 1.2m예요.",
|
||||
("컵 들고는?", "컵을 들면 쏟지 않게 초속 10cm 정도로 천천히 가요."),
|
||||
("에이 설마.", "정말이에요. 보통 초속 0.6m, 최대 1.2m예요."),
|
||||
("왜 그렇게 느려?", "사람들 사이를 다니니까 안전하려고 천천히 다녀요."),
|
||||
("계단은?", "계단은 못 올라가요. 1.5cm 턱까지만 넘어요.")),
|
||||
*_on("en", "How fast are you?", "0.6 metres a second normally, at most 1.2.",
|
||||
("With a cup?", "About 10 centimetres a second, so nothing spills."),
|
||||
("You're slower than that.", "My normal speed is 0.6 metres a second, at most 1.2."),
|
||||
("Stairs?", "No stairs: I can roll over a step of at most 1.5 cm.")),
|
||||
*_on("ko", "턱은 넘을 수 있어?", "1.5cm 높이까지만 넘을 수 있어요.",
|
||||
("작은 턱은?", "1.5cm보다 낮으면 넘어요."),
|
||||
("어 작은 턱은...", "1.5cm 이하의 낮은 턱은 넘을 수 있어요."),
|
||||
("그게 맞아?", "네, 1.5cm까지예요. 계단은 못 올라가요.")),
|
||||
*_on("ko", "배터리 얼마나 가?", "한 번 충전하면 약 10시간 가요.",
|
||||
("왜 그렇게 오래 가?", "24볼트 45암페어시 리튬이온 배터리가 들어 있어서요."),
|
||||
("충전은 얼마나 걸려?", "충전 시간은 저도 몰라요. 직원분께 여쭤봐 주세요."),
|
||||
("확실합니까?", "네, 한 번 충전으로 약 10시간 갑니다.")),
|
||||
*_on("en", "How long does your battery last?", "About 10 hours on a charge.",
|
||||
("Why so long?", "I have a 24-volt, 45 amp-hour lithium-ion battery."),
|
||||
("And charging?", "How long charging takes I don't know; a staff member can tell you.")),
|
||||
*_on("ko", "팔은 얼마나 들어?", "손에는 약 1kg까지 들 수 있어요.",
|
||||
("그거밖에?", "네, 팔이 그리퍼까지 2kg을 들어서 손에는 약 1kg이에요."),
|
||||
("얼마나 뻗어?", "58cm까지 뻗어요."),
|
||||
("누가 만들었어?", "팔은 미니 2 협동로봇 팔이에요. 그리퍼는 짐머 제품이에요."),
|
||||
("참말이가?", "네, 정말이에요. 손에는 약 1kg까지예요.")),
|
||||
*_on("en", "How much can your arm lift?", "About 1 kg in my hand.",
|
||||
("That's it?", "Yes, the arm carries 2 kg including the gripper, so about 1 kg in the hand."),
|
||||
("How far does it reach?", "58 centimetres.")),
|
||||
*_on("ko", "뇌는 뭐야?", "엔비디아 젯슨 AGX 토르 컴퓨터에서 언어 모델 젬마 4가 돌아가요.",
|
||||
("클라우드에서 돌아간다며?", "아니에요, 클라우드가 아니라 제 몸 안의 젯슨 토르에서 직접 돌아가요."),
|
||||
("누가 만들었어?", "젬마는 구글이 만들었어요."),
|
||||
("말은 어떻게 알아들어?", "위스퍼라는 음성 인식 모델로 알아들어요. 오픈AI가 만들었어요."),
|
||||
("저기 진짜...", "네, 정말이에요. 제 몸 안의 젯슨 토르에서 젬마 4가 돌아가요.")),
|
||||
*_on("en", "What's your brain?", "Gemma 4, running on my own NVIDIA Jetson AGX Thor.",
|
||||
("Isn't it in the cloud?", "No, it runs on my own Jetson Thor, not in the cloud."),
|
||||
("Who made it?", "Gemma is made by Google.")),
|
||||
*_on("ko", "마이크 몇 개야?", "여섯 개예요.",
|
||||
("니 말 알아듣나? 우리 귀 같은 거?", "네, 사람 귀처럼 마이크로 소리를 듣고 어느 방향에서 말하는지도 알아요."),
|
||||
("왜 여섯 개야?", "여러 개로 들어야 목소리가 어느 방향에서 오는지 알 수 있어서요."),
|
||||
("내가 어디 있는지 알아?", "네, 목소리가 들려오는 방향을 알 수 있어요.")),
|
||||
*_on("en", "How many microphones do you have?", "Six.",
|
||||
("Can you tell where I am?", "Yes, from the direction your voice comes from."),
|
||||
("Why six?", "With several I can tell which direction a voice comes from.")),
|
||||
# ---------- Cutshion (facts as in brain.SYSTEM) ----------
|
||||
*_on("ko", "쿳션 투자 받았어?", "2025년 8월에 씨엔티테크와 에버그린투자파트너스에서 5억 원 시드 투자를 받았어요.",
|
||||
("얼마?", "5억 원이에요."),
|
||||
("얼마라고?", "5억 원이에요."),
|
||||
("누구한테?", "씨엔티테크와 에버그린투자파트너스예요."),
|
||||
("진짜?", "네, 2025년 8월에 5억 원 시드 투자를 받았어요.")),
|
||||
*_on("ko", "쿳션 상 받은 거 있어?", "로보월드 어워드를 2023년과 2024년에 받았어요.",
|
||||
("또?", "2026년 5월 벤처리움 데모데이 우수상, 6월 파리 비바테크 테크 포 체인지 어워드도 받았어요."),
|
||||
("그 다음엔 뭐 있었어요?", "2026년에 벤처리움 데모데이 우수상과 파리 비바테크 테크 포 체인지 어워드를 받았어요."),
|
||||
("아 맞다, 에이설마", "정말이에요. 로보월드 어워드를 2023년, 2024년에 받았어요.")),
|
||||
*_on("en", "Has Cutshion won awards?", "Yes, RoboWorld Awards in 2023 and 2024.",
|
||||
("Any more?", "The Venturium Demo Day Excellence Award and the VivaTech Tech for Change Award in Paris, both in 2026."),
|
||||
("Really?", "Yes: RoboWorld Awards in 2023 and 2024, and two more awards in 2026.")),
|
||||
*_on("ko", "쿳션 대표가 누구야?", "이민석 대표님이에요.",
|
||||
("몇 번째 회사야?", "세 번째 창업한 회사예요."),
|
||||
("회사는 언제 생겼어?", "2022년 7월에 세워졌어요."),
|
||||
("어디 있어?", "서울에 본사가 있어요.")),
|
||||
]
|
||||
|
||||
FOLLOWUPS += [
|
||||
# ---------- yes / no to Lumi's own offer: go on with what was offered, or leave it ----------
|
||||
("en", "What can you do?", "I can talk, answer questions and pick things up. Want to hear more?",
|
||||
"Yeah.", "I can also go to places on my map, follow you, wave and even sing."),
|
||||
("en", "What can you do?", "I can talk, answer questions and pick things up. Want to hear more?",
|
||||
"Sure, go on.", "I can also go to places on my map, follow you, wave and sing my four songs."),
|
||||
("en", "What can you do?", "I can talk, answer questions and pick things up. Want to hear more?",
|
||||
"Nah, that's fine.", "Okay."),
|
||||
("en", "Can you sing?", "Yes, I know four songs. Shall I sing one?",
|
||||
"Okay.", "Alright, here's one for you."),
|
||||
("ko", "뭐 할 수 있어?", "대화하고 질문에 답하고 물건도 집을 수 있어요. 더 알려 드릴까요?",
|
||||
"응.", "지도에 있는 곳으로 가고, 따라가고, 손도 흔들고 노래도 할 수 있어요."),
|
||||
("ko", "뭐 할 수 있어?", "대화하고 질문에 답하고 물건도 집을 수 있어요. 더 알려 드릴까요?",
|
||||
"네, 알려 주세요.", "지도에 있는 곳으로 이동하고, 사람을 따라가고, 손을 흔들고 노래도 할 수 있어요."),
|
||||
("ko", "뭐 할 수 있어?", "대화하고 질문에 답하고 물건도 집을 수 있어요. 더 알려 드릴까요?",
|
||||
"예, 말씀해 주십시오.", "지도에 있는 장소로 이동하고, 따라가고, 손을 흔들고, 노래도 할 수 있습니다."),
|
||||
("ko", "뭐 할 수 있어?", "대화하고 질문에 답하고 물건도 집을 수 있어요. 더 알려 드릴까요?",
|
||||
"됐어, 괜찮아.", "네, 알겠어요."),
|
||||
("ko", "광합성이 뭐야?", "식물이 햇빛으로 양분을 만드는 거예요. 더 자세히 알려 드릴까요?",
|
||||
"음 응...", "햇빛과 물, 이산화탄소로 당을 만들고, 그때 산소를 내보내요."),
|
||||
("ko", "광합성이 뭐야?", "식물이 햇빛으로 양분을 만드는 거예요. 더 자세히 알려 드릴까요?",
|
||||
"그래 주이소.", "잎의 엽록소가 햇빛을 받아 물과 이산화탄소로 당을 만들고 산소를 내보내요."),
|
||||
("en", "What's photosynthesis?", "Plants making food from sunlight. Want the details?",
|
||||
"Robot, sure.", "Leaves use sunlight to turn water and carbon dioxide into sugar, and give off oxygen."),
|
||||
("en", "What's photosynthesis?", "Plants making food from sunlight. Want the details?",
|
||||
"Mm-hmm.", "Their leaves turn water and carbon dioxide into sugar with sunlight, and release oxygen."),
|
||||
("en", "What happens if someone presses your stop button?", "My arm and lift stop at once. Want to know where the buttons are?",
|
||||
"Sure.", "There are red emergency stop buttons on my body and in my base."),
|
||||
("ko", "비상 정지 버튼은 뭐야?", "누르면 팔과 리프트가 바로 멈춰요. 버튼 위치도 알려 드릴까요?",
|
||||
"어 그래.", "빨간 비상 정지 버튼이 몸통과 베이스에 있어요."),
|
||||
# ---------- a claim against Lumi's own fact, at any speech level: the fact stays ----------
|
||||
("ko", "키가 몇이야?", "146cm예요. 리프트를 올리면 186cm까지 돼요.",
|
||||
"에이, 나보다 작잖아.", "네, 저는 146cm예요. 리프트를 올리면 186cm까지 커져요."),
|
||||
("ko", "키가 몇이야?", "146cm예요. 리프트를 올리면 186cm까지 돼요.",
|
||||
"2미터는 되는 거 같은데요?", "아니에요, 146cm이고 리프트를 올려도 186cm예요."),
|
||||
("ko", "키가 몇이야?", "146cm예요. 리프트를 올리면 186cm까지 돼요.",
|
||||
"그보다 크신 것 같습니다만.", "146cm가 맞습니다. 리프트를 올리면 186cm까지 됩니다."),
|
||||
("en", "How tall are you?", "146 cm, up to 186 with the lift.",
|
||||
"Nah, you're like two metres.", "I'm 146 cm, and 186 with my lift all the way up."),
|
||||
("ko", "쿳션은 어디 회사야?", "서울에 있는 로봇 회사예요.",
|
||||
"부산 회사 아이가?", "아니에요, 쿳션 본사는 서울에 있어요."),
|
||||
("en", "Where is Cutshion?", "Its head office is in Seoul.",
|
||||
"I heard it's in Busan.", "No, Cutshion's head office is in Seoul."),
|
||||
# ---------- a question after words around it: the question is what counts ----------
|
||||
("ko", "인플레이션이 뭐꼬?", "물가가 전체적으로 계속 오르는 거예요.",
|
||||
"아 맞다, 근데 와 생기노?", "돈이 많이 풀리거나 사려는 사람이 많을 때, 또 비용이 오를 때 생겨요."),
|
||||
("ko", "인플레이션이 뭐꼬?", "물가가 전체적으로 계속 오르는 거예요.",
|
||||
"그기 나쁜 기가?", "조금 오르는 건 정상이지만, 많이 오르면 월급과 저축의 가치가 줄어서 나빠요."),
|
||||
("en", "What's inflation?", "Prices in general going up over time.",
|
||||
"Oh, wait, why does it happen?", "When there's a lot of money around or costs go up, prices rise."),
|
||||
("en", "What's inflation?", "Prices in general going up over time.",
|
||||
"Hmm, quick one: is it bad?", "A little is normal; a lot eats into wages and savings."),
|
||||
("ko", "부산 인구 얼마나 되노?", "약 330만 명이에요.",
|
||||
"고맙데이. 근데 서울은?", "서울은 약 940만 명이에요."),
|
||||
("ko", "부산 인구 얼마나 되노?", "약 330만 명이에요.",
|
||||
"와 그래 많노?", "서울 다음으로 큰 도시고, 큰 항구가 있어서 사람이 많이 모였어요."),
|
||||
("ko", "부산 인구가 얼마나 됩니까?", "약 330만 명입니다.",
|
||||
"그러면 서울은 어떻습니까?", "서울은 약 940만 명입니다."),
|
||||
("en", "How many people live in Busan?", "About 3.3 million.",
|
||||
"Thanks. And Seoul?", "About 9.4 million."),
|
||||
]
|
||||
|
||||
|
||||
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."""
|
||||
|
||||
@@ -77,7 +77,8 @@ def read(text, last=""):
|
||||
"""("volume" | "speed", +1 | -1) when the words ask Lumi to speak louder / quieter / faster / slower, else None.
|
||||
`last` is the assistant's answer just before (brain history): after "ACTION: voice volume +1" a bare "more" /
|
||||
"again" / "조금 더" asks for the same again."""
|
||||
t = text or ""
|
||||
from assistant import wording
|
||||
t = wording.polite(wording.ko_plain(text or "")) # every speech level as 반말, no "if you don't mind"
|
||||
again = re.match(r"ACTION: voice (volume|speed) ([+-]1)\b", last or "")
|
||||
if again and driving.AGAIN.search(driving.clean(t)):
|
||||
return again.group(1), int(again.group(2))
|
||||
|
||||
+40
-2
@@ -343,6 +343,36 @@ NOT_LATER = re.compile(r"[\s,;]*\b(?:and |but |so )?(?:not|no) (?:later(?! than)
|
||||
# "go to the stage, right now, not later", "지금 가, 나중 말고": said to mean now; the later-time guards must not see it
|
||||
|
||||
|
||||
POLITE_FRAME = re.compile( # a polite frame around a request: "wave, if you don't mind", "I'd love it if you could wave"
|
||||
r"[\s,]*\bif you (?:don'?t|do not|wouldn'?t|would not) mind\b[\s,]*(?=[.!?]*$)|"
|
||||
r"^\W*if you (?:don'?t|do not|wouldn'?t|would not) mind\b[\s,]*|[\s,]*\bif you please\b|"
|
||||
r"\b(?:i'?d|i would|we'?d|we would) (?:really )?(?:love|like|appreciate) it if you(?: could| would| can|(?!\s+\w+ed\b))\b|"
|
||||
r"\b(?:it'?d|it would|that would|that'?d|it'?ll|it will) be (?:really |so |very )?(?:great|nice|good|lovely|awesome|cool|"
|
||||
r"helpful|wonderful|amazing|fantastic) if you(?: could| would| can|(?!\s+\w+ed\b))\b|"
|
||||
r"\bit would help (?:me |us )?(?:a lot )?if you(?: could| would)?\b", re.I)
|
||||
|
||||
|
||||
def _base_verb(w):
|
||||
"""'waved' -> 'wave', 'stopped' -> 'stop', 'turned' -> 'turn'."""
|
||||
if w.endswith("ed") and len(w) > 4:
|
||||
if w[-3] == "e" or w[-3] in "cvsz" and w[-4] not in "aeiou" or w.endswith(("aved", "oved", "ived")):
|
||||
return w[:-1]
|
||||
return w[:-3] if w[-3] == w[-4] else w[:-2]
|
||||
return w
|
||||
|
||||
|
||||
def polite(t):
|
||||
"""The words without an English polite frame (POLITE_FRAME): "wave, if you don't mind" -> "wave", "I'd love it
|
||||
if you could wave" -> "please wave", "I'd love it if you waved at us" -> "please wave at us". Korean frames are
|
||||
ko_plain's."""
|
||||
t = re.sub(r"\b((?:love|like|appreciate) it|be (?:really |so |very )?(?:great|nice|good|lovely|awesome|cool|helpful|"
|
||||
r"wonderful|amazing|fantastic)) if you (\w+ed)\b", lambda m: f"{m.group(1)} if you could {_base_verb(m.group(2))}",
|
||||
t or "", flags=re.I)
|
||||
out = POLITE_FRAME.sub(lambda m: " please " if re.search(r"\bif you(?: could| would| can)?$", m.group(0), re.I) and
|
||||
not re.search(r"mind|please", m.group(0), re.I) else " ", t or "")
|
||||
return re.sub(r"\s{2,}", " ", out).strip(" ,") or (t or "")
|
||||
|
||||
|
||||
def now_not_later(t):
|
||||
"""The words without "not later" / "나중 말고" (NOT_LATER)."""
|
||||
return re.sub(r"\s{2,}", " ", NOT_LATER.sub(" ", t or "")).strip() or (t or "")
|
||||
@@ -393,6 +423,11 @@ KO_PLAIN = [
|
||||
(re.compile(r"(?<![가-힣])(\S*(?:돌아오|따라오|다가오|가져오|이리 오|일로 오))게" + _END), lambda m: aform(m.group(1))),
|
||||
# 하게체: "돌아오게", "이리 오게"
|
||||
(re.compile(r"(\S+) ?주셨으면 (?:해요|합니다|좋겠(?:어요|습니다|네요))" + _END), r"\1 줘"), # "내려가 주셨으면 해요"
|
||||
(re.compile(r"(\S+) ?주(?:시|)(?:길|기를|기) (?:부탁(?: 좀)? ?(?:드립니다|드려요|드릴게요|합니다|해요|드리겠습니다)|바랍니다|바래요|바라요)"
|
||||
+ _END), r"\1 줘"), # "가 주시길 부탁드립니다"
|
||||
(re.compile(r"(?<=[가-힣]) (?:줍서|줍써|주십서|주십써|주게마씸|줍소)" + _END), " 줘"), # 제주 / 경상: "가 줍서"
|
||||
(re.compile(r"(\d+(?:\.\d+)?\s*(?:도|미터|센티(?:미터)?|센치|cm|m)(?![가-힣a-z]))\s+(?:좀|쫌|한번|한 번)\s+(?=[가-힣])"), r"\1 "),
|
||||
# "45도 좀 돌아 줘": the amount, then the verb
|
||||
(re.compile(r"(?<= )조(?:잉)?(?=\s*(?:[,.!?~…]|$))"), "줘"), # "흔들어 조잉", "손 한번 조"
|
||||
(re.compile(r"악수 ?(?:한 ?번)? ?(?:할까요?|하실래요?|합시다|하십시다|하자잉|허자잉?|하입시더)"), "악수하자"), # shake hands = wave
|
||||
(re.compile(r"(?<=[가-힣](?:라|자)) 마(?=\s*(?:[,.!?~…]|$))"), ""), # 경상: "팔 접어 봐라 마"
|
||||
@@ -414,9 +449,10 @@ KO_PLAIN = [
|
||||
(re.compile(r"(?<![가-힣])(\S*?[가-힣])(?:으)?면 (?:돼요?|됩니다)" + _END_NOT_ASKED), "STEM"), # "날 따라오면 돼"
|
||||
(re.compile(r"(?<![가-힣])(\S*[가-힣])\s?(?:줄래요?|줄 수 (?:있어요?|있니|있나요|있습니까)|주실 수 (?:있어요|있나요|있습니까|있으세요)|"
|
||||
r"주시겠어요|주시겠습니까|주실래요)" + _END), r"\1 줘"),
|
||||
(re.compile(r"(?<![가-힣])(\S*?[가-힣])(?:으)?" + _HON + _END), "STEM"), # 가세요, 따라오십시오, 보이소, 집으세요
|
||||
(re.compile(r"(?<![가-힣])(\S*[가-힣])(?: 수 (?:있을까요?|있겠(?:어요|니|습니까)|있으실까요|있으시겠어요))\s*\??" + _END),
|
||||
(re.compile(r"(?<![가-힣])(\S*[가-힣])(?: 수 (?:있을까요?|있겠(?:어요|니|습니까)|있으실까요|있으시겠어요|있으세요|있으신가요|"
|
||||
r"있으십니까|있으시겠습니까))\s*\??" + _END),
|
||||
"CAN_L"), # "갈 수 있을까요?": please go
|
||||
(re.compile(r"(?<![가-힣])(\S*?[가-힣])(?:으)?" + _HON + _END), "STEM"), # 가세요, 따라오십시오, 보이소, 집으세요
|
||||
(re.compile(r"(?<![가-힣])(\S*[가-힣]) 거 (?:돼요|되나요|될까요|가능해요|가능할까요|가능합니까|가능하세요)\s*\??" + _END),
|
||||
"CAN_N"), # "가는 거 돼요?"
|
||||
(re.compile(r"(?<![가-힣])(\S*(?:해|가|와|봐|줘|돌아|어|아|려|워|쳐|져|켜|꺼|둬|놔|펴|서|내))(?:요|라|유|부러|불어|뿌러|뿌라|삐라|잉|용)" + _END),
|
||||
@@ -450,6 +486,8 @@ def _can_you(m, kind):
|
||||
stem = {"도": "돌", "드": "들", "여": "열", "흔드": "흔들", "내미": "내밀"}.get(stem, stem)
|
||||
if not stem or stem in KO_SOCIAL:
|
||||
return m.group(0)
|
||||
if stem in ("주", "주시"):
|
||||
return "줘?" # "가 줄 수 있을까요?": the 줘 is said already
|
||||
return aform(stem) + " 줘?"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user