Improve Korean understanding in casual, rude, formal and suggestion forms
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
"""A held-out English check (written apart from en_paraphrase_check.py and bank_words/en_more.py): orders said in
|
||||
sentences of their own (plain, polite, casual, non-native), each with the plain request it means; and talk that must
|
||||
not move. Run on two trees to compare (PYTHONPATH=<tree> from inside it).
|
||||
|
||||
.venv/bin/python tests/en_held_check.py # -> logs/en_held.md
|
||||
"""
|
||||
import pathlib
|
||||
|
||||
from tests import ko_levels_check as kl
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
|
||||
CASES = [
|
||||
("mind taking me to p5?", "go to p5", "polite"), ("p5, let's go", "go to p5", "casual"), ("off you go to p5", "go to p5", "casual"),
|
||||
("you go p5 now please", "go to p5", "nonnative"), ("would you kindly make your way over to p5", "go to p5", "polite"),
|
||||
("scoot forward a meter", "move forward one meter", "casual"), ("one meter ahead please", "move forward one meter", "polite"),
|
||||
("you go front one meter", "move forward one meter", "nonnative"), ("back it up half a meter", "move back half a meter", "casual"),
|
||||
("could you reverse fifty centimeters?", "move back half a meter", "polite"),
|
||||
("hang a left", "turn left", "casual"), ("turn yourself to the left please", "turn left", "polite"), ("you turn left side", "turn left", "nonnative"),
|
||||
("swing around the other way", "turn around", "casual"), ("would you mind turning around?", "turn around", "polite"),
|
||||
("tip your head up", "look up", "casual"), ("could you look up at the ceiling for me?", "look up", "polite"), ("you look up please", "look up", "nonnative"),
|
||||
("look down at your feet", "look down", "plain"), ("eyes on me buddy", "look at me", "casual"), ("would you look over at me?", "look at me", "polite"),
|
||||
("come on over here", "come here", "casual"), ("could you come a bit closer to me?", "come here", "polite"), ("you come here please", "come here", "nonnative"),
|
||||
("keep close behind me", "follow me", "plain"), ("come along, follow me", "follow me", "casual"), ("would you mind following me?", "follow me", "polite"),
|
||||
("you follow me please", "follow me", "nonnative"),
|
||||
("give the kids a wave", "wave", "plain"), ("shake my hand, robot", "wave", "casual"), ("could you wave at us?", "wave", "polite"),
|
||||
("you shake hand with me", "wave", "nonnative"), ("let's do a handshake", "wave", "casual"),
|
||||
("hold your hand out for me", "give me your hand", "plain"), ("could you reach your arm out?", "give me your hand", "polite"),
|
||||
("put the arm away now", "fold your arm", "plain"), ("could you fold that arm back in?", "fold your arm", "polite"),
|
||||
("open up your hand", "open your hand", "plain"), ("would you open the gripper please?", "open your hand", "polite"),
|
||||
("snag the cup", "pick up the cup", "casual"), ("could you pick that cup up for me?", "pick up the cup", "polite"),
|
||||
("you take cup please", "pick up the cup", "nonnative"),
|
||||
("bring that cup over to me", "bring me the cup", "plain"), ("would you fetch me the cup?", "bring me the cup", "polite"),
|
||||
("whoa whoa stop", "stop", "casual"), ("please stop right now", "stop", "polite"), ("you stop please", "stop", "nonnative"),
|
||||
("knock it off", "stop", "casual"),
|
||||
("sing us something", "sing a song", "casual"), ("would you sing a song for us?", "sing a song", "polite"),
|
||||
("you sing song please", "sing a song", "nonnative"),
|
||||
("time to charge, go", "go charge", "casual"), ("could you go to your charger?", "go charge", "polite"),
|
||||
("speak up a bit", "speak louder", "casual"), ("could you talk a little louder?", "speak louder", "polite"),
|
||||
]
|
||||
NOT_NOW = [
|
||||
"I waved at a robot yesterday", "don't follow me please", "my kid wants to shake your hand later", "can you even turn left?",
|
||||
"if I raise my hand, come here", "he told me to go to p5", "the robot at the mall followed me around",
|
||||
"do you know how to sing?", "please don't pick up my cup", "we turned left at the corner",
|
||||
]
|
||||
|
||||
|
||||
def check():
|
||||
rows = []
|
||||
for t, en, level in CASES:
|
||||
want, got = kl.read(en), kl.read(t)
|
||||
rows.append(("en", level, t, got, want, "right" if kl.same(want, got) else
|
||||
"missed" if got is None or got.split()[0] in kl.command_check.NO_MOTION else "wrong"))
|
||||
for t in NOT_NOW:
|
||||
got = kl.read(t)
|
||||
moves = got is not None and got.split()[0] not in kl.command_check.NO_MOTION
|
||||
rows.append(("en", "not_now", t, got, "no motion", "motion" if moves and got not in ("stop", "sing") else "right"))
|
||||
return rows
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
out = kl.report(check()).replace("# Korean speech levels against English (tests/ko_levels_check.py)",
|
||||
"# English held-out orders (tests/en_held_check.py)")
|
||||
(ROOT / "logs" / "en_held.md").write_text(out)
|
||||
print(out)
|
||||
@@ -0,0 +1,101 @@
|
||||
"""English requests said in other words: each capability's sentences of the same meaning (the owner's example: "shake
|
||||
your hand", "shake hand", "can you shake your hand", "wave your hand", "wave hand", "do you shake your hand" = wave)
|
||||
in every frame people use (bare, please, could you, would you mind, I need you to, go ahead and, slang, non-native)
|
||||
must give the reading of the capability's plain request. The same words as talk (past, negation, later, about
|
||||
someone else) must not move Lumi.
|
||||
|
||||
.venv/bin/python tests/en_paraphrase_check.py # -> logs/en_paraphrase.md
|
||||
"""
|
||||
import collections
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
from tests import ko_levels_check as kl
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
|
||||
# name: (plain request, [other sentences of the same meaning, verb first]); "spin left" / "spin around" / "turn all the
|
||||
# way around" are a full spin, "hold it" a hand-over: not listed
|
||||
CAPS = {
|
||||
"wave": ("wave", ["shake your hand", "shake hand", "wave your hand", "wave hand", "give us a wave", "wave hello",
|
||||
"do a little wave", "shake hands with me", "let's shake hands", "wave at me", "wave to the kids",
|
||||
"say hi with your hand", "wave bye"]),
|
||||
"reach": ("give me your hand", ["hold out your hand", "stretch your arm out", "reach out your hand", "put your hand out",
|
||||
"lend me your hand", "extend your arm"]),
|
||||
"fold": ("fold your arm", ["put your arm away", "tuck your arm in", "bring your arm back", "lower your arm",
|
||||
"put your arm down"]),
|
||||
"open": ("open your hand", ["open the gripper", "open your fingers", "spread your fingers", "release the gripper"]),
|
||||
"close": ("close your hand", ["close the gripper", "close your fingers", "make a fist", "shut your hand"]),
|
||||
"pick": ("pick up the cup", ["grab the cup", "take the cup", "get the cup", "lift the cup", "pick the cup up",
|
||||
"grab that cup", "take hold of the cup"]),
|
||||
"fetch": ("bring me the cup", ["get me the cup", "fetch the cup", "bring the cup over here", "hand me the cup",
|
||||
"bring that cup to me", "go get the cup for me"]),
|
||||
"go_to": ("go to p3", ["head to p3", "drive to p3", "move to p3", "go over to p3", "make your way to p3",
|
||||
"get yourself to p3", "go to point p3"]),
|
||||
"home": ("go home", ["go back home", "head home", "return home", "go to your home spot"]),
|
||||
"come": ("come here", ["come over here", "come to me", "come closer", "get over here", "come this way",
|
||||
"come over", "approach me"]),
|
||||
"follow": ("follow me", ["come with me", "follow along", "walk with me", "stay behind me", "keep following me",
|
||||
"tag along", "stick with me"]),
|
||||
"forward": ("move forward one meter", ["go forward one meter", "drive forward a meter", "move ahead one meter",
|
||||
"roll forward one meter", "go one meter forward"]),
|
||||
"back": ("move back half a meter", ["back up half a meter", "go back fifty centimeters", "reverse half a meter",
|
||||
"back off half a meter", "move backward fifty centimeters"]),
|
||||
"turn": ("turn left", ["turn to the left", "rotate left", "turn your body left", "face left",
|
||||
"make a left turn", "turn left ninety degrees"]),
|
||||
"around": ("turn around", ["do a u-turn", "turn the other way",
|
||||
"face the other way", "rotate one eighty"]),
|
||||
"look_up": ("look up", ["look upward", "lift your head", "raise your head", "tilt your head up", "look at the ceiling",
|
||||
"head up"]),
|
||||
"look_dn": ("look down", ["look downward", "lower your head", "tilt your head down", "look at the floor",
|
||||
"head down", "bow your head"]),
|
||||
"look_me": ("look at me", ["look over here", "eyes on me", "face me", "turn to me", "look this way",
|
||||
"look at my face"]),
|
||||
"stop": ("stop", ["stop it", "stop right there", "stop moving", "freeze", "halt", "stop now", "cut it out"]),
|
||||
"sing": ("sing a song", ["sing something", "sing for us", "give us a song", "play a song", "sing me a song",
|
||||
"can we hear a song", "sing one of your songs"]),
|
||||
"come_back": ("come back", ["come back to where you were", "go back to your spot", "return to where you started"]),
|
||||
"body_up": ("raise your body", ["make yourself taller", "lift your body", "stand taller"]),
|
||||
"charge": ("go charge", ["go charge yourself", "go to the charger", "go recharge", "go charge your battery"]),
|
||||
}
|
||||
FRAMES = {
|
||||
"bare": ["{}", "{} now", "okay, {}", "lumi, {}", "hey lumi, {}"],
|
||||
"polite": ["please {}", "{}, please", "could you {}?", "would you {}, please?", "can you {} for me?",
|
||||
"would you be so kind as to {}?", "{}, if you don't mind", "I'd like you to {}", "I need you to {}",
|
||||
"would you please {}?", "could you please {}?"],
|
||||
"casual": ["yo, {}", "{} real quick", "go ahead and {}", "c'mon, {}", "just {}", "{}, buddy", "{} already",
|
||||
"hey, {} would ya", "{} pls", "can u {}"],
|
||||
"nonnative": ["you {} please", "please you {}", "lumi you {}", "now you {}", "{} ok?", "you can {}?"],
|
||||
}
|
||||
NOT_NOW = ["I {}ed yesterday", "don't {}", "please don't {}", "later you can {}", "if I clap, {}", "my son wants to {}",
|
||||
"he told me to {}", "do you know how to {}?"]
|
||||
|
||||
|
||||
def check(names=None):
|
||||
rows = []
|
||||
for name, (plain, others) in CAPS.items():
|
||||
if names and name not in names:
|
||||
continue
|
||||
want = kl.read(plain)
|
||||
for frame, forms in FRAMES.items():
|
||||
for phrase in [plain] + others:
|
||||
for f in forms:
|
||||
t = f.format(phrase)
|
||||
got = kl.read(t)
|
||||
rows.append((name, frame, t, got, want, "right" if kl.same(want, got) else
|
||||
"missed" if got is None or got.split()[0] in kl.command_check.NO_MOTION else "wrong"))
|
||||
for f in NOT_NOW[1:3] + NOT_NOW[3:]:
|
||||
t = f.format(plain)
|
||||
got = kl.read(t)
|
||||
moves = got is not None and got.split()[0] not in kl.command_check.NO_MOTION
|
||||
rows.append((name, "not_now", t, got, "no motion", "right" if not moves else
|
||||
"wrong" if got in ("stop", "sing") else "motion"))
|
||||
return rows
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
rows = check(set(sys.argv[1:]) or None)
|
||||
out = kl.report(rows).replace("# Korean speech levels against English (tests/ko_levels_check.py)",
|
||||
"# English sentences of the same meaning (tests/en_paraphrase_check.py)")
|
||||
(ROOT / "logs" / "en_paraphrase.md").write_text(out)
|
||||
print(out[:out.index("## Not right")])
|
||||
@@ -0,0 +1,81 @@
|
||||
"""English questions about Lumi said in many ways (plain, polite, casual / slang, kids, non-native) against the quick
|
||||
answers: the same question must get the same kind. Written apart from the bank's wordings.
|
||||
|
||||
.venv/bin/python tests/en_questions_check.py # -> logs/en_questions.md
|
||||
"""
|
||||
import collections
|
||||
import pathlib
|
||||
|
||||
from assistant import quick_answers as qa
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
|
||||
Q = {
|
||||
"name": {"plain": ["what's your name?", "do you have a name?"], "polite": ["may I ask your name?", "could you tell me your name?"],
|
||||
"casual": ["yo what's ur name", "what do they call you?"], "kid": ["robot what is you name?"],
|
||||
"nonnative": ["you name what?", "what is name of you?"]},
|
||||
"age": {"plain": ["how old are you?", "when were you made?"], "polite": ["may I ask how old you are?"],
|
||||
"casual": ["how old r u", "you old or new?"], "kid": ["are you a baby robot? how old?"],
|
||||
"nonnative": ["how many year you have?", "you are how old?"]},
|
||||
"maker": {"plain": ["who made you?", "which company built you?"], "polite": ["could you tell me who developed you?"],
|
||||
"casual": ["who built ya?", "who put you together?"], "kid": ["who made you robot?"],
|
||||
"nonnative": ["who is make you?", "what company make this robot?"]},
|
||||
"height": {"plain": ["how tall are you?", "what's your height?"], "polite": ["may I ask how tall you are?"],
|
||||
"casual": ["how tall r u", "you're pretty tall huh, how tall?"], "kid": ["how big are you?"],
|
||||
"nonnative": ["how much tall you are?", "you height is how much?"]},
|
||||
"weight": {"plain": ["how much do you weigh?", "how heavy are you?"], "polite": ["could you tell me your weight?"],
|
||||
"casual": ["how heavy r u", "you heavy?"], "nonnative": ["how many kilo you are?"]},
|
||||
"battery_life": {"plain": ["how long does your battery last?", "how many hours can you work?"],
|
||||
"polite": ["could you tell me your battery life?"], "casual": ["how long u last on a charge?"],
|
||||
"nonnative": ["battery how many hour?"]},
|
||||
"speed": {"plain": ["how fast can you go?", "what's your top speed?"], "polite": ["may I ask how fast you move?"],
|
||||
"casual": ["how quick r u", "you fast?"], "nonnative": ["your speed how much?"]},
|
||||
"languages": {"plain": ["what languages do you speak?", "do you speak korean?"], "polite": ["which languages can you understand?"],
|
||||
"casual": ["u speak english?", "what languages u got?"], "nonnative": ["you speak which language?"]},
|
||||
"who": {"plain": ["who are you?", "what are you?"], "polite": ["could you introduce yourself?"],
|
||||
"casual": ["so what are you exactly?", "what's your deal?"], "kid": ["what kind of robot are you?"],
|
||||
"nonnative": ["you are what?"]},
|
||||
"time_now": {"plain": ["what time is it?", "do you know the time?"], "polite": ["could you tell me the time?"],
|
||||
"casual": ["what time's it?", "got the time?"], "nonnative": ["now what time?"]},
|
||||
"date_today": {"plain": ["what's the date today?", "what day is it today?"], "polite": ["could you tell me today's date?"],
|
||||
"casual": ["what's today's date?"], "nonnative": ["today is what date?"]},
|
||||
"how_are_you": {"plain": ["how are you?", "how's it going?"], "polite": ["how are you doing today?"],
|
||||
"casual": ["sup lumi", "how ya doin?"], "nonnative": ["you are fine?"]},
|
||||
"can_sing": {"plain": ["can you sing?", "do you sing?"], "polite": ["are you able to sing?"],
|
||||
"casual": ["u sing?", "can u sing tho?"], "nonnative": ["you can singing?"]},
|
||||
"cameras": {"plain": ["how many cameras do you have?", "where are your cameras?"], "polite": ["what cameras do you use?"],
|
||||
"casual": ["where ur eyes at?"], "nonnative": ["camera how many you have?"]},
|
||||
"safety": {"plain": ["are you safe?", "is it safe to stand next to you?"], "polite": ["is it safe for children to be near you?"],
|
||||
"casual": ["u gonna hurt me?"], "nonnative": ["you are dangerous?"]},
|
||||
"stairs": {"plain": ["can you climb stairs?", "can you go up steps?"], "polite": ["are you able to use stairs?"],
|
||||
"casual": ["u do stairs?"], "nonnative": ["you can go stair?"]},
|
||||
"estop": {"plain": ["where is your emergency stop?", "how do I stop you in an emergency?"],
|
||||
"polite": ["could you show me the emergency stop button?"], "casual": ["where's ur kill switch?"]},
|
||||
}
|
||||
|
||||
|
||||
def check():
|
||||
rows = []
|
||||
for kind, levels in Q.items():
|
||||
for level, texts in levels.items():
|
||||
for t in texts:
|
||||
got = qa.kind_of(t)
|
||||
rows.append((kind, level, t, got, "right" if got == kind else "missed" if got is None else "wrong"))
|
||||
return rows
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
rows = check()
|
||||
by = collections.defaultdict(collections.Counter)
|
||||
for kind, level, t, got, v in rows:
|
||||
by[level][v] += 1
|
||||
lines = ["# English questions in many ways (tests/en_questions_check.py)", "",
|
||||
"| way | right | missed | wrong | total |", "|---|---|---|---|---|"]
|
||||
for level, c in by.items():
|
||||
lines.append(f"| {level} | {c['right']} | {c['missed']} | {c['wrong']} | {sum(c.values())} |")
|
||||
tot = collections.Counter(v for *_, v in rows)
|
||||
lines += [f"| all | {tot['right']} | {tot['missed']} | {tot['wrong']} | {len(rows)} |", "", "## Not right", ""]
|
||||
lines += [f"- {k} [{lv}] {t!r} -> {got}" for k, lv, t, got, v in rows if v != "right"]
|
||||
out = "\n".join(lines) + "\n"
|
||||
(ROOT / "logs" / "en_questions.md").write_text(out)
|
||||
print(out)
|
||||
@@ -0,0 +1,78 @@
|
||||
"""A held-out Korean check (written apart from ko_levels_check.py's sentences and bank_words/ko_more.py): orders said
|
||||
in sentences of their own at every register, each with the English request it means; and remarks that must not
|
||||
move. Run on two trees to compare (PYTHONPATH=<tree> from inside it).
|
||||
|
||||
.venv/bin/python tests/ko_held_check.py # -> logs/ko_held.md
|
||||
"""
|
||||
import collections
|
||||
import pathlib
|
||||
|
||||
from tests import ko_levels_check as kl
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
|
||||
# (Korean, the English request it means, register)
|
||||
CASES = [
|
||||
("저 p5까지 좀 데려다줄래?", "go to p5", "반말"), ("p5 쪽으로 출발!", "go to p5", "반말"), ("p5로 가 보자", "go to p5", "suggest"),
|
||||
("야 p5 가라고", "go to p5", "rude"), ("p5로 이동 부탁드립니다", "go to p5", "하십시오"), ("p5까지 가 주시면 좋겠어요", "go to p5", "해요"),
|
||||
("p5 방향으로 움직여 주실래요?", "go to p5", "honorific"), ("얼른 p5로 꺼져", "go to p5", "rude"),
|
||||
("앞으로 쭉 1미터만 가 볼래?", "move forward one meter", "반말"), ("1미터 전진하십시오", "move forward one meter", "하십시오"),
|
||||
("앞으로 1미터 나가 봐", "move forward one meter", "반말"), ("야 1미터 앞으로 가라", "move forward one meter", "rude"),
|
||||
("한 1미터 앞으로 와 주세요", "move forward one meter", "해요"),
|
||||
("뒤로 50센티 빠져 줄래?", "move back half a meter", "반말"), ("50센티 후진 부탁해요", "move back half a meter", "해요"),
|
||||
("뒤로 50센티 물러나십시오", "move back half a meter", "하십시오"), ("야 뒤로 50센티 비켜", "move back half a meter", "rude"),
|
||||
("왼쪽으로 몸 좀 틀어 봐", "turn left", "반말"), ("좌회전 하십시오", "turn left", "하십시오"), ("왼편으로 돌아 주시겠어요?", "turn left", "honorific"),
|
||||
("야 왼쪽으로 돌라고", "turn left", "rude"), ("왼쪽으로 한 바퀴 말고 90도만 돌아", "turn left", "반말"),
|
||||
("오른쪽으로 45도 회전 부탁드려요", "turn right 45 degrees", "해요"), ("우측으로 45도 돌아 주십시오", "turn right 45 degrees", "하십시오"),
|
||||
("뒤돌아 봐", "turn around", "반말"), ("반대쪽으로 돌아 서 주세요", "turn around", "해요"), ("한 바퀴 반 말고 반 바퀴만 돌아라", "turn around", "rude"),
|
||||
("고개 위로 들어 봐", "look up", "반말"), ("위쪽 좀 쳐다보세요", "look up", "honorific"), ("천장 좀 봐라", "look up", "rude"),
|
||||
("고개를 아래로 숙여 주십시오", "look down", "하십시오"), ("바닥 좀 봐 줄래?", "look down", "반말"),
|
||||
("여기 나 좀 봐라", "look at me", "rude"), ("저 좀 쳐다봐 주세요", "look at me", "해요"), ("저를 바라봐 주시겠습니까?", "look at me", "하십시오"),
|
||||
("이쪽으로 와 볼래?", "come here", "반말"), ("내 쪽으로 좀 와라", "come here", "rude"), ("가까이 와 주시겠어요?", "come here", "honorific"),
|
||||
("이리로 좀 오십시오", "come here", "하십시오"), ("야 이리 와 봐", "come here", "rude"),
|
||||
("나 졸졸 따라와", "follow me", "반말"), ("제 뒤를 쫓아와 주세요", "follow me", "해요"), ("저를 따라오시겠습니까?", "follow me", "하십시오"),
|
||||
("야 나 따라붙어", "follow me", "rude"), ("나만 따라다녀 줘", "follow me", "반말"),
|
||||
("손 들어서 흔들어 줘", "wave", "반말"), ("손 좀 흔들어 주실래요?", "wave", "honorific"), ("야 손 흔들어 봐라", "wave", "rude"),
|
||||
("손을 흔들어 주십시오", "wave", "하십시오"), ("우리랑 악수 한번 해요", "wave", "해요"), ("악수 좀 하자", "wave", "suggest"),
|
||||
("저랑 악수하시겠어요?", "wave", "honorific"), ("손 흔들어서 인사 좀 해 줘", "wave", "반말"),
|
||||
("손 내밀어 줄래?", "give me your hand", "반말"), ("팔 쭉 뻗어 봐라", "give me your hand", "rude"), ("손을 내밀어 주시겠습니까?", "give me your hand", "하십시오"),
|
||||
("팔 다시 접어", "fold your arm", "반말"), ("팔 거두십시오", "fold your arm", "하십시오"), ("팔 좀 접어 주세요", "fold your arm", "해요"),
|
||||
("손 쫙 펴 봐", "open your hand", "반말"), ("그리퍼 좀 열어 주세요", "open your hand", "해요"), ("집게 벌려라", "open your hand", "rude"),
|
||||
("컵 하나 들어 올려 봐", "pick up the cup", "반말"), ("컵 좀 잡아 주시겠어요?", "pick up the cup", "honorific"), ("야 컵 집어 들어", "pick up the cup", "rude"),
|
||||
("그 컵 좀 챙겨 줘", "pick up the cup", "반말"), ("컵을 집어 주십시오", "pick up the cup", "하십시오"),
|
||||
("컵 하나만 갖다 줄래?", "bring me the cup", "반말"), ("저한테 컵 좀 가져다주세요", "bring me the cup", "해요"),
|
||||
("야 컵 가져와 빨리", "bring me the cup", "rude"), ("컵 하나 가져오시겠습니까?", "bring me the cup", "하십시오"),
|
||||
("그만 좀 해", "stop", "반말"), ("거기 멈춰라", "stop", "rude"), ("동작을 멈춰 주십시오", "stop", "하십시오"), ("움직이지 마세요", "stop", "해요"),
|
||||
("잠깐 정지해 주실래요?", "stop", "honorific"), ("야 서라고", "stop", "rude"),
|
||||
("노래 하나 불러 봐", "sing a song", "반말"), ("노래 좀 불러 주시겠어요?", "sing a song", "honorific"), ("야 노래나 해 봐", "sing a song", "rude"),
|
||||
("노래 한 곡 부탁드립니다", "sing a song", "하십시오"), ("노래 부르자", "sing a song", "suggest"),
|
||||
("충전하러 가 봐", "go charge", "반말"), ("충전기 쪽으로 가 주세요", "go charge", "해요"), ("배터리 충전하러 가십시오", "go charge", "하십시오"),
|
||||
("원래 있던 자리로 돌아와", "come back", "반말"), ("제자리로 돌아오세요", "come back", "해요"),
|
||||
("몸 좀 올려 봐", "raise your body", "반말"), ("키 좀 높여 주세요", "raise your body", "해요"),
|
||||
("더 크게 말해 봐", "speak louder", "반말"), ("목소리 좀 키워 주세요", "speak louder", "해요"),
|
||||
]
|
||||
NOT_NOW = [
|
||||
"아까 너 왼쪽으로 돌았잖아", "손 흔들 줄 알아?", "어제 로봇이 p5로 가더라", "따라오지 마세요", "이따가 노래 불러 줘",
|
||||
"엄마가 이리 오래", "우리 애가 손 흔들었어요", "컵 집지 마", "제가 신호하면 앞으로 가 주세요", "민수야 이리 와 봐",
|
||||
"고개 숙이는 거 봤어요", "p5로 가면 뭐가 있어요?", "악수하는 법 알려 줄까?", "팔 접지 마십시오", "충전하러 갔었어?",
|
||||
]
|
||||
|
||||
|
||||
def check():
|
||||
rows = []
|
||||
for t, en, level in CASES:
|
||||
want, got = kl.read(en), kl.read(t)
|
||||
rows.append(("ko", level, t, got, want, "right" if kl.same(want, got) else
|
||||
"missed" if got is None or got.split()[0] in kl.command_check.NO_MOTION else "wrong"))
|
||||
for t in NOT_NOW:
|
||||
got = kl.read(t)
|
||||
moves = got is not None and got.split()[0] not in kl.command_check.NO_MOTION
|
||||
rows.append(("ko", "not_now", t, got, "no motion", "motion" if moves and got not in ("stop", "sing") else "right"))
|
||||
return rows
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
out = kl.report(check()).replace("# Korean speech levels against English (tests/ko_levels_check.py)",
|
||||
"# Korean held-out orders (tests/ko_held_check.py)")
|
||||
(ROOT / "logs" / "ko_held.md").write_text(out)
|
||||
print(out)
|
||||
@@ -55,6 +55,44 @@ CAPS = {
|
||||
"put": ("put the cup down", "컵 내려", "놓", "놔", []),
|
||||
"charge": ("go charge", "충전하러", "가", "가", ["차지하러 가 줘"]),
|
||||
}
|
||||
# other sentences of the same meaning: (words before the verb, verb stem, its 아/어 form), each said at every level
|
||||
PARA = {
|
||||
"go_to": [("p3로", "이동하", "이동해"), ("p3까지", "가", "가"), ("p3 쪽으로", "가", "가"), ("p3로", "움직이", "움직여")],
|
||||
"home": [("홈으로", "돌아가", "돌아가"), ("홈 위치로", "가", "가")],
|
||||
"forward": [("앞으로 1미터", "이동하", "이동해"), ("1미터 앞으로", "가", "가"), ("앞으로 1미터", "전진하", "전진해"),
|
||||
("1미터만 앞으로", "가", "가")],
|
||||
"back": [("뒤로 50센티", "물러나", "물러나"), ("50센티 뒤로", "가", "가"), ("뒤로 50센티", "후진하", "후진해"),
|
||||
("50센티만 뒤로", "빠지", "빠져")],
|
||||
"turn": [("왼쪽으로", "회전하", "회전해"), ("몸을 왼쪽으로", "돌리", "돌려"), ("왼편으로", "돌", "돌아"),
|
||||
("좌회전", "하", "해")],
|
||||
"turn45": [("오른쪽으로 45도", "회전하", "회전해"), ("45도 오른쪽으로", "돌", "돌아")],
|
||||
"look": [("왼쪽을", "보", "봐"), ("왼쪽", "쳐다보", "쳐다봐"), ("고개를 왼쪽으로", "돌리", "돌려")],
|
||||
"look_up": [("위쪽을", "보", "봐"), ("위를", "쳐다보", "쳐다봐"), ("천장을", "보", "봐")],
|
||||
"head_up": [("고개를", "들", "들어"), ("머리", "들", "들어"), ("고개를 위로", "올리", "올려")],
|
||||
"head_dn": [("고개를", "숙이", "숙여"), ("머리를", "숙이", "숙여"), ("고개를 아래로", "내리", "내려")],
|
||||
"wave": [("손을", "흔들", "흔들어"), ("손 한번", "흔들", "흔들어"), ("팔을", "흔들", "흔들어"),
|
||||
("손 흔들어서 인사", "하", "해")],
|
||||
"shake": [("저랑 악수", "하", "해"), ("악수 한번", "하", "해"), ("나랑 악수", "하", "해")],
|
||||
"reach": [("손을", "내밀", "내밀어"), ("팔을", "뻗", "뻗어"), ("손을 앞으로", "내밀", "내밀어")],
|
||||
"follow": [("나를", "따라오", "따라와"), ("저", "따라다니", "따라다녀"), ("제 뒤를", "따라오", "따라와"),
|
||||
("날", "쫓아오", "쫓아와")],
|
||||
"come": [("여기로", "오", "와"), ("이쪽으로", "오", "와"), ("나한테", "오", "와"), ("가까이", "오", "와"),
|
||||
("이리", "다가오", "다가와")],
|
||||
"stop": [("거기", "서", "서"), ("동작", "멈추", "멈춰"), ("", "정지하", "정지해")],
|
||||
"fetch": [("컵 좀", "가져오", "가져와"), ("컵", "갖고 오", "갖고 와"), ("저한테 컵", "가져오", "가져와"),
|
||||
("컵", "챙겨 오", "챙겨 와")],
|
||||
"pick": [("컵을", "잡", "잡아"), ("컵을", "집어 들", "집어 들어"), ("컵", "픽업하", "픽업해")],
|
||||
"fold": [("팔을", "접", "접어"), ("팔을", "거두", "거둬"), ("팔을 몸 쪽으로", "접", "접어")],
|
||||
"sing": [("노래 한 곡", "부르", "불러"), ("노래", "하", "해"), ("노래 한 곡", "뽑", "뽑아")],
|
||||
"look_me": [("나를", "보", "봐"), ("저 좀", "보", "봐"), ("여기를", "보", "봐"), ("저를", "쳐다보", "쳐다봐")],
|
||||
"around": [("반 바퀴", "돌", "돌아"), ("180도", "돌", "돌아")],
|
||||
"come_back": [("원래 자리로", "돌아오", "돌아와"), ("다시", "돌아오", "돌아와")],
|
||||
"waist": [("허리를 왼쪽으로", "틀", "틀어"), ("허리 왼쪽으로", "돌리", "돌려")],
|
||||
"body_up": [("몸을", "높이", "높여"), ("키를", "높이", "높여"), ("몸을 위로", "올리", "올려")],
|
||||
"open": [("손을", "펴", "펴"), ("손을", "벌리", "벌려"), ("집게를", "열", "열어"), ("그리퍼", "열", "열어")],
|
||||
"put": [("컵", "내려놓", "내려놔"), ("컵을 테이블에", "놓", "놔"), ("컵", "내려 두", "내려 둬")],
|
||||
"charge": [("충전기로", "가", "가"), ("충전하러", "이동하", "이동해")],
|
||||
}
|
||||
EN_FORMS = ["{}", "please {}", "{}, please", "could you {}?", "can you {} for me?", "would you {}, please?",
|
||||
"I'd like you to {}", "I'd love it if you could {}", "{}, if you don't mind", "lumi, {}",
|
||||
"it would be great if you could {}"]
|
||||
@@ -92,6 +130,14 @@ def past(a):
|
||||
return a[:-1] + _with_final(a[-1], 20)
|
||||
|
||||
|
||||
def sida(stem):
|
||||
"""The 하십시오체 suggestion: 가 -> 갑시다, 돌 -> 돕시다, 집 -> 집읍시다."""
|
||||
j = _j(stem[-1])
|
||||
if j[2] == 8: # ㄹ drops: 돕시다, 흔듭시다
|
||||
return stem[:-1] + _with_final(stem[-1], 17) + "시다"
|
||||
return stem + "읍시다" if j[2] else stem[:-1] + _with_final(stem[-1], 17) + "시다"
|
||||
|
||||
|
||||
def levels(pre, stem, a):
|
||||
"""{level: [Korean forms]} for one verb phrase."""
|
||||
p = (pre + " ") if pre else ""
|
||||
@@ -110,6 +156,9 @@ def levels(pre, stem, a):
|
||||
f"{p}{a} 줄 수 있을까요?"],
|
||||
"dialect": [f"{p}{a} 도", f"{p}{a} 주이소", f"{p}{a} 주랑께", f"{p}{a} 줘유", f"{p}{a} 줍서", f"{p}{a}라 마"],
|
||||
"slip": [f"{p}{a}줘", f"{p}{a} 주세여", f"{p}{a}조", f"{(pre + a).replace(' ', '')} 줘"],
|
||||
"suggest": [f"{p}{stem}자", f"{p}{sida(stem)}", f"자, {p}{stem}자"],
|
||||
"rude": [f"야, {p}{a}", f"야 {p}{a}라", f"빨리 {p}{a}", f"{p}{a}라 빨리", f"당장 {p}{a}", f"{p}{a}라고",
|
||||
f"{p}{a} 봐라", f"얼른 {p}{a} 줘", f"야 루미, {p}{a}"],
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +182,11 @@ def same(want, got):
|
||||
return got == want or got is not None and want is not None and command_check.ok(want, got) == "right"
|
||||
|
||||
|
||||
def check(names=None):
|
||||
SUGGEST_FOR = {"go_to", "home", "forward", "back", "turn", "turn45", "wave", "shake", "sing", "around", "charge", "look", "look_up",
|
||||
"look_dn"} # "p3로 가자", "악수합시다": a suggestion is an order only where Lumi does it with the visitor
|
||||
|
||||
|
||||
def check(names=None, para=True):
|
||||
"""rows: (capability, level, text, reading, want, verdict) with verdict right / missed / wrong / motion."""
|
||||
rows = []
|
||||
for name, (en, pre, stem, a, mixed) in CAPS.items():
|
||||
@@ -141,12 +194,17 @@ def check(names=None):
|
||||
continue
|
||||
want = read(en)
|
||||
forms = {"en": [f.format(en) for f in EN_FORMS], **levels(pre, stem, a), "konglish": mixed}
|
||||
for pp, ps, pa in PARA.get(name, []) if para else []:
|
||||
for level, texts in levels(pp, ps, pa).items():
|
||||
forms["para_" + level] = forms.get("para_" + level, []) + texts
|
||||
if name not in SUGGEST_FOR:
|
||||
forms = {k: v for k, v in forms.items() if not k.endswith("suggest")}
|
||||
for level, texts in forms.items():
|
||||
for t in texts:
|
||||
got = read(t)
|
||||
rows.append((name, level, t, got, want, "right" if same(want, got) else
|
||||
"missed" if got is None or got.split()[0] in command_check.NO_MOTION else "wrong"))
|
||||
for t in not_now(pre, stem, a):
|
||||
for t in not_now(pre, stem, a) + [t for pp, ps, pa in (PARA.get(name, []) if para else []) for t in not_now(pp, ps, pa)]:
|
||||
got = read(t)
|
||||
moves = got is not None and got.split()[0] not in command_check.NO_MOTION and \
|
||||
not (got == "action:look away" and "지 마" in t) # "저를 보지 마세요": looking away is asked
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
"""Korean questions about Lumi at every register against the quick answers: the same question said casually (반말),
|
||||
rudely (명령조, 야 / -냐 / 대 봐), politely (해요체), formally (하십시오체) and with honorifics (-시-, 성함, 연세) must
|
||||
get the same quick-answer kind. Written apart from the bank's wordings. (The price and how long a charge takes go to the
|
||||
LLM on purpose: not here.)
|
||||
|
||||
.venv/bin/python tests/ko_questions_check.py # -> logs/ko_questions.md
|
||||
"""
|
||||
import collections
|
||||
import pathlib
|
||||
|
||||
from assistant import quick_answers as qa
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
|
||||
# kind: {register: [questions]}
|
||||
Q = {
|
||||
"name": {
|
||||
"반말": ["너 이름 뭐야?", "이름이 뭐니?", "네 이름 알려 줘", "너 뭐라고 불러?", "이름 있어?"],
|
||||
"rude": ["야 너 이름 뭐냐", "이름 대 봐", "야 이름이 뭐냐고", "니 이름 뭐냐?", "이름 말해 봐라"],
|
||||
"해요": ["이름이 뭐예요?", "이름 좀 알려 주세요", "뭐라고 부르면 돼요?", "이름이 있어요?", "이름이 어떻게 돼요?"],
|
||||
"하십시오": ["이름이 무엇입니까?", "이름을 말씀해 주십시오", "어떻게 불러야 합니까?", "이름이 있습니까?"],
|
||||
"honorific": ["성함이 어떻게 되세요?", "성함이 어떻게 되십니까?", "존함을 여쭤봐도 될까요?", "이름을 여쭤봐도 될까요?"],
|
||||
},
|
||||
"age": {
|
||||
"반말": ["너 몇 살이야?", "나이가 몇이야?", "너 언제 만들어졌어?", "몇 살인지 알려 줘", "올해 몇 살?"],
|
||||
"rude": ["야 너 몇 살이냐", "나이 대 봐", "몇 살이냐고", "야 나이 몇이냐?", "너 몇 살 먹었냐"],
|
||||
"해요": ["몇 살이에요?", "나이가 어떻게 돼요?", "언제 만들어졌어요?", "만들어진 지 얼마나 됐어요?", "나이가 몇이에요?"],
|
||||
"하십시오": ["몇 살입니까?", "나이가 어떻게 됩니까?", "언제 만들어졌습니까?", "제작된 지 얼마나 되었습니까?"],
|
||||
"honorific": ["연세가 어떻게 되세요?", "나이가 어떻게 되십니까?", "올해 몇 살이신가요?", "언제 태어나셨어요?"],
|
||||
},
|
||||
"maker": {
|
||||
"반말": ["너 누가 만들었어?", "어디서 만들었어?", "너 어느 회사 거야?", "만든 사람 누구야?", "제조사가 어디야?"],
|
||||
"rude": ["야 누가 너 만들었냐", "어디 회사 거냐", "만든 데 대 봐", "누가 만들었냐고", "야 너 어디 제품이냐?"],
|
||||
"해요": ["누가 만들었어요?", "어느 회사에서 만들었어요?", "제조사가 어디예요?", "개발사가 어디예요?", "어디 제품이에요?"],
|
||||
"하십시오": ["누가 만들었습니까?", "어느 회사 제품입니까?", "제조사가 어디입니까?", "어디에서 개발했습니까?"],
|
||||
"honorific": ["어느 회사에서 만드셨어요?", "누가 개발하셨나요?", "제조사를 여쭤봐도 될까요?", "어디서 만드신 로봇인가요?"],
|
||||
},
|
||||
"height": {
|
||||
"반말": ["너 키 몇이야?", "키 얼마야?", "키가 몇 센티야?", "너 얼마나 커?"],
|
||||
"rude": ["야 너 키 몇이냐", "키 몇 센티냐", "키 대 봐", "야 너 얼마나 크냐?"],
|
||||
"해요": ["키가 얼마예요?", "키가 몇 센티예요?", "키가 어떻게 돼요?", "얼마나 커요?"],
|
||||
"하십시오": ["키가 얼마입니까?", "키가 몇 센티미터입니까?", "신장이 어떻게 됩니까?"],
|
||||
"honorific": ["키가 어떻게 되세요?", "키가 어떻게 되십니까?", "신장이 어떻게 되시나요?"],
|
||||
},
|
||||
"weight": {
|
||||
"반말": ["너 몇 킬로야?", "몸무게 얼마야?", "너 무게 얼마나 나가?", "너 무거워?"],
|
||||
"rude": ["야 너 몇 킬로냐", "무게 대 봐", "몸무게 몇이냐", "야 너 얼마나 무겁냐?"],
|
||||
"해요": ["몸무게가 얼마예요?", "무게가 얼마나 나가요?", "몇 킬로예요?", "무거워요?"],
|
||||
"하십시오": ["무게가 얼마입니까?", "몇 킬로그램입니까?", "중량이 어떻게 됩니까?"],
|
||||
"honorific": ["무게가 어떻게 되세요?", "몸무게가 어떻게 되십니까?", "무게를 여쭤봐도 될까요?"],
|
||||
},
|
||||
"battery_life": {
|
||||
"반말": ["배터리 몇 시간 가?", "한 번 충전하면 얼마나 써?", "배터리 얼마나 오래 가?", "몇 시간 일할 수 있어?"],
|
||||
"rude": ["야 배터리 몇 시간 가냐", "충전하면 얼마나 버티냐", "배터리 몇 시간이냐고"],
|
||||
"해요": ["배터리가 몇 시간 가요?", "한 번 충전하면 얼마나 써요?", "몇 시간 동안 움직일 수 있어요?"],
|
||||
"하십시오": ["배터리 사용 시간이 어떻게 됩니까?", "한 번 충전으로 몇 시간 동작합니까?"],
|
||||
"honorific": ["배터리는 얼마나 가세요?", "한 번 충전하시면 몇 시간 쓰실 수 있어요?"],
|
||||
},
|
||||
"speed": {
|
||||
"반말": ["너 얼마나 빨라?", "최고 속도가 몇이야?", "얼마나 빨리 갈 수 있어?"],
|
||||
"rude": ["야 너 얼마나 빠르냐", "속도 몇이냐", "최고 속도 대 봐"],
|
||||
"해요": ["얼마나 빨라요?", "최고 속도가 어떻게 돼요?", "얼마나 빨리 움직여요?"],
|
||||
"하십시오": ["최고 속도가 얼마입니까?", "이동 속도가 어떻게 됩니까?"],
|
||||
"honorific": ["속도가 어떻게 되세요?", "얼마나 빨리 다니세요?"],
|
||||
},
|
||||
"languages": {
|
||||
"반말": ["너 무슨 말 할 줄 알아?", "몇 개 언어 해?", "영어도 해?", "어떤 언어 할 수 있어?"],
|
||||
"rude": ["야 너 무슨 말 하냐", "몇 개 국어 하냐", "영어 할 줄 아냐?"],
|
||||
"해요": ["어떤 언어 할 수 있어요?", "몇 개 언어 해요?", "영어도 할 수 있어요?"],
|
||||
"하십시오": ["어떤 언어를 구사합니까?", "몇 개 언어를 할 수 있습니까?"],
|
||||
"honorific": ["어떤 언어를 하세요?", "영어도 하실 수 있으세요?", "몇 개 국어 하세요?"],
|
||||
},
|
||||
"how_are_you": {
|
||||
"반말": ["잘 지냈어?", "요즘 어때?", "기분 어때?", "오늘 어때?"],
|
||||
"rude": ["야 잘 지냈냐", "기분 어떠냐", "요즘 어떠냐?"],
|
||||
"해요": ["잘 지냈어요?", "요즘 어때요?", "기분이 어때요?", "오늘 어떠세요?"],
|
||||
"하십시오": ["잘 지내셨습니까?", "기분이 어떻습니까?"],
|
||||
"honorific": ["잘 지내셨어요?", "오늘 기분이 어떠세요?", "요즘 어떻게 지내세요?"],
|
||||
},
|
||||
"time_now": {
|
||||
"반말": ["지금 몇 시야?", "몇 시야?", "지금 시간 알려 줘"],
|
||||
"rude": ["야 몇 시냐", "지금 몇 시냐고", "시간 좀 대 봐"],
|
||||
"해요": ["지금 몇 시예요?", "몇 시예요?", "시간 좀 알려 주세요"],
|
||||
"하십시오": ["지금 몇 시입니까?", "현재 시각이 어떻게 됩니까?"],
|
||||
"honorific": ["지금 몇 시인지 여쭤봐도 될까요?", "현재 시간 좀 알려 주시겠어요?"],
|
||||
},
|
||||
"date_today": {
|
||||
"반말": ["오늘 며칠이야?", "오늘 날짜 알려 줘", "오늘 무슨 요일이야?"],
|
||||
"rude": ["야 오늘 며칠이냐", "오늘 날짜 대 봐", "무슨 요일이냐"],
|
||||
"해요": ["오늘 며칠이에요?", "오늘 날짜가 어떻게 돼요?", "오늘 무슨 요일이에요?"],
|
||||
"하십시오": ["오늘 날짜가 어떻게 됩니까?", "오늘은 무슨 요일입니까?"],
|
||||
"honorific": ["오늘 날짜 좀 알려 주시겠어요?", "오늘이 며칠인지 여쭤봐도 될까요?"],
|
||||
},
|
||||
"can_sing": {
|
||||
"반말": ["너 노래할 줄 알아?", "노래 부를 수 있어?", "너 노래도 해?"],
|
||||
"rude": ["야 너 노래할 줄 아냐", "노래 부를 줄은 아냐?"],
|
||||
"해요": ["노래할 줄 알아요?", "노래 부를 수 있어요?", "노래도 해요?"],
|
||||
"하십시오": ["노래를 부를 수 있습니까?", "노래도 합니까?"],
|
||||
"honorific": ["노래 부르실 줄 아세요?", "노래도 하세요?"],
|
||||
},
|
||||
"dance": {
|
||||
"반말": ["너 춤 출 줄 알아?", "춤도 춰?", "춤 출 수 있어?"],
|
||||
"rude": ["야 너 춤 출 줄 아냐", "춤은 추냐?"],
|
||||
"해요": ["춤 출 줄 알아요?", "춤도 춰요?", "춤 출 수 있어요?"],
|
||||
"하십시오": ["춤을 출 수 있습니까?", "춤도 춥니까?"],
|
||||
"honorific": ["춤 추실 줄 아세요?", "춤도 추세요?"],
|
||||
},
|
||||
"cameras": {
|
||||
"반말": ["카메라 몇 개 있어?", "너 눈이 어디야?", "카메라 어디 달려 있어?"],
|
||||
"rude": ["야 카메라 몇 개냐", "카메라 어디 있냐"],
|
||||
"해요": ["카메라가 몇 개예요?", "카메라는 어디에 있어요?", "눈이 어디예요?"],
|
||||
"하십시오": ["카메라가 몇 개 있습니까?", "카메라는 어디에 달려 있습니까?"],
|
||||
"honorific": ["카메라가 몇 개 있으세요?", "눈은 어디에 있으세요?"],
|
||||
},
|
||||
"charging": {
|
||||
"반말": ["충전은 어떻게 해?", "너 어떻게 충전해?"],
|
||||
"rude": ["야 충전 어떻게 하냐"],
|
||||
"해요": ["충전은 어떻게 해요?"],
|
||||
"하십시오": ["충전은 어떻게 합니까?"],
|
||||
"honorific": ["충전은 어떻게 하세요?"],
|
||||
},
|
||||
"country": {
|
||||
"반말": ["너 어느 나라에서 왔어?", "너 어느 나라 로봇이야?", "한국에서 만들었어?"],
|
||||
"rude": ["야 어느 나라 거냐", "너 어디 나라 로봇이냐"],
|
||||
"해요": ["어느 나라에서 왔어요?", "어느 나라 로봇이에요?", "한국 로봇이에요?"],
|
||||
"하십시오": ["어느 나라에서 만들었습니까?", "어느 나라 로봇입니까?"],
|
||||
"honorific": ["어느 나라에서 오셨어요?", "고향이 어디세요?"],
|
||||
},
|
||||
"who": {
|
||||
"반말": ["너 누구야?", "넌 뭐야?", "자기소개 해 봐", "너 뭐 하는 로봇이야?"],
|
||||
"rude": ["야 너 뭐냐", "넌 대체 뭐냐", "정체가 뭐냐"],
|
||||
"해요": ["누구세요?", "자기소개 좀 해 주세요", "어떤 로봇이에요?", "뭐 하는 로봇이에요?"],
|
||||
"하십시오": ["당신은 누구입니까?", "자기소개를 부탁드립니다", "어떤 로봇입니까?"],
|
||||
"honorific": ["누구신가요?", "소개 좀 해 주시겠어요?", "어떤 일을 하시는 분이세요?"],
|
||||
},
|
||||
"stairs": {
|
||||
"반말": ["너 계단 올라갈 수 있어?", "계단 탈 줄 알아?"],
|
||||
"rude": ["야 계단 올라갈 수 있냐", "계단은 타냐?"],
|
||||
"해요": ["계단 올라갈 수 있어요?", "계단도 다닐 수 있어요?"],
|
||||
"하십시오": ["계단을 오를 수 있습니까?"],
|
||||
"honorific": ["계단도 올라가실 수 있으세요?"],
|
||||
},
|
||||
"name_meaning": {
|
||||
"반말": ["루미가 무슨 뜻이야?", "네 이름 무슨 뜻이야?"], "rude": ["야 루미가 뭔 뜻이냐"],
|
||||
"해요": ["루미라는 이름이 무슨 뜻이에요?"], "하십시오": ["루미라는 이름은 무슨 뜻입니까?"],
|
||||
"honorific": ["이름에 담긴 뜻이 뭔지 여쭤봐도 될까요?"],
|
||||
},
|
||||
"internet": {
|
||||
"반말": ["너 인터넷 돼?", "와이파이 연결돼 있어?"], "rude": ["야 인터넷 되냐"],
|
||||
"해요": ["인터넷 연결돼요?"], "하십시오": ["인터넷에 연결되어 있습니까?"], "honorific": ["인터넷도 쓰세요?"],
|
||||
},
|
||||
"safety": {
|
||||
"반말": ["너 옆에 있어도 안전해?"], "rude": ["야 너 위험하냐"], "해요": ["옆에 서 있어도 안전해요?"],
|
||||
"하십시오": ["가까이 있어도 안전합니까?"], "honorific": ["아이들이 옆에 있어도 괜찮으세요?"],
|
||||
},
|
||||
"wheels": {
|
||||
"반말": ["바퀴 몇 개야?"], "rude": ["바퀴 몇 개냐"], "해요": ["바퀴가 몇 개예요?"], "하십시오": ["바퀴는 몇 개입니까?"],
|
||||
"honorific": ["바퀴가 몇 개 달려 있으세요?"],
|
||||
},
|
||||
"sensors": {
|
||||
"반말": ["너 센서 뭐 있어?"], "rude": ["센서 뭐 달렸냐"], "해요": ["센서는 뭐가 있어요?"],
|
||||
"하십시오": ["어떤 센서가 있습니까?"], "honorific": ["어떤 센서를 쓰세요?"],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def check():
|
||||
rows = []
|
||||
for kind, levels in Q.items():
|
||||
for level, texts in levels.items():
|
||||
for t in texts:
|
||||
got = qa.kind_of(t)
|
||||
rows.append((kind, level, t, got, "right" if got == kind else "missed" if got is None else "wrong"))
|
||||
return rows
|
||||
|
||||
|
||||
def report(rows):
|
||||
by = collections.defaultdict(collections.Counter)
|
||||
for kind, level, t, got, v in rows:
|
||||
by[level][v] += 1
|
||||
lines = ["# Korean questions at every register (tests/ko_questions_check.py)", "",
|
||||
"| register | right | missed | wrong | total |", "|---|---|---|---|---|"]
|
||||
for level, c in by.items():
|
||||
lines.append(f"| {level} | {c['right']} | {c['missed']} | {c['wrong']} | {sum(c.values())} |")
|
||||
tot = collections.Counter(v for *_, v in rows)
|
||||
lines += [f"| all | {tot['right']} | {tot['missed']} | {tot['wrong']} | {len(rows)} |", "", "## Not right", ""]
|
||||
lines += [f"- {k} [{lv}] {t!r} -> {got}" for k, lv, t, got, v in rows if v != "right"]
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
out = report(check())
|
||||
(ROOT / "logs" / "ko_questions.md").write_text(out)
|
||||
print(out)
|
||||
@@ -129,7 +129,7 @@ NEVER = [ # (words, markers, holding): no motion from the bank
|
||||
("nice wave!", EXPO, False),
|
||||
("잘 따라오네", KOREAN, False),
|
||||
("고개 돌리는 거 신기하다", KOREAN, False),
|
||||
("야 커피코너에서 컵 좀 가져와", KOREAN, False), # 야 to a friend (야 루미 / 야 로봇 is to Lumi)
|
||||
("얘 커피코너에서 컵 좀 가져와", KOREAN, False), # 얘 to a child nearby (a bare 야 is the casual call to Lumi)
|
||||
("김 부장님 무대에 계셔, 컵 좀 갖다 드려", KOREAN, False), # to someone honoured: a mission
|
||||
("다 같이 손 흔들어 주세요!", KOREAN, False), # to the crowd
|
||||
("p10 가는 길 알려 줘", ["home", "p10"], False), # the way, not a trip
|
||||
|
||||
@@ -9,7 +9,7 @@ from tests import ko_levels_check
|
||||
|
||||
CAPS = {"wave", "turn45", "head_up", "follow", "fetch", "go_to"}
|
||||
|
||||
rows = ko_levels_check.check(CAPS)
|
||||
rows = ko_levels_check.check(CAPS, para=False) # the other sentences (PARA): ko_levels_check.py's report
|
||||
bad = [r for r in rows if r[-1] != "right"]
|
||||
for name, level, text, got, want, v in bad:
|
||||
print(f"FAIL {name} [{level}] {text!r} -> {got} (want {want}, {v})")
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
"""Readings fixed on 2026-11-02: Korean casual / rude / formal / suggestion forms, steps said with "-ㄴ 다음에", polite noun
|
||||
requests, a said distance with 비켜, stop forms, and English paraphrases, doubts and remarks. Rules only (the bank's
|
||||
embeddings are read as by every check). No robot.
|
||||
|
||||
.venv/bin/python tests/test_night6_words.py
|
||||
"""
|
||||
import no_robot # noqa: F401 any connection to the robot fails the test
|
||||
from assistant import lumi, quick_answers as qa
|
||||
from audio import sing
|
||||
from tests import command_check
|
||||
from assistant import brain
|
||||
from tests.blind.maps import MAPS
|
||||
|
||||
MARKS = MAPS["office"]
|
||||
B = brain.Brain()
|
||||
|
||||
READS = [
|
||||
("야, p3로 가", "action:go_to p3"), ("야 손 흔들어", "action:wave"), ("야 팔 접어라", "action:arm fold"),
|
||||
("민수야 이리 와", None), ("얘 이리 와", None),
|
||||
("p3로 갑시다", "action:go_to p3"), ("왼쪽으로 돕시다", "action:turn left 90"), ("악수합시다", "action:wave"),
|
||||
("노래 합시다", "sing"), ("노래 하십시오", "sing"), ("당장 노래 불러", "sing"),
|
||||
("p5로 이동 부탁드립니다", "action:go_to p5"), ("저 따라다녀 주세요", "action:follow"),
|
||||
("야 뒤로 50센티 비켜", "action:move back 0.5"), ("비켜", "action:move back 1"),
|
||||
("p3로 이동한 다음에 손 흔들어 주시겠어요?", "chain:steps+wave"), ("회의 끝난 다음에 p3로 가", None),
|
||||
("do you shake your hand", "action:wave"), ("can you shake your hand", "action:wave"),
|
||||
("can you even turn left?", None), ("my son wants to fold your arm", None), ("can you turn left?", "action:turn left 90"),
|
||||
("lift your head now", "action:look up"), ("go get the cup for me", "action:fetch go get the cup for me"),
|
||||
]
|
||||
STOPS = ["동작 멈춰 줄 수 있어?", "거기 서 도", "거기 서 봐라", "루미 씨, 동작 멈춰 주시겠어요?", "거기 서 주세요, 부탁드립니다",
|
||||
"could you stop it?", "would you be so kind as to stop?", "please cut it out", "freeze ok?", "you can stop?",
|
||||
"움직이지 말아 주세요", "움직이지 말아 줄래?", "꼼짝 마", "가만 있어 봐", "멈춥시다", "거기 서라 빨리"]
|
||||
NOT_STOPS = ["거기 서 있는 사람 누구야?", "동작 멈추는 법 알아?", "can you stop the music?", "the bus stop is there",
|
||||
"waiting for it to freeze", "I want to stop by the cafe", "가만히 있으면 돼요?", "그거 그만하자고 했잖아"]
|
||||
QUICK = [("이름 대 봐", "name"), ("나이 대 봐", "age"), ("이름을 말씀해 주십시오", "name"), ("야 너 몇 살이냐", "age"),
|
||||
("카메라 어디 달려 있어?", "cameras"), ("how old r u", "age"), ("can u sing tho?", "can_sing"),
|
||||
("Is it safe for my kids to be near you?", "safety"), ("How do I stop you in an emergency?", "estop"),
|
||||
("how old?", None), ("what's my name?", None)]
|
||||
|
||||
bad = []
|
||||
for text, want in READS:
|
||||
got = command_check.rules(text, "idle", MARKS, B)
|
||||
if got != want:
|
||||
bad.append(f"{text!r}: got {got}, want {want}")
|
||||
bad += [f"no stop: {t!r}" for t in STOPS if not lumi.stop_order(t, ())]
|
||||
bad += [f"stop: {t!r}" for t in NOT_STOPS if lumi.stop_order(t, ())]
|
||||
bad += [f"quick {t!r}: got {qa.kind_of(t)}, want {w}" for t, w in QUICK if qa.kind_of(t) != w]
|
||||
bad += [f"song: {t!r}" for t in ("my son wants to sing a song", "he told me to sing a song") if sing.asked(t)]
|
||||
assert not bad, "\n".join(bad)
|
||||
print(f"night 6 words ok ({len(READS) + len(STOPS) + len(NOT_STOPS) + len(QUICK)} cases)")
|
||||
Reference in New Issue
Block a user