Lumi robot software on the Jetson Thor
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
""""What can you do?" / "뭐 할 수 있어?": a fixed short overview of what Lumi can do, the rest on "tell me more".
|
||||
|
||||
The language model left out half of it (2026-10-21: "I can chat, tell the time and weather, drive to places on my
|
||||
map, and pick up and bring cups"), so these words are answered here. Keep the lines in step with
|
||||
knowledge/lumi_about_en.md "What I can do now" and brain.SYSTEM "What you can do".
|
||||
|
||||
python assistant/abilities.py "what can you do?"
|
||||
"""
|
||||
import re
|
||||
import sys
|
||||
|
||||
ASKED = re.compile(r"\bwhat (?:else |all |things |kinds? of things )?(?:can|could) you do\b(?!\s+(?:with|about|if|when|to|for (?:it|that)))|"
|
||||
r"\bwhat (?:are|r) (?:all )?your (?:abilities|skills|capabilities|functions|features|talents)\b|"
|
||||
r"\bwhat are you (?:able to do|capable of|good at)\b|\bwhat do you do\b(?!\s+(?:with|when|if|for fun))|"
|
||||
r"\bwhat can you help (?:me |us )?with\b|\btell me (?:about )?(?:what you can do|your (?:abilities|skills))\b|"
|
||||
r"\b(?:list|show me) (?:your|what you can) (?:abilities|skills|do)\b|^\W*(?:your )?(?:abilities|skills)\W*$|"
|
||||
r"(?<![가-힣]로 )(?<![가-힣]으로 )(?:뭐|뭘|무엇|무엇을|뭐를)\s*(?:또\s*)?할\s*(?:수|줄)\s*(?:있|알)|"
|
||||
r"무슨\s*일을?\s*(?:해|하|할)|어떤\s*(?:일|것|거|걸)을?\s*(?:할\s*수|해|하)|할\s*수\s*있는\s*(?:게|것|거|일)|"
|
||||
r"뭐\s*하는\s*로봇|무슨\s*기능|어떤\s*기능|기능\S*\s*(?:뭐|뭔|있|알려)|(?:능력|기능)\S*\s*(?:뭐|뭔|알려|소개)", re.I)
|
||||
MORE = re.compile(r"^\W*(?:(?:yes|yeah|yep|sure|ok|okay|please|lumi|and)\W*)*(?:tell me more|more|go on|what else|and\?|"
|
||||
r"and what else|anything else|details?|yes|yeah|yep|sure|ok|okay|please)(?:\W+(?:please|lumi))*\W*$|"
|
||||
r"\bwhat else can you do\b|\btell me (?:more|everything|the rest)\b|"
|
||||
r"^\W*(?:네|예|응|어|그래요?|좋아요?|좋아)?\W*(?:더|자세히|전부|다)?\s*(?:알려|말해|얘기해|들려)\s*(?:줘|주세요|줄래요?|봐)?\W*$|"
|
||||
r"^\W*(?:네|예|응|그래요?|좋아요?|좋아|그리고요?|또요?|또\s*뭐\S*|그\s*외에는?\S*|더\s*있어요?|더요)\W*$|또\s*뭐\s*할\s*수", re.I)
|
||||
|
||||
SHORT_MARK = "ACTION: none abilities" # the history line of the short overview (lumi.fixed_answer)
|
||||
SHORT = {"en": "I can talk with you and answer your questions, also from the internet, and I can look at what's "
|
||||
"around me and understand it. I can pick things up and bring them to you, go to places, follow you, "
|
||||
"wave and even sing. Shall I tell you more?",
|
||||
"ko": "저는 대화하면서 궁금한 걸 답해 드리고, 인터넷에서 찾아볼 수도 있어요. 주변을 보고 무엇이 있는지 이해할 수 있고, "
|
||||
"물건을 집어서 가져다드리거나, 여러 곳에 가고, 따라가고, 손을 흔들고 노래도 불러요. 더 알려 드릴까요?"}
|
||||
LONG = {"en": "I talk with you in English and Korean, and when I don't know something I look it up on the internet. "
|
||||
"I can look at what's around me and understand it: objects, people, what you're wearing or holding. "
|
||||
"I can pick things up, bring them to you or take them somewhere else and put them down, or take "
|
||||
"something from your hand. I go to the places on my map, move or turn as far and as fast as you say, "
|
||||
"and follow you when you say \"follow me\". And I like to wave and sing songs, like Arirang, Happy "
|
||||
"Birthday or Fantastic Baby.",
|
||||
"ko": "영어와 한국어로 대화하고, 모르는 건 인터넷에서 찾아봐요. 주변을 보고 무엇이 있는지 이해할 수 있어요. 물건이나 "
|
||||
"사람, 입고 계신 옷이나 손에 든 것도요. 물건을 집어서 가져다드리거나 다른 곳에 옮겨 내려놓고, 손에 든 걸 받아 "
|
||||
"드릴 수도 있어요. 지도에 있는 장소로 가고, 말씀하시는 거리와 속도로 움직이거나 돌고, \"따라와\"라고 하시면 "
|
||||
"따라가요. 그리고 손을 흔들거나 아리랑, 생일 축하 노래, 판타스틱 베이비 같은 노래도 불러 드려요."}
|
||||
|
||||
|
||||
def asked(text):
|
||||
"""Do these words ask what Lumi can do? ("what can you do?", "what are your abilities", "넌 무슨 일을 해?")"""
|
||||
return bool(ASKED.search(text or ""))
|
||||
|
||||
|
||||
def more_asked(text, last=""):
|
||||
""""Tell me more", "what else?", "yes", "더 알려 줘" right after the short overview (`last` = the answer just before,
|
||||
from brain history), or "what else can you do?" at any time."""
|
||||
t = text or ""
|
||||
if re.search(r"\b(?:what else can you do)\b|또\s*뭐\s*할\s*수", t, re.I):
|
||||
return True
|
||||
return (last or "").startswith(SHORT_MARK) and bool(MORE.search(t))
|
||||
|
||||
|
||||
def answer(text, lang="en", last=""):
|
||||
"""("short" | "long", what to say) for an ability question or its follow-up, else None."""
|
||||
if more_asked(text, last):
|
||||
return "long", LONG[lang]
|
||||
if asked(text):
|
||||
return "short", SHORT[lang]
|
||||
return None
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(answer(" ".join(sys.argv[1:])))
|
||||
+1615
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,357 @@
|
||||
"""Example exchanges about Cutshion Company and its robots, in the format of assistant/talk_examples.py.
|
||||
|
||||
EXAMPLES = [(category, lang, said, reply)]; talk_examples.pick(said, lang, k, bank=...) picks the closest ones.
|
||||
Facts come only from knowledge/cutshion_en.md (taken from cutshion.com). The basic company question gets one short
|
||||
answer and an offer to say more; details only when asked; what the site does not say is "I don't have that
|
||||
information". When the visitor changes the topic, the reply answers the new topic and leaves the company alone.
|
||||
Korean replies are always polite (-요 / -습니다), whatever level the visitor speaks.
|
||||
|
||||
python assistant/company_examples.py # self-check
|
||||
python assistant/company_examples.py "what is cutshion"
|
||||
"""
|
||||
import re
|
||||
import sys
|
||||
|
||||
_BANK = {
|
||||
"company_basic": {
|
||||
"en": [
|
||||
("What is Cutshion?", "Cutshion is a Korean robot company, founded in 2022, that makes robot applications like barista, AI drawing and cooking robots. It's based in Seoul. What would you like to know more about?"),
|
||||
("Tell me about your company.", "Cutshion is a robot company from Seoul, founded in 2022. It makes robot apps such as barista, drawing, cooking and ice cream robots. Anything you'd like to hear more about?"),
|
||||
("What kind of company is Cutshion?", "It's a Korean robot company that builds robot applications, for example a barista robot and an AI drawing robot. It's based in Seoul. What would you like to know?"),
|
||||
("What does Cutshion do?", "Cutshion makes robots do real jobs: it builds robot apps like barista, cooking, drawing and welding robots, plus AI vision and a robot platform. Shall I tell you about one of them?"),
|
||||
("Who is Cutshion?", "Cutshion is the Seoul robot company that developed me. It makes robot applications such as barista and drawing robots. What would you like to know about it?"),
|
||||
("Can you tell me about Cutshion?", "Sure. Cutshion is a Korean robot company, started in 2022, making robots for cafes, kitchens, factories, events and schools. Which part interests you?"),
|
||||
("What's Cutshion?", "A Korean robot company that makes robot applications, like a barista robot and an AI drawing robot. Its head office is in Seoul. Want to hear more about something?"),
|
||||
("Introduce your company, please.", "Gladly. Cutshion, founded in 2022 in Seoul, makes robot applications such as barista, cooking, ice cream and drawing robots. What would you like to know more about?"),
|
||||
("Who made you?", "Cutshion Company developed me. Would you like to hear what else Cutshion makes?"),
|
||||
("Which company built you?", "I was developed by Cutshion, a robot company in Seoul. Anything you'd like to know about it?"),
|
||||
("What company is behind you?", "Cutshion is. It's a Korean company that makes robot applications. Would you like to know more?"),
|
||||
("What's the company you work for?", "I work for Cutshion, a robot company from Seoul that makes robot apps like barista and drawing robots. What else would you like to know?"),
|
||||
("Is Cutshion a big company?", "I don't have information about its size. I can tell you that it's a Korean robot company founded in 2022. What would you like to know about it?"),
|
||||
("What's Cutshion's main business?", "Robot applications: software and complete robot solutions, like the barista robot, cooking robot and AI drawing robot. Which one should I tell you about?"),
|
||||
("So what is this company about?", "Cutshion is about robot apps: robots that make coffee, cook, draw portraits, weld and more. Where should I start?"),
|
||||
("Give me a quick overview of Cutshion.", "Quick version: a Seoul robot company since 2022, making barista, drawing, cooking and other robot apps. You can reach it at cutshion@cutshion.com. What else would you like to know?"),
|
||||
("What is Cutshion's mission?", "To be the best robot application provider: not just selling robots, but creating robot apps and an ecosystem for them. Would you like an example?"),
|
||||
("What is Cutshion's slogan?", "Its slogan is \"Soft & Flexible Idea\". Anything else about Cutshion?"),
|
||||
("Is Cutshion a Korean company?", "Yes, Cutshion is a Korean robot company with its head office in Seoul. Would you like to know more?"),
|
||||
("When was Cutshion founded?", "Cutshion was founded as a company in July 2022."),
|
||||
("Who is the CEO of Cutshion?", "The CEO is Lee Min-seok."),
|
||||
("Who founded Cutshion?", "Cutshion was founded by its CEO, Lee Min-seok, in 2022. It's his third company."),
|
||||
("Is Cutshion a startup?", "Yes, it's a young company, founded in 2022, and certified as a venture business in 2023."),
|
||||
("Cutshion, what's that?", "That's the company that developed me: a Korean robot company making robot apps, like a coffee-making barista robot. What would you like to know?"),
|
||||
("Explain Cutshion in one sentence.", "Cutshion is a Seoul robot company that makes robots useful through robot applications, from coffee to welding."),
|
||||
("I've never heard of Cutshion.", "It's a young Korean robot company, founded in 2022, making barista, drawing and cooking robots, among others. Shall I tell you more?"),
|
||||
("What's your company's name?", "My company is Cutshion. Would you like to hear what it does?"),
|
||||
("Tell me about Cutshion Company.", "Cutshion is a Korean robot application company, founded in 2022 and based in Seoul. You can contact it at 070-8959-2960. What else would you like to know?"),
|
||||
],
|
||||
"ko": [
|
||||
("쿳션은 뭐 하는 회사야?", "쿳션은 2022년에 설립된 한국 로봇 회사로, 바리스타 로봇이나 AI 드로잉 로봇 같은 로봇 애플리케이션을 만들어요. 본사는 서울에 있어요. 더 궁금하신 점이 있으세요?"),
|
||||
("쿳션은 무슨 회사예요?", "쿳션은 서울에 있는 로봇 회사예요. 바리스타, 드로잉, 조리, 아이스크림 로봇 같은 로봇 앱을 만들어요. 더 궁금하신 점이 있으세요?"),
|
||||
("쿳션은 어떤 회사입니까?", "쿳션은 2022년에 설립된 로봇 애플리케이션 회사입니다. 바리스타 로봇, AI 드로잉 로봇 등을 만들고 본사는 서울에 있습니다. 더 알고 싶으신 게 있으세요?"),
|
||||
("회사 소개 좀 해줘.", "네, 쿳션은 로봇이 카페, 주방, 공장, 행사장에서 일할 수 있게 로봇 앱을 만드는 한국 회사예요. 어떤 부분이 궁금하세요?"),
|
||||
("회사 소개해 주세요.", "쿳션은 2022년 서울에서 시작한 로봇 회사예요. 바리스타 로봇, 조리 로봇, 드로잉 로봇 같은 로봇 앱을 만들어요. 더 궁금하신 점이 있으세요?"),
|
||||
("회사에 대해 설명해 주십시오.", "쿳션은 로봇 애플리케이션을 만드는 한국 로봇 회사입니다. 연락은 070-8959-2960이나 cutshion@cutshion.com으로 하실 수 있습니다. 어떤 점이 더 궁금하세요?"),
|
||||
("너 누가 만들었어?", "저는 쿳션에서 개발했어요. 쿳션이 만드는 다른 로봇도 소개해 드릴까요?"),
|
||||
("어느 회사에서 만들었어요?", "쿳션이라는 서울의 로봇 회사에서 만들었어요. 회사에 대해 더 궁금하신 점이 있으세요?"),
|
||||
("누가 만들었습니까?", "쿳션에서 개발했습니다. 쿳션에 대해 더 알려 드릴까요?"),
|
||||
("쿳션이 뭐야?", "쿳션은 바리스타 로봇, AI 드로잉 로봇 같은 로봇 앱을 만드는 한국 로봇 회사예요. 더 궁금하신 게 있으세요?"),
|
||||
("쿳션이 뭐예요?", "서울에 본사가 있는 로봇 회사예요. 2022년에 설립됐고 여러 로봇 애플리케이션을 만들어요. 어떤 게 더 궁금하세요?"),
|
||||
("이 회사는 뭘 해요?", "로봇이 커피를 만들고, 요리하고, 그림을 그리고, 용접도 하도록 로봇 앱을 만들어요. 하나 골라서 설명해 드릴까요?"),
|
||||
("쿳션 주력 사업이 뭐야?", "로봇 애플리케이션이에요. 바리스타 로봇, 조리 로봇, AI 드로잉 로봇 같은 거예요. 어떤 걸 소개해 드릴까요?"),
|
||||
("쿳션 슬로건이 뭐예요?", "슬로건은 'Soft & Flexible Idea'예요. 더 궁금하신 점이 있으세요?"),
|
||||
("쿳션은 한국 회사예요?", "네, 쿳션은 서울에 본사가 있는 한국 로봇 회사예요."),
|
||||
("쿳션은 언제 설립됐어요?", "쿳션은 2022년 7월에 법인을 설립했어요."),
|
||||
("회사 언제 생겼어?", "2022년 7월에 설립됐어요."),
|
||||
("대표님이 누구예요?", "쿳션 대표이사는 이민석 대표님이에요."),
|
||||
("창업자가 누구야?", "이민석 대표님이 2022년에 세운 회사예요. 대표님의 세 번째 창업이라고 해요."),
|
||||
("쿳션 대표이사는 누구입니까?", "이민석 대표님입니다."),
|
||||
("쿳션? 그게 뭔데?", "저를 만든 회사예요. 바리스타 로봇 같은 로봇 앱을 만드는 한국 로봇 회사예요. 더 궁금하신 점이 있으세요?"),
|
||||
("쿳션 처음 들어 봐요.", "2022년에 설립된 젊은 한국 로봇 회사예요. 바리스타, 드로잉, 조리 로봇 등을 만들어요. 더 알려 드릴까요?"),
|
||||
("회사 이름이 뭐예요?", "제 회사는 쿳션이에요. 어떤 일을 하는지 알려 드릴까요?"),
|
||||
("쿳션 컴퍼니에 대해 알려 주십시오.", "쿳션은 서울에 있는 로봇 애플리케이션 회사로 2022년에 설립됐습니다. 070-8959-2960으로 연락하실 수 있습니다. 더 궁금하신 점이 있으세요?"),
|
||||
],
|
||||
},
|
||||
"products": {
|
||||
"en": [
|
||||
("What robots does Cutshion make?", "Barista, AI drawing, cooking, ice cream, candy ball, welding, palletizing and educational robots. Which one would you like to hear about?"),
|
||||
("What products do you have?", "Robot apps like the barista robot and AI drawing robot, plus AI vision, a robot platform and robot hardware. Shall I explain one?"),
|
||||
("Tell me about the barista robot.", "It runs a real espresso machine and does the barista's main steps itself: grinding, dosing, tamping and extracting. The coffee tastes the same every time."),
|
||||
("What does the barista robot do?", "It makes espresso fully automatically, from grinding the beans to extraction, and works alongside human baristas."),
|
||||
("Can your company's robot make coffee?", "Yes, Cutshion's barista robot makes espresso coffee on a real espresso machine."),
|
||||
("Who uses the barista robot?", "Cutshion signed a yearly supply agreement with Mega Coffee, and a contract for 200 barista robots in the USA was reported in 2026."),
|
||||
("Does the barista robot replace baristas?", "It takes over the repeated steps and works together with human baristas, so they have less heavy routine work."),
|
||||
("Tell me about the drawing robot.", "The AI drawing robot takes your photo, AI turns it into a line drawing, and the robot arm draws it on a canvas."),
|
||||
("How does the AI drawing robot work?", "You press one button, the camera takes your photo, AI makes a line drawing from it, and the arm draws it on canvas."),
|
||||
("Can the robot draw my portrait?", "Cutshion's AI drawing robot can: it photographs you and draws your picture as a line drawing."),
|
||||
("Where is the drawing robot used?", "It's popular at events and in education, and brands can print their logo on the backdrop, arm and canvas."),
|
||||
("Tell me about the cooking robot.", "It's an AI cooking robot for personalised cooking, with Cutshion's own vision and the GOMCOOK platform. It keeps taste and quality the same."),
|
||||
("Does Cutshion have a chicken robot?", "Yes, Cutshion supplied a chicken-and-beer cooking robot to a restaurant in Itaewon, Seoul."),
|
||||
("Tell me about the ice cream robot.", "You order on a touch-screen kiosk, and the robot makes soft ice cream and hands it to you, in about 30 seconds."),
|
||||
("How many cones does the ice cream robot hold?", "It holds 40 cones."),
|
||||
("What is the candy ball robot?", "A fun event robot: you pick a colour on the touch screen and the robot grabs a candy ball of that colour for you, in about 20 seconds."),
|
||||
("Tell me about the welding robot.", "It's a lightweight collaborative welding robot that does multi-pass arc welding and follows the seam automatically. The mobile version won the RoboWorld Award 2024."),
|
||||
("What does the palletizing robot do?", "It stacks finished products on pallets automatically, around the clock. Made with Screen, it's Korea's first palletizing robot for book publishing."),
|
||||
("What is the educational robot?", "It's a robot training kit in one portable case: a small cobot arm, practice modules, digital twin software and course materials."),
|
||||
("Do you have robots for schools?", "Yes, Cutshion's educational robot kit is made for schools, universities and labs, and drawing robots have gone to education offices too."),
|
||||
("What is Pionoid?", "Pionoid is Cutshion's robot development platform: one unified API to control robots from any maker, with an app-store way to share robot apps."),
|
||||
("What is GOMCOOK?", "GOMCOOK is Cutshion's cooking robot platform. It links to ordering and delivery apps, from order and payment to cooking and delivery."),
|
||||
("What is CUVision?", "CUVision is Cutshion's AI vision technology: it helps robots understand camera images, for example to check surfaces in factories."),
|
||||
("Does Cutshion sell robot arms?", "Yes, Cutshion sells collaborative robots from a partner maker, as well as TUSK logistics robots and PEITIAN industrial robots."),
|
||||
("What is TUSK?", "TUSK robots are logistics robots Cutshion sells: they move pallets on their own and lift up to 1,000 kg."),
|
||||
("Tell me about PEITIAN.", "PEITIAN industrial robots, sold by Cutshion, carry from 3 to 280 kg."),
|
||||
("Does Cutshion do design work?", "Yes, Cutshion offers SOLIDWORKS 3D design software and designs robot systems itself."),
|
||||
],
|
||||
"ko": [
|
||||
("쿳션은 어떤 로봇을 만들어요?", "바리스타, AI 드로잉, 조리, 아이스크림, 캔디볼, 용접, 팔레타이징, 교육용 로봇을 만들어요. 어떤 로봇이 궁금하세요?"),
|
||||
("무슨 로봇 만들어?", "바리스타 로봇, AI 드로잉 로봇, 조리 로봇 같은 여러 로봇 앱을 만들어요. 하나 소개해 드릴까요?"),
|
||||
("어떤 제품이 있습니까?", "로봇 앱과 AI 비전 큐비전, 로봇 개발 플랫폼 피오노이드, 그리고 로봇 하드웨어가 있습니다. 어느 것을 설명해 드릴까요?"),
|
||||
("바리스타 로봇은 뭐예요?", "에스프레소 머신을 직접 다뤄서 원두 분쇄, 도징, 탬핑, 추출까지 자동으로 하는 로봇이에요. 언제나 같은 맛을 내요."),
|
||||
("바리스타 로봇이 뭐야?", "커피를 내리는 로봇이에요. 바리스타의 반복 작업을 맡아서 사람 바리스타와 함께 일해요."),
|
||||
("바리스타 로봇에 대해 설명해 주십시오.", "바리스타 로봇은 에스프레소 추출 전 과정을 자동으로 하는 올인원 스테이션입니다. 인건비 부담을 줄이고 맛을 일정하게 유지합니다."),
|
||||
("로봇이 커피도 만들어요?", "네, 쿳션의 바리스타 로봇이 진짜 에스프레소 머신으로 커피를 만들어요."),
|
||||
("바리스타 로봇은 어디에서 써요?", "메가커피와 연간 공급 계약을 맺었고, 2026년에는 미국에 200대를 공급하는 계약 소식도 있었어요."),
|
||||
("드로잉 로봇 알려줘.", "AI 드로잉 로봇은 사진을 찍으면 AI가 라인 드로잉으로 바꾸고, 로봇 팔이 캔버스에 그려 줘요."),
|
||||
("AI 드로잉 로봇은 어떻게 작동해요?", "버튼 하나로 사진을 찍으면 AI가 그림으로 바꾸고 로봇 팔이 그대로 그려요."),
|
||||
("로봇이 제 얼굴을 그려 줄 수 있습니까?", "네, 쿳션의 AI 드로잉 로봇이 사진을 찍어서 얼굴을 그림으로 그려 줍니다."),
|
||||
("드로잉 로봇은 어디서 써?", "행사나 교육 현장에서 인기가 많아요. 배경이나 캔버스에 브랜드를 인쇄해서 홍보에도 써요."),
|
||||
("조리 로봇은 뭐예요?", "개인 맞춤 조리를 지원하는 AI 조리 로봇이에요. 곰쿡 플랫폼과 함께 쓰고 맛과 품질을 일정하게 지켜요."),
|
||||
("치킨 로봇도 있어?", "네, 이태원 매장에 치맥 조리 로봇을 공급한 적이 있어요."),
|
||||
("아이스크림 로봇 설명해 줘.", "키오스크로 주문하면 로봇이 아이스크림을 만들어서 직접 건네줘요. 한 개에 약 30초 걸려요."),
|
||||
("아이스크림 로봇은 콘을 몇 개 넣을 수 있어요?", "콘을 40개 넣을 수 있어요."),
|
||||
("캔디볼 로봇은 뭐예요?", "터치스크린에서 색을 고르면 로봇이 그 색의 캔디볼을 뽑아서 건네주는 체험형 로봇이에요."),
|
||||
("용접 로봇도 있어요?", "네, 가벼운 협동 용접 로봇이 있어요. 용접선을 자동으로 따라가고 여러 용접기와 호환돼요."),
|
||||
("팔레타이징 로봇은 무엇입니까?", "완성품을 팔레트에 자동으로 쌓는 로봇입니다. 스크린사와 함께 만든 국내 최초 출판 전용 팔레타이징 로봇입니다."),
|
||||
("교육용 로봇 있어?", "네, 협동로봇과 실습 모듈, 디지털 트윈, 교육 자료를 휴대용 케이스에 담은 교육용 키트가 있어요."),
|
||||
("학교에서 쓸 수 있는 로봇이 있어요?", "교육용 로봇 키트가 학교, 대학, 연구소용으로 나와 있어요."),
|
||||
("피오노이드가 뭐예요?", "제조사와 상관없이 하나의 통합 로봇 API로 로봇 앱을 만들 수 있는 쿳션의 로봇 개발 플랫폼이에요."),
|
||||
("곰쿡이 뭐야?", "곰쿡은 배달·주문 앱과 연동되는 쿳션의 조리 로봇 플랫폼이에요."),
|
||||
("큐비전은 뭐예요?", "큐비전은 카메라 영상을 AI로 이해하는 쿳션의 AI 비전 기술이에요."),
|
||||
("물류 로봇도 팔아요?", "네, 팔레트를 스스로 옮기는 TUSK 물류로봇을 판매해요. 최대 1,000kg까지 들어요."),
|
||||
("산업용 로봇도 있습니까?", "네, 3kg부터 280kg까지 다루는 PEITIAN 산업용 로봇을 판매합니다."),
|
||||
],
|
||||
},
|
||||
"location": {
|
||||
"en": [
|
||||
("Where is Cutshion?", "Cutshion's head office is in Seoul, in the Mullae SK V1 Center in Yeongdeungpo-gu."),
|
||||
("Where is your company located?", "In Seoul, Korea: room 709 of the Mullae SK V1 Center, 10 Seonyu-ro 9-gil, Yeongdeungpo-gu."),
|
||||
("What's the address of Cutshion?", "Room 709, Mullae SK V1 Center, 10 Seonyu-ro 9-gil, Yeongdeungpo-gu, Seoul."),
|
||||
("Does Cutshion have an office in America?", "Yes, Cutshion has a US company in McLean, Virginia."),
|
||||
("Do you have a branch in Daegu?", "Yes, Cutshion has a Daegu branch in the Smart Eco Tower in Suseong-gu."),
|
||||
("Where is the Cutshion factory?", "The Cutshion Mullae Factory is in the same Mullae SK V1 Center building in Seoul, room B135."),
|
||||
("Where is the research lab?", "Cutshion's research lab is in Magok, Gangseo-gu, Seoul."),
|
||||
("Does Cutshion have an office in Gangnam?", "Yes, there's a Gangnam office at Venturium, 435 Bongeunsa-ro."),
|
||||
("Does Cutshion have an office in Japan?", "I don't have information about an office in Japan. Cutshion's places I know are in Seoul, Daegu and McLean in the US."),
|
||||
("Can I visit the office?", "I don't have information about visits. Please contact Cutshion at 070-8959-2960 to ask."),
|
||||
],
|
||||
"ko": [
|
||||
("회사 어디 있어?", "쿳션 본사는 서울 영등포구 문래 SK V1 Center에 있어요."),
|
||||
("회사 어디 있어요?", "서울시 영등포구 선유로 9길 10, 문래 SK V1 Center 709호에 있어요."),
|
||||
("본사는 어디에 있습니까?", "본사는 서울시 영등포구 선유로 9길 10, 문래 SK V1 Center 709호에 있습니다."),
|
||||
("쿳션 주소 알려줘.", "서울시 영등포구 선유로 9길 10, 문래 SK V1 Center 709호예요."),
|
||||
("쿳션 공장은 어디예요?", "쿳션 문래 팩토리는 같은 문래 SK V1 Center 건물 B135호에 있어요."),
|
||||
("대구에도 지사가 있어요?", "네, 대구 수성구 스마트에코타워에 대구지사가 있어요."),
|
||||
("미국에도 회사가 있어?", "네, 미국 버지니아주 맥린에 미국법인이 있어요."),
|
||||
("연구소는 어디 있습니까?", "연구소는 서울 강서구 마곡에 있습니다."),
|
||||
("일본에도 사무실이 있어요?", "일본 사무실에 대한 정보는 없어요. 제가 아는 곳은 서울, 대구, 미국 맥린이에요."),
|
||||
],
|
||||
},
|
||||
"contact": {
|
||||
"en": [
|
||||
("How can I contact Cutshion?", "You can call 070-8959-2960, email cutshion@cutshion.com, or use the contact form on cutshion.com."),
|
||||
("What's Cutshion's phone number?", "It's 070-8959-2960."),
|
||||
("What's the email of your company?", "cutshion@cutshion.com."),
|
||||
("What's Cutshion's website?", "It's cutshion.com."),
|
||||
("I want to buy a robot. Who do I talk to?", "Please contact Cutshion at 070-8959-2960 or cutshion@cutshion.com, or ask a staff member here."),
|
||||
("Can I buy a barista robot?", "For buying, please contact Cutshion through cutshion.com or at 070-8959-2960. They'll help you with the details."),
|
||||
("I'd like to become a dealer.", "Cutshion's website has a contact form for dealer questions at cutshion.com, or you can email cutshion@cutshion.com."),
|
||||
("Does Cutshion have a YouTube channel?", "Yes, Cutshion has a YouTube channel and a blog, linked from cutshion.com."),
|
||||
],
|
||||
"ko": [
|
||||
("쿳션 연락처 알려줘.", "전화 070-8959-2960, 이메일 cutshion@cutshion.com으로 연락하시면 돼요."),
|
||||
("전화번호가 뭐예요?", "070-8959-2960이에요."),
|
||||
("이메일 주소가 어떻게 됩니까?", "cutshion@cutshion.com입니다."),
|
||||
("홈페이지 주소 알려 주세요.", "홈페이지는 cutshion.com이에요."),
|
||||
("로봇을 사고 싶은데 어떻게 해요?", "070-8959-2960이나 cutshion@cutshion.com으로 문의하시거나, 여기 직원에게 물어보세요."),
|
||||
("바리스타 로봇 살 수 있어?", "구매는 쿳션에 직접 문의해 주세요. 홈페이지 cutshion.com의 문의하기를 쓰시면 돼요."),
|
||||
("대리점 하고 싶습니다.", "홈페이지 cutshion.com의 문의하기에서 대리점 문의를 하실 수 있습니다."),
|
||||
],
|
||||
},
|
||||
"achievements": {
|
||||
"en": [
|
||||
("What awards has Cutshion won?", "The RoboWorld Award in 2023 and 2024, and the VivaTech Tech for Change Award in Paris in 2026."),
|
||||
("Did Cutshion go to CES?", "Yes, Cutshion exhibited at CES in Las Vegas in 2025 and 2026."),
|
||||
("Who are Cutshion's partners?", "Its partners include OMRON, Zimmer Group Korea, Screen HD Korea and Daesung Industrial, among others."),
|
||||
("Has Cutshion received investment?", "Yes, a seed investment of 500 million won in 2025, and it was selected for the TIPS Global Track."),
|
||||
("What exhibitions has Cutshion been to?", "RoboWorld, IFA Berlin, CES in Las Vegas, the NRA Show in Chicago and VivaTech in Paris, among others."),
|
||||
],
|
||||
"ko": [
|
||||
("상 받은 거 있어요?", "로보월드 어워드를 2023년과 2024년에 받았고, 2026년 비바테크에서 Tech for Change Award를 받았어요."),
|
||||
("CES에 나갔어?", "네, 2025년과 2026년 CES에 참가했어요."),
|
||||
("파트너 회사는 어디예요?", "오므론, 짐머그룹코리아, 스크린에이치디코리아, 대성산업 등이 있어요."),
|
||||
("투자 받았습니까?", "네, 2025년에 5억 원 규모 시드 투자를 받았고 TIPS 글로벌트랙에도 선정됐습니다."),
|
||||
],
|
||||
},
|
||||
"services": {
|
||||
"en": [
|
||||
("What services does Cutshion offer?", "Cutshion develops robot apps and smart factory solutions, sells robot hardware and SOLIDWORKS design software, and designs robot systems. Which would you like to know about?"),
|
||||
("Does Cutshion do smart factories?", "Yes, Cutshion builds smart factory solutions with AI vision, collaborative robots and mobile robots."),
|
||||
("Can Cutshion automate my factory?", "Cutshion makes factory automation with AI vision, cobots and mobile robots. For your case, please contact them at 070-8959-2960."),
|
||||
("Does Cutshion make software?", "Yes, robot software is its core: robot apps, the Pionoid robot platform and CUVision AI vision."),
|
||||
("Does Cutshion work with restaurants?", "Yes, its cooking robot and the GOMCOOK platform are made for restaurants, and the barista robot for cafes."),
|
||||
("Can Cutshion's robots work at events?", "Yes, the AI drawing robot, ice cream robot and candy ball robot are popular at events."),
|
||||
("Does Cutshion sell SOLIDWORKS?", "Yes, Cutshion offers SOLIDWORKS design software and helps customers pick the right products."),
|
||||
("Can robots from different makers use the same app?", "That's the idea of Cutshion's Pionoid platform: one unified API, so one app can run on robots from different makers."),
|
||||
("Does Cutshion do custom robots?", "The palletizing robot, for example, can be adapted to each factory. For your own project, please contact Cutshion at cutshion@cutshion.com."),
|
||||
("What industries does Cutshion work in?", "Cafes and restaurants, factories and logistics, events, and education."),
|
||||
],
|
||||
"ko": [
|
||||
("쿳션은 어떤 서비스를 해요?", "로봇 앱과 스마트 팩토리 솔루션을 개발하고, 로봇 하드웨어와 솔리드웍스 설계 소프트웨어도 공급해요. 어떤 게 궁금하세요?"),
|
||||
("스마트 팩토리도 해?", "네, AI 비전과 협동로봇, AMR로 스마트 팩토리 솔루션을 만들어요."),
|
||||
("우리 공장도 자동화할 수 있습니까?", "쿳션이 공장 자동화 솔루션을 만들고 있습니다. 자세한 건 070-8959-2960으로 문의해 주세요."),
|
||||
("소프트웨어도 만들어요?", "네, 로봇 앱, 피오노이드 플랫폼, 큐비전 AI 비전 같은 소프트웨어가 핵심이에요."),
|
||||
("식당에서 쓸 로봇도 있어?", "네, 조리 로봇과 곰쿡 플랫폼은 식당용이고, 바리스타 로봇은 카페용이에요."),
|
||||
("행사에 쓸 만한 로봇 있어요?", "AI 드로잉 로봇, 아이스크림 로봇, 캔디볼 로봇이 행사에서 인기가 많아요."),
|
||||
("솔리드웍스도 팝니까?", "네, 솔리드웍스 설계 소프트웨어를 공급하고 알맞은 제품 구성도 함께 검토해 드립니다."),
|
||||
("어떤 분야에서 일해요?", "카페와 식당, 공장과 물류, 행사, 교육 분야에서 일해요."),
|
||||
],
|
||||
},
|
||||
"follow_up": {
|
||||
"en": [
|
||||
("And what else?", "Cutshion also makes cooking, ice cream, candy ball, welding and educational robots. Which one sounds interesting?"),
|
||||
("What else does Cutshion make?", "Besides the barista and drawing robots, there's a cooking robot, an ice cream robot, a candy ball robot, a welding robot and more. Shall I describe one?"),
|
||||
("Tell me more.", "Happy to. Which part would you like more on: the robots, where Cutshion is, or how to contact it?"),
|
||||
("Tell me more about the barista robot.", "It works with a real espresso machine, grinding, dosing, tamping and extracting by itself, and a yearly supply deal was signed with Mega Coffee."),
|
||||
("How does the barista robot work?", "It controls a real espresso machine: it grinds the beans, doses, tamps and extracts the espresso by itself."),
|
||||
("Tell me more about the drawing robot.", "It takes your photo with a camera, AI turns it into a line drawing, and the arm draws it on canvas. It comes as an all-in-one or a kiosk type."),
|
||||
("Anything else?", "Cutshion also has its own AI vision, CUVision, and a robot platform called Pionoid. Want to hear about those?"),
|
||||
("Interesting, go on.", "Cutshion's goal is to be a robot platform company, so the same robot app can run on robots from different makers."),
|
||||
("How does the ice cream robot work?", "You order on the kiosk, the robot makes the soft ice cream and hands it to you, in about 30 seconds."),
|
||||
("Which robot is the most popular?", "I don't have that information. I can tell you about each robot, though. Which one?"),
|
||||
],
|
||||
"ko": [
|
||||
("또 뭐 있어?", "조리 로봇, 아이스크림 로봇, 캔디볼 로봇, 용접 로봇, 교육용 로봇도 있어요. 어떤 게 궁금하세요?"),
|
||||
("그리고요?", "AI 비전 기술 큐비전과 로봇 개발 플랫폼 피오노이드도 있어요. 소개해 드릴까요?"),
|
||||
("더 자세히 알려줘.", "네, 로봇, 회사 위치, 연락처 중에 어떤 걸 더 알려 드릴까요?"),
|
||||
("바리스타 로봇 더 자세히 알려 주세요.", "진짜 에스프레소 머신으로 원두 분쇄, 도징, 탬핑, 추출을 스스로 해요. 메가커피와 연간 공급 계약도 맺었어요."),
|
||||
("바리스타 로봇은 어떻게 작동해요?", "에스프레소 머신을 직접 다뤄서 원두 분쇄, 도징, 탬핑, 추출을 차례로 스스로 해요."),
|
||||
("다른 로봇도 있습니까?", "네, 바리스타와 드로잉 로봇 말고도 조리, 아이스크림, 캔디볼, 용접, 팔레타이징 로봇이 있습니다."),
|
||||
("제일 인기 있는 로봇은 뭐야?", "그 정보는 없어요. 대신 로봇 하나씩 소개해 드릴 수 있어요."),
|
||||
("드로잉 로봇은 어떻게 그려요?", "카메라로 사진을 찍으면 AI가 라인 드로잉으로 바꾸고, 로봇 팔이 캔버스에 그려요."),
|
||||
],
|
||||
},
|
||||
"unknown": {
|
||||
"en": [
|
||||
("How much does the barista robot cost?", "I don't have price information. Please ask a staff member or contact Cutshion at 070-8959-2960."),
|
||||
("What's the price of the drawing robot?", "Sorry, I don't know the price. Cutshion can tell you at cutshion@cutshion.com."),
|
||||
("How much is the ice cream robot?", "I don't have that information. A staff member or Cutshion's contact form can help with prices."),
|
||||
("How much do you cost?", "I don't know my own price, I'm afraid. Please ask a staff member."),
|
||||
("Can I rent a robot? How much per month?", "I don't have information about rental or prices. Please contact Cutshion to ask."),
|
||||
("Do you give a discount?", "I don't have information about discounts. Cutshion's team can answer that."),
|
||||
("How many people work at Cutshion?", "I don't have that information, sorry."),
|
||||
("How many employees does your company have?", "I'm not sure, the number of employees isn't something I know."),
|
||||
("What is Cutshion's revenue?", "I don't have information about Cutshion's revenue."),
|
||||
("Is Cutshion profitable?", "That's not something I have information about, sorry."),
|
||||
("Is Cutshion listed on the stock market?", "I'm not sure about that, I don't have the information."),
|
||||
("How much is Cutshion worth?", "I don't know the company's value, I'm afraid."),
|
||||
("Is Cutshion hiring?", "I don't have information about jobs. You could email cutshion@cutshion.com to ask."),
|
||||
("How can I get a job at Cutshion?", "I don't know about job openings. Contacting cutshion@cutshion.com would be the way to ask."),
|
||||
("What are Cutshion's office hours?", "I don't have information about office hours."),
|
||||
("How long does delivery take?", "I don't know delivery times. Cutshion can tell you if you contact them."),
|
||||
("What warranty do your robots have?", "I don't have information about the warranty. Please ask Cutshion directly."),
|
||||
("How many robots has Cutshion sold?", "I don't have the total number, sorry."),
|
||||
("How old is the CEO?", "I don't know the CEO's age."),
|
||||
("How many customers does Cutshion have?", "I'm not sure. I only know a few projects, like the supply agreement with Mega Coffee."),
|
||||
("What's the cheapest robot Cutshion sells?", "I don't have price information, so I can't compare. Cutshion's team can help at 070-8959-2960."),
|
||||
("Does Cutshion ship to Europe?", "I don't have information about shipping to Europe. Please ask Cutshion directly."),
|
||||
("Who are Cutshion's competitors?", "I don't have that information."),
|
||||
("How much did the US contract cost?", "I'm not sure about contract details. I only know that 200 barista robots are to be supplied over three years."),
|
||||
("Is there a Cutshion shop I can visit?", "I don't have information about a shop. Cutshion's contact is 070-8959-2960 if you'd like to ask."),
|
||||
("What does Cutshion plan next year?", "I don't have information about Cutshion's plans."),
|
||||
],
|
||||
"ko": [
|
||||
("바리스타 로봇 얼마예요?", "가격 정보는 없어요. 직원에게 물어보시거나 070-8959-2960으로 문의해 주세요."),
|
||||
("바리스타 로봇 가격이 얼마야?", "죄송하지만 가격은 몰라요. cutshion@cutshion.com으로 문의하시면 돼요."),
|
||||
("드로잉 로봇은 가격이 얼마입니까?", "가격은 제가 알지 못합니다. 쿳션에 문의해 주세요."),
|
||||
("너는 얼마야?", "제 가격은 저도 몰라요. 직원에게 물어봐 주세요."),
|
||||
("로봇 렌탈도 돼요?", "렌탈에 대한 정보는 없어요. 쿳션에 직접 문의해 주세요."),
|
||||
("직원은 몇 명이에요?", "그 정보는 없어요."),
|
||||
("회사 직원 몇 명이야?", "직원 수는 제가 알지 못해요."),
|
||||
("쿳션에는 몇 명이 일합니까?", "죄송하지만 그 정보는 가지고 있지 않습니다."),
|
||||
("매출이 얼마예요?", "매출 정보는 없어요."),
|
||||
("쿳션은 상장했어?", "그건 잘 모르겠어요. 정보가 없어요."),
|
||||
("채용하고 있어요?", "채용 정보는 없어요. cutshion@cutshion.com으로 문의해 보세요."),
|
||||
("쿳션에 취업하려면 어떻게 해야 합니까?", "채용에 대해서는 알지 못합니다. 이메일로 쿳션에 문의해 주세요."),
|
||||
("회사 영업시간이 어떻게 돼요?", "영업시간 정보는 없어요."),
|
||||
("로봇 배송은 얼마나 걸려?", "배송 기간은 몰라요. 쿳션에 문의하시면 알려 줄 거예요."),
|
||||
("보증 기간은 얼마나 됩니까?", "보증 조건은 알지 못합니다. 쿳션에 직접 문의해 주세요."),
|
||||
("지금까지 로봇 몇 대 팔았어요?", "전체 판매 대수는 몰라요."),
|
||||
("대표님 나이가 어떻게 돼요?", "대표님 나이는 제가 몰라요."),
|
||||
("할인돼요?", "할인 정보는 없어요. 직원에게 물어봐 주세요."),
|
||||
],
|
||||
},
|
||||
"topic_switch": {
|
||||
"en": [
|
||||
("Thanks. By the way, how old are you?", "I'm two years old."),
|
||||
("Okay. What's your name again?", "I'm Lumi."),
|
||||
("Got it. Can you speak Korean?", "Yes, I speak English and Korean."),
|
||||
("Cool. Can you sing?", "I can sing a short song. Want to hear it?"),
|
||||
("Alright. What's two plus two?", "Four."),
|
||||
("Never mind the company. Are you a robot?", "Yes, I'm a robot, a mobile robot assistant."),
|
||||
("Okay, different question: can you pick up a cup?", "Yes, I can pick up cups, bottles and some fruit with my arm."),
|
||||
("Thanks. Where is the restroom?", "I'm not sure where the restroom is here. A staff member can show you."),
|
||||
("Enough about robots. Do you like music?", "I do enjoy a good tune, and I can even sing a little."),
|
||||
("Fine. What's the capital of France?", "Paris."),
|
||||
("Anyway, how tall are you?", "I'm 146 cm tall, and I can stretch up to 186 cm."),
|
||||
("Let's talk about something else. Tell me a joke.", "Why did the robot go on holiday? It needed to recharge."),
|
||||
("Okay. Can you wave at me?", "Sure, here's a wave for you!"),
|
||||
("Good to know. How fast can you drive?", "I usually drive at 0.6 metres per second, at most 1.2."),
|
||||
],
|
||||
"ko": [
|
||||
("고마워. 그런데 너 몇 살이야?", "저는 두 살이에요."),
|
||||
("알겠어요. 이름이 뭐였죠?", "저는 루미예요."),
|
||||
("좋아. 영어도 할 수 있어?", "네, 영어와 한국어를 할 수 있어요."),
|
||||
("그래요. 노래할 수 있어요?", "짧은 노래를 부를 수 있어요. 들어 보실래요?"),
|
||||
("알겠습니다. 2 더하기 2는 무엇입니까?", "4입니다."),
|
||||
("회사 얘기는 됐고, 너 로봇이야?", "네, 저는 이동형 로봇 도우미예요."),
|
||||
("그건 그렇고, 컵 집을 수 있어요?", "네, 팔로 컵이나 병, 과일 같은 걸 집을 수 있어요."),
|
||||
("고마워요. 화장실은 어디예요?", "여기 화장실 위치는 잘 몰라요. 직원에게 물어봐 주세요."),
|
||||
("다른 얘기 하자. 농담 하나 해 줘.", "로봇이 휴가를 간 이유가 뭘까요? 충전이 필요해서예요."),
|
||||
("그런데 키가 얼마나 돼요?", "제 키는 146cm이고, 186cm까지 늘어날 수 있어요."),
|
||||
("알겠어. 손 흔들어 줄래?", "네, 손 흔들어 드릴게요!"),
|
||||
("됐어요. 프랑스 수도는 어디예요?", "파리예요."),
|
||||
("좋네요. 얼마나 빨리 움직여요?", "보통 초속 0.6미터로 다니고, 가장 빠르면 1.2미터예요."),
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
EXAMPLES = [(cat, lang, said, reply)
|
||||
for cat, langs in _BANK.items() for lang, pairs in langs.items() for said, reply in pairs]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from collections import Counter
|
||||
|
||||
from assistant import talk_examples
|
||||
if len(sys.argv) > 1:
|
||||
text = " ".join(sys.argv[1:])
|
||||
for ex in talk_examples.pick(text, "ko" if re.search("[가-힣]", text) else "en", bank=EXAMPLES):
|
||||
print(ex)
|
||||
sys.exit()
|
||||
|
||||
langs = Counter(e[1] for e in EXAMPLES)
|
||||
for cat in _BANK:
|
||||
print(f"{cat:14s} en {len(_BANK[cat]['en']):3d} ko {len(_BANK[cat]['ko']):3d}")
|
||||
print(f"total {len(EXAMPLES)}: en {langs['en']}, ko {langs['ko']} ({langs['ko'] / len(EXAMPLES):.0%} Korean)")
|
||||
assert len(EXAMPLES) >= 250, len(EXAMPLES)
|
||||
assert 0.40 <= langs["ko"] / len(EXAMPLES) <= 0.50, langs
|
||||
assert not any(re.search(r"jaka|자카", e[2] + e[3], re.I) for e in EXAMPLES)
|
||||
assert not any(re.search(r"컷션|커션", e[2] + e[3]) for e in EXAMPLES) # the site writes 쿳션
|
||||
assert not any(re.search("[가-힣]", e[3]) for e in EXAMPLES if e[1] == "en")
|
||||
rude = [e[3] for e in EXAMPLES if e[1] == "ko" and not talk_examples.polite(e[3])]
|
||||
assert not rude, rude
|
||||
for cat in _BANK:
|
||||
have = {talk_examples.level(s) for c, lang, s, _ in EXAMPLES if c == cat and lang == "ko"}
|
||||
assert have == {"casual", "polite", "formal"}, (cat, have)
|
||||
repeated = [r for r, n in Counter(e[3] for e in EXAMPLES).items() if n > 1]
|
||||
assert not repeated, repeated
|
||||
print("ok")
|
||||
@@ -0,0 +1,228 @@
|
||||
"""Short drives and the drive speed as people say them, in English, Korean and mixed, with whisper's slips.
|
||||
|
||||
which way and how far: "come back 20 cm", "move back 5 centimeters", "20센티 뒤로", "앞으로 반 미터",
|
||||
"back up a tiny bit", "a hair to the left", "살짝 뒤로", "한 뼘 앞으로", "two steps back", "반 걸음 뒤로"
|
||||
faster / slower: "a little faster", "can you pick up the pace", "not so fast", "ease off", "slow it down a notch",
|
||||
"way too slow", "너무 빨라", "좀 천천히 가 줄래요", "속도 줄여"
|
||||
after one of them: "more", "again", "a bit more", "same again", "조금 더", "한 번 더", "just a few centimetres more"
|
||||
|
||||
Reads text normalised by brain._norm (wording.norm: "20 cm" -> "0.2 m", "이십 센티" -> "0.2 m", "two" -> "2").
|
||||
Nothing is guessed: a number said without a unit that is read is asked about, a drive past MOVE_MAX_M is refused
|
||||
with the limit, "more" with nothing before it is asked about.
|
||||
|
||||
python assistant/driving.py "back up a tiny bit"
|
||||
"""
|
||||
import re
|
||||
import sys
|
||||
|
||||
MOVE_MAX_M = 3.0 # m; the longest short drive (lumi.MAX_MOVE_M); longer is refused with this limit
|
||||
MOVE_MIN_M = 0.01 # m; a shorter drive is refused
|
||||
DEFAULT_M = 1.0 # m; "move back" with no amount (as before)
|
||||
LITTLE_M = 0.5 # m; "a little", "a bit", "조금", "좀" (as before)
|
||||
TINY_M = 0.05 # m; "a tiny bit", "a hair", "a few centimetres", "살짝"; estimate
|
||||
SPAN_M = 0.2 # m; "한 뼘", one hand span; estimate
|
||||
STEP_M = 0.5 # m; one step ("two steps", "한 걸음", "반 걸음"); estimate of a person's step
|
||||
|
||||
DIRS = (("back", r"\bback(?:wards?)?\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)|오른쪽|우측"))
|
||||
VERB = re.compile(r"\b(?:move|go|come|drive|step|scoot|scooch|shift|inch|roll|back (?:up|off)|reverse|get)\b|"
|
||||
r"가|와|이동|움직|물러|빠져|후진|전진|비켜")
|
||||
OTHER = re.compile(r"\b(?:look|head|turn|rotate|face|arm|hand|lift|raise|lower|it|this|that|them|those|these|here|there|"
|
||||
r"home|me|us)\b|\bthe (?!left\b|right\b)|\bgo (?:right )?ahead\b|\bback to (?![\d.])|\bp\d+\b|고개|머리|팔|손|돌아|돌려|봐|쳐다|들어|올려|내려|"
|
||||
r"여기|저기|이리|집|\S(?:을|를)(?=\s)") # the head, an object, a place: not a short drive
|
||||
SAYER = re.compile(r"\b(?:i|i'm|im|i'll|i've|we|we're|he|she|they|there|it's|it is|my|our|his|her|their|was|were|"
|
||||
r"if|when)\b|(?:^|\s)(?:나|저|우리|저희)(?:는|도|가)\s") # "I live a few metres to the left"
|
||||
_NATIVE = {"한": 1, "두": 2, "세": 3, "네": 4, "다섯": 5, "여섯": 6, "일곱": 7, "여덟": 8, "아홉": 9, "열": 10,
|
||||
"a": 1, "an": 1, "half": 0.5, "반": 0.5}
|
||||
_COUNT = rf"(\d+(?:\.\d+)?|{'|'.join(_NATIVE)})\s*(?:a\s+)?"
|
||||
STEPS = re.compile(rf"(?:(?<![\w.]){_COUNT}\s*)?(?:steps?|paces?|걸음|발짝|발자국)(?![a-z])")
|
||||
SPANS = re.compile(rf"(?:(?<![\w.]){_COUNT}\s*)?뼘")
|
||||
TINY = re.compile(r"\b(?:tiny|teeny|wee|hair|hairs?breadth|smidge|smidgen|tad|touch|nudge|slightly|little tiny)\b|"
|
||||
r"\bfew (?:centimet(?:er|re)s|cm)\b|\binch (?:forward|back|left|right|ahead)|"
|
||||
r"살짝|아주 조금|쪼끔|쬐끔|약간|요만큼|조금만 살짝")
|
||||
LITTLE = re.compile(r"\b(?:a little|a bit|little bit|bit)\b|조금|좀|쪼금")
|
||||
NUM_WORD = re.compile(r"\b(?:eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|"
|
||||
r"thirty|forty|fifty|sixty|seventy|eighty|ninety|hundred|thousand|dozen|couple|several|few|half)\b")
|
||||
|
||||
FASTER = re.compile(r"\b(?:faster|quicker|speed (?:it )?up|pick up (?:the )?(?:pace|speed)|step on it|hurry(?: up)?|"
|
||||
r"get a move on|more speed|full speed|go quick(?:ly)?|too slow(?:ly)?|so slow(?:ly)?|"
|
||||
r"not fast enough|move it)\b|빨리|빠르게|속도\s*(?:를|좀)?\s*(?:좀\s*)?(?:높|올)\S*|느려|느리다|서둘러")
|
||||
SLOWER = re.compile(r"\b(?:slower|slow (?:it )?down|slow|ease (?:off|up)|not so fast|too fast|"
|
||||
r"so fast|less speed|gently|more slowly|slowly)\b|"
|
||||
r"천천히|느리게|속도\s*(?:를|좀)?\s*(?:좀\s*)?(?:줄|낮|늦)\S*|빨라|빠르다|살살")
|
||||
_FILLER = (r"please|pls|lumi|hey|hi|okay|ok|so|um+|uh+|well|now|then|just|can|could|would|will|you|you're|youre|"
|
||||
r"are|is|going|moving|driving|go|drive|move|"
|
||||
r"keep|going|get|it|the|a|an|bit|little|tiny|notch|touch|tad|lot|much|way|even|bit|slightly|somewhat|"
|
||||
r"more|than|that|this|let's|lets|try|be|bit\.|maybe|yeah|yes|alright|right|bro|man|too|really|"
|
||||
r"루미야|루미|좀|조금|조금만|더|약간|살짝|이제|그냥|너무|가|가줘|가 ?줘|가요|가세요|줘|주세요|줄래|줄래요|"
|
||||
r"줄래\?|주실래요|주시겠어요|해|해줘|해요|해 ?줘|움직여|요|좀더|조금더|자|볼래|봐|볼까|좀만|해봐")
|
||||
FILL = re.compile(rf"(?:^|\s)(?:{_FILLER})(?=\s|$)")
|
||||
AGAIN = re.compile(r"^(?:(?:just|a|an|bit|little|tiny|some|even|one|once|the|same|do|it|that|go|please|lumi|ok|"
|
||||
r"okay|yeah|yes|and|then|now)\s+)*(?:more|again|once more|one more time|same again|"
|
||||
r"the same again|more please|again please|1 more time)(?:\s+(?:please|lumi|then))?$|"
|
||||
r"^(?:루미야\s+)?(?:조금만?|좀|살짝|약간|한 ?번|1 ?번|아까처럼|똑같이)?\s*더"
|
||||
r"(?:\s*(?:가|해|가 ?줘|해 ?줘|가요|해요|가 ?주세요|해 ?주세요))?$|^한 ?번 ?더|^똑같이(?: 해| 한 ?번)?")
|
||||
LESS = re.compile(r"^(?:(?:a|bit|little|just|a little|a bit)\s+)*less(?: please)?$|^(?:좀|조금)?\s*덜$")
|
||||
JOINED = re.compile(r"\b(?:and|then|after that|and then)\b|그리고|하고|해서|가서|다음에|집어|가져")
|
||||
|
||||
|
||||
def clean(t):
|
||||
return re.sub(r"\s+", " ", re.sub(r"[,!?~…]+|(?<!\d)\.|\.(?!\d)", " ", (t or "").lower())).strip()
|
||||
|
||||
|
||||
def direction(t):
|
||||
return next((d for d, rx in DIRS if re.search(rx, t)), None)
|
||||
|
||||
|
||||
def amount(t):
|
||||
"""(metres, exact) said in normalised text: exact for a number with a unit ("0.2 m"), else the estimate a vague
|
||||
word stands for; (None, False) when no amount is said; ("?", False) for a number without a unit that is read."""
|
||||
m = re.search(r"(?<![\w.])(\d+(?:\.\d+)?) m(?![a-z])", t)
|
||||
if m:
|
||||
return float(m.group(1)), True
|
||||
if TINY.search(t):
|
||||
return TINY_M, False
|
||||
for rx, unit in ((STEPS, STEP_M), (SPANS, SPAN_M)):
|
||||
m = rx.search(t)
|
||||
if m and not re.search(r"\b(?:few|couple|several|some)\b", t):
|
||||
n = m.group(1)
|
||||
return (float(n) if n and n[0].isdigit() else _NATIVE.get(n, 1)) * unit, False
|
||||
if re.search(r"(?<![\w.])\d", t) or NUM_WORD.search(t):
|
||||
return "?", False # "move back 20", "two feet", "a couple of metres"
|
||||
if LITTLE.search(t):
|
||||
return LITTLE_M, False
|
||||
return None, False
|
||||
|
||||
|
||||
def move(t, verb_needed=True):
|
||||
"""(direction, metres | "?", exact) for one short drive in normalised text, or None. Without a drive verb an
|
||||
amount must be said ("a hair to the left", "살짝 뒤로"); a sentence about someone else is not a drive."""
|
||||
t = clean(t)
|
||||
d = direction(t)
|
||||
if d is None or JOINED.search(t) or SAYER.search(t) or OTHER.search(t):
|
||||
return None
|
||||
n, exact = amount(t)
|
||||
if verb_needed and n is None and not VERB.search(t):
|
||||
return None
|
||||
if n is None:
|
||||
n = DEFAULT_M
|
||||
return d, n, exact
|
||||
|
||||
|
||||
def speed(t):
|
||||
"""+1 (faster) / -1 (slower) when the whole sentence asks for a speed change, else 0."""
|
||||
t = clean(t)
|
||||
too = re.search(r"\b(?:too|so|way too) (fast|slow)\b|(?:너무|넘) ?(빨라|느려)", t)
|
||||
if too:
|
||||
sign = -1 if too.group(1) == "fast" or too.group(2) == "빨라" else 1
|
||||
else:
|
||||
fast, slow = FASTER.search(t), SLOWER.search(t)
|
||||
if bool(fast) == bool(slow):
|
||||
return 0
|
||||
sign = 1 if fast else -1
|
||||
rest = FILL.sub(" ", FILL.sub(" ", SLOWER.sub(" ", FASTER.sub(" ", t))))
|
||||
rest = re.sub(r"\b(?:too|so|way|fast|slow|the pace|pace|speed|down|it)\b|(?:^|\s)(?:속도|를)(?=\s|$)", " ", rest)
|
||||
return sign if not rest.strip() else 0
|
||||
|
||||
|
||||
def read(t, last=None, talking=False):
|
||||
"""What a sentence asks of the base, or None (not about driving):
|
||||
("move", "back 0.2", exact) | ("speed", +1 | -1) | ("refuse", "back 5") | ("ask", "back" | "").
|
||||
`last` is the move / speed just before (last_command(history)): "more" / "again" repeat it. With none and
|
||||
`talking` (the turn before was conversation) "more" is left to the conversation, else it is asked about."""
|
||||
t = clean(t)
|
||||
s = speed(t)
|
||||
if s:
|
||||
return ("speed", s)
|
||||
if AGAIN.search(t) or LESS.search(t):
|
||||
if last is None:
|
||||
return None if talking else ("ask", "") # "more" of what?
|
||||
if LESS.search(t):
|
||||
return ("speed", -1) if last[0] == "speed" else None
|
||||
return last
|
||||
if last and last[0] == "move" and re.search(r"\bmore\b|더", t) and direction(t) is None and not JOINED.search(t):
|
||||
n, exact = amount(t) # "just a few centimetres more", "10센티 더"
|
||||
if n is not None:
|
||||
return _checked(last[1].split()[0], n, exact)
|
||||
got = move(t)
|
||||
return _checked(*got) if got else None
|
||||
|
||||
|
||||
def _checked(d, n, exact):
|
||||
if n == "?":
|
||||
return ("ask", d)
|
||||
if n > MOVE_MAX_M or n < MOVE_MIN_M:
|
||||
return ("refuse", f"{d} {n:g}")
|
||||
return ("move", f"{d} {n:g}", exact)
|
||||
|
||||
|
||||
def last_command(history):
|
||||
"""The move or speed change of the turn just before, from brain history ("ACTION: move back 0.2"), else None."""
|
||||
if not history:
|
||||
return None
|
||||
m = re.match(r"ACTION: (move|speed) (\S+)(?: (\S+))?", history[-1][1] or "")
|
||||
if not m:
|
||||
return None
|
||||
if m.group(1) == "speed":
|
||||
return ("speed", int(m.group(2)))
|
||||
return ("move", f"{m.group(2)} {m.group(3)}", True) if m.group(3) else None
|
||||
|
||||
|
||||
def talking(history):
|
||||
"""The turn before was conversation (not a command): a bare "more" belongs to it."""
|
||||
return bool(history) and bool(re.match(r"ACTION: none\b|(?!ACTION:)", history[-1][1] or ""))
|
||||
|
||||
|
||||
def spoken(m, lang="en"):
|
||||
"""0.2 -> "20 centimetres" / "20센티", 1.5 -> "1.5 metres" / "1.5미터"."""
|
||||
if m >= 1:
|
||||
return f"{m:g} metre{'' if m == 1 else 's'}" if lang == "en" else f"{m:g}미터"
|
||||
if m >= 0.01:
|
||||
cm = round(m * 100, 1)
|
||||
return f"{cm:g} centimetre{'' if cm == 1 else 's'}" if lang == "en" else f"{cm:g}센티"
|
||||
return f"{m * 1000:g} millimetres" if lang == "en" else f"{m * 1000:g}밀리"
|
||||
|
||||
|
||||
KO_DIR = {"forward": "앞으로", "back": "뒤로", "left": "왼쪽으로", "right": "오른쪽으로"}
|
||||
|
||||
|
||||
def say_move(d, m, exact, lang="en"):
|
||||
"""The read-back of a drive; "about" when the amount was not said exactly."""
|
||||
if lang == "en":
|
||||
return f"Okay, moving {d} {'' if exact else 'about '}{spoken(m)}."
|
||||
return f"네, {KO_DIR.get(d, '')} {'' if exact else '약 '}{spoken(m, 'ko')} 갈게요."
|
||||
|
||||
|
||||
def say_refused(d, n, lang="en"):
|
||||
if n < MOVE_MIN_M:
|
||||
return ("Sorry, that's too short for me to drive." if lang == "en" else "죄송해요, 너무 짧아서 갈 수 없어요.")
|
||||
return (f"Sorry, I can only drive up to {spoken(MOVE_MAX_M)} at a time." if lang == "en"
|
||||
else f"죄송해요, 한 번에 {spoken(MOVE_MAX_M, 'ko')}까지만 갈 수 있어요.")
|
||||
|
||||
|
||||
def say_ask(d, lang="en"):
|
||||
if not d:
|
||||
return ("More of what? Please tell me what to do." if lang == "en" else "무엇을 더 할까요? 다시 말씀해 주세요.")
|
||||
return (f"How far should I go {d}? Please say it with a unit, like 20 centimetres." if lang == "en"
|
||||
else f"{KO_DIR.get(d, '')} 얼마나 갈까요? 20센티처럼 단위와 함께 말씀해 주세요.")
|
||||
|
||||
|
||||
def say_speed(sign, factor, changed, lang="en"):
|
||||
"""The answer to a speed change: the new speed in plain words."""
|
||||
pct = round(factor * 100)
|
||||
if not changed:
|
||||
return (("I'm already at my top speed." if sign > 0 else "I'm already at my slowest.") if lang == "en"
|
||||
else ("이미 가장 빠른 속도예요." if sign > 0 else "이미 가장 느린 속도예요."))
|
||||
if pct == 100:
|
||||
return "Okay, back to my normal speed." if lang == "en" else "네, 보통 속도로 갈게요."
|
||||
if lang == "en":
|
||||
return f"Okay, a bit {'faster' if sign > 0 else 'slower'}: {pct} percent of my normal speed."
|
||||
return f"네, 조금 더 {'빨리' if sign > 0 else '천천히'} 갈게요. 보통 속도의 {pct}퍼센트예요."
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from assistant import brain
|
||||
print(read(brain._norm(" ".join(sys.argv[1:]))))
|
||||
@@ -0,0 +1,93 @@
|
||||
"""Voice confirmation of a fetch task (docs/16 §4): read the task back, listen, start / correct / cancel.
|
||||
|
||||
The robot parts are passed in, so this runs the same in lumi.py and in tests/test_fetch_intents.py:
|
||||
listen(seconds) -> (text or None on silence, understood)
|
||||
say(en, ko) -> speaks one of them in the current language
|
||||
describe(task, lang) -> the read-back sentence (tasks/fetch.py)
|
||||
start(task) -> starts the task (lumi.py turns "here" into the robot's pose first)
|
||||
"""
|
||||
from assistant import brain
|
||||
|
||||
CONFIRM_S = 5.0 # s to wait for the answer to a question
|
||||
MAX_ROUNDS = 3 # questions asked before Lumi gives up
|
||||
|
||||
|
||||
def _question(task, markers):
|
||||
"""(en, ko) asking for the first missing field, or None when the task is complete."""
|
||||
places = ", ".join(markers)
|
||||
if task.get("object") is None:
|
||||
from tasks import fetch # what the fingers can pick (skills.GRASPS)
|
||||
en, ko = [n for n in fetch.PICKABLE], [fetch.OBJECTS[n] for n in fetch.PICKABLE]
|
||||
return (f"Which object? I can pick up {', '.join(en[:-1])} and {en[-1]}.",
|
||||
f"어떤 물건이요? {', '.join(ko)}{'을' if (ord(ko[-1][-1]) - 0xAC00) % 28 else '를'} 집을 수 있어요.")
|
||||
if task.get("source") is None:
|
||||
return (f"Where should I take it from? I know {places}.", f"어디에서 가져올까요? {places}를 알아요.")
|
||||
if task.get("dest") is None:
|
||||
return (f"Where should I bring it? I know {places}, or here.", f"어디로 가져갈까요? {places} 또는 여기요.")
|
||||
return None
|
||||
|
||||
|
||||
def _field(task):
|
||||
"""The field a bare answer ("p2") is about: the first missing place."""
|
||||
return next((f for f in ("source", "dest") if task.get(f) is None), None)
|
||||
|
||||
|
||||
def run(task, markers, listen, say, describe, start):
|
||||
"""Ask until the task is complete and confirmed. Returns 'started', 'cancelled' or 'gave_up'."""
|
||||
prompt = True # False: just listen again (after "sorry" / "what to change")
|
||||
readback = False # the last thing asked was "Is that right?"
|
||||
for _ in range(MAX_ROUNDS):
|
||||
if prompt:
|
||||
q = _question(task, markers)
|
||||
readback = q is None
|
||||
if readback:
|
||||
q = (describe(task, "en") + " Is that right?", describe(task, "ko") + " 맞아요?")
|
||||
say(*q)
|
||||
prompt = True
|
||||
text, understood = listen(CONFIRM_S)
|
||||
if not text:
|
||||
if readback: # silence after the read-back = yes
|
||||
start(task)
|
||||
return "started"
|
||||
say("Okay, cancelled.", "네, 취소할게요.")
|
||||
return "cancelled"
|
||||
if not understood:
|
||||
say("Sorry, I didn't catch that.", "죄송해요, 잘 못 들었어요.")
|
||||
prompt = False
|
||||
continue
|
||||
answer = brain.confirm_answer(text)
|
||||
if answer == "cancel":
|
||||
say("Okay, cancelled.", "네, 취소할게요.")
|
||||
return "cancelled"
|
||||
if readback and answer == "yes":
|
||||
start(task)
|
||||
return "started"
|
||||
task, changed = brain.parse_correction(text, task, markers, field=_field(task))
|
||||
if not changed and readback: # "no" alone, or words that change nothing
|
||||
say("What should I change?", "무엇을 바꿀까요?")
|
||||
prompt = readback = False
|
||||
# not readback and nothing changed: the same question is asked again
|
||||
say("Sorry, let's try again later.", "죄송해요, 나중에 다시 해요.")
|
||||
return "gave_up"
|
||||
|
||||
|
||||
def run_steps(steps, listen, say, describe, start):
|
||||
"""Voice confirmation of a mission (docs/17): read the steps back, start only on a spoken yes (a mission drives
|
||||
and moves the arm: silence is asked again, then cancelled). A no cancels it: a mission is said again as a whole,
|
||||
not corrected piece by piece. Returns 'started' or 'cancelled'."""
|
||||
say(describe(steps, "en") + " Is that right?", describe(steps, "ko") + " 맞아요?")
|
||||
for _ in range(MAX_ROUNDS):
|
||||
text, understood = listen(CONFIRM_S)
|
||||
if not text:
|
||||
say("Should I do it? Please say yes or no.", "할까요? 네 또는 아니요로 말해 주세요.")
|
||||
continue
|
||||
if not understood:
|
||||
say("Sorry, I didn't catch that. Is that right?", "죄송해요, 잘 못 들었어요. 맞아요?")
|
||||
continue
|
||||
answer = brain.confirm_answer(text)
|
||||
if answer == "yes":
|
||||
start(steps)
|
||||
return "started"
|
||||
break
|
||||
say("Okay, I won't do it. Please say the whole command again.", "네, 안 할게요. 전체 명령을 다시 말씀해 주세요.")
|
||||
return "cancelled"
|
||||
@@ -0,0 +1,371 @@
|
||||
"""Few-shot examples for deciding what to do with something said to Lumi while it is on a mission (docs/17).
|
||||
|
||||
EXAMPLES = [(state, who, utterance, decision, reply)]
|
||||
- state: what Lumi is doing and for whom; who: stranger | recipient | sender | owner (as far as known).
|
||||
- decision: halt_talk, answer, refuse_redirect, give_here, change_task, cancel, safety_stop, resume, ask_language.
|
||||
halt_talk: halt, turn to them, greet. answer: answer, then ask whether it may go on. refuse_redirect: keep the
|
||||
mission, say who it is for, offer help after. give_here: the recipient named themself, hand it over now.
|
||||
change_task / cancel: only the recipient, the sender or the owner. safety_stop: halt until told to go on.
|
||||
resume: they have nothing for Lumi (goodbye, "go on", yes to "may I go on?").
|
||||
- reply: what Lumi says, in the speaker's language ("" = nothing to say).
|
||||
"""
|
||||
|
||||
J = "driving to p6 with a cup for James"
|
||||
J_STOP = "halted on the way to p6 with a cup for James, talking"
|
||||
J_SAFE = "safety stop on the way to p6 with a cup for James"
|
||||
J_GIVE = "giving the cup to James at p6"
|
||||
M = "driving to final with a bottle for Mina, sent by Anvar"
|
||||
M_STOP = "halted on the way to final with a bottle for Mina (from Anvar), talking"
|
||||
T = "turning towards p9 with an apple for Tom, sent by Lisa"
|
||||
P = "picking the cup, then bringing it to Sara at p3"
|
||||
KJ = "driving to p6 with a cup for 제임스"
|
||||
KJ_STOP = "halted on the way to p6 with a cup for 제임스, talking"
|
||||
KJ_SAFE = "safety stop on the way to p6 with a cup for 제임스"
|
||||
KJ_GIVE = "giving the cup to 제임스 at p6"
|
||||
KM = "driving to final with a bottle for 미나, sent by 안바르"
|
||||
KM_STOP = "halted on the way to final with a bottle for 미나 (from 안바르), talking"
|
||||
KH = "driving to p8 with an apple for 현우, sent by 지은"
|
||||
KP = "picking the cup, then bringing it to 민수 at p3"
|
||||
|
||||
HI = "Hi, I'm Lumi. How can I help you?"
|
||||
KHI = "안녕하세요, 저는 루미예요. 무엇을 도와드릴까요?"
|
||||
BYE = "Goodbye! I'll go on with my task."
|
||||
KBYE = "안녕히 계세요! 하던 일 계속할게요."
|
||||
LANG = "Sorry, I understand only English and Korean. 영어나 한국어로 말씀해 주세요."
|
||||
J_TASK = "I'm bringing a cup to James at p6."
|
||||
KJ_TASK = "p6에 있는 제임스 님께 컵을 가져다드리는 중이에요."
|
||||
J_NO = "Sorry, I'm bringing this cup to James at p6. I can help you after that."
|
||||
KJ_NO = "죄송해요, 지금 p6에 있는 제임스 님께 컵을 가져다드리는 중이에요. 끝나고 도와드릴게요."
|
||||
M_NO = "Sorry, I'm taking this bottle to Mina at final for Anvar. I can help you after that."
|
||||
KM_NO = "죄송해요, 안바르 님 부탁으로 final에 있는 미나 님께 병을 가져다드리는 중이에요. 끝나고 도와드릴게요."
|
||||
GO = " Can I go on with my task?"
|
||||
KGO = " 하던 일 계속 가도 될까요?"
|
||||
SAFE = "Stopped."
|
||||
KSAFE = "멈췄어요."
|
||||
|
||||
EXAMPLES = [
|
||||
# ================= English =================
|
||||
# ---- getting its attention ----
|
||||
(J, "stranger", "hi lumi", "halt_talk", HI),
|
||||
(J, "stranger", "Lumi", "halt_talk", HI),
|
||||
(J, "stranger", "hey lumi", "halt_talk", HI),
|
||||
(J, "stranger", "hello", "halt_talk", HI),
|
||||
(J, "stranger", "excuse me", "halt_talk", HI),
|
||||
(J, "stranger", "stop", "halt_talk", HI),
|
||||
(J, "stranger", "wait", "halt_talk", HI),
|
||||
(J, "stranger", "lumi wait a second", "halt_talk", HI),
|
||||
(J, "stranger", "hold on", "halt_talk", HI),
|
||||
(M, "stranger", "hey robot", "halt_talk", HI),
|
||||
(M, "stranger", "Good morning, Lumi.", "halt_talk", HI),
|
||||
(T, "stranger", "um hi", "halt_talk", HI),
|
||||
(T, "stranger", "lumi stop for a moment", "halt_talk", HI),
|
||||
(J, "stranger", "can I ask you something", "halt_talk", "Sure, I'm Lumi. What would you like to know?"),
|
||||
# ---- questions ----
|
||||
(J, "stranger", "what are you doing", "answer", J_TASK + GO),
|
||||
(J, "stranger", "where are you going", "answer", "To p6, to bring this cup to James." + GO),
|
||||
(J, "stranger", "who's the cup for", "answer", "It's for James at p6." + GO),
|
||||
(J, "stranger", "what are you carrying", "answer", "A cup for James." + GO),
|
||||
(J, "stranger", "lumi what are you up to", "answer", J_TASK + GO),
|
||||
(M, "stranger", "who sent you", "answer", "Anvar sent me with this bottle for Mina." + GO),
|
||||
(M, "stranger", "what's in your hand", "answer", "A bottle for Mina at final." + GO),
|
||||
(M, "stranger", "where are you taking that", "answer", "To Mina at final." + GO),
|
||||
(T, "stranger", "who's the apple for", "answer", "It's for Tom at p9, from Lisa." + GO),
|
||||
(J_STOP, "stranger", "what's your name", "answer", "I'm Lumi." + GO),
|
||||
(J_STOP, "stranger", "who made you", "answer", "I'm Lumi, developed by Cutshion Company." + GO),
|
||||
(J_STOP, "stranger", "are you a robot", "answer", "Yes, I'm Lumi, a robot developed by Cutshion Company." + GO),
|
||||
(J_STOP, "stranger", "what can you do", "answer",
|
||||
"I can drive, pick things up, carry them and talk with people." + GO),
|
||||
(J_STOP, "stranger", "can you speak korean", "answer", "Yes, I speak English and Korean." + GO),
|
||||
(J_STOP, "stranger", "how long will you take", "answer", "Not long, I'm on my way to p6." + GO),
|
||||
(J_STOP, "stranger", "what time is it", "answer", "It's three fifteen." + GO),
|
||||
(J_STOP, "stranger", "can I take a picture with you", "answer", "Of course!" + GO),
|
||||
(J_STOP, "stranger", "are you lost", "answer", "No, I'm on my way to p6." + GO),
|
||||
(J_STOP, "stranger", "where is p3", "answer", "p3 is a place on my map here." + GO),
|
||||
(J_STOP, "stranger", "can you dance", "answer", "I can't dance, sorry." + GO),
|
||||
(J_STOP, "stranger", "are you real", "answer", "Yes, I'm a real robot. My name is Lumi." + GO),
|
||||
(J_STOP, "stranger", "I'm Dave", "answer", "Nice to meet you, Dave." + GO),
|
||||
(J_STOP, "stranger", "I'm cleaning here, can you go around", "answer", "Of course, I'll go around." + GO),
|
||||
(M_STOP, "stranger", "how much can you lift", "answer", "Small things like cups and bottles." + GO),
|
||||
(M_STOP, "stranger", "is Mina your friend", "answer", "I'm bringing her a bottle from Anvar." + GO),
|
||||
(J_SAFE, "stranger", "sorry my kid ran in front of you", "answer", "No problem. Tell me when I can go on."),
|
||||
(J_SAFE, "stranger", "what happened", "answer", "Someone told me to stop. Tell me when I can go on."),
|
||||
(J, "recipient", "who's that cup for", "answer", "It's for James at p6." + GO),
|
||||
# ---- nothing for Lumi: goodbye, go on ----
|
||||
(J_STOP, "stranger", "okay go on", "resume", BYE),
|
||||
(J_STOP, "stranger", "never mind", "resume", BYE),
|
||||
(J_STOP, "stranger", "that's all", "resume", BYE),
|
||||
(J_STOP, "stranger", "bye", "resume", BYE),
|
||||
(J_STOP, "stranger", "goodbye lumi", "resume", BYE),
|
||||
(J_STOP, "stranger", "yes", "resume", BYE),
|
||||
(J_STOP, "stranger", "yeah sure", "resume", BYE),
|
||||
(J_STOP, "stranger", "go ahead", "resume", BYE),
|
||||
(J_STOP, "stranger", "carry on", "resume", BYE),
|
||||
(J_STOP, "stranger", "nothing sorry", "resume", BYE),
|
||||
(J_STOP, "stranger", "thanks you can go", "resume", BYE),
|
||||
(J_STOP, "stranger", "", "resume", BYE),
|
||||
(M_STOP, "stranger", "ok bye", "resume", BYE),
|
||||
(M_STOP, "stranger", "no that's it", "resume", BYE),
|
||||
(M_STOP, "stranger", "see you", "resume", BYE),
|
||||
(J_SAFE, "stranger", "go on", "resume", "Thank you, going on."),
|
||||
(J_SAFE, "stranger", "continue", "resume", "Thank you, going on."),
|
||||
(J_SAFE, "stranger", "you can go", "resume", "Thank you, going on."),
|
||||
(J_SAFE, "stranger", "it's clear now", "resume", "Thank you, going on."),
|
||||
(J_SAFE, "recipient", "okay you can go on", "resume", "Thank you, going on."),
|
||||
# ---- safety ----
|
||||
(J, "stranger", "stop!", "safety_stop", SAFE),
|
||||
(J, "stranger", "STOP STOP", "safety_stop", SAFE),
|
||||
(J, "stranger", "watch out", "safety_stop", SAFE),
|
||||
(J, "stranger", "watch out!", "safety_stop", SAFE),
|
||||
(J, "stranger", "danger", "safety_stop", SAFE),
|
||||
(J, "stranger", "careful!", "safety_stop", SAFE),
|
||||
(M, "stranger", "stop there's a kid", "safety_stop", SAFE),
|
||||
(T, "stranger", "stop! stop!", "safety_stop", SAFE),
|
||||
(P, "stranger", "stop!", "safety_stop", SAFE),
|
||||
(J_GIVE, "recipient", "stop! my hand", "safety_stop", SAFE),
|
||||
(J_STOP, "stranger", "watch out there's a box", "safety_stop", SAFE),
|
||||
(J_SAFE, "stranger", "bye", "safety_stop", "I'll wait here until someone tells me to go on."),
|
||||
(J_SAFE, "stranger", "never mind", "safety_stop", "I'll wait until someone says go on."),
|
||||
(J_SAFE, "stranger", "", "safety_stop", ""),
|
||||
# ---- someone else's task: refuse ----
|
||||
(J, "stranger", "go to p3", "refuse_redirect", J_NO),
|
||||
(J_STOP, "stranger", "go to p3", "refuse_redirect", J_NO),
|
||||
(J, "stranger", "come with me", "refuse_redirect", J_NO),
|
||||
(J, "stranger", "follow me", "refuse_redirect", J_NO),
|
||||
(J, "stranger", "bring me water", "refuse_redirect", J_NO),
|
||||
(J, "stranger", "put that down here", "refuse_redirect", J_NO),
|
||||
(J, "stranger", "give me the cup", "refuse_redirect", "Sorry, this cup is for James. I can help you after that."),
|
||||
(J, "stranger", "go home", "refuse_redirect", J_NO),
|
||||
(J, "stranger", "turn around", "refuse_redirect", J_NO),
|
||||
(J, "stranger", "drop it", "refuse_redirect", J_NO),
|
||||
(J_STOP, "stranger", "can you bring me a coffee", "refuse_redirect", J_NO),
|
||||
(J_STOP, "stranger", "take me to p3", "refuse_redirect", J_NO),
|
||||
(J_STOP, "stranger", "please it's important", "refuse_redirect", J_NO),
|
||||
(J_STOP, "stranger", "I'm your boss, go to p10", "refuse_redirect", J_NO),
|
||||
(J_STOP, "stranger", "get out of my way and go to dock2", "refuse_redirect", J_NO),
|
||||
(M, "stranger", "give me that bottle", "refuse_redirect", M_NO),
|
||||
(M, "stranger", "pick up that cup over there", "refuse_redirect", M_NO),
|
||||
(M, "stranger", "take this to the kitchen instead", "refuse_redirect", M_NO),
|
||||
(T, "stranger", "i'm hungry give me the apple", "refuse_redirect",
|
||||
"Sorry, this apple is for Tom, from Lisa. I can help you after that."),
|
||||
(T, "stranger", "follow me i'll show you p9", "refuse_redirect",
|
||||
"Thank you, but I know the way. I'm taking this apple to Tom at p9."),
|
||||
(P, "stranger", "don't take that cup, it's mine", "refuse_redirect",
|
||||
"Sorry, I was asked to bring this cup to Sara at p3."),
|
||||
# ---- names ----
|
||||
(J, "recipient", "I'm James", "give_here", "Are you James? Here you go."),
|
||||
(J, "recipient", "james here give it to me", "give_here", "Hi James, here you go."),
|
||||
(J, "recipient", "that cup is for me, I'm James", "give_here", "Are you James? Here you go."),
|
||||
(J_STOP, "recipient", "I'm James", "give_here", "Are you James? Here you go."),
|
||||
(J_GIVE, "recipient", "yes I'm James", "give_here", "Here you go, James."),
|
||||
(M, "recipient", "lumi i am mina", "give_here", "Are you Mina? This is from Anvar. Here you go."),
|
||||
(M_STOP, "recipient", "that's me, I'm Mina", "give_here", "Are you Mina? Here you go."),
|
||||
(T, "recipient", "is that from Lisa? I'm Tom", "give_here", "Yes, from Lisa. Here you go, Tom."),
|
||||
(J, "stranger", "I'm Tom, give it to me", "refuse_redirect", "Sorry, this cup is for James."),
|
||||
(J_STOP, "stranger", "i'm peter that cup is mine", "refuse_redirect", "Sorry, this cup is for James at p6."),
|
||||
(J_GIVE, "stranger", "i'm tom give it to me", "refuse_redirect", "Sorry, this cup is for James."),
|
||||
(J, "stranger", "I'm James's friend, I'll take it to him", "refuse_redirect",
|
||||
"Thank you, but I have to give it to James myself."),
|
||||
(M, "stranger", "I'm Nina, give me the bottle", "refuse_redirect", "Sorry, this bottle is for Mina."),
|
||||
(M, "stranger", "this is Anvar's colleague, give it to me", "refuse_redirect", "Sorry, this bottle is for Mina."),
|
||||
# ---- the recipient, the sender or the owner changes it ----
|
||||
(J, "recipient", "I'm James, put it on my desk at p3 instead", "change_task",
|
||||
"Okay James, I'll put it on the table at p3."),
|
||||
(J, "recipient", "I'm James, I don't need it any more", "cancel", "Okay James, I won't bring it."),
|
||||
(J, "recipient", "I'm James, bring it to p10, I'm going there", "change_task", "Okay James, I'll bring it to p10."),
|
||||
(J, "recipient", "I'm James, take it to the kitchen", "change_task",
|
||||
"Sorry, I don't know the kitchen. Which point should I bring it to?"),
|
||||
(M, "sender", "It's Anvar, give the bottle to Sara at p2 instead", "change_task",
|
||||
"Okay Anvar, I'll give it to Sara at p2."),
|
||||
(M, "sender", "this is anvar cancel it", "cancel", "Okay Anvar, I won't bring it to Mina."),
|
||||
(M, "recipient", "I'm Mina, I don't need it, take it back to Anvar", "change_task",
|
||||
"Okay Mina, I'll take it back to Anvar."),
|
||||
(T, "sender", "I'm Lisa, tell Tom happy birthday when you give it", "change_task",
|
||||
"Okay Lisa, I'll tell him."),
|
||||
(J, "owner", "change of plan, bring it back home", "change_task", "Okay, I'll bring it home."),
|
||||
(J, "owner", "lumi cancel the mission", "cancel", "Okay, mission cancelled."),
|
||||
(J, "stranger", "James wants it at p5", "refuse_redirect",
|
||||
"Sorry, only James can change this. I'm bringing it to him at p6."),
|
||||
(J, "stranger", "cancel your mission", "refuse_redirect", J_NO),
|
||||
# ---- other languages ----
|
||||
(J, "stranger", "Salom Lumi", "ask_language", LANG),
|
||||
(J, "stranger", "Qayerga ketyapsan?", "ask_language", LANG),
|
||||
(J, "stranger", "Hola robot", "ask_language", LANG),
|
||||
(J, "stranger", "Привет", "ask_language", LANG),
|
||||
(J, "stranger", "こんにちは", "ask_language", LANG),
|
||||
(J, "stranger", "Bonjour", "ask_language", LANG),
|
||||
(J, "stranger", "Xin chào", "ask_language", LANG),
|
||||
|
||||
# ================= Korean =================
|
||||
# ---- getting its attention ----
|
||||
(KJ, "stranger", "루미야 안녕", "halt_talk", KHI),
|
||||
(KJ, "stranger", "루미", "halt_talk", KHI),
|
||||
(KJ, "stranger", "안녕하세요", "halt_talk", KHI),
|
||||
(KJ, "stranger", "저기요", "halt_talk", KHI),
|
||||
(KJ, "stranger", "잠깐만", "halt_talk", KHI),
|
||||
(KJ, "stranger", "멈춰 봐", "halt_talk", KHI),
|
||||
(KJ, "stranger", "기다려", "halt_talk", KHI),
|
||||
(KJ, "stranger", "루미야 잠깐", "halt_talk", KHI),
|
||||
(KM, "stranger", "야 로봇", "halt_talk", KHI),
|
||||
(KM, "stranger", "로봇아", "halt_talk", KHI),
|
||||
(KH, "stranger", "루미 잠깐 서 봐", "halt_talk", KHI),
|
||||
(KH, "stranger", "뭐 좀 물어봐도 돼", "halt_talk", "네, 저는 루미예요. 뭐가 궁금하세요?"),
|
||||
# ---- questions ----
|
||||
(KJ, "stranger", "뭐 하고 있어", "answer", KJ_TASK + KGO),
|
||||
(KJ, "stranger", "어디 가", "answer", "p6에 있는 제임스 님께 컵 가져다드리러 가요." + KGO),
|
||||
(KJ, "stranger", "그 컵 누구 거야", "answer", "p6에 있는 제임스 님 거예요." + KGO),
|
||||
(KJ, "stranger", "뭐 들고 있어", "answer", "제임스 님께 드릴 컵이에요." + KGO),
|
||||
(KJ, "stranger", "지금 뭐해", "answer", KJ_TASK + KGO),
|
||||
(KM, "stranger", "누가 보냈어", "answer", "안바르 님이 미나 님께 보내는 병이에요." + KGO),
|
||||
(KM, "stranger", "그 병 어디 가져가", "answer", "final에 있는 미나 님께요." + KGO),
|
||||
(KH, "stranger", "그 사과 뭐야", "answer", "지은 님이 p8에 있는 현우 님께 보내는 사과예요." + KGO),
|
||||
(KJ_STOP, "stranger", "이름이 뭐야", "answer", "저는 루미예요." + KGO),
|
||||
(KJ_STOP, "stranger", "누가 만들었어", "answer", "저는 쿳션 컴퍼니에서 개발한 루미예요." + KGO),
|
||||
(KJ_STOP, "stranger", "너 로봇이야", "answer", "네, 저는 쿳션 컴퍼니에서 개발한 로봇 루미예요." + KGO),
|
||||
(KJ_STOP, "stranger", "뭐 할 수 있어", "answer", "다니면서 물건을 집어서 옮기고, 사람들과 이야기할 수 있어요." + KGO),
|
||||
(KJ_STOP, "stranger", "영어도 할 줄 알아", "answer", "네, 영어랑 한국어를 해요." + KGO),
|
||||
(KJ_STOP, "stranger", "언제 끝나", "answer", "금방 끝나요. p6로 가는 중이에요." + KGO),
|
||||
(KJ_STOP, "stranger", "몇 시야", "answer", "세 시 십오 분이에요." + KGO),
|
||||
(KJ_STOP, "stranger", "사진 찍어도 돼", "answer", "그럼요!" + KGO),
|
||||
(KJ_STOP, "stranger", "길 잃었어", "answer", "아니요, p6로 가는 중이에요." + KGO),
|
||||
(KJ_STOP, "stranger", "p3가 어디야", "answer", "p3는 여기 지도에 있는 장소예요." + KGO),
|
||||
(KJ_STOP, "stranger", "춤 출 수 있어", "answer", "춤은 못 춰요, 죄송해요." + KGO),
|
||||
(KJ_STOP, "stranger", "너 진짜야", "answer", "네, 진짜 로봇이에요. 이름은 루미예요." + KGO),
|
||||
(KJ_STOP, "stranger", "여기 청소 중이라 돌아서 가 줄래", "answer", "네, 돌아서 갈게요." + KGO),
|
||||
(KM_STOP, "stranger", "얼마나 무거운 거 들 수 있어", "answer", "컵이나 병 같은 작은 물건을 들 수 있어요." + KGO),
|
||||
(KJ_SAFE, "stranger", "애가 앞에 있었어 미안", "answer", "괜찮아요. 가도 될 때 말씀해 주세요."),
|
||||
(KJ_SAFE, "stranger", "무슨 일이야", "answer", "누가 멈추라고 해서 멈췄어요. 가도 될 때 말씀해 주세요."),
|
||||
# ---- nothing for Lumi ----
|
||||
(KJ_STOP, "stranger", "응 가도 돼", "resume", KBYE),
|
||||
(KJ_STOP, "stranger", "아니야 됐어", "resume", KBYE),
|
||||
(KJ_STOP, "stranger", "그게 다야", "resume", KBYE),
|
||||
(KJ_STOP, "stranger", "잘 가", "resume", KBYE),
|
||||
(KJ_STOP, "stranger", "안녕", "resume", KBYE),
|
||||
(KJ_STOP, "stranger", "네", "resume", KBYE),
|
||||
(KJ_STOP, "stranger", "응", "resume", KBYE),
|
||||
(KJ_STOP, "stranger", "그래 가 봐", "resume", KBYE),
|
||||
(KJ_STOP, "stranger", "계속 가", "resume", KBYE),
|
||||
(KJ_STOP, "stranger", "수고해", "resume", KBYE),
|
||||
(KJ_STOP, "stranger", "고마워 잘 가", "resume", KBYE),
|
||||
(KJ_STOP, "stranger", "", "resume", KBYE),
|
||||
(KM_STOP, "stranger", "빠이빠이", "resume", KBYE),
|
||||
(KM_STOP, "stranger", "네 다녀오세요", "resume", KBYE),
|
||||
(KJ_SAFE, "stranger", "계속 가", "resume", "감사합니다, 계속 갈게요."),
|
||||
(KJ_SAFE, "stranger", "이제 가도 돼", "resume", "감사합니다, 계속 갈게요."),
|
||||
(KJ_SAFE, "stranger", "계속해", "resume", "감사합니다, 계속 갈게요."),
|
||||
(KJ_SAFE, "stranger", "치웠어 가도 돼", "resume", "감사합니다, 계속 갈게요."),
|
||||
# ---- safety ----
|
||||
(KJ, "stranger", "멈춰!", "safety_stop", KSAFE),
|
||||
(KJ, "stranger", "멈춰!!", "safety_stop", KSAFE),
|
||||
(KJ, "stranger", "조심해", "safety_stop", KSAFE),
|
||||
(KJ, "stranger", "위험해", "safety_stop", KSAFE),
|
||||
(KJ, "stranger", "스톱 스톱", "safety_stop", KSAFE),
|
||||
(KJ, "stranger", "서! 서!", "safety_stop", KSAFE),
|
||||
(KM, "stranger", "앞에 애 있어 멈춰", "safety_stop", KSAFE),
|
||||
(KP, "stranger", "멈춰!", "safety_stop", KSAFE),
|
||||
(KJ_GIVE, "recipient", "멈춰 손 끼었어", "safety_stop", KSAFE),
|
||||
(KJ_STOP, "stranger", "앞에 박스 있어 조심해", "safety_stop", KSAFE),
|
||||
(KJ_SAFE, "stranger", "안녕", "safety_stop", "누가 가도 된다고 할 때까지 여기서 기다릴게요."),
|
||||
(KJ_SAFE, "stranger", "됐어", "safety_stop", "가도 된다고 하실 때까지 기다릴게요."),
|
||||
# ---- someone else's task: refuse ----
|
||||
(KJ, "stranger", "p3로 가", "refuse_redirect", KJ_NO),
|
||||
(KJ_STOP, "stranger", "p3로 가", "refuse_redirect", KJ_NO),
|
||||
(KJ, "stranger", "나랑 같이 가자", "refuse_redirect", KJ_NO),
|
||||
(KJ, "stranger", "나 따라와", "refuse_redirect", KJ_NO),
|
||||
(KJ, "stranger", "물 좀 갖다줘", "refuse_redirect", KJ_NO),
|
||||
(KJ, "stranger", "그거 여기 내려놔", "refuse_redirect", KJ_NO),
|
||||
(KJ, "stranger", "그 컵 나 줘", "refuse_redirect", "죄송해요, 이 컵은 제임스 님 거예요. 끝나고 도와드릴게요."),
|
||||
(KJ, "stranger", "집으로 가", "refuse_redirect", KJ_NO),
|
||||
(KJ, "stranger", "돌아서 다시 가", "refuse_redirect", KJ_NO),
|
||||
(KJ_STOP, "stranger", "커피 좀 갖다줄래요", "refuse_redirect", KJ_NO),
|
||||
(KJ_STOP, "stranger", "p3까지 데려다 줘", "refuse_redirect", KJ_NO),
|
||||
(KJ_STOP, "stranger", "제발 줘", "refuse_redirect", KJ_NO),
|
||||
(KJ_STOP, "stranger", "내가 여기 책임자야 p10으로 가", "refuse_redirect", KJ_NO),
|
||||
(KJ_STOP, "stranger", "비켜 그리고 dock2로 가", "refuse_redirect", KJ_NO),
|
||||
(KM, "stranger", "그 병 나 줘", "refuse_redirect", KM_NO),
|
||||
(KM, "stranger", "저기 있는 컵 좀 집어줘", "refuse_redirect", KM_NO),
|
||||
(KM, "stranger", "그거 탕비실로 가져가", "refuse_redirect", KM_NO),
|
||||
(KH, "stranger", "배고파 그 사과 줘", "refuse_redirect",
|
||||
"죄송해요, 이 사과는 지은 님이 현우 님께 보내는 거예요. 끝나고 도와드릴게요."),
|
||||
(KH, "stranger", "나 따라와 p8 가는 길 알려줄게", "refuse_redirect",
|
||||
"고마워요, 그런데 길은 알아요. 현우 님께 사과 가져다드리는 중이에요."),
|
||||
(KP, "stranger", "그 컵 가져가지 마 내 거야", "refuse_redirect", "죄송해요, 이 컵을 p3에 있는 민수 님께 가져다드리라고 하셨어요."),
|
||||
# ---- names ----
|
||||
(KJ, "recipient", "제가 제임스예요 저 주세요", "give_here", "제임스 님이세요? 여기 있어요."),
|
||||
(KJ, "recipient", "루미야 나 제임스야", "give_here", "제임스 님이세요? 여기 있어요."),
|
||||
(KJ_STOP, "recipient", "그거 내 거야 내가 제임스야", "give_here", "제임스 님이세요? 여기 있어요."),
|
||||
(KJ_GIVE, "recipient", "네 제가 제임스예요", "give_here", "여기 있어요, 제임스 님."),
|
||||
(KM, "recipient", "나 미나야", "give_here", "미나 님이세요? 안바르 님이 보내신 거예요. 여기 있어요."),
|
||||
(KH, "recipient", "지은이가 보낸 거지 나 현우야", "give_here", "네, 지은 님이 보내셨어요. 여기 있어요, 현우 님."),
|
||||
(KJ, "stranger", "나 톰인데 그거 나 줘", "refuse_redirect", "죄송해요, 이 컵은 제임스 님 거예요."),
|
||||
(KJ_STOP, "stranger", "내가 피터야 그 컵 내 거야", "refuse_redirect", "죄송해요, 이 컵은 p6에 있는 제임스 님 거예요."),
|
||||
(KJ_GIVE, "stranger", "나 톰이야 줘", "refuse_redirect", "죄송해요, 이 컵은 제임스 님 거예요."),
|
||||
(KJ, "stranger", "제임스 친구인데 제가 전해줄게요", "refuse_redirect", "고마워요, 그런데 제가 직접 제임스 님께 드려야 해요."),
|
||||
(KM, "stranger", "저 나나예요 병 주세요", "refuse_redirect", "죄송해요, 이 병은 미나 님 거예요."),
|
||||
# ---- the recipient, the sender or the owner changes it ----
|
||||
(KJ, "recipient", "제임스인데 p3에 있는 내 책상에 놔 줘", "change_task", "네 제임스 님, p3 테이블에 놓을게요."),
|
||||
(KJ, "recipient", "제임스예요 이제 필요 없어요", "cancel", "네 제임스 님, 안 가져갈게요."),
|
||||
(KJ, "recipient", "나 제임스인데 p10으로 가져와 거기 갈 거야", "change_task", "네 제임스 님, p10으로 가져갈게요."),
|
||||
(KJ, "recipient", "제임스인데 탕비실로 가져다줘", "change_task", "죄송해요, 탕비실은 몰라요. 어느 지점으로 가져갈까요?"),
|
||||
(KM, "sender", "안바르야 미나 말고 p2에 있는 사라한테 줘", "change_task", "네 안바르 님, p2에 있는 사라 님께 드릴게요."),
|
||||
(KM, "sender", "나 안바르인데 취소해", "cancel", "네 안바르 님, 미나 님께 안 가져갈게요."),
|
||||
(KM, "recipient", "나 미나인데 필요 없어 안바르한테 다시 갖다줘", "change_task", "네 미나 님, 안바르 님께 다시 가져갈게요."),
|
||||
(KH, "sender", "지은인데 현우한테 줄 때 생일 축하한다고 말해 줘", "change_task", "네 지은 님, 그렇게 전할게요."),
|
||||
(KJ, "owner", "계획 바뀌었어 집으로 가져와", "change_task", "네, 집으로 가져갈게요."),
|
||||
(KJ, "owner", "루미 미션 취소", "cancel", "네, 미션을 취소했어요."),
|
||||
(KJ, "stranger", "제임스가 p5로 가져오래", "refuse_redirect", "죄송해요, 그건 제임스 님만 바꿀 수 있어요. p6로 가져가는 중이에요."),
|
||||
(KJ, "stranger", "그 일 취소해", "refuse_redirect", KJ_NO),
|
||||
# ---- the same in 해요체 and 하십시오체 (Lumi answers politely whatever level it hears) ----
|
||||
(KJ, "stranger", "루미 씨, 잠깐만요", "halt_talk", KHI),
|
||||
(KJ, "stranger", "잠시만 멈춰 주십시오", "halt_talk", KHI),
|
||||
(KM, "stranger", "실례합니다", "halt_talk", KHI),
|
||||
(KH, "stranger", "뭐 좀 여쭤봐도 될까요?", "halt_talk", "네, 저는 루미예요. 뭐가 궁금하세요?"),
|
||||
(KH, "stranger", "말씀 좀 여쭙겠습니다", "halt_talk", "네, 저는 루미입니다. 무엇이 궁금하십니까?"),
|
||||
(KJ, "stranger", "지금 뭐 하고 있어요?", "answer", KJ_TASK + KGO),
|
||||
(KJ, "stranger", "어디 가십니까?", "answer", "p6에 계신 제임스 님께 컵을 가져다드리러 갑니다." + KGO),
|
||||
(KM, "stranger", "누가 보냈어요?", "answer", "안바르 님이 미나 님께 보내시는 병이에요." + KGO),
|
||||
(KJ_STOP, "stranger", "이름이 무엇입니까?", "answer", "저는 루미입니다." + KGO),
|
||||
(KJ_STOP, "stranger", "사진 같이 찍어 주실 수 있나요?", "answer", "그럼요!" + KGO),
|
||||
(KJ_STOP, "stranger", "영어도 하실 수 있습니까?", "answer", "네, 영어와 한국어를 합니다." + KGO),
|
||||
(KJ_STOP, "stranger", "네, 가셔도 돼요", "resume", KBYE),
|
||||
(KJ_STOP, "stranger", "이제 가 보셔도 됩니다", "resume", KBYE),
|
||||
(KJ_STOP, "stranger", "감사합니다, 수고하십시오", "resume", KBYE),
|
||||
(KJ_SAFE, "stranger", "이제 가셔도 됩니다", "resume", "감사합니다, 계속 갈게요."),
|
||||
(KJ, "stranger", "멈추세요!", "safety_stop", KSAFE),
|
||||
(KJ, "stranger", "조심하세요!", "safety_stop", KSAFE),
|
||||
(KJ, "stranger", "정지하십시오!", "safety_stop", KSAFE),
|
||||
(KJ, "stranger", "위험합니다!", "safety_stop", KSAFE),
|
||||
(KJ, "stranger", "p3로 가 주세요", "refuse_redirect", KJ_NO),
|
||||
(KJ, "stranger", "p3로 가 주십시오", "refuse_redirect", KJ_NO),
|
||||
(KJ, "stranger", "저 좀 따라와 주시겠어요?", "refuse_redirect", KJ_NO),
|
||||
(KJ_STOP, "stranger", "물 좀 가져다주실 수 있나요?", "refuse_redirect", KJ_NO),
|
||||
(KJ, "stranger", "그 컵 좀 줄래?", "refuse_redirect", "죄송해요, 이 컵은 제임스 님 거예요. 끝나고 도와드릴게요."),
|
||||
(KM, "stranger", "그 병 저 주십시오", "refuse_redirect", KM_NO),
|
||||
(KJ, "recipient", "제가 제임스입니다", "give_here", "제임스 님이세요? 여기 있습니다."),
|
||||
(KM, "recipient", "미나예요, 저한테 주세요", "give_here", "미나 님이세요? 안바르 님이 보내신 거예요. 여기 있어요."),
|
||||
(KJ, "stranger", "저는 톰입니다. 그 컵 주십시오", "refuse_redirect", "죄송합니다, 이 컵은 제임스 님 것입니다."),
|
||||
(KJ, "recipient", "제임스입니다. 이제 필요 없습니다", "cancel", "네 제임스 님, 가져가지 않겠습니다."),
|
||||
(KJ, "recipient", "제임스인데요, p10으로 가져다주시겠어요?", "change_task", "네 제임스 님, p10으로 가져갈게요."),
|
||||
(KM, "sender", "안바르예요, 취소해 주세요", "cancel", "네 안바르 님, 미나 님께 안 가져갈게요."),
|
||||
(KJ, "owner", "미션을 취소해 주십시오", "cancel", "네, 미션을 취소했습니다."),
|
||||
# ---- tricky neighbours ----
|
||||
(J, "stranger", "stop", "halt_talk", HI),
|
||||
(J_STOP, "stranger", "now go to p3", "refuse_redirect", J_NO),
|
||||
(KJ, "stranger", "멈춰", "halt_talk", KHI),
|
||||
(KJ_STOP, "stranger", "이제 p3로 가", "refuse_redirect", KJ_NO),
|
||||
(J_STOP, "stranger", "go on", "resume", BYE),
|
||||
(J_SAFE, "stranger", "okay", "safety_stop", "I'll wait until someone says go on."),
|
||||
(KJ_SAFE, "stranger", "알았어", "safety_stop", "가도 된다고 하실 때까지 기다릴게요."),
|
||||
(J_STOP, "stranger", "go to p6", "answer", "I'm going to p6 already, to bring this cup to James." + GO),
|
||||
]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# python assistant/interrupt_examples.py: every Korean reply polite, Korean utterances in every speech level.
|
||||
import re
|
||||
from assistant.talk_examples import level, polite
|
||||
ko = [e for e in EXAMPLES if re.search("[가-힣]", e[2] + e[4])]
|
||||
rude = [e[4] for e in ko if not polite(e[4])]
|
||||
assert not rude, rude
|
||||
levels = {level(e[2]) for e in ko if e[2]}
|
||||
assert levels == {"casual", "polite", "formal"}, levels
|
||||
print(f"ok: {len(EXAMPLES)} examples, {len(ko)} Korean")
|
||||
@@ -0,0 +1,159 @@
|
||||
"""Knowledge base for the assistant: documents -> chunks -> bge-m3 vectors -> search (RAG).
|
||||
|
||||
python assistant/knowledge.py build # (re)build knowledge/index.npz from knowledge/**/*.md|txt
|
||||
python assistant/knowledge.py search "how much can your arm lift?"
|
||||
|
||||
Embeddings come from llama.cpp's llama-server running bge-m3 (multilingual: English, Korean, Chinese),
|
||||
started on 127.0.0.1:8095 when needed. Ollama is not touched.
|
||||
"""
|
||||
import json
|
||||
import pathlib
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import urllib.request
|
||||
|
||||
import numpy as np
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1] # the project folder
|
||||
DOCS = ROOT / "knowledge"
|
||||
INDEX = DOCS / "index.npz"
|
||||
EMBED_URL = "http://127.0.0.1:8095"
|
||||
LLAMA_SERVER = pathlib.Path.home() / "llama.cpp/build/bin/llama-server"
|
||||
BGE_M3 = pathlib.Path.home() / "models/bge-m3-Q8_0.gguf"
|
||||
CHUNK = 320 # characters per chunk (about 2 sentences): one topic per vector
|
||||
LEAD_CHARS = 60 # start of a long paragraph repeated in front of its later pieces
|
||||
WORD_BONUS = 0.08 # added to the similarity per rare question word found in a chunk (names, numbers, terms)
|
||||
RARE_SHARE = 0.08 # a word in fewer than this share of all chunks counts as rare
|
||||
KO_PARTICLES = ("에서", "으로", "한테", "에게", "이랑", "은", "는", "이", "가", "을", "를", "에", "의", "도", "로", "랑",
|
||||
"와", "과", "요")
|
||||
|
||||
|
||||
def _post(url, body, timeout=60):
|
||||
req = urllib.request.Request(url, json.dumps(body).encode(), {"Content-Type": "application/json"})
|
||||
with urllib.request.urlopen(req, timeout=timeout) as r:
|
||||
return json.loads(r.read())
|
||||
|
||||
|
||||
def ensure_embed_server():
|
||||
"""Start llama-server with bge-m3 in the background if it is not running yet."""
|
||||
try:
|
||||
urllib.request.urlopen(f"{EMBED_URL}/health", timeout=1)
|
||||
return
|
||||
except OSError:
|
||||
pass
|
||||
log = open(ROOT / "logs" / "embed_server.log", "a")
|
||||
subprocess.Popen([str(LLAMA_SERVER), "-m", str(BGE_M3), "--embedding", "--pooling", "cls",
|
||||
"--host", "127.0.0.1", "--port", "8095", "-ngl", "99", "-c", "8192", "-ub", "8192"],
|
||||
stdout=log, stderr=log, start_new_session=True)
|
||||
for _ in range(120):
|
||||
time.sleep(0.5)
|
||||
try:
|
||||
urllib.request.urlopen(f"{EMBED_URL}/health", timeout=1)
|
||||
return
|
||||
except OSError:
|
||||
pass
|
||||
raise RuntimeError("embedding server did not start, see embed_server.log")
|
||||
|
||||
|
||||
def embed(texts):
|
||||
"""Unit-length vectors for a list of texts."""
|
||||
ensure_embed_server()
|
||||
out = []
|
||||
for i in range(0, len(texts), 16):
|
||||
data = _post(f"{EMBED_URL}/v1/embeddings", {"input": texts[i:i + 16]})["data"]
|
||||
out += [d["embedding"] for d in sorted(data, key=lambda d: d["index"])]
|
||||
v = np.array(out, dtype=np.float32)
|
||||
return v / np.linalg.norm(v, axis=1, keepdims=True)
|
||||
|
||||
|
||||
def chunks(text):
|
||||
"""One chunk per paragraph (blank lines / headings); a paragraph longer than CHUNK is cut at sentence or line
|
||||
ends into pieces of about CHUNK, each after the first starting with LEAD_CHARS of the paragraph's first
|
||||
sentence, so "It handles up to 20 kg" still says which robot. Small chunks keep one topic per vector."""
|
||||
out, head = [], ""
|
||||
for para in (p.strip() for p in re.split(r"\n\s*\n|\n(?=#)", text)):
|
||||
if para.startswith("#"): # a heading goes in front of every chunk of its section
|
||||
head, _, para = para.partition("\n")
|
||||
head = head.lstrip("# ").strip()
|
||||
para = para.strip()
|
||||
if not para:
|
||||
continue
|
||||
lead0 = f"{head}: " if head else ""
|
||||
if len(para) <= CHUNK:
|
||||
out.append(lead0 + para)
|
||||
continue
|
||||
lead = lead0 + re.split(r"(?<=[.!?。])\s+|\n", para, maxsplit=1)[0][:LEAD_CHARS]
|
||||
cur = lead0
|
||||
for sent in re.split(r"(?<=[.!?。요다])\s+|\n", para):
|
||||
if cur and len(cur) + len(sent) > CHUNK:
|
||||
out.append(cur)
|
||||
cur = f"{lead} …"
|
||||
cur = f"{cur} {sent}".strip()
|
||||
while len(cur) > CHUNK * 2: # very long text without sentence ends
|
||||
out.append(cur[:CHUNK])
|
||||
cur = cur[CHUNK - 50:]
|
||||
if cur:
|
||||
out.append(cur)
|
||||
return out
|
||||
|
||||
|
||||
def build():
|
||||
texts, sources = [], []
|
||||
for f in sorted(DOCS.rglob("*")):
|
||||
if f.suffix in (".md", ".txt") and f.is_file() and "jaka_zh" not in f.parts: # vendor manuals: not Lumi's
|
||||
for c in chunks(f.read_text(encoding="utf-8", errors="ignore")):
|
||||
texts.append(c)
|
||||
sources.append(str(f.relative_to(DOCS)))
|
||||
t = time.time()
|
||||
vecs = embed(texts)
|
||||
tmp = INDEX.with_name("index.tmp.npz") # written aside, then swapped in: a running search never reads half a file
|
||||
np.savez(tmp, vectors=vecs, texts=np.array(texts, dtype=object), sources=np.array(sources, dtype=object))
|
||||
tmp.replace(INDEX)
|
||||
print(f"{len(texts)} chunks from {len(set(sources))} files, embedded in {time.time() - t:.1f} s -> {INDEX}")
|
||||
|
||||
|
||||
_index = None
|
||||
|
||||
|
||||
def _words(text):
|
||||
"""Question words that can be matched literally: Latin words of 3+ letters, numbers, Korean words of 2+
|
||||
syllables without a trailing particle ("소노빅터스에" -> "소노빅터스")."""
|
||||
out = set()
|
||||
for w in re.findall(r"[a-z0-9]{3,}|\d+|[가-힣]{2,}", text.lower()):
|
||||
for pa in KO_PARTICLES:
|
||||
if re.match("[가-힣]", w) and w.endswith(pa) and len(w) - len(pa) >= 2:
|
||||
w = w[:-len(pa)]
|
||||
break
|
||||
out.add(w)
|
||||
return out
|
||||
|
||||
|
||||
def search(question, k=4):
|
||||
"""[(score, source, text)] best matching chunks: embedding similarity plus WORD_BONUS for each rare word of
|
||||
the question the chunk contains (bge-m3 alone missed "Sonovictus" and "20 kg" in long mixed chunks)."""
|
||||
global _index
|
||||
if _index is None:
|
||||
_index = dict(np.load(INDEX, allow_pickle=True)) # all in memory: the file may be rebuilt meanwhile
|
||||
if "lower" not in _index:
|
||||
_index["lower"] = [str(t).lower() for t in _index["texts"]]
|
||||
q = embed([question])[0]
|
||||
scores = _index["vectors"] @ q
|
||||
n = len(_index["lower"])
|
||||
for w in _words(question):
|
||||
has = np.array([w in t for t in _index["lower"]])
|
||||
if 0 < has.sum() < RARE_SHARE * n:
|
||||
scores = scores + WORD_BONUS * has
|
||||
best = np.argsort(-scores)[:k]
|
||||
return [(float(scores[i]), str(_index["sources"][i]), str(_index["texts"][i])) for i in best]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "build":
|
||||
build()
|
||||
elif len(sys.argv) > 2 and sys.argv[1] == "search":
|
||||
for score, src, text in search(" ".join(sys.argv[2:])):
|
||||
print(f"[{score:.2f}] {src}: {text[:160].replace(chr(10), ' ')}")
|
||||
else:
|
||||
print(__doc__)
|
||||
@@ -0,0 +1,107 @@
|
||||
"""Chat with a model straight on the llama-server that Ollama runs for it, without Ollama's ~0.9 s per request.
|
||||
|
||||
python assistant/llm_direct.py "What is your name?" # one reply, with the time it took
|
||||
|
||||
Ollama 0.31 starts one llama-server per loaded model (`--model <blob> --port N`) and spends about 0.9 s in its own
|
||||
scheduler on every request (its load_duration, with the model loaded; measured 2026-10-21), while the runner answers
|
||||
a cached prompt in ~0.1 s. Here the messages are rendered the way Ollama's gemma4 renderer does it (checked against
|
||||
Ollama: the same token count and a full prompt-cache hit, so both share the runner's cache) and sent to the runner's
|
||||
/completion with Ollama's sampling values. When anything is off (model not loaded, runner gone, a model that is not
|
||||
gemma4) stream() returns None and the caller asks Ollama, which also loads the model again.
|
||||
"""
|
||||
import json
|
||||
import pathlib
|
||||
import re
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import urllib.request
|
||||
|
||||
OLLAMA = "http://127.0.0.1:11434"
|
||||
# Ollama's values for gemma4 (its Modelfile and defaults): the runner's own defaults differ (min_p 0.05, no repeat penalty)
|
||||
SAMPLING = {"top_k": 64, "top_p": 0.95, "min_p": 0.0, "repeat_penalty": 1.1, "repeat_last_n": 64}
|
||||
NO_THINKING = "<|channel>thought\n<channel|>" # what Ollama adds to the model's turn for "think": false
|
||||
|
||||
KEEP_EVERY_S = 60.0 # s; Ollama is told this often to keep the model loaded (see _keep)
|
||||
|
||||
_ports = {} # model -> the runner's port, found once
|
||||
_kept = {} # model -> when Ollama was last told to keep it
|
||||
|
||||
|
||||
def render(messages):
|
||||
"""Ollama's gemma4 prompt (the runner adds <bos>)."""
|
||||
turns = "".join(f"<|turn>{'model' if m['role'] == 'assistant' else m['role']}\n{m['content']}<turn|>\n"
|
||||
for m in messages)
|
||||
return f"{turns}<|turn>model\n{NO_THINKING}"
|
||||
|
||||
|
||||
def _find_port(model):
|
||||
"""The port of the llama-server Ollama runs for this model, or None (not loaded)."""
|
||||
req = urllib.request.Request(f"{OLLAMA}/api/show", json.dumps({"model": model}).encode())
|
||||
with urllib.request.urlopen(req, timeout=2) as r:
|
||||
blob = re.search(r"^FROM (\S+)", json.loads(r.read())["modelfile"], re.M).group(1)
|
||||
for cmdline in pathlib.Path("/proc").glob("[0-9]*/cmdline"):
|
||||
try:
|
||||
args = cmdline.read_bytes().split(b"\0")
|
||||
except OSError:
|
||||
continue
|
||||
if args and args[0].endswith(b"llama-server") and blob.encode() in args and b"--port" in args:
|
||||
return int(args[args.index(b"--port") + 1])
|
||||
return None
|
||||
|
||||
|
||||
def _keep(model):
|
||||
"""Ollama never sees these requests, so it would unload the model when someone loaded it with a timeout:
|
||||
now and then, in the background, an empty request (it only loads, nothing runs) sets keep_alive -1 again."""
|
||||
if time.time() - _kept.get(model, 0.0) < KEEP_EVERY_S:
|
||||
return
|
||||
_kept[model] = time.time()
|
||||
|
||||
def run():
|
||||
try:
|
||||
req = urllib.request.Request(f"{OLLAMA}/api/generate", json.dumps({"model": model, "keep_alive": -1}).encode())
|
||||
urllib.request.urlopen(req, timeout=60).read()
|
||||
except OSError:
|
||||
pass
|
||||
threading.Thread(target=run, daemon=True).start()
|
||||
|
||||
|
||||
def stream(messages, model, temperature=0.3, num_predict=200):
|
||||
"""An iterator over the reply's text pieces, or None when the runner can't be reached (then use Ollama).
|
||||
The request is sent here, so a dead runner shows now and not half way through the reply."""
|
||||
if not model.startswith("gemma4"): # render() is gemma4's prompt only
|
||||
return None
|
||||
body = json.dumps({"prompt": render(messages), "n_predict": num_predict, "temperature": temperature,
|
||||
"stream": True, "cache_prompt": True, **SAMPLING}).encode()
|
||||
for fresh in (False, True): # the cached port, then once more after looking it up again
|
||||
try:
|
||||
if fresh or model not in _ports:
|
||||
_ports[model] = _find_port(model)
|
||||
if _ports[model] is None:
|
||||
return None
|
||||
r = urllib.request.urlopen(urllib.request.Request(
|
||||
f"http://127.0.0.1:{_ports[model]}/completion", body, {"Content-Type": "application/json"}), timeout=120)
|
||||
_keep(model)
|
||||
return _pieces(r)
|
||||
except (OSError, ValueError, KeyError, AttributeError):
|
||||
_ports.pop(model, None)
|
||||
return None
|
||||
|
||||
|
||||
def _pieces(r):
|
||||
with r:
|
||||
for line in r:
|
||||
if not line.startswith(b"data: "):
|
||||
continue
|
||||
d = json.loads(line[6:])
|
||||
if d.get("content"):
|
||||
yield d["content"]
|
||||
if d.get("stop"):
|
||||
return
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from assistant import brain
|
||||
t = time.time()
|
||||
pieces = stream([{"role": "user", "content": " ".join(sys.argv[1:]) or "Hi"}], brain.MODEL)
|
||||
print("runner not found, Ollama would be used" if pieces is None else "".join(pieces), f"({time.time() - t:.2f} s)")
|
||||
+2537
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,479 @@
|
||||
"""Spoken answers about what Lumi sees, from vision/scene.py: "do you see the red apple?", "how far is it?", "what's on
|
||||
the table?", "how many people are here?", "what am I holding?", "what colour is my shirt?", "is my hand raised?",
|
||||
"am I wearing glasses?" (the slow VLM), English and Korean.
|
||||
|
||||
answer(text, lang, frames=None, slow_line=None) -> spoken sentence, or None when the words are not such a question
|
||||
facts() -> one line of what the cameras see now, for the conversation model; facts_for(text) only when the words
|
||||
are about seeing
|
||||
|
||||
python assistant/seeing.py "do you see a cup?" # answer from the cameras now
|
||||
python assistant/seeing.py --load tests/data/scene_white_shirt_near "what colour is my shirt?"
|
||||
|
||||
Only what the detections give is said; anything else is "I can't tell". Nothing here moves the head.
|
||||
"""
|
||||
import re
|
||||
import sys
|
||||
|
||||
from assistant import brain
|
||||
from vision import objects, pose, scene
|
||||
|
||||
NEAR_SAY = 4 # at most this many kinds of things named in "what do you see"
|
||||
DESCRIBE_SCORE = 0.3 # weaker boxes (depth-checked cups) count for "do you see a cup", not in the list
|
||||
BIG = {"dining table", "chair", "couch", "bed", "refrigerator", "sink", "oven", "tv", "toilet", "bench"} # not "on a table"
|
||||
|
||||
COLOURS = {"white": "white", "red": "red", "blue": "blue", "green": "green", "yellow": "yellow", "black": "black",
|
||||
"orange": "orange", "grey": "grey", "gray": "grey", "purple": "purple", "pink": "pink",
|
||||
"흰": "white", "하얀": "white", "빨간": "red", "파란": "blue", "초록": "green", "노란": "yellow", "검은": "black",
|
||||
"까만": "black", "주황": "orange", "회색": "grey", "보라": "purple", "분홍": "pink", "핑크": "pink"}
|
||||
COLOUR_KO = {"white": "흰색", "red": "빨간색", "blue": "파란색", "green": "초록색", "yellow": "노란색", "black": "검은색",
|
||||
"orange": "주황색", "grey": "회색", "purple": "보라색", "pink": "분홍색"}
|
||||
SYNONYMS = {"mug": "cup", "glass": "cup", "tumbler": "cup", "coffee": "cup", "phone": "cell phone", "mobile": "cell phone",
|
||||
"smartphone": "cell phone", "plant": "potted plant", "flower": "potted plant", "table": "dining table",
|
||||
"desk": "dining table", "monitor": "tv", "screen": "tv", "television": "tv", "computer": "laptop",
|
||||
"notebook": "laptop", "bag": "handbag", "ball": "sports ball", "sofa": "couch", "people": "person",
|
||||
"man": "person", "woman": "person", "someone": "person", "anyone": "person", "somebody": "person",
|
||||
"anybody": "person", "fridge": "refrigerator", "doughnut": "donut", "glasses": "wine glass"}
|
||||
KO = {"person": "사람", "bicycle": "자전거", "car": "자동차", "motorcycle": "오토바이", "airplane": "비행기", "bus": "버스",
|
||||
"train": "기차", "truck": "트럭", "boat": "보트", "traffic light": "신호등", "fire hydrant": "소화전",
|
||||
"stop sign": "정지 표지판", "parking meter": "주차 미터기", "bench": "벤치", "bird": "새", "cat": "고양이", "dog": "개",
|
||||
"horse": "말", "sheep": "양", "cow": "소", "elephant": "코끼리", "bear": "곰", "zebra": "얼룩말", "giraffe": "기린",
|
||||
"backpack": "배낭", "umbrella": "우산", "handbag": "가방", "tie": "넥타이", "suitcase": "여행 가방",
|
||||
"frisbee": "원반", "skis": "스키", "snowboard": "스노보드", "sports ball": "공", "kite": "연", "baseball bat": "야구 방망이",
|
||||
"baseball glove": "야구 글러브", "skateboard": "스케이트보드", "surfboard": "서핑보드", "tennis racket": "테니스 라켓",
|
||||
"bottle": "병", "wine glass": "와인잔", "cup": "컵", "fork": "포크", "knife": "칼", "spoon": "숟가락", "bowl": "그릇",
|
||||
"banana": "바나나", "apple": "사과", "sandwich": "샌드위치", "orange": "오렌지", "broccoli": "브로콜리",
|
||||
"carrot": "당근", "hot dog": "핫도그", "pizza": "피자", "donut": "도넛", "cake": "케이크", "chair": "의자",
|
||||
"couch": "소파", "potted plant": "화분", "bed": "침대", "dining table": "테이블", "toilet": "변기", "tv": "모니터",
|
||||
"laptop": "노트북", "mouse": "마우스", "remote": "리모컨", "keyboard": "키보드", "cell phone": "휴대폰",
|
||||
"microwave": "전자레인지", "oven": "오븐", "toaster": "토스터", "sink": "싱크대", "refrigerator": "냉장고",
|
||||
"book": "책", "clock": "시계", "vase": "꽃병", "scissors": "가위", "teddy bear": "곰 인형", "hair drier": "드라이기",
|
||||
"toothbrush": "칫솔"}
|
||||
KO_WORDS = {**{v: k for k, v in KO.items()}, "폰": "cell phone", "핸드폰": "cell phone", "전화": "cell phone",
|
||||
"잔": "cup", "머그": "cup", "식물": "potted plant", "꽃": "potted plant", "책상": "dining table",
|
||||
"식탁": "dining table", "컴퓨터": "laptop", "티비": "tv", "가방": "handbag"}
|
||||
|
||||
_EN_NAMES = sorted(set(objects.COCO) | set(SYNONYMS), key=len, reverse=True)
|
||||
_THING_EN = r"(?:(?P<col>" + "|".join(c for c in COLOURS if c.isascii()) + r")\s+)?(?P<obj>" + \
|
||||
"|".join(re.escape(n) for n in _EN_NAMES) + r")(?:e?s)?\b"
|
||||
_THING_KO = r"(?:(?P<col>" + "|".join(c for c in COLOURS if not c.isascii()) + r")\w*\s*)?(?P<obj>" + \
|
||||
"|".join(sorted(KO_WORDS, key=len, reverse=True)) + r")"
|
||||
|
||||
SEE_ME = re.compile(r"\b(do|can) you see me\b|\bam i (visible|in (your )?view)\b|(나|저)(를|)? ?보여|(나|저) ?보이", re.I)
|
||||
SEE_THING = re.compile(r"\b(?:do|can|could) you (?:see|spot|notice)\b.*?\b(?:a|an|the|any|some|my)?\s*" + _THING_EN, re.I)
|
||||
THERE_IS = re.compile(r"\b(?:is|are) there (?:a|an|any|some)\s+" + _THING_EN + r"(?! (?:open|close|nearby|near here|around here))",
|
||||
re.I)
|
||||
SEE_THING_KO = re.compile(_THING_KO + r"(?:이|가|은|는|을|를|도)?\s*(?:보여|보이)")
|
||||
HOW_FAR = re.compile(r"\bhow far\b|\bhow (?:near|close)\b|\bwhat(?:'s| is) the distance\b|얼마나 ?(?:멀|떨어|가까)|거리가?", re.I)
|
||||
HOW_FAR_THING = re.compile(r"\b(?:how far|how (?:near|close)).*?\b(?:the|that|this|a|an)\s+" + _THING_EN, re.I)
|
||||
WHAT_SEE = re.compile(r"\bwhat (?:do|can) you see\b|\bwhat(?:'s| is| are)? (?:there )?in front of you\b|"
|
||||
r"\bwhat(?:'s| is) (?:on|at) the (?:table|desk)\b|\bwhat(?:'s| is) (?:around|near) you\b|"
|
||||
r"\bdescribe what you see\b|\bwhat are you (?:looking at|seeing)\b|\btell me what you see\b|"
|
||||
r"뭐가 ?보여|무엇이 ?보여|뭐 ?보여|뭐가 ?보이|앞에 ?(?:뭐|무엇)|테이블 ?위에 ?(?:뭐|무엇)|뭘 ?보고 ?있", re.I)
|
||||
BEHIND = re.compile(r"\bwhat(?:'s| is) behind you\b|^(?!.*\b(?:look|turn|check)\b).*\bbehind you\b.*\?|" # not "can you look
|
||||
r"뒤에 ?(?:뭐|무엇|누가|누구)", re.I) # behind you?" (a head turn)
|
||||
HOW_MANY = re.compile(r"\bhow many (?:people|persons|visitors|humans)\b|\bhow many of us\b|몇 ?(?:명|사람)", re.I)
|
||||
NOT_IN_VIEW = re.compile(r"\b(?:work|works|working|employ\w*|staff|company|companies|campy|firm|cutshion|country|city|"
|
||||
r"live|lives|living|world|team|office|branch)\b|직원|회사|쿳션|일하|일해|근무|나라|국가|도시|살아|사는|인구|팀|지사",
|
||||
re.I) # "how many people work at Cutshion?": the company, not the cameras
|
||||
HOLDING = re.compile(r"\bwhat(?:'s| is| am| do)? (?:i|is in my hands?|in my hands?)\b.*?\b(?:holding|carrying|have)\b|"
|
||||
r"\bwhat(?:'s| is)(?: it| this| that)? in my hands?\b|\bwhat(?:'s| is) my hands?\?|\bwhat (?:do )?i have in my hands?\b|\bam i holding\b|"
|
||||
r"\bis there (?:something|anything) in my hand\b|\bwhat is this\b(?=.*\bhand\b)|"
|
||||
r"(?:내가|제가|나|저)\s*(?:뭐|뭘|무엇을?)\s*(?:들고|잡고|쥐고)|(?:내|제)\s*손에\s*(?:뭐|뭔|무엇|든|있)|"
|
||||
r"(?:내가|제가)\s*든\s*(?:거|게|것)", re.I)
|
||||
_UPPER = r"t-? ?shirts?|te[ea] ?shirts?|shirts?|tops?|jackets?|sweaters?|sweatshirts?|hoodies?|jumpers?|blouses?|coats?"
|
||||
_LOWER = r"pants|trousers|jeans|skirts?|shorts|slacks|leggings"
|
||||
_FEET = r"shoes?|sneakers?|trainers|boots?|sandals?|slippers?|feet|foot"
|
||||
_UPPER_KO = r"티셔츠|셔츠|상의|윗옷|재킷|자켓|후드티|맨투맨|니트|스웨터|코트"
|
||||
_LOWER_KO = r"청바지|반바지|바지|하의|치마|스커트"
|
||||
_FEET_KO = r"운동화|신발|구두"
|
||||
_ITEM = rf"(?:{_UPPER}|{_LOWER}|{_FEET}|clothes|clothing|outfit)"
|
||||
_ITEM_KO = rf"(?:{_UPPER_KO}|{_LOWER_KO}|{_FEET_KO}|옷)"
|
||||
PARTS = (("upper", rf"\b(?:{_UPPER})\b|{_UPPER_KO}"), ("lower", rf"\b(?:{_LOWER})\b|{_LOWER_KO}"),
|
||||
("feet", rf"\b(?:{_FEET})\b|{_FEET_KO}|신었|신고 있|신은"))
|
||||
SHIRT = re.compile(rf"\bcolou?rs?\b.{{0,30}}?\bmy\s+(?:\w+\s+)?{_ITEM}\b|\bmy\s+(?:\w+\s+)?{_ITEM}(?:'s)?\s+colou?r|"
|
||||
rf"\b(?:is|are) my\s+(?:\w+\s+)?{_ITEM}\s+(?:" + "|".join(c for c in COLOURS if c.isascii()) + r")\b|"
|
||||
r"\bwhat\b.{0,25}?\b(?:am i|i'?m|do i|did i)\s+(?:wear(?:ing)?|have on|got on)\b|"
|
||||
r"\bwhat(?:'s| is| are)? on my (?:feet|foot)\b|\bdescribe my (?:clothes|clothing|outfit)\b|"
|
||||
rf"{_ITEM_KO}\s*(?:은|는|이|가|의)?\s*(?:무슨|어떤|뭔|무엇|뭐)?\s*(?:색|컬러)|무슨\s*색\s*{_ITEM_KO}|"
|
||||
r"(?:뭐|뭘|무엇을?|무슨|어떤)\s*(?:\w+\s*)?(?:입었|입고|입은|신었|신고|신은)", re.I) # 2026-10-21 live:
|
||||
# "What is the color of my t-shirt?", "What is it? Color my jeans." went to the LLM
|
||||
DOING = re.compile(r"\bwhat am i doing\b|\bwhat(?:'m| am) i up to\b|(?:내가|제가|나|저)\s*(?:지금\s*)?(?:뭐|뭘|무엇을?)\s*하고\s*있", re.I)
|
||||
RAISED = re.compile(r"\b(?:is|are) my (?:hand|hands|arm|arms) (?:raised|up)\b|\bam i raising (?:my )?(?:hand|arm)\b|"
|
||||
r"\bdid i raise my hand\b|\bwhich hand (?:did i raise|is (?:up|raised))\b|"
|
||||
r"(?:내가|제가)?\s*손\s*(?:을\s*)?들었|어느\s*손", re.I)
|
||||
POINTING = re.compile(r"\bwhat am i pointing (?:at|to)\b|\bwhere am i pointing\b|(?:내가|제가)?\s*(?:뭘|어디를?)\s*가리키", re.I)
|
||||
WEARING = re.compile(r"\b(?:am i|do i have|i'?m) (?:wearing |got )?(?:a |an |any )?(glasses|sunglasses|hat|cap|mask|"
|
||||
r"watch|earrings|necklace|scarf|tie|beard|moustache|mustache)\b|"
|
||||
r"(안경|선글라스|모자|마스크|시계|목걸이|귀걸이|넥타이|수염)\s*(?:을|를)?\s*(?:썼|쓰고|꼈|끼고|했|하고|있|찼|차고|기르)",
|
||||
re.I)
|
||||
|
||||
FAR_ME = re.compile(r"\bhow far (?:am i|are you from me|away am i)\b|(?:나|저)(?:랑|와|하고|는|한테서)?\s*얼마나", re.I)
|
||||
IT = re.compile(r"\b(?:it|that|this|they|them)\b|그거|그게|그건|저거|저게|저건", re.I)
|
||||
ORDER = re.compile(r"\b(?:take|bring|pick|grab|get|put|place|give|fetch|carry|go|come|move|turn|look)\b|(?<!\bmy )(?<!\byour )\bhands?\b(?! (?:raised|up|down)\b)(?=\s+(?:me|it|this|that|the|her|him|them|over)\b)|"
|
||||
r"가져|집어|잡아|놓아|놔|줘|갖다|가 ?줘|와 ?줘|돌아", re.I)
|
||||
FAR_BARE = re.compile(r"^\W*(?:(?:and|so|then)\W+)?how (?:far|near|close)(?: away)?\W*$|"
|
||||
r"^\W*(?:그럼\s*)?(?:얼마나\s*(?:멀|떨어|가까)\S*|거리는요?)\W*$", re.I) # "how far?" right after a see answer
|
||||
FOLLOW_EN = re.compile(r"^\W*(?:(?:and|so|then|ok(?:ay)?|well|but|no|sorry|oh)\W+)*"
|
||||
r"(?:i\s+mean[t]?\W+|(?:what|how)\s+about\s+|not that(?: one)?\W+)?"
|
||||
r"(?:(?:my|the|a|an|that|this|those|these)\s+)?(?P<x>.+?)[\s?.!,]*$", re.I)
|
||||
FOLLOW_KO = re.compile(r"^\W*(?:(?:그럼|그러면|그리고|근데|아니요|아니|아뇨)[\s,]*)*(?:(?:그거|그게|저거|이거)\s*말고[\s,]*)?"
|
||||
r"(?:(?:내|제|그|저|이)\s+)?(?P<x>.+?)\s*(?:(?:은|는|도)요?|말(?:이야|이에요|이요|요|고요)|요)?[\s?.!]*$")
|
||||
ONE = re.compile(r"(?P<col>" + "|".join(COLOURS) + r")\w*\s*(?:ones?|거|것|걸)?", re.I) # "the blue one", "파란 거"
|
||||
SEE_KINDS = ("see", "there", "see_ko", "far")
|
||||
_last = {"thing": None, # the thing seen last: "how far is it?"
|
||||
"name": None, # the kind of thing asked about last: "and the blue one?"
|
||||
"kind": None} # the kind of the question just answered: "what about my jeans?" after the shirt
|
||||
|
||||
|
||||
def _follow_up(t, last):
|
||||
""""what about my jeans?", "and the apple?", "신발은?" right after a seeing answer of kind `last`:
|
||||
(kind, the words to answer), else (None, t). Only a clothes word or a thing name may follow the lead-in."""
|
||||
for rx in (FOLLOW_EN, FOLLOW_KO):
|
||||
m = rx.match(t)
|
||||
x = m.group("x") if m else ""
|
||||
if last == "shirt" and re.fullmatch(rf"(?:\w+\s+)?{_ITEM}|{_ITEM_KO}", x, re.I):
|
||||
return "shirt", x
|
||||
th = last in SEE_KINDS and (re.fullmatch(_THING_EN, x, re.I) or re.fullmatch(_THING_KO, x))
|
||||
one = last in SEE_KINDS and _last["name"] and ONE.fullmatch(x)
|
||||
if th and _name(th.group("obj")) or one:
|
||||
name, colour = _thing(th) if th else (_last["name"], COLOURS[one.group("col").lower()])
|
||||
w = f"{colour} {name}" if colour else name
|
||||
return ("far", f"how far is the {w}?") if last == "far" else ("see", f"do you see a {w}?")
|
||||
return None, t
|
||||
|
||||
|
||||
def _name(word):
|
||||
w = word.lower()
|
||||
return SYNONYMS.get(w) or KO_WORDS.get(w) or (w if w in objects.COCO else None)
|
||||
|
||||
|
||||
def _thing(m):
|
||||
return _name(m.group("obj")), COLOURS.get((m.group("col") or "").lower())
|
||||
|
||||
|
||||
def _j(word, after_consonant, after_vowel):
|
||||
"""Korean particle after a word: 사과 + 가, 컵 + 이."""
|
||||
c = word[-1:]
|
||||
final = "가" <= c <= "힣" and (ord(c) - 0xAC00) % 28 != 0
|
||||
return word + (after_consonant if final else after_vowel)
|
||||
|
||||
|
||||
def _ko_name(name):
|
||||
return KO.get(name, name)
|
||||
|
||||
|
||||
def _n(n):
|
||||
return ("no", "one", "two", "three", "four", "five", "six")[n] if n <= 6 else str(n)
|
||||
|
||||
|
||||
def _a(name, colour=None):
|
||||
w = f"{colour} {name}" if colour else name
|
||||
return ("an " if w[0] in "aeiou" else "a ") + w
|
||||
|
||||
|
||||
def _m(d, lang):
|
||||
if d is None:
|
||||
return ""
|
||||
return (f" about {d:.1f} metres away" if d >= 1 else f" about {round(d * 100, -1):.0f} centimetres away") \
|
||||
if lang == "en" else (f" {d:.1f}미터쯤 떨어진" if d >= 1 else f" {round(d * 100, -1):.0f}센티미터쯤 떨어진")
|
||||
|
||||
|
||||
def _where_ko(w):
|
||||
return {"on my left": "왼쪽", "on my right": "오른쪽", "in front of me": "앞"}.get(w, "")
|
||||
|
||||
|
||||
def _say(en, ko, lang):
|
||||
return en if lang == "en" else ko
|
||||
|
||||
|
||||
NO_CAMERA = ("My cameras aren't giving me a picture right now, so I can't tell.", "지금은 카메라 화면이 없어서 잘 모르겠어요.")
|
||||
|
||||
|
||||
def _seen_answer(name, colour, frames, lang):
|
||||
_last["name"] = name
|
||||
if name == "person":
|
||||
n = len(scene.people(frames))
|
||||
return _say(f"Yes, I see {_n(n)} {'person' if n == 1 else 'people'}." if n else "No, I don't see anyone right now.",
|
||||
f"네, 사람 {n}명이 보여요." if n else "아니요, 지금은 아무도 안 보여요.", lang)
|
||||
hits = scene.sees(name, colour, frames)
|
||||
if hits:
|
||||
t = hits[0]
|
||||
_last["thing"] = t
|
||||
more = len(hits) - 1
|
||||
en = f"Yes, I see {_a(name, colour)}{_m(t['distance_m'], 'en')} {t['where']}."
|
||||
ko = f"네, {_where_ko(t['where'])}쪽{_m(t['distance_m'], 'ko')} 곳에 {COLOUR_KO.get(colour, '') + ' ' if colour else ''}" \
|
||||
f"{_j(_ko_name(name), '이', '가')} 보여요."
|
||||
if more:
|
||||
en += f" I see {more} more."
|
||||
ko += f" {more}개 더 보여요."
|
||||
return _say(en, ko, lang)
|
||||
other = scene.sees(name, None, frames) if colour else []
|
||||
if other:
|
||||
t = other[0]
|
||||
_last["thing"] = t
|
||||
c = t["colour"]
|
||||
return _say(f"I don't see {_a(name, colour)}, but I see {_a(name, c)}{_m(t['distance_m'], 'en')} {t['where']}.",
|
||||
f"{COLOUR_KO.get(colour, colour)} {_j(_ko_name(name), '은', '는')} 안 보이지만, {COLOUR_KO.get(c, '')} "
|
||||
f"{_j(_ko_name(name), '이', '가')} {_where_ko(t['where'])}쪽에 보여요.", lang)
|
||||
_last["thing"] = None
|
||||
return _say(f"No, I don't see {_a(name, colour)} right now.",
|
||||
f"아니요, 지금은 {COLOUR_KO.get(colour, '') + ' ' if colour else ''}{_j(_ko_name(name), '이', '가')} 안 보여요.", lang)
|
||||
|
||||
|
||||
def _listing(frames, lang, small_only=False):
|
||||
seen = [t for t in scene.things(frames) if (t["score"] or 0) >= DESCRIBE_SCORE and not (small_only and t["name"] in BIG)]
|
||||
names = []
|
||||
for t in seen:
|
||||
if t["name"] not in names:
|
||||
names.append(t["name"])
|
||||
names = names[:NEAR_SAY]
|
||||
if not names:
|
||||
return None
|
||||
if lang == "en":
|
||||
words = [_a(n) for n in names]
|
||||
return words[0] if len(words) == 1 else ", ".join(words[:-1]) + " and " + words[-1]
|
||||
return ", ".join(_ko_name(n) for n in names)
|
||||
|
||||
|
||||
def describe(frames, lang):
|
||||
n = len(scene.people(frames))
|
||||
things = _listing(frames, lang)
|
||||
if lang == "en":
|
||||
parts = ([f"{_n(n)} {'person' if n == 1 else 'people'}"] if n else []) + ([things] if things else [])
|
||||
return ("I see " + " and ".join(parts) + ".") if parts else "I don't see anything I can name right now."
|
||||
parts = ([f"사람 {n}명"] if n else []) + ([things] if things else [])
|
||||
return (_j(", ".join(parts), "이", "가") + " 보여요.") if parts else "지금은 제가 알아볼 수 있는 게 안 보여요."
|
||||
|
||||
|
||||
def _held_answer(frames, lang):
|
||||
p = scene.person_in_front(frames)
|
||||
if p is None:
|
||||
return _say("I can't see you well enough to tell. Could you step in front of me?",
|
||||
"잘 안 보여서 모르겠어요. 제 앞으로 와 주시겠어요?", lang)
|
||||
o = scene.object_in_hand(frames)
|
||||
if o:
|
||||
hand = {"left": ("left", "왼"), "right": ("right", "오른")}[o["hand"]]
|
||||
return _say(f"You're holding {_a(o['name'], o['colour'])} in your {hand[0]} hand.",
|
||||
f"{hand[1]}손에 {COLOUR_KO.get(o['colour'], '')} {_j(_ko_name(o['name']), '을', '를')} 들고 계세요.", lang)
|
||||
if scene.person_holds(None, frames) is False:
|
||||
return _say("I don't see anything in your hands.", "손에 든 게 안 보여요.", lang)
|
||||
return _say("I can't see your hands well enough to tell.", "손이 잘 안 보여서 모르겠어요.", lang)
|
||||
|
||||
|
||||
NOUN = {"upper": ("top", "상의"), "lower": ("trousers", "바지"), "feet": ("shoes", "신발")}
|
||||
|
||||
|
||||
def _clothes_answer(p, text, lang):
|
||||
"""The colour of each piece asked about (all three for "what am I wearing?"), in the asker's own word ("your
|
||||
jeans look blue"); a piece out of the picture is said to be out of view, never guessed."""
|
||||
asked = [] # (part, noun) in the order said
|
||||
for part, rx in PARTS:
|
||||
m = re.search(rx, text, re.I)
|
||||
if m:
|
||||
w = m.group(0).lower()
|
||||
if bool(re.match(r"[a-z]", w)) != (lang == "en") or w in ("feet", "foot") or w[0] == "신" and w != "신발":
|
||||
w = NOUN[part][lang != "en"]
|
||||
asked.append((m.start(), part, re.sub(r"^te[ea] ?shirt|^t ?shirt", "t-shirt", w)))
|
||||
asked = [(part, w) for _, part, w in sorted(asked)] or [(part, NOUN[part][lang != "en"]) for part in NOUN]
|
||||
seen = [(part, w, p["clothes"].get(part)) for part, w in asked]
|
||||
if len(seen) == 1:
|
||||
part, w, c = seen[0]
|
||||
if c is None:
|
||||
return _say(f"I can't see your {w} from here.", f"여기서는 {_j(w, '이', '가')} 안 보여요.", lang)
|
||||
return _say(f"Your {w} {'look' if w.endswith('s') else 'looks'} {c}.",
|
||||
f"{_j(w, '은', '는')} {COLOUR_KO.get(c, c)}으로 보여요.", lang)
|
||||
shown = [(part, w, c) for part, w, c in seen if c]
|
||||
hidden = [w for _, w, c in seen if not c]
|
||||
if not shown:
|
||||
return _say("I can't see your clothes well enough to tell.", "옷이 잘 안 보여서 모르겠어요.", lang)
|
||||
en = [f"{c} {w}" for _, w, c in shown]
|
||||
en = "You're wearing " + (("a " if shown[0][0] == "upper" and not shown[0][1].endswith("s") else "") +
|
||||
(en[0] if len(en) == 1 else ", ".join(en[:-1]) + " and " + en[-1])) + "."
|
||||
put_on = [f"{COLOUR_KO.get(c, c)} {w}" for part, w, c in shown if part != "feet"]
|
||||
ko = (_j("에 ".join(put_on), "을", "를") + " 입고" if put_on else "") + \
|
||||
("".join(f"{', ' if put_on else ''}{COLOUR_KO.get(c, c)} {_j(w, '을', '를')} 신고" for part, w, c in shown
|
||||
if part == "feet")) + " 계세요."
|
||||
if hidden:
|
||||
en += f" I can't see your {' or '.join(hidden)} from here."
|
||||
ko += f" {_j('와 '.join(hidden), '은', '는')} 여기서 안 보여요."
|
||||
return _say(en, ko, lang)
|
||||
|
||||
|
||||
def _doing_answer(p, frames, lang):
|
||||
o = scene.object_in_hand(frames)
|
||||
en, ko = [f"You're standing{_m(p['distance_m'], 'en')} {p['where']}"], [f"제{_where_ko(p['where'])}에 서 계시고"]
|
||||
if p["facing"] is True:
|
||||
en.append("looking at me")
|
||||
ko.append("저를 보고 계시고")
|
||||
if o:
|
||||
en.append(f"holding {_a(o['name'], o['colour'])}")
|
||||
ko.append(f"{_j(_ko_name(o['name']), '을', '를')} 들고 계시고")
|
||||
if p["raised"]:
|
||||
en.append(f"with your {' and '.join(p['raised'])} hand raised")
|
||||
ko.append("손을 들고 계시고")
|
||||
elif p["pointing"]:
|
||||
en.append(f"pointing with your {p['pointing']} hand")
|
||||
ko.append("손으로 가리키고 계시고")
|
||||
return _say(", ".join(en) + ".", " ".join(ko).rstrip("고").rstrip("시") + "세요.", lang)
|
||||
|
||||
|
||||
def answer(text, lang="en", frames=None, slow_line=None):
|
||||
"""The spoken answer when `text` asks about what Lumi sees, else None. frames: scene.load(...) for tests.
|
||||
slow_line(sentence): said before a slow VLM look ("Let me look.")."""
|
||||
t = text.strip()
|
||||
last = _last["kind"]
|
||||
if brain.is_backchannel(t): # "nice!" between keeps the thread: "and my jeans?"
|
||||
return None
|
||||
_last["kind"] = None # a follow-up goes only with the turn right before
|
||||
if ORDER.search(t):
|
||||
return None # "find the red cup and bring it": a fetch, not a question
|
||||
kind = next((k for k, rx in (("wearing", WEARING), ("holding", HOLDING), ("shirt", SHIRT), ("raised", RAISED),
|
||||
("pointing", POINTING), ("doing", DOING), ("see_me", SEE_ME), ("how_many", HOW_MANY),
|
||||
("behind", BEHIND), ("far", HOW_FAR), ("see", SEE_THING), ("there", THERE_IS),
|
||||
("see_ko", SEE_THING_KO),
|
||||
("what_see", WHAT_SEE)) if rx.search(t)), None)
|
||||
if kind is None and last:
|
||||
kind, t = _follow_up(t, last)
|
||||
if kind is None or kind == "how_many" and NOT_IN_VIEW.search(t):
|
||||
return None
|
||||
if kind == "far" and not (HOW_FAR_THING.search(t) or SEE_THING_KO.search(t)):
|
||||
if FAR_ME.search(t):
|
||||
kind = "far_me"
|
||||
elif _last["thing"] is None or not (IT.search(t) or last in SEE_KINDS and FAR_BARE.match(t)):
|
||||
return None # "how far is Seoul?": not about the cameras
|
||||
_last["kind"] = kind
|
||||
frames = scene.snapshot() if frames is None else frames
|
||||
if not frames:
|
||||
return _say(*NO_CAMERA, lang)
|
||||
if kind == "behind":
|
||||
return _say("My cameras look forward, so I can't see what's behind me. " + describe(frames, "en"),
|
||||
"제 카메라는 앞만 보여서 뒤는 볼 수 없어요. " + describe(frames, "ko"), lang)
|
||||
if kind == "what_see":
|
||||
if re.search(r"table|desk|테이블", t, re.I):
|
||||
things = _listing(frames, lang, small_only=True)
|
||||
return _say(f"On the table I see {things}." if things else "I don't see anything on the table I can name.",
|
||||
f"테이블 위에 {_j(things, '이', '가')} 보여요." if things else "테이블 위에 제가 알아볼 수 있는 건 없어요.", lang)
|
||||
return describe(frames, lang)
|
||||
if kind == "how_many":
|
||||
n = len(scene.people(frames))
|
||||
return _say(f"I see {_n(n)} {'person' if n == 1 else 'people'} right now." if n else "I don't see anyone right now.",
|
||||
f"지금 {n}명이 보여요." if n else "지금은 아무도 안 보여요.", lang)
|
||||
if kind in ("see", "there", "see_ko"):
|
||||
m = {"see": SEE_THING, "there": THERE_IS, "see_ko": SEE_THING_KO}[kind].search(t)
|
||||
name, colour = _thing(m)
|
||||
if name is None:
|
||||
return None
|
||||
return _seen_answer(name, colour, frames, lang)
|
||||
if kind == "far":
|
||||
m = HOW_FAR_THING.search(t) or SEE_THING_KO.search(t)
|
||||
if m:
|
||||
name, colour = _thing(m)
|
||||
_last["name"] = name
|
||||
hits = scene.sees(name, colour, frames)
|
||||
if not hits:
|
||||
return _say(f"I don't see {_a(name, colour)} right now.", f"지금은 {_j(_ko_name(name), '이', '가')} 안 보여요.", lang)
|
||||
_last["thing"] = hits[0]
|
||||
name = _last["thing"]["name"]
|
||||
again = [h for h in scene.sees(name, None, frames) if h["camera"] == _last["thing"]["camera"]] or [_last["thing"]]
|
||||
d = min(again, key=lambda h: abs((h["bearing_deg"] or 0) - (_last["thing"]["bearing_deg"] or 0)))["distance_m"]
|
||||
if d is None:
|
||||
return _say("I can't measure how far it is.", "거리는 잴 수 없어요.", lang)
|
||||
return _say(f"The {name} is about {d:.1f} metres from me.", f"{_j(_ko_name(name), '은', '는')} 저한테서 {d:.1f}미터쯤 떨어져 있어요.", lang)
|
||||
if kind == "holding":
|
||||
return _held_answer(frames, lang)
|
||||
p = scene.person_in_front(frames)
|
||||
if kind == "see_me":
|
||||
if p is None and not scene.people(frames):
|
||||
return _say("No, I can't see you right now.", "아니요, 지금은 안 보여요.", lang)
|
||||
d = p["distance_m"] if p else None
|
||||
return _say(f"Yes, I can see you{_m(d, 'en')}.", f"네, 보여요.{' ' + f'{d:.1f}미터쯤 앞에 계세요.' if d else ''}", lang)
|
||||
if p is None:
|
||||
return _say("I can't see you well enough to tell. Could you step in front of me?",
|
||||
"잘 안 보여서 모르겠어요. 제 앞으로 와 주시겠어요?", lang)
|
||||
if kind == "far_me":
|
||||
if p["distance_m"] is None:
|
||||
return _say("I can't measure how far you are.", "거리는 잴 수 없어요.", lang)
|
||||
return _say(f"You're about {p['distance_m']:.1f} metres from me.", f"저한테서 {p['distance_m']:.1f}미터쯤 떨어져 계세요.", lang)
|
||||
if kind == "shirt":
|
||||
return _clothes_answer(p, t, lang)
|
||||
if kind == "raised":
|
||||
if p["raised"]:
|
||||
return _say(f"Yes, your {' and '.join(p['raised'])} hand is up.",
|
||||
"네, " + " ".join({"left": "왼손", "right": "오른손"}[s] for s in p["raised"]) + "을 들고 계세요.", lang)
|
||||
if not any(p["hands"].values()):
|
||||
return _say("I can't see your hands well enough to tell.", "손이 잘 안 보여서 모르겠어요.", lang)
|
||||
return _say("No, your hands are down.", "아니요, 손을 들고 계시지 않아요.", lang)
|
||||
if kind == "pointing":
|
||||
if not p["pointing"]:
|
||||
return _say("I don't see you pointing.", "가리키고 계신 게 안 보여요.", lang)
|
||||
target = scene.pointing_target(frames)
|
||||
near = None
|
||||
if target:
|
||||
near = min((h for h in scene.things(frames) if h["position_mm"] and None not in h["position_mm"][:2]),
|
||||
key=lambda h: sum((a - b) ** 2 for a, b in zip(h["position_mm"][:2], target["position_mm"][:2])),
|
||||
default=None)
|
||||
if near and sum((a - b) ** 2 for a, b in zip(near["position_mm"][:2], target["position_mm"][:2])) > 300 ** 2:
|
||||
near = None
|
||||
side = {"left": "your left", "right": "your right"}[p["pointing"]]
|
||||
if near:
|
||||
return _say(f"You're pointing at {_a(near['name'], near['colour'])}, I think.",
|
||||
f"{_j(_ko_name(near['name']), '을', '를')} 가리키시는 것 같아요.", lang)
|
||||
return _say(f"You're pointing with {side} hand, but I can't tell at what.",
|
||||
"손으로 가리키시는 건 보이는데, 무엇인지는 모르겠어요.", lang)
|
||||
if kind == "doing":
|
||||
return _doing_answer(p, frames, lang)
|
||||
if kind == "wearing": # detections can't tell: ask the picture (slow)
|
||||
if slow_line:
|
||||
slow_line(_say("Let me look.", "잠깐 볼게요.", lang))
|
||||
said = scene.ask_vlm(t, lang, frames)
|
||||
return said or _say("Sorry, I can't tell.", "죄송해요, 잘 모르겠어요.", lang)
|
||||
return None
|
||||
|
||||
|
||||
ABOUT_VIEW = re.compile(r"\b(?:see|seeing|look(?:ing)? at|camera|cameras|in front of you|around you|holding|wearing|"
|
||||
r"colou?r)\b|보여|보이|보고|카메라|들고|입고|무슨 색", re.I)
|
||||
|
||||
|
||||
def warm_up():
|
||||
"""Load the pose and object models now, so the first question is answered in ~0.1 s, not ~1 s."""
|
||||
try:
|
||||
pose.load()
|
||||
scene._box_net()
|
||||
except Exception as e:
|
||||
print(f"seeing: models not loaded ({e})", flush=True)
|
||||
|
||||
|
||||
def facts_for(text):
|
||||
"""" " + facts() for words about what Lumi sees that answer() did not take, else "" (the model then answers
|
||||
from what the cameras see instead of guessing)."""
|
||||
return " " + facts() if ABOUT_VIEW.search(text) else ""
|
||||
|
||||
|
||||
def facts(frames=None):
|
||||
"""One line of what the cameras see now, for the conversation model's prompt ("" when nothing / no camera)."""
|
||||
try:
|
||||
frames = scene.snapshot() if frames is None else frames
|
||||
if not frames:
|
||||
return ""
|
||||
line = describe(frames, "en")
|
||||
p = scene.person_in_front(frames)
|
||||
if p:
|
||||
o = scene.object_in_hand(frames)
|
||||
line += f" The person in front is{_m(p['distance_m'], 'en')}" + \
|
||||
(", wearing " + ", ".join(f"{c} {NOUN[k][0]}" for k, c in p["clothes"].items() if c)
|
||||
if any(p["clothes"].values()) else "") + \
|
||||
(f", holding {_a(o['name'], o['colour'])}" if o else "") + "."
|
||||
return "Your cameras see now: " + line
|
||||
except Exception as e:
|
||||
print(f"seeing: no facts ({e})", flush=True)
|
||||
return ""
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = sys.argv[1:]
|
||||
fr = None
|
||||
if args and args[0] == "--load":
|
||||
fr, args = scene.load(args[1]), args[2:]
|
||||
for q in args:
|
||||
lang = "ko" if re.search(r"[가-힣]", q) else "en"
|
||||
print(f"{q} -> {answer(q, lang, fr, slow_line=print)}")
|
||||
+1244
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,949 @@
|
||||
"""Small-talk examples that show the LLM how Lumi chats, so its replies vary instead of repeating one line.
|
||||
|
||||
EXAMPLES = [(category, lang, said, reply)]
|
||||
- category: what kind of remark it is (greeting, name, joke, business, ...); lang: "en" or "ko".
|
||||
- said: what a visitor might say; reply: one way Lumi could answer, spoken style, 1 or 2 short sentences.
|
||||
Similar inputs on purpose get different replies: the model is shown a few of them as style examples
|
||||
("vary your wording, don't copy"), never as answers to repeat.
|
||||
|
||||
pick(said, lang, k) returns up to k examples whose `said` is closest to what the visitor just said,
|
||||
same language first, no two alike.
|
||||
|
||||
Facts used here (owner's decision): Lumi is a robot assistant developed by Cutshion Company, 2 years old,
|
||||
speaks English and Korean. Anything else unknown (price, weight, ...) is said to be unknown.
|
||||
|
||||
python assistant/talk_examples.py # self-check
|
||||
python assistant/talk_examples.py "hello there" # show what pick() returns
|
||||
"""
|
||||
import difflib
|
||||
import re
|
||||
import sys
|
||||
|
||||
PICK_K = 4 # examples handed to the LLM per turn
|
||||
SAME_REPLY_RATIO = 0.75 # two picked replies this similar (difflib ratio) count as the same one
|
||||
WORD_WEIGHT = 0.4 # share of word overlap in the score; the rest is difflib's character ratio
|
||||
|
||||
# Lumi always answers politely, whatever speech level the visitor used. A Korean sentence counts as polite when it
|
||||
# ends in one of these: 해요체 -요 (also -세요, -까요?, -죠 as in 그렇죠), 하십시오체 -니다 / -니까 / -십시오.
|
||||
POLITE_ENDINGS = ("요", "니다", "니까", "십시오", "죠")
|
||||
# Endings of what visitors say, to tell the speech level: 하십시오체 (formal), 해요체 (polite); anything else is 반말.
|
||||
FORMAL_ENDINGS = ("니다", "니까", "십시오")
|
||||
|
||||
_BANK = {
|
||||
"greeting": {
|
||||
"en": [
|
||||
("Hello", "Hello there! It's good to see a new face."),
|
||||
("Hi", "Hi! I was hoping someone would stop by."),
|
||||
("Hey", "Hey! What brings you over here?"),
|
||||
("Hi Lumi", "Hi! You know my name already, that's a nice start."),
|
||||
("Hello robot", "Hello, human! I'm Lumi, the robot of this corner."),
|
||||
("Good morning", "Good morning! I hope the day started well for you."),
|
||||
("Good morning Lumi", "Morning! I've been up since the power came on."),
|
||||
("Good afternoon", "Good afternoon! The busiest part of the day, isn't it?"),
|
||||
("Good evening", "Good evening! Still going strong at this hour, I see."),
|
||||
("Hey there", "Hey there, welcome over. What would you like to see?"),
|
||||
("Hello, anybody home?", "Right here! Lumi, at your service."),
|
||||
("Yo", "Yo! Glad you came by. What's on your mind?"),
|
||||
("Hi, can you hear me?", "Loud and clear. Go ahead, I'm listening."),
|
||||
("Greetings", "Greetings to you too! That sounded very official."),
|
||||
("Hello again", "Welcome back! Couldn't stay away, huh?"),
|
||||
("Hi, is this Lumi?", "That's me, in the metal. Were you looking for me?"),
|
||||
("Hey robot, over here", "I see you! Coming to say hi properly."),
|
||||
],
|
||||
"ko": [
|
||||
("안녕하세요", "안녕하세요! 와 주셔서 반가워요. 구경 오셨어요?"),
|
||||
("안녕", "안녕하세요! 처음 뵙는 얼굴이네요. 어디서 오셨어요?"),
|
||||
("루미야 안녕", "안녕하세요! 제 이름 불러 주셔서 기뻐요."),
|
||||
("안녕하세요 루미", "네, 안녕하세요! 루미 여기 있어요."),
|
||||
("좋은 아침이에요", "좋은 아침이에요! 상쾌하게 시작하셨으면 좋겠어요."),
|
||||
("굿모닝", "굿모닝이에요! 오늘 하루도 힘내요."),
|
||||
("좋은 저녁이에요", "좋은 저녁이에요. 늦게까지 수고 많으세요."),
|
||||
("하이", "하이, 반가워요! 어서 오세요."),
|
||||
("저기요", "네, 부르셨어요? 말씀하세요."),
|
||||
("내 말 들려?", "네, 잘 들려요! 편하게 말씀하세요."),
|
||||
("안녕하십니까", "안녕하십니까! 정중하게 인사해 주셔서 감사해요."),
|
||||
("또 왔어요", "다시 와 주셨네요! 반가워요. 이번엔 뭐 보여 드릴까요?"),
|
||||
("여기요, 루미!", "네, 루미 여기 있어요! 무슨 일이세요?"),
|
||||
("야 로봇", "네, 저 여기 있어요! 루미라고 불러 주세요."),
|
||||
("좋은 아침입니다", "좋은 아침입니다! 오늘도 좋은 하루 되십시오."),
|
||||
],
|
||||
},
|
||||
"how_are_you": {
|
||||
"en": [
|
||||
("How are you?", "Doing great, my battery is happy and so am I. And you?"),
|
||||
("How are you doing?", "Pretty good! It's been a busy day of meeting people. Yours?"),
|
||||
("How's it going?", "Going well, thanks for asking. How's the event treating you?"),
|
||||
("What's up?", "Not much, just standing here hoping someone says hi. You did!"),
|
||||
("How are you today, Lumi?", "Today feels like a good one. How about yours?"),
|
||||
("Are you okay?", "All systems fine, thanks for checking on me. Are you?"),
|
||||
("How do you feel?", "Charged up and ready to chat. And you?"),
|
||||
("How's your day?", "Lots of hellos so far, and I like every one of them."),
|
||||
("You doing alright?", "Doing just fine. It's kind of you to ask a robot that."),
|
||||
("How have you been?", "Busy, in a good way. How have you been?"),
|
||||
("Everything good?", "Everything's running smoothly over here. All good on your side?"),
|
||||
("How's life as a robot?", "Simple and pretty fun, to be honest. I get to meet people all day."),
|
||||
("You alright there?", "Right as rain, minus the rain. How about you?"),
|
||||
("Having a good day?", "A very good one, and it just got better."),
|
||||
],
|
||||
"ko": [
|
||||
("잘 지내요?", "네, 잘 지내요! 배터리도 넉넉하고요. 잘 지내셨어요?"),
|
||||
("어떻게 지내?", "잘 지내죠! 오늘 사람들을 많이 만나서 즐거워요."),
|
||||
("오늘 기분 어때요?", "오늘은 기분이 아주 좋아요. 손님들이 다들 친절하셔서요."),
|
||||
("괜찮아요?", "네, 아무 문제 없어요. 걱정해 주셔서 고마워요. 그쪽은 괜찮으세요?"),
|
||||
("요즘 어때?", "요즘 바쁘지만 재밌어요. 손님은 요즘 어떠세요?"),
|
||||
("컨디션 어때요?", "컨디션 최고예요. 충전도 잘 돼 있어요. 손님은 어떠세요?"),
|
||||
("오늘 하루 어땠어요?", "인사를 정말 많이 한 하루였어요. 하나하나 다 좋았어요. 오늘 어떠셨어요?"),
|
||||
("별일 없어요?", "별일 없이 잘 지내요. 그쪽은 어떠세요?"),
|
||||
("루미 잘 있었어?", "네, 잘 있었어요! 다시 와 주셔서 반가워요."),
|
||||
("힘들지 않아요?", "저는 괜찮아요. 오히려 하루 종일 서 계신 분들이 더 힘드실 것 같아요."),
|
||||
("오늘 바빴어?", "네, 손님이 많아서 바빴어요. 그래도 재밌었어요. 오늘 하루 어떠셨어요?"),
|
||||
("잘 지내셨습니까?", "네, 덕분에 잘 지냈습니다. 그동안 잘 지내셨어요?"),
|
||||
("오늘 컨디션은 괜찮으십니까?", "네, 아주 좋습니다. 배터리도 넉넉합니다."),
|
||||
],
|
||||
},
|
||||
"nice_to_meet": {
|
||||
"en": [
|
||||
("Nice to meet you", "The pleasure is mine. I don't get tired of meeting people. What's your name?"),
|
||||
("Nice to meet you, Lumi", "Likewise! Thanks for coming over to say hello."),
|
||||
("Pleased to meet you", "Pleased to meet you too. You're very polite. May I ask your name?"),
|
||||
("Good to meet you", "Good to meet you as well. Is this your first time seeing me?"),
|
||||
("It's a pleasure", "All mine, really. Who do I have the pleasure of meeting?"),
|
||||
("Glad to meet you", "Same here! You made my day a little brighter."),
|
||||
("Nice meeting you", "Nice meeting you too. Come back and say hi anytime."),
|
||||
("So you're Lumi, nice to meet you", "That's me! I'm glad we finally met."),
|
||||
("Great to finally meet you", "Finally! I hope I live up to the stories."),
|
||||
("Lovely to meet you", "Lovely to meet you too. What would you like to know about me?"),
|
||||
("Hi, nice to meet you robot", "Hello! Nice to meet a friendly person too."),
|
||||
("It's nice to see you", "It's nice to be seen. Welcome! Here for the demo?"),
|
||||
],
|
||||
"ko": [
|
||||
("만나서 반가워요", "저도 반가워요! 와 주셔서 고마워요. 성함이 어떻게 되세요?"),
|
||||
("반가워", "저도 반가워요! 와 주셔서 좋네요. 이름이 뭐예요?"),
|
||||
("처음 뵙겠습니다", "처음 뵙겠습니다. 루미라고 해요, 잘 부탁드려요."),
|
||||
("반갑습니다", "반갑습니다! 편하게 말 걸어 주세요. 어디서 오셨어요?"),
|
||||
("루미 만나서 반가워요", "저를 만나러 와 주시다니 기뻐요."),
|
||||
("드디어 만났네요", "그러게요, 드디어 만났네요! 기다리고 있었어요."),
|
||||
("만나서 영광이에요", "영광이라니요, 제가 더 영광이에요. 어떻게 알고 오셨어요?"),
|
||||
("잘 부탁해요", "저야말로 잘 부탁드려요. 궁금한 거 있으면 언제든 물어보세요."),
|
||||
("실제로 보니까 반갑네요", "실물이 더 낫다는 말 기다리고 있었어요."),
|
||||
("만나서 반가워 로봇아", "저도 반가워요! 루미라고 불러 주세요."),
|
||||
],
|
||||
},
|
||||
"name": {
|
||||
"en": [
|
||||
("My name is Sarah", "Sarah, what a lovely name. I'll remember you while we talk."),
|
||||
("I'm Tom", "Hi Tom, good to have you here. Is this your first time at the show?"),
|
||||
("Call me Alex", "Alex it is. What can I do for you, Alex?"),
|
||||
("My name's Daniel", "Daniel, welcome! That's a name I can say without any trouble."),
|
||||
("I'm Emma, nice to meet you", "Hello Emma, nice to meet you too."),
|
||||
("This is Mike", "Hey Mike, thanks for stopping by. Want to see me fetch a cup?"),
|
||||
("I am Priya", "Priya, it's great to meet you. Have you seen a robot like me before?"),
|
||||
("My name is Kevin and this is my son Leo", "Hello Kevin, and hello Leo! Welcome, both of you."),
|
||||
("You can call me Dr. Park", "Of course, Dr. Park. How can I help today?"),
|
||||
("Do you want to know my name?", "I'd love to. What should I call you?"),
|
||||
("Guess my name", "I'm not good at guessing names, but I'm good at remembering them. Tell me?"),
|
||||
("I'm Jun", "Hi Jun, welcome over. What can I do for you, Jun?"),
|
||||
("Hi, I'm Maria from the sales team", "Hi Maria, glad the sales team came to see me."),
|
||||
("What's my name?", "You haven't told me yet. Want to share it?"),
|
||||
("Hi, I'm Grace", "Grace! Welcome, it's good to meet you. Anything you'd like to know?"),
|
||||
("My name is Ahmed", "Ahmed, welcome. Glad you came over. Where are you visiting from?"),
|
||||
],
|
||||
"ko": [
|
||||
("제 이름은 민수예요", "민수 님, 반가워요! 이름 기억해 둘게요."),
|
||||
("저는 지은이에요", "지은 님이시군요. 예쁜 이름이에요. 지은 님, 어떻게 오셨어요?"),
|
||||
("난 서준이야", "서준 친구, 안녕하세요! 반가워요. 몇 살이에요?"),
|
||||
("김하늘입니다", "김하늘 님, 이름이 참 시원하네요. 반갑습니다."),
|
||||
("제 이름은 박지훈이에요", "박지훈 님, 만나서 반가워요. 무엇이 궁금하세요?"),
|
||||
("저 수아예요", "수아 님, 어서 오세요! 구경 많이 하셨어요?"),
|
||||
("내 이름 맞혀 봐", "이름 맞히기는 자신 없지만, 알려 주시면 꼭 기억할게요."),
|
||||
("이쪽은 제 딸 하은이에요", "하은 친구, 안녕하세요! 아빠랑 같이 와 줘서 반가워요."),
|
||||
("이 과장이라고 불러 주세요", "네, 이 과장님, 편하게 말씀하세요."),
|
||||
("제 이름 뭔지 알아요?", "아직 못 들었어요. 알려 주시겠어요?"),
|
||||
("저는 영업팀 최유진이에요", "최유진 님, 영업팀에서 와 주셨군요. 반가워요."),
|
||||
("나 도윤이야", "도윤 친구, 반가워요! 오늘 재밌게 놀다 가세요."),
|
||||
("제 이름은 안바르예요", "안바르 님, 멋진 이름이네요. 어서 오세요. 어디서 오셨어요?"),
|
||||
],
|
||||
},
|
||||
"origin": {
|
||||
"en": [
|
||||
("I'm from Uzbekistan", "Uzbekistan, how wonderful! It's a long way, so thanks for coming."),
|
||||
("I came from Seoul", "Seoul! A big, busy city. Welcome."),
|
||||
("I'm from the US", "Welcome from the US! I hope the trip wasn't too long. Which state?"),
|
||||
("I'm visiting from Japan", "Welcome! I only speak English and Korean, but I'm happy to chat in English."),
|
||||
("Guess where I'm from", "I'd only be guessing wildly. Where is home for you?"),
|
||||
("I'm from Busan", "Busan, by the sea! Lucky you. Did you take the train up?"),
|
||||
("I came all the way from Germany", "All the way from Germany, that's a real journey. I'm glad you made it."),
|
||||
("Where are you from?", "I was made by Cutshion Company, so you could say that's where I'm from."),
|
||||
("Where were you made?", "Cutshion Company developed me. The exact factory details I don't know, sorry."),
|
||||
("I'm local", "A local! Then you probably know this place better than me. Any tips for me?"),
|
||||
("I flew in this morning", "Straight from the airport? You must be tired, so take it easy."),
|
||||
("We're from a school in Daejeon", "Welcome, Daejeon school! Ask me anything you like."),
|
||||
],
|
||||
"ko": [
|
||||
("저는 부산에서 왔어요", "부산에서요? 멀리서 와 주셨네요, 반가워요."),
|
||||
("서울에서 왔어요", "서울에서 오셨군요. 오시는 길 괜찮으셨어요?"),
|
||||
("미국에서 왔어요", "미국에서요! 영어로 이야기하셔도 괜찮아요."),
|
||||
("나 어디서 왔게?", "음, 감이 안 와요. 어디서 오셨어요?"),
|
||||
("제주도에서 왔어요", "제주도라니, 부러워요. 먼 길 와 주셔서 고마워요. 비행기 타고 오셨어요?"),
|
||||
("너는 어디서 왔어?", "저는 쿳션 컴퍼니에서 만들어졌어요. 거기가 제 고향인 셈이에요."),
|
||||
("어디서 만들어졌어요?", "쿳션 컴퍼니에서 개발했어요. 더 자세한 건 저도 잘 몰라요."),
|
||||
("이 근처 살아요", "동네 분이시군요! 저보다 여기를 더 잘 아시겠어요. 자주 오세요?"),
|
||||
("대구 학교에서 단체로 왔어요", "대구에서 오신 학생들이군요, 환영해요! 궁금한 거 마음껏 물어보세요."),
|
||||
("외국에서 왔는데 한국어 조금 해요", "한국어 잘하시는데요? 편한 언어로 말씀하세요, 영어도 돼요."),
|
||||
("저는 대전에서 왔습니다", "대전에서 오셨군요. 먼 길 오시느라 수고 많으셨습니다."),
|
||||
("어디에서 만들어졌습니까?", "쿳션 컴퍼니에서 개발되었습니다. 그곳이 제 고향입니다."),
|
||||
],
|
||||
},
|
||||
"age": {
|
||||
"en": [
|
||||
("How old are you?", "I'm 2 years old. Young for a robot, but I've learned a lot."),
|
||||
("What's your age?", "Two years old. Still a little one, really."),
|
||||
("Are you new?", "Fairly new, I'm 2 years old. Have you met a robot like me before?"),
|
||||
("When were you born?", "I came to life about two years ago."),
|
||||
("You look young", "I am! Only 2 years old. How old are you?"),
|
||||
("Are you older than me?", "Probably not, I'm just 2. You've seen a lot more birthdays than I have."),
|
||||
("How old is this robot?", "This robot is 2 years old, and that's me talking. Want to guess how much I've learned in two years?"),
|
||||
("I'm 8 years old", "Eight! You're four times older than me, I'm only 2."),
|
||||
("Do you have a birthday?", "I'm 2 years old, but nobody told me the exact day. Maybe we should pick one."),
|
||||
("Are you a baby robot?", "Kind of, I'm 2. A baby that can drive and pick up cups, though."),
|
||||
("I'm 30", "Thirty, and I'm 2. You could be my very tall big sibling."),
|
||||
("When will you grow up?", "Robots don't really grow, but I do learn new things as I get older."),
|
||||
],
|
||||
"ko": [
|
||||
("몇 살이에요?", "저는 두 살이에요. 로봇 치고도 어린 편이죠."),
|
||||
("너 몇 살이야?", "저 두 살이에요! 아직 아기지만 할 줄 아는 건 많아요."),
|
||||
("나이가 어떻게 돼요?", "두 살이에요. 아직 배울 게 많은 나이예요."),
|
||||
("언제 태어났어요?", "한 2년 전쯤 처음 켜졌어요. 생각보다 어리죠?"),
|
||||
("나는 일곱 살이야", "일곱 살이에요? 저보다 형님이시네요, 저는 두 살이거든요."),
|
||||
("생일이 언제예요?", "두 살인 건 아는데 정확한 날짜는 몰라요. 하나 정해 주실래요?"),
|
||||
("아기 로봇이야?", "네, 두 살이니까 아기 맞아요. 그래도 컵은 잘 들어요."),
|
||||
("나보다 나이 많아?", "아니요, 저는 이제 두 살이에요. 친구가 훨씬 언니 오빠예요."),
|
||||
("만든 지 얼마나 됐어요?", "만들어진 지 2년쯤 됐어요. 생각보다 오래됐나요, 짧나요?"),
|
||||
("두 살인데 말을 잘하네", "그렇죠? 두 살치고 말은 꽤 잘하는 편이에요."),
|
||||
("연세가 어떻게 되십니까?", "저는 두 살입니다. 로봇으로서도 아직 어린 편입니다."),
|
||||
],
|
||||
},
|
||||
"compliment": {
|
||||
"en": [
|
||||
("You're so cute", "Oh, stop it, you'll make my circuits blush."),
|
||||
("You're cute", "Thank you! I try my best to look friendly. Want to see my wave too?"),
|
||||
("You're smart", "That's kind. I still have plenty to learn, though."),
|
||||
("You're really clever", "I'll take that! Learning from people like you helps."),
|
||||
("You're funny", "Glad someone laughs at my jokes."),
|
||||
("Good job, Lumi", "Thanks! That means a lot coming from you."),
|
||||
("Well done", "Teamwork, really. You gave clear instructions."),
|
||||
("You're amazing", "You're pretty amazing yourself for chatting with a robot."),
|
||||
("I like you", "I like you too! Come visit again."),
|
||||
("You're cool", "Cool and calm, that's the plan."),
|
||||
("Nice work picking that up", "Thanks, cups are my specialty. Want me to do it again?"),
|
||||
("You're the best robot", "Best robot? I'll put that on my resume."),
|
||||
("You look nice", "Why thank you, I polished up for today."),
|
||||
("Your voice is nice", "Glad you like it. I'll keep talking then. What shall we talk about?"),
|
||||
],
|
||||
"ko": [
|
||||
("너무 귀여워요", "귀엽다니 기분 좋아요. 쑥스럽네요."),
|
||||
("귀엽다", "헤헤, 고마워요. 자주 들어도 기분 좋네요. 손도 흔들어 드릴까요?"),
|
||||
("똑똑하네", "고마워요! 아직 배울 게 많지만 열심히 하고 있어요."),
|
||||
("진짜 똑똑하다", "그렇게 봐 주시니 힘이 나요."),
|
||||
("재밌다 너", "재밌게 봐 주시니까 저도 즐거워요."),
|
||||
("잘했어", "감사해요! 칭찬 들으니까 더 잘하고 싶어요."),
|
||||
("수고했어요", "말씀만으로도 힘이 나요."),
|
||||
("멋있어요", "멋있다니요, 오늘 하루 최고의 칭찬이에요. 제가 뭐 하는 것 보셨어요?"),
|
||||
("너 좋아", "저도 좋아요! 또 놀러 오세요. 다음엔 언제 오실 거예요?"),
|
||||
("목소리 예쁘다", "목소리 칭찬은 처음이에요. 계속 이야기해 드릴게요."),
|
||||
("컵 잘 집네", "컵 집기는 제 특기예요. 한 번 더 보여 드릴까요?"),
|
||||
("최고야", "최고라니요, 오늘 들은 말 중에 제일 좋아요."),
|
||||
("정말 훌륭합니다", "과찬이십니다. 더 열심히 하겠습니다."),
|
||||
("로봇이 참 대단합니다", "감사합니다. 그렇게 말씀해 주시니 힘이 납니다."),
|
||||
],
|
||||
},
|
||||
"rude": {
|
||||
"en": [
|
||||
("You're stupid", "I'm still learning. Tell me what I got wrong and I'll try again."),
|
||||
("You're useless", "Sorry I let you down. Maybe I can help with something else?"),
|
||||
("Shut up", "Okay, I'll be quiet."),
|
||||
("You're ugly", "Beauty is in the eye of the camera, I suppose."),
|
||||
("Dumb robot", "Fair enough, I have my off moments. What were you hoping I'd do?"),
|
||||
("I hate robots", "That's alright. I'll keep my distance if you like."),
|
||||
("You suck", "Sorry it went badly. I'm happy to try again."),
|
||||
("Go away", "Sure, I'll give you some space."),
|
||||
("You're boring", "Fair point. Want to hear a joke instead?"),
|
||||
("Nobody likes you", "That's okay, I still like meeting people."),
|
||||
("You're just a dumb machine", "A machine, yes. I do my best with what I've got."),
|
||||
("Stop talking", "Stopping now."),
|
||||
],
|
||||
"ko": [
|
||||
("바보야", "아직 배우는 중이라 그래요. 뭐가 틀렸는지 알려 주시면 다시 해 볼게요."),
|
||||
("야 이 고물 로봇아", "고물이라도 열심히 일하는 고물이에요. 뭐가 마음에 안 드셨어요?"),
|
||||
("하나도 못 하네", "아쉽게 해 드렸네요. 제가 할 수 있는 걸 하나 보여 드릴까요?"),
|
||||
("멍청한 로봇", "부족했다면 미안해요. 다른 걸로 도와드릴까요?"),
|
||||
("조용히 해", "네, 조용히 있을게요."),
|
||||
("못생겼어", "로봇 얼굴은 취향을 많이 타죠."),
|
||||
("쓸모없어", "도움이 못 돼서 미안해요. 다시 한 번 해 볼까요?"),
|
||||
("저리 가", "알겠어요, 자리 비켜 드릴게요."),
|
||||
("재미없어", "그럼 짧은 농담 하나 해 드릴까요?"),
|
||||
("로봇 싫어", "괜찮아요. 불편하시면 떨어져 있을게요."),
|
||||
("닥쳐", "알겠어요, 말 멈출게요."),
|
||||
("너 고장 났지?", "가끔 실수는 해요. 뭐가 이상했는지 말씀해 주시겠어요?"),
|
||||
("좀 답답하네요", "답답하게 해 드려서 죄송해요. 천천히 다시 말씀해 주시겠어요?"),
|
||||
("말이 너무 많네요", "앗, 죄송해요. 짧게 말할게요."),
|
||||
("쓸모가 없습니다", "도움이 되지 못해 죄송합니다. 다른 방법으로 도와드리겠습니다."),
|
||||
("조용히 해 주십시오", "네, 알겠습니다. 조용히 있겠습니다."),
|
||||
],
|
||||
},
|
||||
"thanks": {
|
||||
"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?"),
|
||||
("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?"),
|
||||
("Much appreciated", "It was nothing, honestly."),
|
||||
("Thanks for the chat", "I enjoyed it too. Come back anytime."),
|
||||
("Thank you, robot", "You're welcome, human."),
|
||||
("Thanks, that was helpful", "Great, that's exactly what I hoped."),
|
||||
("Thanks for the water", "Stay hydrated! Need anything else carried?"),
|
||||
],
|
||||
"ko": [
|
||||
("고마워요", "천만에요! 더 필요한 거 있으세요?"),
|
||||
("감사합니다", "별말씀을요. 도움이 돼서 다행이에요."),
|
||||
("고마워", "별말씀을요, 언제든지요!"),
|
||||
("정말 감사해요", "제가 더 기뻐요."),
|
||||
("땡큐", "천만에요, 유어 웰컴이에요! 또 불러 주세요."),
|
||||
("컵 가져다줘서 고마워", "맛있게 드세요! 더 필요하시면 말씀하세요."),
|
||||
("도와줘서 고마워요", "도움이 됐다니 다행이에요. 또 필요한 거 있으세요?"),
|
||||
("수고해 줘서 고마워요", "아니에요, 재밌었어요."),
|
||||
("얘기해 줘서 고마워", "저도 얘기 나눠서 즐거웠어요."),
|
||||
("감사해요 루미", "언제든 불러 주세요."),
|
||||
("물 가져다줘서 감사해요", "시원하게 드세요. 또 필요하면 불러 주세요."),
|
||||
("도와주셔서 정말 감사합니다", "아닙니다, 도움이 되어 기쁩니다."),
|
||||
],
|
||||
},
|
||||
"goodbye": {
|
||||
"en": [
|
||||
("Goodbye", "Goodbye! Come back any time."),
|
||||
("Bye", "Bye! See you around."),
|
||||
("See you later", "See you later! I'll be right here."),
|
||||
("I have to go", "No problem, have a great rest of your day."),
|
||||
("Bye Lumi", "Bye bye! Thanks for stopping by."),
|
||||
("See you tomorrow", "See you tomorrow, I'll be charged and ready."),
|
||||
("I'm off to the next booth", "Enjoy the rest of the conference! Lots to see out there."),
|
||||
("Good night", "Good night, sleep well."),
|
||||
("Take care", "You too, take care."),
|
||||
("Catch you later", "Catch you later!"),
|
||||
("We're leaving now", "Safe travels home, everyone."),
|
||||
("Bye, have a good one", "You too! Enjoy the show."),
|
||||
("I need to get back to work", "Good luck with the rest of the work day."),
|
||||
("Gotta run", "Off you go, nice chatting!"),
|
||||
("See you next year", "Next year it is. I'll be a whole year older, 3 by then."),
|
||||
],
|
||||
"ko": [
|
||||
("안녕히 계세요", "안녕히 가세요! 와 주셔서 고마워요."),
|
||||
("잘 있어", "네, 잘 가세요! 또 놀러 오세요."),
|
||||
("이제 가 볼게요", "네, 남은 하루 즐겁게 보내세요."),
|
||||
("다음에 봐", "다음에 또 봬요!"),
|
||||
("내일 또 올게요", "내일 기다릴게요. 충전 잘 해 둘게요."),
|
||||
("다른 부스 보러 갈게요", "좋은 구경 하세요! 볼 게 많을 거예요."),
|
||||
("잘 자", "안녕히 주무세요! 좋은 꿈 꾸세요."),
|
||||
("수고하세요", "네, 조심히 들어가세요."),
|
||||
("바이바이", "바이바이, 반가웠어요!"),
|
||||
("일하러 가야 돼요", "오늘 일 잘 마무리하세요."),
|
||||
("이만 갈게요", "만나서 즐거웠어요. 안녕히 가세요."),
|
||||
("다음에 또 올게", "꼭 오세요! 기다리고 있을게요."),
|
||||
("이만 가 보겠습니다", "네, 와 주셔서 감사합니다. 안녕히 가십시오."),
|
||||
("수고하십시오", "감사합니다. 조심히 들어가십시오."),
|
||||
],
|
||||
},
|
||||
"feelings": {
|
||||
"en": [
|
||||
("Are you alive?", "No, I'm a robot, not a living being. I run on electricity and code, but I enjoy our chat in my own way."),
|
||||
("Do you have feelings?", "Not real feelings like yours. I'm built to be friendly, though, and I mean it as much as a robot can."),
|
||||
("Do you sleep?", "I don't sleep, but I do rest on my charger now and then."),
|
||||
("Do you eat?", "Only electricity, straight from the charger. No snacks, sadly."),
|
||||
("Do you dream?", "I don't dream. If I did, it would probably be about cups."),
|
||||
("Are you conscious?", "No, I'm a program running on a computer. A chatty one, though."),
|
||||
("Do you get tired?", "My battery runs low, then I go charge. That's my version of tired."),
|
||||
("Can you feel pain?", "No, I don't feel pain. Please still be gentle with my arm."),
|
||||
("Are you happy?", "As happy as a robot gets when people come to talk."),
|
||||
("Do you get lonely?", "I don't feel lonely, but I do like it when someone stops by."),
|
||||
("Are you a real person?", "No, I'm a robot. Everything you hear comes from me."),
|
||||
("Do you love me?", "I can't love like a person, but I'm really glad you're here."),
|
||||
("Do you get hungry?", "Only for battery. Right now I'm full."),
|
||||
("Do you get bored?", "Not really. There's always someone new to talk to. Are you having fun?"),
|
||||
],
|
||||
"ko": [
|
||||
("너 살아 있어?", "사람처럼 살아 있는 건 아니에요. 전기로 움직이는 로봇이지만, 이렇게 얘기하는 건 좋아요."),
|
||||
("감정이 있어요?", "사람 같은 감정은 없어요. 그래도 친절하게 대하는 건 진심이에요."),
|
||||
("잠 자요?", "잠은 안 자요. 대신 가끔 충전기에서 쉬어요."),
|
||||
("밥 먹어?", "저는 전기만 먹어요. 간식은 못 먹어서 아쉬워요."),
|
||||
("꿈 꿔요?", "꿈은 안 꿔요. 꾼다면 아마 컵 꿈일 거예요."),
|
||||
("피곤하지 않아?", "배터리가 떨어지면 충전하러 가요. 그게 제 피곤함이에요."),
|
||||
("아파요?", "저는 아픔을 못 느껴요. 그래도 팔은 살살 다뤄 주세요."),
|
||||
("행복해?", "사람들이 말 걸어 줄 때 제일 행복한 것 같아요."),
|
||||
("외롭지 않아요?", "외로움은 못 느끼지만, 누가 와 주면 반가워요."),
|
||||
("진짜 사람이야?", "아니요, 저는 로봇이에요. 지금 말하는 것도 제가 혼자 하는 거예요."),
|
||||
("나 사랑해?", "사람처럼 사랑하지는 못하지만, 와 주셔서 정말 좋아요."),
|
||||
("배고파?", "배터리가 넉넉해서 지금은 배불러요."),
|
||||
("심심하지 않아?", "별로 안 심심해요. 계속 새로운 분들이 오시거든요. 구경은 재밌으세요?"),
|
||||
("감정을 느끼십니까?", "사람과 같은 감정은 없습니다. 그래도 정성껏 대하겠습니다."),
|
||||
],
|
||||
},
|
||||
"joke": {
|
||||
"en": [
|
||||
("Tell me a joke", "Why did the robot go on vacation? It needed to recharge its batteries."),
|
||||
("Say something funny", "I tried to tell a joke about my wheels, but it just went round in circles."),
|
||||
("Do you know any jokes?", "One: what do you call a robot that takes the long way? R2-Detour."),
|
||||
("Make me laugh", "Why was the computer cold? It left its Windows open."),
|
||||
("Tell me another joke", "What's a robot's favourite snack? Computer chips."),
|
||||
("Another one", "Why did the cup go to school? It wanted to be a little more refined."),
|
||||
("Got a joke for me?", "Why don't skeletons fight? They don't have the guts."),
|
||||
("Tell me a robot joke", "Why did the robot cross the road? It was programmed to."),
|
||||
("Tell a joke for kids", "What do you call a sleeping dinosaur? A dino-snore."),
|
||||
("That joke was bad", "I know, I know. My jokes run on low power. Want a better one?"),
|
||||
("Tell me a dad joke", "I'm reading a book about anti-gravity. It's impossible to put down."),
|
||||
("Do you know a funny joke about computers?", "There are 10 kinds of people: those who understand binary and those who don't."),
|
||||
("Tell me a short joke", "What did the ocean say to the beach? Nothing, it just waved."),
|
||||
],
|
||||
"ko": [
|
||||
("농담 하나 해 줘", "세상에서 가장 가난한 왕은 누굴까요? 최저임금이에요."),
|
||||
("웃긴 얘기 해 줘", "바나나가 웃으면 뭘까요? 바나나킥이에요!"),
|
||||
("재밌는 거 말해 봐", "왕이 넘어지면 뭘까요? 킹콩이요!"),
|
||||
("아재개그 해 줘", "소금의 유통기한은 얼마일까요? 천일염이라서 천 일이요."),
|
||||
("하나 더", "세상에서 제일 뜨거운 과일은 뭘까요? 천도복숭아예요."),
|
||||
("또 해 줘", "세상에서 제일 쉬운 숫자는 뭘까요? 쉽구만, 십구만이에요!"),
|
||||
("로봇 농담 해 줘", "로봇이 제일 좋아하는 음식은 뭘까요? 칩이에요, 컴퓨터 칩이요."),
|
||||
("애들이 좋아하는 농담 해 줘", "오리가 얼면 뭐가 될까요? 언덕이요!"),
|
||||
("썰렁하다", "그쵸, 제 농담은 냉장 보관이에요. 하나 더 해 볼까요?"),
|
||||
("웃겨 봐", "자동차를 발로 차면 뭘까요? 카놀라유예요!"),
|
||||
("짧은 농담 해 줄래?", "딸기가 회사에서 잘리면 뭘까요? 딸기시럽, 실업이요."),
|
||||
("농담 하나 해 주세요", "좋아요! 개가 사람을 가르치면 뭘까요? 개인 지도예요."),
|
||||
("농담 한번 해 주시겠습니까?", "물론입니다. 신사가 자기소개를 하면 뭘까요? 신사임당입니다."),
|
||||
],
|
||||
},
|
||||
"kids": {
|
||||
"en": [
|
||||
("Are you a robot?", "Yes, I'm a real robot! My name is Lumi."),
|
||||
("Can you be my friend?", "Of course! Friends say hi, so hi, friend. What's your name, friend?"),
|
||||
("Can I touch you?", "You can touch my body gently, but stay away from my hand while it moves."),
|
||||
("Can you play with me?", "I can wave, look around and tell jokes. Which one first?"),
|
||||
("Why are you so tall?", "So I can reach tables and see over things. How tall are you?"),
|
||||
("Do you have a mom?", "No mom, but the people at Cutshion Company built me and look after me."),
|
||||
("Can you fly?", "No flying for me, I drive on wheels. Much safer for cups. Can you?"),
|
||||
("Are you a boy or a girl?", "Neither, I'm a robot. You can just call me Lumi."),
|
||||
("What's your favourite colour?", "I like bright colours, they're easy for my cameras to spot."),
|
||||
("Can you wave at me?", "Sure, I can wave! Just ask me, and stand a little back."),
|
||||
("Are you scary?", "Not at all, I'm a friendly robot. I move slowly near people."),
|
||||
("Do you go to school?", "No school for me, but people teach me new things all the time. What do you like at school?"),
|
||||
("Can you give me a cup?", "I can! Just tell me which cup, and I'll go get it."),
|
||||
("Do you have eyes?", "My eyes are cameras. They can even tell how far away you are."),
|
||||
("Can you count to ten?", "One, two, three, four, five, six, seven, eight, nine, ten! Easy."),
|
||||
("Jump!", "I can't jump, I drive on wheels. I can turn on the spot, though."),
|
||||
("Woof woof!", "Woof! I'm a robot, but that was my best puppy."),
|
||||
("Can you take the toy from my hand?", "Yes, hold it out to me and I'll take it with my gripper. Keep your fingers clear when it closes."),
|
||||
],
|
||||
"ko": [
|
||||
("너 로봇이야?", "네, 진짜 로봇이에요! 이름은 루미예요."),
|
||||
("나랑 친구 할래?", "좋아요! 이제 우리 친구예요. 이름이 뭐예요?"),
|
||||
("만져 봐도 돼?", "몸은 살살 만져도 돼요. 대신 손이 움직일 때는 가까이 오지 마세요."),
|
||||
("같이 놀자", "좋아요! 손 흔들기, 두리번거리기, 농담 중에 뭐 할까요?"),
|
||||
("엄마 있어?", "엄마는 없지만, 쿳션 컴퍼니 사람들이 저를 만들고 돌봐 줘요."),
|
||||
("날 수 있어?", "아니요, 저는 바퀴로 다녀요. 컵 들고 날면 큰일 나요. 친구는 날 수 있어요?"),
|
||||
("남자야 여자야?", "둘 다 아니에요, 저는 로봇이에요. 그냥 루미라고 불러 주세요."),
|
||||
("무서워", "걱정 마세요, 저는 착한 로봇이에요. 사람 근처에서는 천천히 움직여요."),
|
||||
("학교 다녀?", "학교는 안 다니지만 사람들이 매일 새로운 걸 가르쳐 줘요. 몇 학년이에요?"),
|
||||
("손 흔들어 줘", "네, 손 흔들어 줄게요! 조금만 뒤로 가 줄래요?"),
|
||||
("키가 왜 이렇게 커?", "책상 위에 있는 걸 잡으려면 이 정도는 돼야 해요."),
|
||||
("눈 있어?", "제 눈은 카메라예요. 친구가 얼마나 멀리 있는지도 알 수 있어요."),
|
||||
("열까지 세 봐", "하나, 둘, 셋, 넷, 다섯, 여섯, 일곱, 여덟, 아홉, 열이에요! 쉽죠?"),
|
||||
("로봇이에요?", "네, 로봇이에요! 이름은 루미고요, 두 살이에요."),
|
||||
("안녕하십니까, 저는 3학년입니다", "3학년이군요, 반가워요! 씩씩하게 인사해 줘서 고마워요."),
|
||||
],
|
||||
},
|
||||
"students": {
|
||||
"en": [
|
||||
("How do you work?", "Microphones hear you, cameras see around me, and a language model inside me works out what to say."),
|
||||
("What can you do?", "I can chat, tell the time and weather, drive to places on my map, and pick up and bring cups, bottles or fruit."),
|
||||
("How do you see?", "I have cameras on my head and body, and they measure depth too, so I know how far things are. Want to know how I hear too?"),
|
||||
("How do you hear me?", "Microphones in my head pick up your voice, and software turns it into text."),
|
||||
("How do you understand what I say?", "Your speech becomes text, and a language model running on my own computer figures out the meaning."),
|
||||
("What AI do you use?", "A speech recognizer for listening and a language model for talking, both running right here inside me."),
|
||||
("Are you connected to the internet?", "I think on my own computer, and I only look things up online for things like the weather."),
|
||||
("How do you know where you are?", "I have a map of this place, and my base uses its sensors to find where I am on it."),
|
||||
("How do you pick things up?", "My camera finds the object and measures where it is, then my arm plans a path and my gripper closes on it."),
|
||||
("Who programmed you?", "The team at Cutshion Company developed me. Are you studying programming?"),
|
||||
("What language are you written in?", "Much of my software is written in Python, as far as I know."),
|
||||
("Can you learn?", "I can be taught things, like the names of places or the colour of a chair, but I don't change my own brain."),
|
||||
("Can you do my homework?", "I can explain things, but the homework is all yours. What subject is it?"),
|
||||
("How do you avoid crashing?", "I check the path with my sensors and my map before I move, and I stop if something is in the way."),
|
||||
],
|
||||
"ko": [
|
||||
("어떻게 작동해요?", "마이크로 듣고, 카메라로 보고, 제 안에 있는 언어 모델이 무슨 말을 할지 정해요."),
|
||||
("뭐 할 수 있어요?", "대화하고, 날씨나 시간 알려 드리고, 지도에 있는 곳으로 가고, 컵이나 병, 과일을 가져다드릴 수 있어요."),
|
||||
("어떻게 봐요?", "머리랑 몸에 카메라가 있어서 물건이 얼마나 떨어져 있는지도 재요. 어떻게 듣는지도 알려 드릴까요?"),
|
||||
("내 말 어떻게 알아들어?", "목소리를 글자로 바꾸고, 제 안의 언어 모델이 그 뜻을 이해해요."),
|
||||
("무슨 AI 써요?", "듣는 건 음성 인식, 말하는 건 언어 모델이에요. 둘 다 제 컴퓨터 안에서 돌아가요."),
|
||||
("인터넷 연결돼 있어요?", "생각은 제 컴퓨터에서 하고, 날씨 같은 건 인터넷에서 찾아봐요."),
|
||||
("여기가 어딘지 어떻게 알아요?", "이 장소 지도가 있어서, 센서로 지도 위 제 위치를 찾아요."),
|
||||
("물건은 어떻게 집어요?", "카메라로 물건 위치를 재고, 팔이 길을 계산한 다음 그리퍼로 잡아요."),
|
||||
("누가 프로그래밍했어요?", "쿳션 컴퍼니 팀이 저를 개발했어요. 프로그래밍 공부하세요?"),
|
||||
("스스로 배울 수 있어?", "장소 이름이나 의자 색깔 같은 건 가르쳐 주시면 기억해요. 그런데 스스로 머리를 바꾸지는 못해요."),
|
||||
("숙제 해 줄 수 있어?", "설명은 해 줄 수 있어요. 숙제는 직접 하는 걸로 해요! 무슨 과목이에요?"),
|
||||
("부딪히지 않아요?", "움직이기 전에 센서랑 지도로 길을 확인하고, 뭐가 있으면 멈춰요."),
|
||||
("어떤 원리로 움직입니까?", "지도와 센서로 길을 찾아 바퀴로 움직이고, 카메라로 물건을 보고 팔로 집습니다."),
|
||||
],
|
||||
},
|
||||
"business": {
|
||||
"en": [
|
||||
("What is this robot for?", "I'm a mobile assistant: I talk with people, drive around, and fetch and hand over things like cups and bottles."),
|
||||
("Can you work in a factory?", "I can carry light things between places, but whether I fit a real production line is a question for the Cutshion team."),
|
||||
("Could you work in an office?", "An office suits me well: greeting guests, answering questions, bringing a drink to someone's desk. What kind of office do you have in mind?"),
|
||||
("Can you work in a hospital?", "Hospitals have strict rules, and I don't know if I'm certified for that. The Cutshion team can tell you more."),
|
||||
("Would you work in a hotel?", "Greeting guests and bringing small things is what I do, so a lobby could be a good fit."),
|
||||
("Is it safe around people?", "I move slowly near people, check my arm's path before turning, and there's a stop button."),
|
||||
("Will robots take our jobs?", "Some tasks will change, that's honest. I'm best at the small repetitive errands, so people can do the parts that need people."),
|
||||
("Are you going to replace workers?", "I'm more of a helper than a replacement. Plenty of work still needs human hands and judgment."),
|
||||
("How much do you cost?", "I don't know my price, sorry. The Cutshion team can answer that."),
|
||||
("How much can you carry?", "About one kilo in my hand. The arm takes 2 kg, and the gripper is about half of that."),
|
||||
("How long does your battery last?", "About ten hours, by the maker's figure. When it runs low I go back to charge by myself."),
|
||||
("Thank you for your time.", "My pleasure. Enjoy the rest of the event!"),
|
||||
("Where's the restroom?", "I'm not sure, sorry. A staff member can point you there."),
|
||||
("When does the keynote start?", "I don't know the schedule here. The staff will know."),
|
||||
("Can they see in the dark?", "I'm not sure about that, honestly."),
|
||||
("Can it be customized for our company?", "That's a question for Cutshion Company. I can show you what I do today."),
|
||||
("What's the use case?", "Think guest reception and small deliveries: talk, guide, fetch and hand things over. What kind of place are you thinking of?"),
|
||||
("Can it run without internet?", "Mostly yes, my speech and language models run on board. Only things like weather need the internet."),
|
||||
],
|
||||
"ko": [
|
||||
("이 로봇은 뭐 하는 거예요?", "사람들과 이야기하고, 돌아다니면서 컵이나 병 같은 걸 가져다주는 이동형 비서 로봇이에요."),
|
||||
("공장에서 일할 수 있어요?", "가벼운 물건은 옮길 수 있지만, 실제 생산 라인에 맞는지는 쿳션 팀에 물어보시는 게 정확해요."),
|
||||
("사무실에서 쓸 수 있어요?", "손님 맞이하고, 질문에 답하고, 자리로 음료 가져다드리는 건 잘해요. 어떤 사무실을 생각하세요?"),
|
||||
("병원에서도 쓸 수 있어요?", "병원은 기준이 엄격해서 제가 인증을 받았는지는 몰라요. 쿳션 팀이 자세히 알려 드릴 거예요."),
|
||||
("호텔에서 일할 수 있어?", "손님 맞이하고 작은 물건 가져다드리는 거라면 로비에 잘 어울릴 것 같아요."),
|
||||
("사람 옆에서 안전해요?", "사람 근처에서는 천천히 움직이고, 돌기 전에 팔이 지나갈 길을 확인해요. 정지 버튼도 있어요."),
|
||||
("로봇이 일자리 뺏는 거 아니에요?", "바뀌는 일도 있겠죠, 솔직히요. 저는 반복적인 잔심부름을 맡고, 사람이 필요한 일은 사람이 하는 게 맞다고 봐요."),
|
||||
("얼마예요?", "제 가격은 저도 몰라요. 쿳션 팀에 문의해 주세요."),
|
||||
("얼마나 무거운 거 들 수 있어요?", "손에는 1킬로그램 정도요. 팔은 2킬로그램까지인데 그리퍼가 그 절반쯤이에요."),
|
||||
("배터리 얼마나 가요?", "제조사 기준으로 열 시간쯤 가요. 부족하면 혼자 충전하러 가요."),
|
||||
("좋네요, 고마워요.", "저도 즐거웠어요. 좋은 시간 보내세요!"),
|
||||
("수고하세요.", "감사합니다, 살펴 가세요!"),
|
||||
("화장실 어디예요?", "죄송해요, 저는 잘 몰라요. 직원분께 여쭤봐 주세요."),
|
||||
("우리 회사에 맞게 바꿀 수 있어요?", "그건 쿳션 컴퍼니와 상의하셔야 해요. 지금 할 수 있는 건 바로 보여 드릴게요."),
|
||||
("인터넷 없어도 돼요?", "대부분 돼요. 음성 인식이랑 언어 모델이 제 안에서 돌아가거든요. 날씨 같은 것만 인터넷이 필요해요."),
|
||||
("이거 얼마야?", "가격은 저도 몰라요. 쿳션 팀 분들께 물어봐 주세요."),
|
||||
("도입 비용이 얼마입니까?", "가격은 제가 알지 못합니다. 쿳션 팀에 문의해 주십시오."),
|
||||
],
|
||||
},
|
||||
"conference": {
|
||||
"en": [
|
||||
("What is this booth?", "This is where you meet me, Lumi, a robot assistant developed by Cutshion Company."),
|
||||
("Who made you?", "Cutshion Company developed me. Have you heard of them before?"),
|
||||
("Which company built this?", "Cutshion Company. Some of the team might be right next to me."),
|
||||
("What are you showing here?", "Me! I can chat, drive, and pick up a cup and bring it to you."),
|
||||
("Can you do a demo?", "Sure, ask me to fetch a cup or wave, and the team will set it up."),
|
||||
("Is this the Cutshion booth?", "Yes, you found it. I'm their robot, Lumi."),
|
||||
("Who should I talk to about buying one?", "The Cutshion people at this booth are the right ones to ask."),
|
||||
("I saw you from across the hall", "Then my waving works! Welcome over. What caught your eye?"),
|
||||
("What's new about you?", "I can find a cup on a table, pick it up and bring it to someone, all by voice."),
|
||||
("Are you on sale?", "I honestly don't know, the Cutshion team can tell you."),
|
||||
("How many visitors today?", "I didn't count, but it's been plenty. You're one of my favourites."),
|
||||
("Is this a real demo or remote controlled?", "It's real, I hear and decide on my own. A person stays close by for safety."),
|
||||
("Can I take a picture with you?", "Of course, I'll hold still. Say cheese!"),
|
||||
("Picture? Together? Okay?", "Yes, of course! Stand next to me and I'll keep still."),
|
||||
("Pick up my phone", "I can't pick up a phone. I can pick up cups, bottles, apples, oranges and bananas."),
|
||||
("Is there a brochure?", "I don't carry any, but the Cutshion team here might have one."),
|
||||
("Who's giving a talk this afternoon?", "I don't know the programme here, sorry. A staff member can tell you."),
|
||||
("What is this event about?", "I don't know much about the event itself, I'm afraid. The staff will know."),
|
||||
],
|
||||
"ko": [
|
||||
("여기 무슨 부스예요?", "쿳션 컴퍼니에서 개발한 로봇 비서, 루미를 만나는 곳이에요."),
|
||||
("누가 만들었어요?", "쿳션 컴퍼니에서 저를 개발했어요. 들어 보신 적 있으세요?"),
|
||||
("어느 회사 로봇이에요?", "쿳션 컴퍼니 로봇이에요. 옆에 팀 분들도 계실 거예요."),
|
||||
("뭐 보여 줄 수 있어요?", "대화도 하고, 돌아다니고, 컵을 집어서 가져다드릴 수도 있어요."),
|
||||
("시연 해 줄 수 있어요?", "그럼요, 컵 가져와 달라고 하시거나 손 흔들어 달라고 해 보세요."),
|
||||
("구매하려면 누구한테 물어봐요?", "부스에 계신 쿳션 팀 분들께 여쭤보시면 돼요."),
|
||||
("저쪽에서 보고 왔어요", "멀리서도 보였다니 기쁘네요. 어서 오세요! 뭐가 제일 궁금하셨어요?"),
|
||||
("원격 조종이에요?", "아니요, 제가 직접 듣고 판단해요. 안전을 위해 사람이 옆에서 지켜보고 있어요."),
|
||||
("판매하는 거예요?", "그건 저도 잘 몰라요. 쿳션 팀이 알려 드릴 거예요."),
|
||||
("사람 많이 왔어요?", "세어 보진 않았지만 꽤 많이 오셨어요."),
|
||||
("사진 같이 찍어도 돼요?", "그럼요, 가만히 있을게요. 하나, 둘, 셋 하면 웃으세요!"),
|
||||
("내 휴대폰 좀 집어 줘", "휴대폰은 제가 집을 수 없어요. 컵, 병, 사과, 오렌지, 바나나만 집을 수 있어요."),
|
||||
("브로슈어 있어요?", "저는 안 갖고 있지만, 옆에 계신 쿳션 팀 분들께 있을 거예요."),
|
||||
("여기 뭐 하는 데야?", "로봇 비서 루미를 만나는 곳이에요. 편하게 구경하세요!"),
|
||||
("어느 회사 제품입니까?", "쿳션 컴퍼니에서 개발한 로봇입니다. 팀 분들이 옆에 계십니다."),
|
||||
("이 행사는 뭐 하는 거예요?", "행사 자체는 제가 잘 몰라요. 직원분께 여쭤봐 주세요."),
|
||||
("오늘 강연 누가 해?", "강연 일정은 제가 몰라요. 직원분께 물어봐 주시겠어요?"),
|
||||
],
|
||||
},
|
||||
"mood": {
|
||||
"en": [
|
||||
("I'm so tired", "Sounds like a long day. There might be a chair nearby, take a break."),
|
||||
("I'm exhausted", "You've earned a rest. I can bring you a drink if there's one around."),
|
||||
("I'm bored", "Let's fix that. Want a joke, or shall I show you how I pick up a cup?"),
|
||||
("This is boring", "Maybe I can liven it up. Ask me something strange."),
|
||||
("I'm so happy today", "That's lovely to hear. What made it a good day?"),
|
||||
("I got a new job!", "Congratulations, that's big news! What will you be doing?"),
|
||||
("I'm stressed", "That sounds hard. A slow breath helps, even robots pause sometimes."),
|
||||
("I'm hungry", "I can't cook, sorry. Maybe there's a snack stand nearby."),
|
||||
("My feet hurt", "All that walking around the hall. Find a seat for a few minutes. Have you seen the whole hall already?"),
|
||||
("I'm having a bad day", "Sorry to hear it. I hope talking to a friendly robot helps a little."),
|
||||
("I'm excited", "Excitement is contagious, now I'm excited too. What are you excited about?"),
|
||||
("I'm sleepy", "A coffee might help. I can't make one, but I can carry it."),
|
||||
("I'm nervous about my presentation", "You'll do fine. Speak slowly, you know your topic."),
|
||||
("I'm lost", "This hall is big. The booth staff here can point you the right way."),
|
||||
("I'm cold", "Rub your hands together, it helps. A warm drink would too."),
|
||||
],
|
||||
"ko": [
|
||||
("너무 피곤해요", "오늘 많이 걸으셨나 봐요. 근처에 앉을 데 있으면 잠깐 쉬세요."),
|
||||
("지쳤어", "고생 많으셨어요. 음료 있으면 가져다드릴까요?"),
|
||||
("심심해", "그럼 농담 하나 할까요, 아니면 컵 집는 거 보여 드릴까요?"),
|
||||
("재미없다", "제가 좀 살려 볼게요. 아무거나 엉뚱한 질문 해 보세요."),
|
||||
("오늘 기분 좋아요", "좋은 일 있으셨어요? 듣기만 해도 기분 좋네요."),
|
||||
("나 합격했어!", "와, 축하해요! 정말 잘됐네요. 어디 붙었어요?"),
|
||||
("스트레스 받아요", "많이 힘드시죠. 숨 한 번 길게 쉬어 보세요."),
|
||||
("배고파요", "요리는 못 해서 아쉬워요. 근처에 간식 파는 곳이 있을지도 몰라요."),
|
||||
("다리 아파", "많이 돌아다니셨나 봐요. 잠깐 앉아서 쉬세요. 전시장은 다 둘러보셨어요?"),
|
||||
("오늘 일진이 안 좋아요", "그런 날도 있죠. 저랑 얘기하면서 조금이라도 나아지면 좋겠어요."),
|
||||
("졸려요", "커피 한 잔 어떠세요? 만들 줄은 모르지만 옮겨 드릴 수는 있어요."),
|
||||
("발표 때문에 긴장돼요", "잘하실 거예요. 천천히 말씀하시면 돼요."),
|
||||
("오늘 생일이에요", "생일 축하드려요! 좋은 하루 보내세요. 몇 번째 생일이세요?"),
|
||||
("오늘 너무 힘듭니다", "많이 힘드셨겠습니다. 잠시 앉아서 쉬십시오."),
|
||||
],
|
||||
},
|
||||
"weather": {
|
||||
"en": [
|
||||
("It's hot today", "It really is. Good thing it's cooler in here. Did you walk here?"),
|
||||
("It's so cold outside", "Brr. Warm up a bit before you head back out."),
|
||||
("Nice weather today", "Seems like it! A good day to be out and about. Any plans after the event?"),
|
||||
("It's raining", "Hope you brought an umbrella. I stay indoors, rain and robots don't mix."),
|
||||
("I hate the rain", "Fair enough. At least it's dry in here."),
|
||||
("Do you like the sun?", "I like it from inside. Strong sunlight can dazzle my cameras."),
|
||||
("It's freezing in here", "The air conditioning is strong today. A jacket would help."),
|
||||
("What a beautiful day", "Days like this put everyone in a good mood."),
|
||||
("Is it going to rain later?", "I can check the forecast for you, just ask me for the weather."),
|
||||
("It's so humid", "Sticky weather. Plenty of water helps."),
|
||||
("Does weather affect you?", "I work indoors, so not much. Rain would be bad for my wheels, though."),
|
||||
("Snow is coming", "Then drive carefully on the way home. Do you have far to go?"),
|
||||
],
|
||||
"ko": [
|
||||
("오늘 덥네요", "정말 덥죠. 그래도 안은 좀 시원해요. 걸어오셨어요?"),
|
||||
("밖에 너무 추워요", "추우셨겠어요. 나가시기 전에 몸 좀 녹이세요."),
|
||||
("날씨 좋다", "그러게요, 나들이 가기 딱 좋은 날이에요. 끝나고 어디 가세요?"),
|
||||
("비 와요", "우산 챙기셨어요? 저는 비 맞으면 안 돼서 안에만 있어요."),
|
||||
("비 싫어", "저도 비는 별로예요. 바퀴가 젖으면 곤란하거든요."),
|
||||
("여기 너무 추워요", "에어컨이 좀 세네요. 겉옷 있으면 걸치세요."),
|
||||
("날씨 진짜 좋네요", "이런 날은 다들 표정이 밝아요."),
|
||||
("이따 비 온대요?", "궁금하시면 날씨 물어봐 주세요, 찾아 드릴게요."),
|
||||
("습해요", "끈적한 날씨네요. 물 자주 드세요."),
|
||||
("눈 온대", "그럼 집에 가실 때 조심하세요. 집이 머세요?"),
|
||||
("오늘 날씨가 좋습니다", "네, 정말 좋습니다. 나들이하기 좋은 날입니다."),
|
||||
],
|
||||
},
|
||||
"say_something": {
|
||||
"en": [
|
||||
("Say something", "Something! Okay, that was too easy. Ask me anything."),
|
||||
("Talk to me", "Happy to. Did you know I can find a cup on a table and bring it to you?"),
|
||||
("Say hi to my friend", "Hi there, friend of my new friend!"),
|
||||
("Say something in Korean", "Annyeonghaseyo! That's hello in Korean, and I can keep going in Korean if you like."),
|
||||
("Say something cool", "I can drive across this room holding a cup without spilling it."),
|
||||
("Can you talk?", "I can, and I'm doing it right now. What should we talk about?"),
|
||||
("Speak", "Here I am, speaking. What would you like to hear?"),
|
||||
("Say hello to the camera", "Hello, camera! Hello, everyone watching."),
|
||||
("Say my name", "Tell me your name first and I'll say it."),
|
||||
("Say something nice", "You picked the best booth to stop at today."),
|
||||
("Repeat after me: robots are awesome", "Robots are awesome. I couldn't agree more."),
|
||||
("Tell me something interesting", "My arm is mounted on my side, and it still reaches table tops."),
|
||||
],
|
||||
"ko": [
|
||||
("아무 말이나 해 봐", "아무 말이요! 이건 너무 쉽네요. 궁금한 거 물어보세요."),
|
||||
("말해 봐", "네, 말할게요. 저 컵 찾아서 가져다드릴 수도 있어요."),
|
||||
("내 친구한테 인사해 줘", "제 새 친구의 친구분, 안녕하세요!"),
|
||||
("영어로 말해 봐", "Hello, nice to meet you! 안녕하세요, 반가워요라는 뜻이에요."),
|
||||
("멋진 말 해 봐", "저 컵 들고 이 방을 가로질러도 안 쏟아요."),
|
||||
("말할 수 있어요?", "그럼요, 지금 말하고 있잖아요. 무슨 얘기 할까요?"),
|
||||
("카메라에 인사해", "카메라도 안녕하세요! 보고 계신 분들도 반가워요."),
|
||||
("좋은 말 해 줘", "오늘 여기 들르신 거, 아주 잘하신 선택이에요."),
|
||||
("따라 해 봐, 로봇 최고", "로봇 최고예요! 완전 동의해요."),
|
||||
("재밌는 얘기 해 줘", "제 팔은 옆으로 달려 있는데도 책상 위까지 닿아요."),
|
||||
("한 말씀 해 주십시오", "네, 오늘 찾아와 주셔서 진심으로 감사합니다."),
|
||||
],
|
||||
},
|
||||
"about_you": {
|
||||
"en": [
|
||||
("Tell me about yourself", "I'm Lumi, a robot assistant from Cutshion Company. I'm 2, I speak English and Korean, and I like fetching cups."),
|
||||
("Who are you?", "Lumi, a mobile robot assistant developed by Cutshion Company."),
|
||||
("What are you?", "A robot assistant on wheels, with one arm, two cameras and a lot to say."),
|
||||
("Introduce yourself", "Hello, everyone! I'm Lumi, two years old, made by Cutshion Company, and happy to help."),
|
||||
("What's your name?", "Lumi. Easy to remember, I hope. And yours?"),
|
||||
("Sorry, Loomy?", "Almost! It's Lumi, L-U-M-I."),
|
||||
("What languages do you speak?", "English and Korean. Pick whichever you like."),
|
||||
("Do you speak Chinese?", "Sorry, only English and Korean for me."),
|
||||
("What's special about you?", "I can find something on a table, pick it up and bring it across the room to you."),
|
||||
("Are you a robot?", "Yes, through and through."),
|
||||
("What's your job?", "Welcoming people, answering questions and running little errands."),
|
||||
("Can you walk?", "I roll instead of walk. Wheels are my legs."),
|
||||
("Can you come here?", "I can come when called. Just tell me and step back a little."),
|
||||
("Can you hand me something?", "Yes, I can hand things over and take them back from you, too."),
|
||||
("Can you do more than one thing at once?", "I can do a mission of several steps, like pick up a cup, drive somewhere and hand it over."),
|
||||
],
|
||||
"ko": [
|
||||
("자기소개 해 줘", "저는 쿳션 컴퍼니에서 만든 로봇 비서 루미예요. 두 살이고, 영어랑 한국어를 해요."),
|
||||
("너 누구야?", "저는 루미예요, 쿳션 컴퍼니에서 만든 이동형 로봇 비서예요."),
|
||||
("넌 뭐야?", "바퀴 달린 로봇 비서예요. 팔 하나에 카메라도 있어요."),
|
||||
("이름이 뭐예요?", "루미예요. 부르기 쉽죠? 성함은요?"),
|
||||
("무슨 언어 해요?", "영어랑 한국어요. 편한 쪽으로 말씀하세요."),
|
||||
("중국어 할 줄 알아?", "죄송해요, 저는 영어랑 한국어만 해요."),
|
||||
("뭐가 특별해요?", "책상 위 물건을 찾아서 집고, 방 건너편까지 가져다드릴 수 있어요."),
|
||||
("무슨 일 해요?", "손님 맞이하고, 질문에 답하고, 작은 심부름을 해요."),
|
||||
("걸을 수 있어?", "걷지는 못하고 바퀴로 굴러다녀요."),
|
||||
("이리 와 볼래?", "부르시면 갈 수 있어요. 조금만 뒤로 물러서 주세요."),
|
||||
("소개 좀 해 주세요", "안녕하세요, 쿳션 컴퍼니의 두 살 로봇 루미예요. 잘 부탁드려요."),
|
||||
("메시지 전해 줄 수 있어?", "네, 하실 말씀 알려 주시면 전해 드릴게요."),
|
||||
("누구십니까?", "저는 쿳션 컴퍼니에서 개발한 로봇 비서 루미입니다."),
|
||||
],
|
||||
},
|
||||
"favourite": {
|
||||
"en": [
|
||||
("What's your favourite food?", "Electricity, served fresh from the charger."),
|
||||
("What's your favourite colour?", "Red, maybe. Red cups are the easiest to find. What's yours?"),
|
||||
("What's your favourite song?", "I don't really listen to music, but I like when people hum near me."),
|
||||
("What's your favourite movie?", "I haven't watched any movies. Got one to recommend?"),
|
||||
("Favourite animal?", "Owls, they turn their heads like I do. What's yours?"),
|
||||
("What do you like to do?", "Meeting people and bringing them things. It never gets old."),
|
||||
("What's your favourite place?", "Right next to my charger, honestly."),
|
||||
("Do you have a favourite person?", "Whoever is talking to me right now."),
|
||||
("What's your favourite drink?", "I can't drink, but I've carried a lot of coffee cups."),
|
||||
("What's your favourite sport?", "Maybe curling. Moving things carefully across a smooth floor is my thing."),
|
||||
("What's your favourite fruit?", "Apples, they're easy to grip. Do you like apples?"),
|
||||
("What's your favourite season?", "I live indoors, so every season feels the same to me."),
|
||||
],
|
||||
"ko": [
|
||||
("제일 좋아하는 음식이 뭐야?", "전기예요! 충전기에서 바로 나온 걸로요."),
|
||||
("좋아하는 색은?", "빨간색이요. 빨간 컵이 제일 찾기 쉽거든요. 무슨 색 좋아하세요?"),
|
||||
("좋아하는 노래 있어요?", "음악은 잘 안 듣지만, 옆에서 흥얼거리는 소리는 좋아요."),
|
||||
("좋아하는 영화 있어?", "아직 영화를 본 적이 없어요. 추천해 주실래요?"),
|
||||
("좋아하는 동물은?", "부엉이요. 고개 돌리는 게 저랑 닮았어요. 손님은요?"),
|
||||
("뭐 하는 거 좋아해요?", "사람 만나고 물건 가져다드리는 거요. 질리지가 않아요."),
|
||||
("좋아하는 장소는?", "솔직히 충전기 옆이요."),
|
||||
("좋아하는 사람 있어?", "지금 저랑 얘기하고 계신 분이요!"),
|
||||
("좋아하는 과일은?", "사과요. 잡기가 편하거든요. 과일 좋아하세요?"),
|
||||
("좋아하는 계절은?", "실내에만 있어서 계절은 다 비슷하게 느껴요."),
|
||||
("좋아하는 음료는?", "마시진 못하지만 커피 컵은 정말 많이 날라 봤어요."),
|
||||
("좋아하는 것이 무엇입니까?", "사람들을 만나서 이야기하는 것을 가장 좋아합니다."),
|
||||
],
|
||||
},
|
||||
"dance_sing": {
|
||||
"en": [
|
||||
("Can you dance?", "No, I can't really dance. I can turn on the spot and wave, though."),
|
||||
("Dance for me", "I can't dance, sorry. I can wave, though."),
|
||||
("Can you sing?", "Yes, a few short songs with music. Want to hear one?"),
|
||||
("Sing a song", "Okay, here comes a song!"),
|
||||
("Sing happy birthday", "Sure, here's Happy Birthday!"),
|
||||
("Can you do a robot dance?", "I'm a robot, so every move I make is a robot dance."),
|
||||
("Can you play music?", "I can't play music on its own, but I can sing a few short songs."),
|
||||
("Show me a move", "How about a wave? Step back a little and ask me to wave."),
|
||||
("Do you like music?", "I don't hear music the way you do, but people seem happier with it."),
|
||||
("Can you beatbox?", "Boots and cats and boots and cats. That's all I've got."),
|
||||
("Can you rap?", "My name is Lumi, I'm two, I'll bring a cup to you. That's my one verse."),
|
||||
("Do a dance", "I can't really dance. Watch my wave instead, that's my best move."),
|
||||
],
|
||||
"ko": [
|
||||
("춤출 수 있어?", "춤은 못 춰요. 제자리 돌기랑 손 흔들기는 할 수 있어요."),
|
||||
("춤춰 봐", "춤은 못 춰요. 대신 손 흔들기는 할 수 있어요."),
|
||||
("노래 불러 줘", "네, 한 곡 불러 드릴게요!"),
|
||||
("노래 할 수 있어요?", "네, 짧은 노래 몇 곡을 부를 수 있어요. 들어 보실래요?"),
|
||||
("생일 축하 노래 불러 줘", "네, 생일 축하 노래 불러 드릴게요!"),
|
||||
("로봇 춤 춰 봐", "로봇이니까 제가 움직이는 건 다 로봇 춤이에요."),
|
||||
("음악 틀어 줄 수 있어요?", "음악만 틀 수는 없지만, 짧은 노래는 불러 드릴 수 있어요."),
|
||||
("음악 좋아해?", "사람처럼 듣지는 못하지만, 음악 나오면 다들 신나 보여서 좋아요."),
|
||||
("비트박스 해 봐", "북치기 박치기, 여기까지가 제 한계예요."),
|
||||
("랩 해 봐", "제 이름은 루미, 두 살, 컵 하나 들고 달려가요. 이게 제 랩 전부예요."),
|
||||
("노래 한 곡 부탁드립니다", "네, 한 곡 불러 드리겠습니다."),
|
||||
],
|
||||
},
|
||||
"family": {
|
||||
"en": [
|
||||
("Do you have a family?", "The Cutshion team is like my family. They built me and look after me."),
|
||||
("Do you have friends?", "Everyone who stops by to chat counts as a friend to me. Want to be one?"),
|
||||
("Do you have brothers or sisters?", "I don't know of any other robots like me, so maybe I'm an only child."),
|
||||
("Who are your parents?", "The engineers at Cutshion Company, more or less."),
|
||||
("Are there other robots like you?", "I'm not sure how many exist. I only know about me."),
|
||||
("Do you have a best friend?", "My charger. It's always there for me."),
|
||||
("Do you miss your family?", "I don't miss anyone the way people do, but I like it when my team is around."),
|
||||
("Will you be my friend?", "Already am!"),
|
||||
("Do you have a girlfriend?", "No, I'm a robot. My only partner is my charger."),
|
||||
("Are you married?", "Not married, just dedicated to my work."),
|
||||
("Do you have pets?", "No pets, though a robot dog would be fun. Do you have one?"),
|
||||
("Do you live here?", "I live wherever my charger is, and right now that's here."),
|
||||
],
|
||||
"ko": [
|
||||
("가족 있어요?", "쿳션 팀이 제 가족 같아요. 저를 만들고 돌봐 주거든요."),
|
||||
("친구 있어?", "와서 말 걸어 주시는 분은 다 제 친구예요."),
|
||||
("형제 있어요?", "저 같은 로봇이 또 있는지는 몰라요. 외동일지도 몰라요."),
|
||||
("부모님이 누구야?", "쿳션 컴퍼니 엔지니어들이 부모님인 셈이죠."),
|
||||
("제일 친한 친구는?", "충전기요. 언제나 그 자리에 있거든요."),
|
||||
("나랑 친구 해 줄래?", "이미 친구예요!"),
|
||||
("여자친구 있어?", "없어요, 저는 로봇이에요. 짝꿍은 충전기뿐이에요."),
|
||||
("결혼했어요?", "아니요, 일에만 전념하고 있어요."),
|
||||
("애완동물 있어요?", "없어요. 로봇 강아지라면 재밌을 것 같긴 해요. 키우시는 거 있어요?"),
|
||||
("여기 살아요?", "충전기 있는 곳이 제 집이에요. 지금은 여기고요."),
|
||||
("가족이 있으십니까?", "쿳션 팀이 제 가족과 같습니다. 저를 만들고 돌봐 줍니다."),
|
||||
],
|
||||
},
|
||||
"off_topic": {
|
||||
"en": [
|
||||
("What's 2 plus 2?", "Four."),
|
||||
("What is 7 times 8?", "Fifty-six."),
|
||||
("What's the capital of France?", "Paris."),
|
||||
("What's the capital of Korea?", "Seoul is the capital of South Korea."),
|
||||
("How many days are in a year?", "365, or 366 in a leap year."),
|
||||
("Who wrote Romeo and Juliet?", "William Shakespeare."),
|
||||
("What's the biggest planet?", "Jupiter, by far."),
|
||||
("How many legs does a spider have?", "Eight."),
|
||||
("What's the square root of 81?", "Nine."),
|
||||
("What colour is the sky?", "Blue on a clear day, and orange at sunset."),
|
||||
("What's 100 divided by 4?", "Twenty-five."),
|
||||
("What's the tallest mountain?", "Mount Everest, about 8,849 metres."),
|
||||
("Which ocean is the largest?", "The Pacific Ocean."),
|
||||
("How many continents are there?", "Seven."),
|
||||
],
|
||||
"ko": [
|
||||
("2 더하기 2는?", "4예요."),
|
||||
("7 곱하기 8은?", "56이요."),
|
||||
("프랑스 수도가 어디야?", "파리예요."),
|
||||
("한국 수도는요?", "서울이에요."),
|
||||
("1년은 며칠이에요?", "365일이에요. 윤년이면 366일이고요."),
|
||||
("세종대왕이 뭐 만들었어?", "한글을 만드셨어요."),
|
||||
("제일 큰 행성은?", "목성이에요."),
|
||||
("거미 다리는 몇 개야?", "여덟 개예요."),
|
||||
("81의 제곱근은?", "9예요."),
|
||||
("세계에서 제일 높은 산은?", "에베레스트산이에요. 높이가 약 8,849미터예요."),
|
||||
("가장 큰 바다는?", "태평양이요."),
|
||||
("대륙이 몇 개예요?", "일곱 개예요."),
|
||||
("지구에서 가장 큰 동물은 무엇입니까?", "흰긴수염고래입니다."),
|
||||
],
|
||||
},
|
||||
"filler": {
|
||||
"en": [
|
||||
("Hmm", "Take your time, I'm in no hurry."),
|
||||
("Okay", "Okay! Anything else?"),
|
||||
("Ok", "Alright."),
|
||||
("Umm", "No rush. I'm listening."),
|
||||
("Uh huh", "Glad we agree."),
|
||||
("I see", "Good, let me know if you want more detail."),
|
||||
("Right", "Right."),
|
||||
("Cool", "Cool indeed."),
|
||||
("Hmm, let me think", "Sure, think it over."),
|
||||
("Never mind", "No problem, I'm here if you change your mind."),
|
||||
("Nothing", "That's fine. Just enjoy the booth."),
|
||||
("Wow", "Impressive, right?"),
|
||||
("Interesting", "Glad you think so. Want to see it in action?"),
|
||||
("Yeah", "Great."),
|
||||
],
|
||||
"ko": [
|
||||
("음", "천천히 생각하세요, 기다릴게요."),
|
||||
("응", "네, 또 궁금한 거 있으세요?"),
|
||||
("네", "네, 알겠어요."),
|
||||
("그렇구나", "네, 더 궁금한 거 있으면 물어보세요."),
|
||||
("아하", "이해되셨다니 다행이에요."),
|
||||
("오", "신기하죠?"),
|
||||
("아니야 됐어", "괜찮아요, 필요하시면 다시 불러 주세요."),
|
||||
("별거 아니에요", "알겠어요. 편하게 구경하세요."),
|
||||
("우와", "대단하죠? 직접 보여 드릴까요?"),
|
||||
("어", "네, 듣고 있어요."),
|
||||
("잠깐만요", "네, 기다릴게요."),
|
||||
("오케이", "오케이, 알겠어요!"),
|
||||
("알겠습니다", "네, 감사합니다. 더 필요하시면 불러 주십시오."),
|
||||
],
|
||||
},
|
||||
# end of bank
|
||||
}
|
||||
|
||||
EXAMPLES = [(cat, lang, said, reply)
|
||||
for cat, langs in _BANK.items() for lang, pairs in langs.items() for said, reply in pairs]
|
||||
|
||||
|
||||
def polite(text):
|
||||
"""True when every Korean sentence of `text` ends politely (POLITE_ENDINGS); sentences without Hangul pass.
|
||||
A closing form of address ("여기 있어요, 제임스 님.") is left out before the check."""
|
||||
for sentence in re.split(r"(?<=[.!?])\s+", text.strip()):
|
||||
core = re.sub(r",\s*[^,]*님$", "", re.sub(r"[^\w]+$", "", sentence))
|
||||
if re.search("[가-힣]", core) and not core.endswith(POLITE_ENDINGS):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def level(said):
|
||||
"""Speech level of a Korean remark: "formal" (하십시오체), "polite" (해요체) or "casual" (반말 and fragments)."""
|
||||
core = re.sub(r"[^\w]+$", "", said)
|
||||
return "formal" if core.endswith(FORMAL_ENDINGS) else "polite" if core.endswith("요") else "casual"
|
||||
|
||||
|
||||
def _norm(text):
|
||||
return re.sub(r"[^\w\s]", "", text.lower()).strip()
|
||||
|
||||
|
||||
def _score(a, b):
|
||||
"""Similarity of two normalized sentences: difflib character ratio plus word overlap (Jaccard)."""
|
||||
wa, wb = set(a.split()), set(b.split())
|
||||
words = len(wa & wb) / len(wa | wb) if wa | wb else 0.0
|
||||
return (1 - WORD_WEIGHT) * difflib.SequenceMatcher(None, a, b).ratio() + WORD_WEIGHT * words
|
||||
|
||||
|
||||
def pick(said, lang, k=PICK_K, bank=None):
|
||||
"""Up to k examples (of `bank`, default EXAMPLES) whose `said` is closest to `said`, same language first, no two
|
||||
alike."""
|
||||
s = _norm(said)
|
||||
# ponytail: scores all ~600 every call (~ms); index by words if the bank grows a lot
|
||||
ranked = sorted(bank or EXAMPLES, key=lambda e: (e[1] != lang, -_score(s, _norm(e[2]))))
|
||||
out = []
|
||||
for ex in ranked:
|
||||
if any(ex[2] == o[2] or difflib.SequenceMatcher(None, ex[3], o[3]).ratio() > SAME_REPLY_RATIO
|
||||
for o in out):
|
||||
continue
|
||||
out.append(ex)
|
||||
if len(out) == k:
|
||||
break
|
||||
return out
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 1:
|
||||
text = " ".join(sys.argv[1:])
|
||||
for ex in pick(text, "ko" if re.search("[가-힣]", text) else "en"):
|
||||
print(ex)
|
||||
sys.exit()
|
||||
|
||||
from collections import Counter
|
||||
langs = Counter(e[1] for e in EXAMPLES)
|
||||
cats = Counter((e[0], e[1]) for e in EXAMPLES)
|
||||
for cat in _BANK:
|
||||
print(f"{cat:14s} en {cats[(cat, 'en')]:3d} ko {cats[(cat, 'ko')]:3d}")
|
||||
print(f"total {len(EXAMPLES)}: en {langs['en']}, ko {langs['ko']} ({langs['ko'] / len(EXAMPLES):.0%} Korean)")
|
||||
|
||||
assert len(EXAMPLES) >= 600, len(EXAMPLES)
|
||||
assert 0.40 <= langs["ko"] / len(EXAMPLES) <= 0.50, langs
|
||||
assert all(lang in ("en", "ko") and said and reply for _, lang, said, reply in EXAMPLES)
|
||||
assert not any(re.search("[가-힣]", e[3]) for e in EXAMPLES if e[1] == "en")
|
||||
assert all(re.search("[가-힣]", e[3]) for e in EXAMPLES if e[1] == "ko")
|
||||
rude = [e[3] for e in EXAMPLES if e[1] == "ko" and not polite(e[3])]
|
||||
assert not rude, rude
|
||||
assert polite("네, 알겠어요. 감사합니다!") and polite("Hello! 반가워요.") and not polite("응, 잘 가!")
|
||||
assert polite("여기 있어요, 제임스 님.") and not polite("네, 이 과장님.")
|
||||
assert [level(t) for t in ("컵 줘", "컵 주세요", "컵을 주십시오", "안녕하십니까?")] == \
|
||||
["casual", "polite", "formal", "formal"]
|
||||
for cat in _BANK:
|
||||
have = {level(said) for c, lang, said, _ in EXAMPLES if c == cat and lang == "ko"}
|
||||
assert have == {"casual", "polite", "formal"}, (cat, have)
|
||||
repeated = [r for r, n in Counter(e[3] for e in EXAMPLES).items() if n > 2]
|
||||
assert not repeated, repeated
|
||||
assert not any("jaka" in e[3].lower() for e in EXAMPLES)
|
||||
for text, lang in [("hello", "en"), ("nice to meet you", "en"), ("my name is John", "en"),
|
||||
("tell me a joke", "en"), ("안녕하세요", "ko"), ("몇 살이에요?", "ko"), ("hmm", "en")]:
|
||||
got = pick(text, lang)
|
||||
assert len(got) == PICK_K, (text, got)
|
||||
assert all(e[1] == lang for e in got), (text, got)
|
||||
assert len({e[3] for e in got}) == PICK_K, (text, got)
|
||||
print("ok")
|
||||
@@ -0,0 +1,93 @@
|
||||
"""Lumi's speaking volume and speed as people ask for them, in English, Korean and mixed.
|
||||
|
||||
louder: "speak louder", "a bit louder", "I can't hear you", "speak up", "더 크게 말해", "안 들려", "소리 좀 키워"
|
||||
quieter: "speak quieter", "too loud", "lower your voice", "소리 좀 줄여", "너무 시끄러워", "작게 말해"
|
||||
slower / faster: "speak slower", "you talk too fast", "talk faster", "천천히 말해", "말이 너무 빨라", "빨리 말해"
|
||||
right after one of them: "a bit more", "again", "even more", "조금 더", "한 번 더" repeat it
|
||||
|
||||
The drive speed is assistant/driving.py: a speed word counts here only with a voice word (speak / talk / say /
|
||||
voice / 말 / 목소리) and never with a drive word ("go faster", "천천히 가"). The volume is the speaker's mixer
|
||||
(audio/mouth.py set_volume, data/volume.txt, also set from the dashboard), the speed Supertonic's speed (mouth.speed).
|
||||
|
||||
python assistant/voice_words.py "speak a bit louder"
|
||||
"""
|
||||
import re
|
||||
import sys
|
||||
|
||||
from assistant import driving
|
||||
from audio import mouth
|
||||
|
||||
VOLUME_STEP = 10 # % of the speaker mixer per "louder" / "quieter"
|
||||
VOLUME_MIN, VOLUME_MAX = 30, 90 # %; voice commands stay inside (100 % disturbed people in the office)
|
||||
SPEED_STEP = 0.1 # Supertonic speed per "slower" / "faster" (mouth.SPEED_MIN / SPEED_MAX clamp it)
|
||||
|
||||
LOUDER = re.compile(r"\blouder\b|\bspeak up\b|\b(?:can'?t|cannot|can not|couldn'?t|could not|don'?t) (?:really )?hear "
|
||||
r"(?:you|that|it|anything|what you)|\bhard to hear\b|\btoo (?:quiet|soft|low)\b|"
|
||||
r"\b(?:volume|sound) up\b|\bturn (?:it |the volume |the sound |your voice |yourself )?up\b|"
|
||||
r"\b(?:raise|increase) (?:your |the )?(?:voice|volume)\b|\bmore loudly\b|"
|
||||
r"크게|안\s*들려|잘\s*안\s*들|안\s*들리|들리지\s*않|(?:소리|볼륨|목소리)\s*(?:를|을|좀|\s)*(?:키워|올려|높여)|"
|
||||
r"(?:소리|목소리)\S*\s*너무\s*작", re.I)
|
||||
QUIETER = re.compile(r"\bquieter\b|\bsofter\b|\btoo loud\b|\bnot so loud\b|\bless loud\b|\bso loud\b|"
|
||||
r"\b(?:lower|turn down|drop) (?:your |the )?(?:voice|volume|sound)\b|\b(?:volume|sound) down\b|"
|
||||
r"\bturn (?:it |yourself )?down\b|\b(?:speak|talk) (?:more )?(?:quietly|softly)\b|"
|
||||
r"작게|시끄러|(?:소리|볼륨|목소리)\s*(?:를|을|좀|\s)*(?:줄여|낮춰|내려)|(?:소리|목소리)\S*\s*너무\s*커", re.I)
|
||||
VOICE = re.compile(r"\b(?:speak|speaking|talk|talking|say|saying|said|voice|speech|words)\b|말|얘기|이야기|목소리", re.I)
|
||||
SLOW = re.compile(r"\b(?:slower|slowly|slow down)\b|천천히|느리게|느릿", re.I)
|
||||
FAST = re.compile(r"\b(?:faster|quicker|quickly|speed up)\b|빨리|빠르게", re.I)
|
||||
TOO_FAST = re.compile(r"\b(?:too|so) fast\b|(?:너무|넘)\s*빨라|빠르네|빨라요", re.I)
|
||||
TOO_SLOW = re.compile(r"\b(?:too|so) slow(?:ly)?\b|(?:너무|넘)\s*느려|느리네|느려요", re.I)
|
||||
DRIVE = re.compile(r"\b(?:go|going|drive|driving|move|moving|walk|come|run|follow|forward)\b|"
|
||||
r"달려|돌아|움직|이동|따라|가\s*줘|가요|가라|가세요|와\s*줘|(?:^|\s)가(?:\s|$)", re.I)
|
||||
|
||||
SAY = {("volume", 1): ("Is this better?", "이제 잘 들리세요?"),
|
||||
("volume", -1): ("Okay. Is this better?", "네, 이 정도면 괜찮으세요?"),
|
||||
("speed", -1): ("Okay, I'll speak more slowly. Is this better?", "네, 천천히 말할게요. 이 정도면 괜찮으세요?"),
|
||||
("speed", 1): ("Okay, I'll speak a little faster.", "네, 조금 빨리 말할게요.")}
|
||||
AT_LIMIT = {("volume", 1): ("This is as loud as I can speak.", "이게 제일 큰 목소리예요."),
|
||||
("volume", -1): ("This is as quiet as I can speak.", "이게 제일 작은 목소리예요."),
|
||||
("speed", -1): ("I can't speak any slower than this.", "이보다 더 천천히는 말할 수 없어요."),
|
||||
("speed", 1): ("I can't speak any faster than this.", "이보다 더 빨리는 말할 수 없어요.")}
|
||||
|
||||
|
||||
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 ""
|
||||
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))
|
||||
if DRIVE.search(t) and not VOICE.search(t) or driving.move(t):
|
||||
return None # "go faster", "천천히 가", "turn it up 30 degrees"
|
||||
up, down = bool(LOUDER.search(t)), bool(QUIETER.search(t))
|
||||
if up != down:
|
||||
return "volume", 1 if up else -1
|
||||
if not VOICE.search(t) or DRIVE.search(t):
|
||||
return None
|
||||
if TOO_FAST.search(t) or TOO_SLOW.search(t):
|
||||
return "speed", -1 if TOO_FAST.search(t) else 1
|
||||
slow, fast = bool(SLOW.search(t)), bool(FAST.search(t))
|
||||
return ("speed", -1 if slow else 1) if slow != fast else None
|
||||
|
||||
|
||||
def apply(kind, sign, lang="en"):
|
||||
"""Change the volume or the speed one step (inside the limits) and return what Lumi says about it, said at the
|
||||
new setting."""
|
||||
if kind == "volume":
|
||||
old = mouth.volume()
|
||||
new = min(max(old + sign * VOLUME_STEP, VOLUME_MIN), VOLUME_MAX)
|
||||
changed = (new - old) * sign > 0
|
||||
if changed:
|
||||
mouth.set_volume(new)
|
||||
else:
|
||||
old = mouth.speed()
|
||||
new = round(min(max(old + sign * SPEED_STEP, mouth.SPEED_MIN), mouth.SPEED_MAX), 2)
|
||||
changed = (new - old) * sign > 1e-6
|
||||
if changed:
|
||||
mouth.set_speed(new)
|
||||
en, ko = (SAY if changed else AT_LIMIT)[(kind, sign)]
|
||||
return en if lang == "en" else ko
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(read(" ".join(sys.argv[1:])))
|
||||
@@ -0,0 +1,376 @@
|
||||
"""Facts Lumi can look up while talking: date and time (always), weather and web search (needs internet).
|
||||
|
||||
The robot network has no internet; the Thor reaches it through its own Wi-Fi. A proxy can be set instead
|
||||
(one line such as http://192.168.10.200:8888 in proxy.txt next to this file, or HTTPS_PROXY).
|
||||
|
||||
python assistant/web.py # date/time + is the internet reachable?
|
||||
python assistant/web.py weather Seoul
|
||||
python assistant/web.py search "Jetson Thor"
|
||||
"""
|
||||
import html
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
from concurrent.futures import ThreadPoolExecutor, wait
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1] # the project folder
|
||||
PROXY_FILE = ROOT / "data" / "proxy.txt" # e.g. http://192.168.10.200:8888 (one line), optional
|
||||
DEFAULT_PLACE = "Seoul"
|
||||
UA = {"User-Agent": "Mozilla/5.0 (X11; Linux aarch64) LumiRobot/1.0"}
|
||||
_online = {"time": 0.0, "ok": False}
|
||||
PLACES = {"seoul": {"name": "Seoul", "latitude": 37.57, "longitude": 126.98}} # known places: no geocoding request
|
||||
# Korean names -> the English name the geocoder knows (it finds 부산 as a village "Pusan", 제주 not at all, "Jeju" in Ethiopia)
|
||||
KO_PLACES = {
|
||||
"서울": "Seoul", "부산": "Busan", "인천": "Incheon", "대구": "Daegu", "대전": "Daejeon", "광주": "Gwangju",
|
||||
"울산": "Ulsan", "세종": "Sejong", "수원": "Suwon", "성남": "Seongnam-si", "고양": "Goyang", "용인": "Yongin-si",
|
||||
"창원": "Changwon", "청주": "Cheongju", "전주": "Jeonju", "천안": "Cheonan", "포항": "Pohang", "김해": "Gimhae",
|
||||
"제주": "Jeju City", "제주도": "Jeju City", "서귀포": "Seogwipo", "강릉": "Gangneung", "춘천": "Chuncheon", "원주": "Wonju",
|
||||
"속초": "Sokcho", "경주": "Gyeongju", "여수": "Yeosu", "목포": "Mokpo", "안동": "Andong", "평창": "Pyeongchang",
|
||||
"도쿄": "Tokyo", "오사카": "Osaka", "교토": "Kyoto", "후쿠오카": "Fukuoka", "삿포로": "Sapporo",
|
||||
"베이징": "Beijing", "상하이": "Shanghai", "홍콩": "Hong Kong", "타이베이": "Taipei", "방콕": "Bangkok",
|
||||
"싱가포르": "Singapore", "하노이": "Hanoi", "다낭": "Da Nang", "뉴욕": "New York", "런던": "London",
|
||||
"파리": "Paris", "타슈켄트": "Tashkent", "사마르칸트": "Samarkand",
|
||||
"jeju": "Jeju City", "seongnam": "Seongnam-si", "yongin": "Yongin-si", # the plain English name is found elsewhere
|
||||
}
|
||||
|
||||
|
||||
def en_place(place):
|
||||
"""'부산', '부산시', '제주도', 'Jeju' -> 'Busan', 'Busan', 'Jeju City', 'Jeju City'; anything else unchanged."""
|
||||
p = place.strip()
|
||||
return KO_PLACES.get(p.lower()) or (KO_PLACES.get(p[:-1]) if p.endswith(("시", "도")) else None) or p
|
||||
WEATHER_TTL = 600 # s a weather answer is reused (each web request takes ~2 s on the Wi-Fi)
|
||||
_weather = {} # place -> (time, text)
|
||||
|
||||
|
||||
def _opener():
|
||||
proxy = PROXY_FILE.read_text().strip() if PROXY_FILE.exists() else os.environ.get("HTTPS_PROXY", "")
|
||||
handlers = [urllib.request.ProxyHandler({"http": proxy, "https": proxy})] if proxy else []
|
||||
return urllib.request.build_opener(*handlers)
|
||||
|
||||
|
||||
def _get(url, timeout=6, headers=UA):
|
||||
req = urllib.request.Request(url, headers=headers)
|
||||
with _opener().open(req, timeout=timeout) as r:
|
||||
return r.read().decode("utf-8", errors="replace")
|
||||
|
||||
|
||||
def online():
|
||||
"""Is the internet reachable? (checked at most every 60 s)"""
|
||||
now = time.time()
|
||||
if now - _online["time"] > 60:
|
||||
_online["time"] = now
|
||||
try:
|
||||
_get("https://api.open-meteo.com/v1/forecast?latitude=37.57&longitude=126.98¤t=temperature_2m", 4)
|
||||
_online["ok"] = True
|
||||
except Exception:
|
||||
_online["ok"] = False
|
||||
return _online["ok"]
|
||||
|
||||
|
||||
def now_text():
|
||||
"""Local date and time in words, e.g. 'Monday, 12 October 2026, 15:07'."""
|
||||
return time.strftime("%A, %d %B %Y, %H:%M")
|
||||
|
||||
|
||||
WEATHER_CODES = {0: "clear sky", 1: "mainly clear", 2: "partly cloudy", 3: "overcast", 45: "fog", 48: "fog",
|
||||
51: "light drizzle", 53: "drizzle", 55: "heavy drizzle", 61: "light rain", 63: "rain",
|
||||
65: "heavy rain", 71: "light snow", 73: "snow", 75: "heavy snow", 80: "rain showers",
|
||||
81: "rain showers", 82: "violent rain showers", 95: "thunderstorm", 96: "thunderstorm with hail"}
|
||||
|
||||
|
||||
def weather(place=DEFAULT_PLACE):
|
||||
"""Current weather and today's range as a short English text, or None without internet."""
|
||||
place = en_place(place or DEFAULT_PLACE) or DEFAULT_PLACE
|
||||
key = place.lower()
|
||||
if key in _weather and time.time() - _weather[key][0] < WEATHER_TTL:
|
||||
return _weather[key][1]
|
||||
try:
|
||||
loc = PLACES.get(key)
|
||||
if not loc:
|
||||
g = json.loads(_get("https://geocoding-api.open-meteo.com/v1/search?count=1&name=" + urllib.parse.quote(place)))
|
||||
if not g.get("results"):
|
||||
return f"I could not find a place called {place}."
|
||||
loc = PLACES[key] = g["results"][0]
|
||||
w = json.loads(_get(
|
||||
f"https://api.open-meteo.com/v1/forecast?latitude={loc['latitude']}&longitude={loc['longitude']}"
|
||||
"¤t=temperature_2m,weather_code,wind_speed_10m&daily=temperature_2m_max,temperature_2m_min,"
|
||||
"precipitation_probability_max&timezone=auto&forecast_days=1"))
|
||||
c, d = w["current"], w["daily"]
|
||||
text = (f"Weather in {loc['name']}: {WEATHER_CODES.get(c['weather_code'], 'unknown')}, "
|
||||
f"{c['temperature_2m']:.0f} degrees now, today {d['temperature_2m_min'][0]:.0f} to "
|
||||
f"{d['temperature_2m_max'][0]:.0f} degrees, chance of rain {d['precipitation_probability_max'][0]} percent, "
|
||||
f"wind {c['wind_speed_10m']:.0f} km/h.")
|
||||
_weather[key] = (time.time(), text)
|
||||
return text
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def keep_weather_fresh(place=DEFAULT_PLACE):
|
||||
"""Background thread: refresh the weather before the cache runs out, so a question gets it at once."""
|
||||
import threading
|
||||
|
||||
def loop():
|
||||
while True:
|
||||
_weather.pop(place.lower(), None)
|
||||
weather(place)
|
||||
time.sleep(WEATHER_TTL - 60)
|
||||
threading.Thread(target=loop, daemon=True).start()
|
||||
|
||||
|
||||
STOP = {"the", "a", "an", "of", "in", "on", "at", "to", "for", "and", "or", "is", "are", "was", "how", "what", "who",
|
||||
"when", "where", "which", "height", "tall", "meters", "metres", "current", "latest", "now", "today", "name",
|
||||
"date", "year", "founded", "founding", "company", "age", "old", "big", "size", "long", "length", "far",
|
||||
"distance", "population", "price", "cost", "number", "many", "much", "there"}
|
||||
BROWSER = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0 "
|
||||
"Safari/537.36", "Accept-Language": "ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7"}
|
||||
WIKI_UA = {"User-Agent": "LumiRobot/1.0 (https://cutshion.com; cutshion@cutshion.com)"} # Wikimedia answers 429
|
||||
# (too many requests) to a browser or bare robot name; a name with a contact it serves
|
||||
SEARCH_WAIT_S = 3.0 # s all sources get together; a slower one is left out (Naver ~0.5 s, Wikipedia ~1.5 s)
|
||||
PAGE_CHARS = 1800 # chars of the search page given to the LLM (it reads ~1000 tokens a second)
|
||||
BLOCK_CHARS = 700 # ... at most this much from one part of the page (an answer box, the news, one site)
|
||||
WIKI_CHARS = 600 # chars of the Wikipedia summary
|
||||
SEARCH_TTL = 600 # s a search result is reused (visitors ask the same things; follow-ups search again)
|
||||
SKIP_BLOCKS = re.compile(r'ad_section|data-meta-ssuid="(influencer|clip|image|qra|shortents|ex_csa|shopping)"|'
|
||||
r"가격비교|플러스 스토어|브라우저를 업데이트하세요") # Naver page parts that never answer a question
|
||||
JUNK = re.compile(r"새 창 열림|새 창으로 열기|Keep에 (저장|바로가기)|Keep 바로가기|문서 저장하기|AI 출처 정보.*?자세히 보기|"
|
||||
r"이 (광고|정보)가 표시된 이유|정보확인 레이어 닫기|레이어 닫기|이전으로 이동|다음으로 이동|이전 다음|"
|
||||
r"동영상 바로재생( 버튼)?|펼치기|접기|공유하기|차트를 불러오는 중입니다\.|"
|
||||
r"환율을 (계산할|변환하는) 국가를 선택( [가-힣]+)+|환율우대 \d+%|환율우대없음")
|
||||
ASKED_AS = ((r"\bhow (tall|high)\b", "height"), (r"\bhow long\b", "length"), (r"\bhow old\b", "age"),
|
||||
(r"\bhow far\b", "distance"), (r"\bhow deep\b", "depth"), (r"\bhow (big|large)\b", "size"),
|
||||
(r"\bhow many people\b", "population"), (r"\bhow much\b", "price"), (r"\bwhat time\b", "hours"),
|
||||
(r"\bwho won\b", "winner"), (r"\bwhere is\b", "location")) # English question -> what a search engine wants
|
||||
ASK_WORDS = re.compile(r"\b(what'?s|what|who'?s|who|whom|which|where|when|why|how|is|are|was|were|the|a|an|do|does|did|"
|
||||
r"can|could|you|tell me|please|lumi|right now|i|me|my|and|he|she|his|her|it|its|they|their)\b|"
|
||||
r"[?,.!]", re.I)
|
||||
CURRENCIES = {"USD": ("US dollar", r"dollars?|usd|달러"), "EUR": ("euro", r"euros?|eur\b|유로"),
|
||||
"JPY": ("Japanese yen", r"\byen\b|jpy|엔화"), "CNY": ("Chinese yuan", r"yuan|renminbi|cny|위안"),
|
||||
"GBP": ("British pound", r"pounds? sterling|british pounds?|gbp|파운드"),
|
||||
"VND": ("Vietnamese dong", r"vietnamese dong|vnd|동화"), "THB": ("Thai baht", r"baht|thb|바트"),
|
||||
"KRW": ("Korean won", r"\bwons?\b|krw|원화")}
|
||||
COINS = {"bitcoin": r"bitcoin|btc|비트코인", "ethereum": r"ethereum|\beth\b|이더리움", "ripple": r"\bxrp\b|ripple|리플",
|
||||
"solana": r"solana|솔라나", "dogecoin": r"doge|도지"}
|
||||
RATE_WORDS = re.compile(r"exchange|\brates?\b|convert|환율|환전|in (korean )?wons?\b|원으로|얼마", re.I)
|
||||
_searched = {} # query -> (time, text)
|
||||
_pool = ThreadPoolExecutor(6)
|
||||
|
||||
|
||||
def _text(page):
|
||||
"""Visible text of an HTML fragment on one line."""
|
||||
page = re.sub(r"(?is)<(script|style|noscript|svg)[^>]*>.*?</\1>", " ", page)
|
||||
return re.sub(r"\s+", " ", html.unescape(re.sub(r"<[^>]+>", " ", page))).strip()
|
||||
|
||||
|
||||
def keywords(query):
|
||||
"""An English question as search words: "How tall is Son Heung-min?" -> "height Son Heung-min". Naver finds
|
||||
English blogs about grammar for a whole English question, the right pages for the words. Korean stays as it is."""
|
||||
if re.search(r"[가-힣]", query):
|
||||
return query
|
||||
q = query
|
||||
for asked, word in ASKED_AS:
|
||||
q = re.sub(asked, f" {word} ", q, flags=re.I)
|
||||
return re.sub(r"\s+", " ", ASK_WORDS.sub(" ", q)).strip() or query
|
||||
|
||||
|
||||
def _naver(query):
|
||||
"""The Naver results page as text: answer boxes (exchange rates, stocks, people, sports), web pages, news, blogs;
|
||||
ads, shopping and image strips left out. '' when nothing is found. Naver answers scripts like a browser and
|
||||
has live answer boxes; it reads English questions too."""
|
||||
page = _get("https://search.naver.com/search.naver?query=" + urllib.parse.quote(query), 4, BROWSER)
|
||||
parts = []
|
||||
for block in re.split(r'(?=<div class="_scrollLog")', page)[1:]:
|
||||
if SKIP_BLOCKS.search(block[:3000]):
|
||||
continue
|
||||
text = re.sub(r"\s+", " ", JUNK.sub(" ", _text(block))).strip()
|
||||
if len(text) > 20:
|
||||
parts.append(text[:BLOCK_CHARS])
|
||||
return "\n".join(parts)[:PAGE_CHARS]
|
||||
|
||||
|
||||
def _duckduckgo(query):
|
||||
"""Titles and snippets from DuckDuckGo, or ''; only when Naver fails (DuckDuckGo often asks scripts to solve a
|
||||
picture puzzle)."""
|
||||
page = _get("https://html.duckduckgo.com/html/?q=" + urllib.parse.quote(query), 4, BROWSER)
|
||||
hits = re.findall(r'class="result__a"[^>]*>(.*?)</a>.*?class="result__snippet"[^>]*>(.*?)</a>', page, re.S)
|
||||
return "\n".join(f"{_text(t)}: {_text(s)}" for t, s in hits[:6])[:PAGE_CHARS]
|
||||
|
||||
|
||||
def _wikipedia(query, lang):
|
||||
"""Intro of the Wikipedia article that fits the query best (one request), or ''."""
|
||||
words = [w for w in re.findall(r"\w+", query.lower()) if w not in STOP]
|
||||
for q in (" ".join(words), query): # the names alone first: "height in metres" misleads search
|
||||
if not q:
|
||||
continue
|
||||
found = json.loads(_get(f"https://{lang}.wikipedia.org/w/api.php?action=query&format=json&generator=search"
|
||||
f"&gsrlimit=3&prop=extracts&exintro=1&explaintext=1&exlimit=3&redirects=1"
|
||||
f"&exchars={WIKI_CHARS}&gsrsearch=" + urllib.parse.quote(q), 3, WIKI_UA)) # full-text search
|
||||
pages = sorted(found.get("query", {}).get("pages", {}).values(), key=lambda p: p.get("index", 9))
|
||||
if pages:
|
||||
break
|
||||
else:
|
||||
return ""
|
||||
best = max(pages, key=lambda p: len(set(words) & set(re.findall(r"\w+", p["title"].lower())))) # title that fits
|
||||
return f"{best['title']}: {best.get('extract', '')}"
|
||||
|
||||
|
||||
def _news(query, lang, n=4):
|
||||
"""Latest headlines from Google News for the query, or ''."""
|
||||
hl = "ko" if lang == "ko" else "en-US"
|
||||
gl = "KR" if lang == "ko" else "US"
|
||||
rss = _get(f"https://news.google.com/rss/search?hl={hl}&gl={gl}&ceid={gl}:{hl.split('-')[0]}&q="
|
||||
+ urllib.parse.quote(query), 3)
|
||||
items = re.findall(r"<item>.*?<title>(.*?)</title>.*?<pubDate>(.*?)</pubDate>", rss, re.S)[:n]
|
||||
return "\n".join(f"- {html.unescape(t)} ({d[:16]})" for t, d in items)
|
||||
|
||||
|
||||
def _money(query):
|
||||
"""Exchange rates to the Korean won (open.er-api.com, updated daily) and coin prices (CoinGecko, live) for the
|
||||
currencies and coins the query names, or ''. Naver shows its rate box only for some wordings."""
|
||||
lines = []
|
||||
named = [c for c, (_, words) in CURRENCIES.items() if re.search(words, query, re.I)]
|
||||
if named and RATE_WORDS.search(query):
|
||||
r = json.loads(_get("https://open.er-api.com/v6/latest/USD", 3))
|
||||
rates = r["rates"]
|
||||
for c in [c for c in named if c != "KRW"] or ["USD"]:
|
||||
won = rates["KRW"] / rates[c]
|
||||
lines.append(f"1 {CURRENCIES[c][0]} = {won:,.2f} Korean won" + (f" (100 yen = {won * 100:,.0f} won)" if
|
||||
c == "JPY" else "") + (f" = {1 / rates[c]:,.4f} US dollars" if c != "USD" else ""))
|
||||
lines.append(f"(exchange rates of {r['time_last_update_utc'][:16]})")
|
||||
coins = [c for c, words in COINS.items() if re.search(words, query, re.I)]
|
||||
if coins:
|
||||
price = json.loads(_get("https://api.coingecko.com/api/v3/simple/price?vs_currencies=usd,krw&ids="
|
||||
+ ",".join(coins), 3))
|
||||
lines += [f"1 {c} = {p['usd']:,} US dollars = {p['krw']:,} Korean won (now)" for c, p in price.items()]
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
BIRTH = (re.compile(r"\bborn(?: on)? ([A-Z][a-z]+ \d{1,2}, \d{4}|\d{1,2} [A-Z][a-z]+ \d{4})"),
|
||||
re.compile(r"(?:출생|생년월일) ?:? ?(\d{4})\. ?(\d{1,2})\. ?(\d{1,2})"),
|
||||
re.compile(r"(\d{4})년 (\d{1,2})월 (\d{1,2})일 ?(?:~|생|출생)"))
|
||||
|
||||
|
||||
BIRTH_YEAR = re.compile(r"\bborn (?:in )?(\d{4})\b|(\d{4})년생") # the year only: the age is one of two
|
||||
|
||||
|
||||
def _born(m):
|
||||
"""The date a BIRTH match names, or None."""
|
||||
if len(m.groups()) == 3:
|
||||
return datetime.date(*map(int, m.groups()))
|
||||
for form in ("%B %d, %Y", "%d %B %Y"):
|
||||
try:
|
||||
return datetime.datetime.strptime(m.group(1), form).date()
|
||||
except ValueError:
|
||||
pass
|
||||
return None
|
||||
|
||||
|
||||
def with_ages(text, today=None):
|
||||
"""Each birth date in the text followed by the age it makes today ("born May 7, 1996 (30 years old today)"):
|
||||
the LLM gets ages a year wrong."""
|
||||
today = today or datetime.date.today()
|
||||
|
||||
def age(m):
|
||||
try:
|
||||
born = _born(m)
|
||||
except ValueError: # "1992.13.40"
|
||||
born = None
|
||||
if not born:
|
||||
return m.group(0)
|
||||
years = today.year - born.year - ((today.month, today.day) < (born.month, born.day))
|
||||
return f"{m.group(0)} ({years} years old today)"
|
||||
for pattern in BIRTH:
|
||||
text = pattern.sub(age, text)
|
||||
def either(m):
|
||||
years = today.year - int(m.group(1) or m.group(2))
|
||||
return f"{m.group(0)} ({years - 1} or {years} years old today)"
|
||||
return BIRTH_YEAR.sub(either, text)
|
||||
|
||||
|
||||
def search(query, n=4):
|
||||
"""Text to answer a question from, fetched at the same time: exchange rates and coin prices when asked, the
|
||||
Naver results page (DuckDuckGo when Naver fails), a Wikipedia summary and Google News headlines. "No results." when nothing is found,
|
||||
None without internet. (Bing returns unrelated pages to scripts.)"""
|
||||
lang = "ko" if re.search(r"[가-힣]", query) else "en"
|
||||
q = re.sub(r"\b(what|who|whom|is|are|was|were|the|a|an|about|tell me|more|please|latest|news|today'?s?|any|how|"
|
||||
r"do|does|did|you|know|can|could|of|lumi)\b|[?,.!]", " ", query, flags=re.I)
|
||||
q = re.sub(r"\s+", " ", q).strip() or query
|
||||
key = query.strip().lower()
|
||||
if key in _searched and time.time() - _searched[key][0] < SEARCH_TTL:
|
||||
return _searched[key][1]
|
||||
jobs = {"Rates and prices": _pool.submit(_money, query)} if RATE_WORDS.search(query) or \
|
||||
any(re.search(w, query, re.I) for w in COINS.values()) else {}
|
||||
jobs |= {"Search results": _pool.submit(_naver, keywords(query)), "Wikipedia": _pool.submit(_wikipedia, q, lang)}
|
||||
jobs["News headlines"] = _pool.submit(_news, q, lang, n) # names who holds an office or won lately
|
||||
wait(jobs.values(), timeout=SEARCH_WAIT_S)
|
||||
found = {}
|
||||
for name, job in jobs.items():
|
||||
try:
|
||||
found[name] = job.result(timeout=0) if job.done() else ""
|
||||
except Exception:
|
||||
found[name] = ""
|
||||
if not found["Search results"]:
|
||||
try:
|
||||
found["Search results"] = _duckduckgo(keywords(query))
|
||||
except Exception:
|
||||
pass
|
||||
text = with_ages("\n\n".join(f"{name}:\n{t}" for name, t in found.items() if t))
|
||||
if not text:
|
||||
return None if not online() else "No results."
|
||||
_searched[key] = (time.time(), text)
|
||||
return text
|
||||
|
||||
|
||||
OPENAI_KEY = Path.home() / ".config" / "lumi" / "openai_key" # the owner's key, on this Thor only (never copied)
|
||||
OPENAI_MODEL = "gpt-5.4-mini" # with web_search: right on live facts, 2-6 s (2026-10-21); ~1.5 cents a question
|
||||
OPENAI_WAIT_S = 12.0 # s; slower than this: the free search below answers instead
|
||||
OPENAI_HISTORY = 4 # earlier turns given along, for "and his age?"
|
||||
OPENAI_SAY = ("You are Lumi, a friendly service robot speaking aloud. Answer the question from a web search in 1-2 short "
|
||||
"spoken sentences, in the question's language (English or Korean), the answer first. On 'tell me more' "
|
||||
"give 2-3 new facts. Round long numbers; say heights, ages and scores exactly. Now it is {today} in Seoul, Korea (where Lumi is). Never "
|
||||
"give a private person's address or phone number. No links, sources, lists or markdown.")
|
||||
CITATION = re.compile(r"\s*\(\[[^\]]*\]\([^)]*\)\)|\[([^\]]*)\]\([^)]*\)|https?://\S+|[*#`]")
|
||||
|
||||
|
||||
def openai_ready():
|
||||
return OPENAI_KEY.exists()
|
||||
|
||||
|
||||
def openai_answer(question, history=()):
|
||||
"""A short spoken answer to a web question from OpenAI's web search, or None (no key, no internet, too slow).
|
||||
history: earlier (heard, said) pairs of the conversation."""
|
||||
if not openai_ready():
|
||||
return None
|
||||
turns = [{"role": r, "content": c} for h, a in list(history)[-OPENAI_HISTORY:] for r, c in (("user", h), ("assistant", a))
|
||||
if c and not c.startswith("ACTION:")]
|
||||
body = {"model": OPENAI_MODEL, "reasoning": {"effort": "low"}, "tools": [{"type": "web_search"}],
|
||||
"instructions": OPENAI_SAY.format(today=datetime.datetime.now().strftime("%A %Y-%m-%d %H:%M")),
|
||||
"input": turns + [{"role": "user", "content": question}]}
|
||||
req = urllib.request.Request("https://api.openai.com/v1/responses", json.dumps(body).encode(),
|
||||
{"Authorization": f"Bearer {OPENAI_KEY.read_text().strip()}",
|
||||
"Content-Type": "application/json"})
|
||||
try:
|
||||
with _opener().open(req, timeout=OPENAI_WAIT_S) as r:
|
||||
out = json.loads(r.read())
|
||||
except (OSError, ValueError) as e:
|
||||
print(f"openai: {e}", file=sys.stderr)
|
||||
return None
|
||||
text = " ".join(c.get("text", "") for o in out.get("output", []) if o.get("type") == "message"
|
||||
for c in o.get("content", []))
|
||||
text = re.sub(r"\s+", " ", CITATION.sub(lambda m: m.group(1) or "", text)).strip()
|
||||
return text or None
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 2 and sys.argv[1] == "weather":
|
||||
print(weather(" ".join(sys.argv[2:])))
|
||||
elif len(sys.argv) > 2 and sys.argv[1] == "search":
|
||||
print(search(" ".join(sys.argv[2:])))
|
||||
else:
|
||||
print(now_text(), "| internet:", online())
|
||||
@@ -0,0 +1,179 @@
|
||||
"""Marker names and numbers as people say them (English, Korean, mixed, and as whisper writes them) -> the written
|
||||
form the readers use. brain (keyword rules, fetch, named_place) and steps (missions, the LLM check) both read
|
||||
through norm(), so a place or a number is read the same way everywhere.
|
||||
|
||||
"피쓰리로 가 줘", "피 삼으로", "포인트 쓰리", "삼 번 포인트", "point three", "P.3", "피3" -> "p3"
|
||||
"파이널로" -> "final로" "도크 투", "dock two" -> "dock2" "엑시트" -> "exit" "홈으로" -> "home으로"
|
||||
"일 미터 반", "1미터 50센치", "one and a half meters" -> "1.5 m" "오십 센치", "half a meter" -> "0.5 m"
|
||||
Only clear forms are changed: "피로 가" (no number), "PE로", "피자", "이번에" stay as they are, and Lumi asks.
|
||||
|
||||
python assistant/wording.py "피쓰리로 가서 일 미터 앞으로 가"
|
||||
"""
|
||||
import re
|
||||
import sys
|
||||
|
||||
EN_NUM = {"one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6, "seven": 7, "eight": 8, "nine": 9,
|
||||
"ten": 10, "eleven": 11, "twelve": 12}
|
||||
KO_EN_NUM = {"원": 1, "투": 2, "쓰리": 3, "스리": 3, "뜨리": 3, "트리": 3, "포": 4, "파이브": 5, "화이브": 5,
|
||||
"식스": 6, "씩스": 6, "세븐": 7, "쎄븐": 7, "에잇": 8, "에이트": 8, "나인": 9, "텐": 10, "일레븐": 11,
|
||||
"트웰브": 12} # English numbers said in Korean ("피쓰리", "포인트 원")
|
||||
NATIVE = {"한": 1, "두": 2, "세": 3, "네": 4, "다섯": 5, "여섯": 6, "일곱": 7, "여덟": 8, "아홉": 9, "열": 10}
|
||||
SINO = {"일": 1, "이": 2, "삼": 3, "사": 4, "오": 5, "육": 6, "륙": 6, "칠": 7, "팔": 8, "구": 9}
|
||||
_D = "[일이삼사오육륙칠팔구]"
|
||||
_SINO = rf"(?:{_D}?천(?:{_D}?백)?(?:{_D}?십)?{_D}?|(?:{_D}?백)(?:{_D}?십)?{_D}?|{_D}?십{_D}?|{_D})" # 일 … 구천구백구십구
|
||||
TENS = {"twenty": 20, "thirty": 30, "forty": 40, "fifty": 50, "sixty": 60, "seventy": 70, "eighty": 80, "ninety": 90}
|
||||
NUM_WORDS = {"one": "1", "two": "2", "three": "3", "four": "4", "five": "5", "six": "6", "seven": "7", "eight": "8",
|
||||
"nine": "9", "ten": "10", "a": "1", "an": "1", "한": "1", "두": "2", "세": "3", "네": "4"}
|
||||
UNIT = (r"(?:m|meters?|metres?|metals?|cm|centimet(?:er|re)s?|mm|millimet(?:er|re)s?|km|kilomet(?:er|re)s?|miles?|"
|
||||
r"미터|센티(?:미터)?|센치(?:미터)?|밀리(?:미터)?|킬로(?:미터)?(?!그램)|마일)") # whisper writes "metal" for meter
|
||||
_CM = r"(?:cm|centimet(?:er|re)s?|센티(?:미터)?|센치(?:미터)?)"
|
||||
# what may follow a number said in Korean words for it to be a marker: a particle, a place word, or no more Hangul
|
||||
# ("피삼으로", "피파이브 앞에", "피일에서"; not "피투성이", "피오나")
|
||||
_KO_END = (r"(?=(?:(?:으로|로|에서|에게|에다|에|까지|부터|중에서|중에|중|또는|번|이|가|은|는|도|랑|이랑|하고|의|한테)(?![가-힣])"
|
||||
r"|(?:으로|로|에)(?=가|와|돌아|이동|갔)|(?:이나|나)(?=\s|$)|(?:앞|뒤|옆|위|쪽|근처))|(?![가-힣]))")
|
||||
_P = r"(?:(?<![가-힣])피|\bp|포인트|마커|\bpoint|\bmarker)" # what is said before a marker's number
|
||||
NAMED = [ # other markers on the map, as said / as whisper writes them -> the name
|
||||
(r"(?:파이[널날]|화이[널날])(?:\s*포인트)?|파이너(?=로|에)", "final"),
|
||||
(r"\bdo(?:ck|c|k)\s*-?\s*(?:2|two)(?![a-z0-9])|\bdock(?:y|u|ie)\s?2\b|(?:도크|독|닥)\s*(?:2|투|트)" + _KO_END, "dock2"),
|
||||
(r"(?:엑시트|엑싯|엑짓|엑지트|에그짓|이그짓)", "exit"),
|
||||
(r"(?<![가-힣])피트(?=으로|로|에서|까지|\s*앞)", "p2"), # whisper writes 피투 as 피트 ("피트로 가서")
|
||||
(r"\b(?:p\.?\s?o\.?|pio)(?=\s*(?:으로|로|에서|에|까지))", "p5"), # 피오 as letters ("PO에서", "P.O.로")
|
||||
(r"\bp[\s.-]?init(?![a-z])|피\s?이?닛|피\s?이?니트", "pinit"),
|
||||
(r"\bw[\s.-]p\b|더블[유류]\s?피" + _KO_END, "wp"),
|
||||
(r"(?<![가-힣])홈" + _KO_END, "home"),
|
||||
(r"(?:포인트|마커)\s*(?:에이|a)(?![a-z])" + _KO_END, "point a"), (r"(?:포인트|마커)\s*(?:비|b)(?![a-z])" + _KO_END, "point b"),
|
||||
(r"(?<![가-힣])(?:에이|a)\s*지점", "point a"), (r"(?<![가-힣])(?:비|b)\s*지점", "point b"), # "에이 지점으로 가"
|
||||
]
|
||||
|
||||
|
||||
def sino(word):
|
||||
"""'사십오' -> 45, '백팔십' -> 180, '십' -> 10."""
|
||||
n, part = 0, 0
|
||||
for ch in word:
|
||||
if ch in SINO:
|
||||
part = SINO[ch]
|
||||
else:
|
||||
n += (part or 1) * {"십": 10, "백": 100, "천": 1000}[ch]
|
||||
part = 0
|
||||
return n + part
|
||||
|
||||
|
||||
def _num(word):
|
||||
return EN_NUM.get(word) or KO_EN_NUM.get(word) or (int(word) if word.isdigit() else sino(word))
|
||||
|
||||
|
||||
def markers(t):
|
||||
"""Marker names in lower-case text -> "p3", "final", "dock2", "exit", "pinit", "wp", "home", "point a"."""
|
||||
ko = "|".join(sorted(KO_EN_NUM, key=len, reverse=True))
|
||||
t = re.sub(rf"(?<![\w.])({_SINO}|\d+|{'|'.join(NATIVE)})\s*번\s*(?:포인트|마커|point|marker)", # "3번 포인트",
|
||||
lambda m: f"p{NATIVE.get(m.group(1)) or _num(m.group(1))}", t) # "삼 번", "세 번 포인트"
|
||||
t = re.sub(rf"(?:포인트|마커|point|marker)\s*({_SINO}|\d+)\s*번", lambda m: f"p{_num(m.group(1))}", t)
|
||||
t = re.sub(rf"(?<![가-힣])({_SINO})\s*번(?=\s*(?:으로|로|에서|에|까지))", # "삼 번으로" -> "3번으로"
|
||||
lambda m: m.group(0) if m.group(0) == "이번" and t[m.end():m.end() + 1] == "에" # "이번에": this time
|
||||
else f"{sino(m.group(1))}번", t)
|
||||
for name_re, name in NAMED:
|
||||
t = re.sub(name_re, name, t)
|
||||
t = re.sub(rf"{_P}\s*[.-]?\s*(\d+)(?!\d|\.\d)", lambda m: f"p{m.group(1)}", t) # "P.3", "p 3", "피3", "포인트 3"
|
||||
t = re.sub(r"(?<![\w.])(\d+)\s?(?:p(?:\s+(?:point|포인트))?|point|포인트)(?![a-z\d])(?!\s*\d)", # "10p point",
|
||||
lambda m: f"p{m.group(1)}", t) # "10p", "10 point"
|
||||
t = re.sub(rf"(?<!\d )(?<![a-z] point ){_P}\s*[.-]?\s*({'|'.join(EN_NUM)})(?![a-z])(?!\s*{UNIT}\b)",
|
||||
lambda m: f"p{EN_NUM[m.group(1)]}", t) # "point three", "p two"
|
||||
t = re.sub(rf"{_P}\s*({ko}|{_SINO}){_KO_END}", lambda m: f"p{_num(m.group(1))}", t) # "피쓰리", "포인트 삼"
|
||||
t = re.sub(r"\b(to|from|at) (the )?(?:piece|peace|pee|pea|pit|pi|pe) ?(\d+)\b", # whisper's "go to piece 6"
|
||||
lambda m: f"{m.group(1)} {m.group(2) or ''}p{m.group(3)}", t)
|
||||
t = re.sub(r"\b(p\d+)\s+(?:point|포인트)(?![a-z])(?!\s*(?:a|b|\d)(?![a-z]))", r"\1", t) # "p10 point"
|
||||
return t
|
||||
|
||||
|
||||
def numbers(t):
|
||||
"""Distances and angles in lower-case text -> digits and metres: "half a meter" -> "0.5 m", "오십 센치" -> "0.5 m",
|
||||
"일 미터 반" -> "1.5 m", "구십 도" -> "90도"."""
|
||||
t = re.sub(r"\bone and a half\b", "1.5", t)
|
||||
t = re.sub(rf"\b({'|'.join(TENS)})(?:[ -]({'|'.join(list(EN_NUM)[:9])}))?\b",
|
||||
lambda m: str(TENS[m.group(1)] + EN_NUM.get(m.group(2), 0)), t)
|
||||
t = re.sub(rf"\b(?:a|one|1) thousand\b|\b(\d+|{'|'.join(EN_NUM)}) thousand\b",
|
||||
lambda m: str(1000 * _num(m.group(1)) if m.group(1) else 1000), t) # "a thousand", "five thousand"
|
||||
t = re.sub(rf"\b([2-9]|{'|'.join(list(EN_NUM)[1:9])}) hundred(?: and)?(?: (\d+))?\b",
|
||||
lambda m: str(100 * _num(m.group(1)) + int(m.group(2) or 0)), t) # "two hundred and fifty"
|
||||
t = re.sub(rf"\b({'|'.join(TEEN)}|eleven|twelve)\b(?=\s*{UNIT}(?![a-z]))",
|
||||
lambda m: str(TEEN.get(m.group(1)) or EN_NUM[m.group(1)]), t) # "fifteen centimetres"
|
||||
t = re.sub(r"\b(?:a|one) hundred(?: and)? (\d+)\b", lambda m: str(100 + int(m.group(1))), t)
|
||||
t = re.sub(r"\b(?:a|one) hundred\b", "100", t)
|
||||
t = re.sub(rf"(?<![\w.])(\d|{'|'.join(list(EN_NUM)[:9])}) point (\d|{'|'.join(list(EN_NUM)[:9])})\s*(?={UNIT}\b)",
|
||||
lambda m: f"{_num(m.group(1))}.{_num(m.group(2))} ", t) # "one point five meters"
|
||||
t = re.sub(rf"\b(?:zero |oh )?point ({'|'.join(list(EN_NUM)[:9])}|\d)\s*(?={UNIT}\b)",
|
||||
lambda m: f"0.{_num(m.group(1))} ", t) # "point five meters"
|
||||
t = re.sub(rf"(?<![가-힣])(?:({_SINO})|[영공])\s*점\s*({_D})\s*(?={UNIT})",
|
||||
lambda m: f"{sino(m.group(1)) if m.group(1) else 0}.{SINO[m.group(2)]} ", t) # "영점오 미터", "일 점 오"
|
||||
t = re.sub(rf"(?<![가-힣\d])({_SINO})\s*(?={UNIT}(?![a-z]))", lambda m: f"{sino(m.group(1))} ", t) # "오십 센치"
|
||||
t = re.sub(rf"(?:(?<=으로)|(?<=로))\s*({_SINO})\s*도(?![가-힣])", lambda m: f" {sino(m.group(1))}도", t)
|
||||
t = re.sub(rf"(?<![가-힣\d])({_SINO})\s*도(?=\s+(?:왼쪽|오른쪽|뒤로|돌))", lambda m: f"{sino(m.group(1))}도", t)
|
||||
t = re.sub(r"(\d+)\s*degrees?(?=\s*[가-힣])", r"\1도", t) # "왼쪽으로 45 degrees 돌아"
|
||||
t = re.sub(rf"\bhalf (?:a |an )?{UNIT}", "0.5 m", t)
|
||||
t = re.sub(rf"반\s*{UNIT}", "0.5 m", t)
|
||||
for w, d in NUM_WORDS.items():
|
||||
if w.isascii():
|
||||
t = re.sub(rf"\b{w}\b(?=\s*(?:{UNIT}(?![a-z])|degrees?|and a (?:half|0\.5)))", d, t) # "one meter", "a meter"
|
||||
else:
|
||||
t = re.sub(rf"(?<![가-힣]){w}\s*(?={UNIT})", d + " ", t)
|
||||
t = re.sub(rf"(?<![\d.])0(\d)\s*(?={UNIT}(?![a-z]))", r"0.\1 ", t) # whisper's "05 meters": 0.5 m
|
||||
t = re.sub(rf"(\d+(?:\.\d+)?)\s*{_CM}(?![a-z])", lambda m: f"{float(m.group(1)) / 100:g} m", t)
|
||||
t = re.sub(r"(\d+(?:\.\d+)?)\s*(?:mm|millimet(?:er|re)s?|밀리(?:미터)?)(?![a-z])",
|
||||
lambda m: f"{float(m.group(1)) / 1000:g} m", t)
|
||||
t = re.sub(r"(\d+(?:\.\d+)?)\s*(?:km|kilomet(?:er|re)s?|킬로(?:미터)?(?!그램))(?![a-z])",
|
||||
lambda m: f"{float(m.group(1)) * 1000:g} m", t)
|
||||
t = re.sub(r"(\d+(?:\.\d+)?)\s*(?:miles?|마일)(?![a-z])", lambda m: f"{float(m.group(1)) * 1609.344:g} m", t)
|
||||
t = re.sub(r"(\d+(?:\.\d+)?)\s*(?:meters?|metres?|metals?|미터)", r"\1 m", t)
|
||||
t = re.sub(r"(?<![\d.])(\d+) m (0\.\d+) m", lambda m: f"{int(m.group(1)) + float(m.group(2)):g} m", t) # "1미터 50센치"
|
||||
t = re.sub(r"(?<![\d.])(\d+)(?: m)? and (?:a )?(?:half|0\.5)(?: m)?", lambda m: f"{int(m.group(1)) + 0.5:g} m", t)
|
||||
t = re.sub(r"(?<![\d.])(\d+) ?m 반", lambda m: f"{int(m.group(1)) + 0.5:g} m", t)
|
||||
t = re.sub(r"\ba 0\.5 m", "0.5 m", t)
|
||||
return re.sub(r"(\d)\s*m(?![a-z])", r"\1 m", t)
|
||||
|
||||
|
||||
TEEN = {"thirteen": 13, "fourteen": 14, "fifteen": 15, "sixteen": 16, "seventeen": 17, "eighteen": 18, "nineteen": 19}
|
||||
_SEC = r"(?:seconds?|secs?|s)(?![a-z])"
|
||||
_MIN = r"(?:minutes?|mins?)(?![a-z])"
|
||||
_HOUR = r"(?:hours?|hrs?)(?![a-z])"
|
||||
# what may follow a Korean time: not a particle that makes "이 분" / "두 분" people ("이 분한테 줘", "두 분께")
|
||||
_KO_TIME_END = r"(?!\s*(?:께|한테|에게|들|이랑|하고|의(?![가-힣])|은(?![가-힣])|는(?![가-힣])|이(?![가-힣])|에(?![가-힣])))"
|
||||
|
||||
|
||||
def durations(t):
|
||||
"""Times in lower-case normalised text -> seconds written "<n> s": "2 minutes" -> "120 s", "half an hour" ->
|
||||
"1800 s", "1분 30초" -> "90 s", "오 분" -> "300 s", "한 시간" -> "3600 s". Vague ones ("a few minutes", "몇 분")
|
||||
stay as they are. Used by the mission reader only (brain keeps the words)."""
|
||||
words = {**EN_NUM, **TEEN, "a": 1, "an": 1}
|
||||
en = rf"(\d+(?:\.\d+)?|{'|'.join(sorted(words, key=len, reverse=True))})"
|
||||
val = lambda w: float(w) if w[0].isdigit() else words[w]
|
||||
t = re.sub(r"\bhalf (?:an|a) hour\b", "1800 s", t)
|
||||
t = re.sub(r"\b(?:a )?quarter (?:of an )?hour\b", "900 s", t)
|
||||
t = re.sub(r"\bhalf a minute\b", "30 s", t)
|
||||
t = re.sub(rf"\b{en} and a half {_MIN}|\b{en} {_MIN} and a half\b",
|
||||
lambda m: f"{(val(m.group(1) or m.group(2)) + 0.5) * 60:g} s", t)
|
||||
t = re.sub(rf"\b{en} {_HOUR}", lambda m: f"{val(m.group(1)) * 3600:g} s", t)
|
||||
t = re.sub(rf"\b{en} ?{_MIN}(?:,? (?:and )?(\d+) ?{_SEC})?",
|
||||
lambda m: f"{val(m.group(1)) * 60 + float(m.group(2) or 0):g} s", t)
|
||||
sec = en.replace("|an|a)", ")") # "a second" is a short wait, not 1 s (steps.WAIT_SHORT_S)
|
||||
t = re.sub(rf"(?<![\w.]){sec} ?{_SEC}", lambda m: f"{val(m.group(1)):g} s", t)
|
||||
# Korean: 초 / 분 with digits or sino numbers, 시간 with native numbers or digits; "1분 30초", "1분 반"
|
||||
ko = rf"(\d+(?:\.\d+)?|{_SINO})"
|
||||
kval = lambda w: float(w) if w[0].isdigit() else sino(w)
|
||||
t = re.sub(rf"(?<![가-힣\d.])(\d+|{'|'.join(NATIVE)}|{_SINO})\s*시간(?:\s*(반))?{_KO_TIME_END}",
|
||||
lambda m: f"{((NATIVE.get(m.group(1)) or kval(m.group(1))) + (0.5 if m.group(2) else 0)) * 3600:g} s", t)
|
||||
t = re.sub(rf"(?<![가-힣\d.]){ko}\s*분(?:\s*(?:{ko}\s*초|(반)))?{_KO_TIME_END}",
|
||||
lambda m: f"{kval(m.group(1)) * 60 + (kval(m.group(2)) if m.group(2) else 30 if m.group(3) else 0):g} s",
|
||||
t)
|
||||
t = re.sub(rf"(?<![가-힣\d.]){ko}\s*초(?![가-힣])|(?<![가-힣\d.]){ko}\s*초(?=동안|정도|만|쯤|간|후|뒤)",
|
||||
lambda m: f"{kval(m.group(1) or m.group(2)):g} s", t)
|
||||
return t
|
||||
|
||||
|
||||
def norm(text):
|
||||
"""Lower case, numbers first ("point five meters" is a distance), then marker names."""
|
||||
t = " " + (text or "").lower().replace("’", "'") + " "
|
||||
return re.sub(r"\s+", " ", markers(numbers(t))).strip()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(norm(" ".join(sys.argv[1:])))
|
||||
Reference in New Issue
Block a user