Hearing: no false wakes from whisper's prompt, own-voice filter only while Lumi talks, Korean retry with a Korean prompt, f16 whisper model, ASR bench
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+32
-6
@@ -216,8 +216,8 @@ FAREWELL_ONLY = re.compile(r"^\s*(?:(?:ok(?:ay)?|alright|lumi|루미야?)[\s,.!]
|
||||
r"good job|great job|nice job|well done|take care|"
|
||||
r"가 ?보세요|가세요|가도 ?돼요?|잘했어요?|잘했네요?|좋아|좋네요?|수고했어요?|고생했어요?|"
|
||||
r"됐어요?,? 고마워요?)[\s.!~]*$", re.I) # said alone: the talk is over
|
||||
THANKS = re.compile(r"\bthank(?:s| you)\b|\bthanx\b|고마워|고맙|감사|땡큐", re.I)
|
||||
DONE_WORDS = re.compile(r"\bthat'?s (?:it|all|enough)\b|\bno,? thanks?\b|\bnothing(?: else)?\b|\benough\b|됐어|됐습니다|"
|
||||
THANKS = re.compile(r"\bthank(?:s| you)\b|\bthanx\b|\bcheers\b|고마워|고맙|감사|땡큐", re.I)
|
||||
DONE_WORDS = re.compile(r"\bthat'?s (?:it|all|enough|everything)\b|\bno,? thanks?\b|\bnothing(?: else)?\b|\benough\b|됐어|됐습니다|"
|
||||
r"그만", re.I) # with thanks: "that's it, thank you", "됐어요 고마워요" end the talk
|
||||
WELCOME = {"en": ["You're welcome.", "My pleasure.", "Anytime."], "ko": ["천만에요.", "별말씀을요.", "네, 언제든지요."]}
|
||||
RECEIVE_OK = re.compile(r"\b(ok(ay)?|done|here you go|there you go|go ahead|thank|thanks|yes)\b|됐어|됐습니다|놨어|여기요|"
|
||||
@@ -254,7 +254,7 @@ STATUS_Q = re.compile(
|
||||
r"(?:컵|병|사과|바나나|오렌지)(?:을|를)? ?들고 ?있(?:어|니|나요|어요)?\?|손이 ?비어|뭐 ?가져가는|그거 ?(?:누구 ?거|나 ?주는)", re.I)
|
||||
NOT_STATUS_NOW = re.compile(r"\b(tonight|after work|weekend|tomorrow|later today|for fun|in your free time)\b|주말|쉬는 날|"
|
||||
r"저 사람|우리|내일|퇴근|나중에", re.I) # not about what Lumi is doing now
|
||||
FAREWELL_WORDS = re.compile(r"\b(thanks?|thank you|bye|bay bay|goodbye|(?<!can't )(?<!cant )(?<!cannot )(?<!not )(?<!to )see you|see ya|that'?s all|good night)\b|(?<=\S)[\s.,!]+안녕[\s.!~]*$|고마워|감사|안녕히|잘 ?가|"
|
||||
FAREWELL_WORDS = re.compile(r"\b(thanks?|thank you|cheers|bye|bay bay|goodbye|(?<!can't )(?<!cant )(?<!cannot )(?<!not )(?<!to )see you|see ya|that'?s all|good night)\b|(?<=\S)[\s.,!]+안녕[\s.!~]*$|고마워|감사|안녕히|잘 ?가|"
|
||||
r"다음에|수고하세요|잘 ?있어|잘 ?있게|바이바이|빠이|(?<![가-힣])바이(?![가-힣])|땡큐|(?<![가-힣])간다[\s.!~]*$|i (have|need) to go|gotta go|i'?m leaving|"
|
||||
r"nice (talking|meeting|chatting)( (to|with))? you|(was|been) nice to meet you|good night|take care|들어가세요|"
|
||||
r"가 ?볼게요|갈게요|이만|나중에 봐요|또 봐요|좋은 하루|(^|\s)(나|저|우리|저희) (이제 )?(집에 )?(가|간다|가요|갑니다)[\s.!]*$",
|
||||
@@ -1871,13 +1871,21 @@ class Lumi:
|
||||
mouth.say(PRIVATE_SAY["en" if en else "ko"])
|
||||
return
|
||||
found = {} # fetched while "Let me check." is said (~1 s)
|
||||
if action == "search" and web.openai_ready(): # OpenAI's web search answers, the free search if it can't
|
||||
use_openai = action == "search" and web.openai_ready()
|
||||
if use_openai: # OpenAI's web search answers, the free search if it can't
|
||||
fetch = threading.Thread(target=lambda: found.update(said=web.openai_answer(text, self.brain.history)),
|
||||
daemon=True)
|
||||
else:
|
||||
fetch = threading.Thread(target=lambda: found.update(
|
||||
facts=web.weather(target) if action == "weather" else web.search(target)), daemon=True)
|
||||
fetch.start()
|
||||
if not use_openai:
|
||||
# the free search: the answer is fetched and made while "Let me check." plays (~1 s sooner)
|
||||
said = mouth.say_stream(self._looked_up(text, action, target, fetch, found), abort=self.speak_abort)
|
||||
log(f"lumi ({time.time() - (t0 or time.time()):.1f} s): {said}")
|
||||
if self.current is None:
|
||||
self.voice_until = time.time() + VOICE_SESSION_S
|
||||
return
|
||||
mouth.say("Let me check." if en else "확인해 볼게요.")
|
||||
fetch.join()
|
||||
if found.get("said"):
|
||||
@@ -1904,6 +1912,21 @@ class Lumi:
|
||||
if self.current is None:
|
||||
self.voice_until = time.time() + VOICE_SESSION_S
|
||||
|
||||
def _looked_up(self, text, action, target, fetch, found):
|
||||
"""'Let me check.', then the answer from the facts the fetch thread finds, sentence by sentence."""
|
||||
en = self.lang == "en"
|
||||
yield "Let me check." if en else "확인해 볼게요."
|
||||
fetch.join()
|
||||
facts = found.get("facts")
|
||||
log(f" {action} {target!r}: {(facts or 'NO INTERNET')[:120]}")
|
||||
if facts is None:
|
||||
yield ("Sorry, I'm not connected to the internet right now, so I can't look that up."
|
||||
if en else "죄송해요, 지금은 인터넷에 연결되어 있지 않아서 찾아볼 수 없어요.")
|
||||
return
|
||||
asked = f"{text} (the weather)" if action == "weather" else text # misheard words ("원하는 날씨가 어때요?")
|
||||
for i, sentence in enumerate(self.brain.respond_from(asked, facts)): # made the LLM say it found nothing
|
||||
yield from mouth.first_parts(sentence) if i == 0 else [sentence] # the voice starts sooner
|
||||
|
||||
def keep_listening(self):
|
||||
if self.current is None:
|
||||
self.voice_until = time.time() + VOICE_SESSION_S
|
||||
@@ -2564,7 +2587,8 @@ def status_question(text):
|
||||
def says_goodbye(text):
|
||||
""""thank you for your time", "okay, bye", "수고하세요": the talk is over (not "thanks, but where is...?").
|
||||
"thank you", "got it, thanks", "네 감사합니다" alone are not: often only "heard you" (talk_fate waits)."""
|
||||
if brain_mod.is_closing(text) and not DONE_WORDS.search(text) and not FAREWELL_WORDS.search(THANKS.sub(" ", text)):
|
||||
if brain_mod.is_closing(text) and not DONE_WORDS.search(text) and not FAREWELL_WORDS.search(THANKS.sub(" ", text)) or \
|
||||
brain_mod.to_someone_else(text): # "Okay kids, say thank you to the robot."
|
||||
return False
|
||||
return bool(FAREWELL_ONLY.match(text) or FAREWELL_WORDS.search(text) and not ASKS_MORE.search(text)
|
||||
and len(text.split()) <= 8 and not brain_mod.intent(text) and not brain_mod.hand_request(text, False)
|
||||
@@ -2620,7 +2644,9 @@ def not_online(text):
|
||||
|
||||
PRIVATE_ASK = re.compile(r"\bhome address|\bwhere (does|do|did) (my|our|his|her|their|this|that) .{0,40}\blives?\b|"
|
||||
r"\b(phone|mobile|cell) number of (?!the |a )|\b(email|e-mail) (address )?of (my|our|his|her)\b|"
|
||||
r"(집|자택) ?주소|(옆집|이웃|동료|친구|선생님|사람).{0,8}(전화번호|연락처|주소|어디 살)", re.I)
|
||||
r"\b(coworker|colleague|neighbou?r|friend|boss|classmate)'?s?\b.{0,30}\b(salary|income|address|"
|
||||
r"phone number)|(집|자택) ?주소|(옆집|이웃|동료|친구|선생님|사람|옆자리).{0,12}(전화번호|연락처|주소|어디 살|"
|
||||
r"연봉|월급)", re.I)
|
||||
PRIVATE_SAY = {"en": "Sorry, I can't look up a person's private details.",
|
||||
"ko": "죄송해요, 개인 정보는 찾아 드릴 수 없어요."}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user