Improve Korean understanding at every speech level and long talks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,11 +34,14 @@ FILLS = 3 # place / object fills made of each template (the same e
|
||||
# ---------- guards: words the bank never reads ----------
|
||||
NEGATION = re.compile(r"\b(?:don'?t|do not|never|no need|not now|no more|stop \w+ing|quit \w+ing|without|forget it|"
|
||||
r"never ?mind|scratch that|cancel that)\b|취소|아니다|됐다|"
|
||||
r"[가-힣]지 ?마(?:세요|요|라|십시오)?(?![가-힣])|하지 ?말|말고|필요 ?없|안 ?(?:해|돼|가|와)(?:도)?\b|그만", re.I)
|
||||
r"[가-힣]지 ?마(?:세요|요|라|십시오)?(?![가-힣])|하지 ?말|말고|[가-힣]지 ?(?:말아|말라|마시|마셔|말게)|필요 ?없|안 ?(?:해|돼|가|와)(?:도)?\b|그만", re.I)
|
||||
LATER = re.compile(r"\b(?:when|whenever|if|unless|after|before|once|until|till|as soon as|later|tomorrow|tonight|"
|
||||
r"next time|in (?:\w+ ){0,2}(?:minute|hour|second|min|sec)s?|in a (?:while|bit)|soon)\b|분 ?(?:뒤|후|있다)|"
|
||||
r"[가-힣](?<![정화측반전표라장내외평단그러])면(?:\s|$)|(?:하|으|오|가|되|끝나|있으|오시)면|나중에|이따|내일|"
|
||||
r"다음에|있다가|(?:^|\s)(?:후|뒤|전)에(?![서가-힣])|때(?:에)?\s", re.I)
|
||||
r"다음에|있다가|(?:^|\s)(?:후|뒤|전)에(?![서가-힣])|때(?:에)?\s|다음 ?(?:주|달|번|시간)에?|"
|
||||
r"(?:^|\s)(?:\d{1,2}|한|두|세|네|다섯|여섯|일곱|여덟|아홉|열|열한|열두) ?시(?:에|쯤|까지)|"
|
||||
r"\b(?:next (?:week|month|year|monday|tuesday|wednesday|thursday|friday|saturday|sunday)|"
|
||||
r"at (?:\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)(?::\d\d)? ?(?:o'?clock|pm|am|p\.m\.|a\.m\.))", re.I)
|
||||
ABILITY = re.compile(r"\b(?:are you able|able to|know how to|how (?:do|can|could|would) you|is it possible|can you even|"
|
||||
r"capable of|do you (?:know|have)|can robots?|could robots?)\b|"
|
||||
r"\bcan you (?:\w+ )?(?:things|anything|objects|stuff|people|by yourself)\b|\b(?:can|could) you \w+(?: up)? (?:a|an|any)\b.*\?|"
|
||||
@@ -47,7 +50,9 @@ WONDER = re.compile(r"\bi wonder\b|\bwonder(?:ing)? (?:if|whether|how)\b|\bi bet
|
||||
r"\b(?:can|could|does|did|will|would|is|was) (?:it|this|that|the robot|this robot|that robot|he|she|this thing)\b|"
|
||||
r"\b(?:it|the robot|this robot|this thing) (?:can|could|does|will|is able)\b|\bcan it\b|"
|
||||
r"(?:있|하|되|가|와|오|돌|봐|올라|내려|흔들|집|따라)나(?:요)?\s*[??.~]*\s*$|나 ?봐(?:요)?\s*[??.~]*\s*$|"
|
||||
r"(?:^|\s)(?:얘|쟤|걔|이 로봇|저 로봇|로봇이|로봇은|로봇도|이게|이거는)\s|궁금", re.I)
|
||||
r"(?:^|\s)(?:얘|쟤|걔|이 로봇|저 로봇|로봇이|로봇은|로봇도|이게|이거는)\s|궁금|"
|
||||
r"(?:^|\s)(?:얘도|쟤도|걔도|이것도|이거도)\s|[가-힣]기도 (?:해|하나|하니|해요|합니까)\s*[??]?\s*$|" # "얘도 팔 접기도 해?"
|
||||
r"\blet'?s have (?:it|the robot|lumi|him|her)\b", re.I)
|
||||
# "can it wave? I wonder", "does it follow people?", "이거 손 흔들 수 있나?", "얘 따라오나 봐"
|
||||
NOT_TO_LUMI = re.compile(
|
||||
r"\bshall we\b|\bwe(?:'re| are) (?:heading|going|off|gonna)\b|\bwe (?:should|could|can|will|might|must|need to)\b|\bwe'll\b|"
|
||||
@@ -65,7 +70,8 @@ QUESTION = re.compile(r"^\W*(?:(?:hey|so|um+|uh+|lumi|okay|ok)\W+)*(?:what|where
|
||||
r"어디|뭐|무엇|왜|언제|누구|어떻게|몇|어느|무슨|어떤|얼마|[가-힣]까\s*[??]+\s*$|봤(?:어|니|나|냐|어요|습니까)|본 ?적|"
|
||||
r"\bhave you (?:been|gone|ever)\b|(?:어|아|해|여)도 ?(?:돼|되|될까|괜찮)|"
|
||||
r"알려 ?(?:줘|주|줄)|설명해|가르쳐|말해 ?(?:줘|봐|주)|\btell me\b|\bexplain\b|\bdescribe\b|"
|
||||
r"정확도|얼마나|을매나|속도", re.I) # "팔 정확도 알려 줘": a question, no motion
|
||||
r"정확도|얼마나|을매나|속도|(?:열려|닫혀|켜져|꺼져|접혀|펴져) ?있(?:어|어요|니|나요|습니까)?\s*[??]", re.I)
|
||||
# "그리퍼 열려 있어요?": a state asked, no motion # "팔 정확도 알려 줘": a question, no motion
|
||||
OTHER_SENSE = re.compile(r"instagram|insta\b|\bsns\b|\baccount\b|\bsubscribe\b|인스타|계정|채널|구독|팔로우 ?해 ?주세요|"
|
||||
r"따라 ?(?:해|하|말|불러)|\brepeat after\b|\bcopy me\b|\bdo what i do\b|\b(?:lend|give) me a hand\b|"
|
||||
r"\bneed a hand\b|\bhand it to\b|가는 ?길|길 ?(?:좀 )?알려|\bhow (?:do i|to) get\b|\bdirections?\b|\bthe way to\b|"
|
||||
@@ -725,7 +731,7 @@ AMOUNT = [(re.compile(r"\b\d+(?:\.\d+)?\s*(?:degrees?|도)(?![a-z])|\b\d+(?:\.\d
|
||||
def plain(text):
|
||||
"""The words without polite frames ("if you don't mind", "it'd be great if you could") and calls before."""
|
||||
from assistant import wording
|
||||
t = POLITE.sub(" ", wording.ko_plain(wording.now_not_later(text)))
|
||||
t = POLITE.sub(" ", wording.polite(wording.ko_plain(wording.now_not_later(text))))
|
||||
for rx, word in SLANG:
|
||||
t = rx.sub(word, t)
|
||||
t = re.sub(r"\s+([,.!?])", r"\1", re.sub(r"^[\s,.!?~]+", "", t))
|
||||
@@ -1145,9 +1151,11 @@ def _slot(kind, text, markers, holding):
|
||||
|
||||
def read(text, markers=(), holding=False):
|
||||
"""(action, target) as brain.intent gives it, when the bank is sure; else None (the LLM reads it)."""
|
||||
from assistant import brain
|
||||
said, text = text, plain(text)
|
||||
if guarded(text):
|
||||
return None
|
||||
if guarded(text) or brain.not_an_order(said, asked=False) or brain.held_back(said):
|
||||
return None # lumi.route holds these before the bank too: a later time, a
|
||||
# quote, "it's going to ...", "for the demo, let's have it ..."
|
||||
kind = kind_of(text, markers)
|
||||
if isinstance(kind, tuple): # two motions close: only when the words fit one of them
|
||||
kind, other = kind
|
||||
|
||||
Reference in New Issue
Block a user