diff --git a/api/dashboard.html b/api/dashboard.html
index cf1389b..798d494 100644
--- a/api/dashboard.html
+++ b/api/dashboard.html
@@ -978,11 +978,11 @@ function whereOf(seg, sel, pick) {
if (m === "marker") return {marker: $(sel).value};
return p && {x: +p.x.toFixed(3), y: +p.y.toFixed(3), theta: +p.theta.toFixed(3)};
}
-let cmdSeq = 0, cmdTimer = null, parsed = null, heldNow = false; // heldNow: Lumi holds the object, From unused
+let cmdSeq = 0, cmdTimer = null, parsed = null, heldNow = false, cmdLLM = false; // cmdLLM: Enter pressed // heldNow: Lumi holds the object, From unused
function cmdChanged() { // repaint the pickers, then read the text again (after typing stops)
paintWhere("tSrcSeg", "tSrcMarkerRow", "tSrcPickBox", srcPick, "tSrcPt");
paintWhere("tDstSeg", "tDstMarkerRow", "tDstPickBox", dstPick, "tDstPt");
- clearTimeout(cmdTimer); cmdTimer = setTimeout(parseCmd, 600);
+ cmdLLM = false; clearTimeout(cmdTimer); cmdTimer = setTimeout(parseCmd, 600);
}
function parseCmd() {
const text = $("tText").value.trim(), n = ++cmdSeq;
@@ -990,16 +990,16 @@ function parseCmd() {
if (n !== cmdSeq) return; // an older answer arriving late
$("tSentence").textContent = sentence;
$("tProblems").innerHTML = probs.map(p => `
${esc(p)}
`).join("");
- $("tStart").disabled = probs.length > 0 || !parsed;
+ $("tStart").disabled = probs.length > 0 || !parsed || !parsed.action;
$("tStart").textContent = {give: "Give", place: "Place", carry: "Go"}[parsed && parsed.action] || "Start";
- $("tWhere").style.display = parsed && ["steps", "give", "place"].includes(parsed.action) ? "none" : "";
+ $("tWhere").style.display = parsed && ["fetch", "carry"].includes(parsed.action) ? "" : "none";
paintSteps();
};
parsed = null;
if (!text && !heldNow) { show("–", []); return; }
const source = whereOf("tSrcSeg", "tSrcMarker", srcPick), dest = whereOf("tDstSeg", "tDstMarker", dstPick);
$("tSentence").textContent = "…";
- api("/tasks/parse", {text, source: source || null, dest: dest || null}).then(r => {
+ api("/tasks/parse", {text, source: source || null, dest: dest || null, llm: cmdLLM}).then(r => {
if (n !== cmdSeq) return;
parsed = r; show(r.sentence, r.problems);
}).catch(e => show("–", [e.message]));
@@ -1038,7 +1038,7 @@ document.querySelectorAll("#cmdModal .seg").forEach(s => s.onclick = e => {
});
["tSrcMarker", "tDstMarker"].forEach(id => $(id).onchange = cmdChanged);
$("tText").oninput = cmdChanged;
-$("tText").onkeydown = e => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); clearTimeout(cmdTimer); parseCmd(); } };
+$("tText").onkeydown = e => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); clearTimeout(cmdTimer); cmdLLM = true; parseCmd(); } };
function openCmd() {
const opts = `` + markerNames.map(n => ``).join("");
for (const id of ["tSrcMarker", "tDstMarker"]) { const old = $(id).value; $(id).innerHTML = opts; if (old) $(id).value = old; }
@@ -1055,6 +1055,7 @@ $("tStart").onclick = e => {
if (r.action === "place") return act(e.target, "Placing", () => api("/tasks/place", {on: (r.task && r.task.on) || null}));
if (r.action === "carry") return act(e.target, "On the way", () => api("/tasks/carry", {dest: r.task.dest, then: r.task.then, on: r.task.on || null}));
if (r.action === "steps") return act(e.target, "Started", () => api("/tasks/steps", {steps: r.steps, lang: r.lang, sender: r.sender || null}));
+ if (r.action === "command") return act(e.target, "Started", () => api("/tasks/command", {text: r.text}));
act(e.target, "Fetch started", () => api("/tasks/fetch", r.task));
};
$("tStop").onclick = e => act(e.target, "Task stopped", () => api("/tasks/stop", {}));
diff --git a/api/server.py b/api/server.py
index 8682f61..ea7a219 100644
--- a/api/server.py
+++ b/api/server.py
@@ -969,43 +969,146 @@ class ParseBody(BaseModel):
text: str = Field(examples=["bring the red apple from p1 to home"], description="the command in English or Korean")
source: str | dict | None = Field(None, description="from the dialog, used when the text names no place to take it from")
dest: str | dict | None = Field(None, description="from the dialog, used when the text names no place to bring it to")
+ llm: bool = Field(False, description="words the rules leave are read by the LLM as by voice (Enter in the dialog; "
+ "not while typing)")
-@app.post("/tasks/parse", tags=["tasks"], summary="A typed command (English or Korean) as a task, its sentence and "
- "problems; while holding, also give / place. Nothing moves")
-def task_parse(body: ParseBody):
+def _talk(sentence, problems=(), kind="talk"):
+ """What voice would only answer (a question, talk, a refusal): shown, nothing to start."""
+ return {"action": None, "task": None, "talk": kind, "sentence": sentence, "problems": list(problems), "read_by": "rules"}
+
+
+def _rule_steps(rule):
+ """A keyword command that the mission runner does the same way as voice: its steps, else None (look, lift, wave,
+ come, follow, quiet need the assistant: /tasks/command)."""
+ a, t = rule
+ d, _, n = (t or "").partition(" ")
+ if a == "go_to":
+ return [{"do": "go", "to": t}]
+ if a == "move" and d in ("forward", "back", "left", "right"):
+ return [{"do": "move", "dir": d, "m": float(n or 1)}]
+ if a == "turn":
+ return [{"do": "turn", "deg": 180.0 if d == "around" else (1 if d == "left" else -1) * float(n or 90)}]
+ if a == "arm":
+ return [{"do": "arm", "pose": t}]
+ if a == "pick":
+ w = t.split()
+ return [{"do": "pick", "object": w[-1], "colour": w[0] if len(w) > 1 else None}]
+ return None
+
+
+def _said(kind, words, what):
from assistant import brain, steps
+ if kind == "steps":
+ return steps.describe(what).rstrip(".")
+ if kind == "talk":
+ return f"answer \u201c{words}\u201d"
+ a, t = what
+ return {"look": f"look {t}", "lift": f"lift {t}", "wave": "wave", "come": "come to you", "come_back": "go back",
+ "follow": "follow you", "go_to": f"go to {brain.place_said(t)}", "arm": f"arm {t}",
+ "quiet": "be quiet"}.get(a, f"{a} {t}".strip())
+
+
+@app.post("/tasks/parse", tags=["tasks"], summary="A typed command (English or Korean) read exactly as by voice "
+ "(lumi.route): a mission, a fetch, a command or chain for the assistant, or what Lumi would only answer. "
+ "Nothing moves")
+def task_parse(body: ParseBody):
+ from assistant import brain, driving, lumi, seeing, steps
from tasks import fetch
markers = agv.markers()
- got = unread = by = None
- fixed = brain.self_correct(body.text, markers) if body.text.strip() else body.text # "go to start, no, end": as
- if not fixed and body.text.strip(): # by voice (lumi.answer)
- return {"action": None, "task": None, "sentence": "–", "read_by": "rules", "problems": [
- "Which one did you mean? Please write it again." if fixed is None else "Taken back: nothing to do."]}
+ text = body.text.strip()
+ lang = "ko" if brain.HANGUL.search(text) else "en"
+ held = bool(fetch.check_hand()) # the camera sees the hand; a stale "holding" is forgotten
+ if not text:
+ return _held_parse(body, markers) if held else _talk("–")
+ if lumi.FOREIGN_SCRIPT.search(text):
+ return _talk("–", ["Please write the command in English or Korean."])
+ fixed = brain.self_correct(text, markers) # "go to start, no, end": as by voice (lumi.answer)
+ if not fixed:
+ return _talk("–", ["Which one did you mean? Please write it again." if fixed is None else "Taken back: nothing to do."])
body = body.model_copy(update={"text": fixed})
- if body.text.strip(): # a mission (docs/17): several steps the fetch / carry can't do
- got, unread, by = steps.read(body.text, markers, llm=False)
- if unread and got and ({s["do"] for s in got} & steps.MISSION_ONLY or steps.is_mission(got)):
- got, unread, by = steps.read(body.text, markers) # clearly several steps: the LLM may read it
- problem = unread and brain.place_problem(" ".join(unread), markers) # "go to p12", "go to booth" (two)
- if problem or got and unread and ({s["do"] for s in got} & steps.MISSION_ONLY or steps.is_mission(got)):
- return {"action": None, "task": None, "sentence": "–", "read_by": by,
- "problems": [problem[0] if problem else f"I didn't understand: {', '.join(unread)}"]}
- if got and steps.is_mission(got):
- return {"action": "steps", "steps": got, "lang": "ko" if brain.HANGUL.search(body.text) else "en",
- "sender": steps.sender(body.text),
- "read_by": by, **_steps_said(got, markers)}
- if fetch.check_hand(): # the camera sees the hand; a stale "holding" is forgotten
+ drive = driving.read(brain._norm(fixed), None, False) # lumi.drive_words: speed, a distance asked or refused
+ if drive and drive[0] in ("refuse", "ask"):
+ d, _, n = drive[1].partition(" ")
+ return _talk(driving.say_refused(d, float(n), "en") if drive[0] == "refuse" else driving.say_ask(drive[1], "en"))
+ if drive and drive[0] == "speed":
+ return {"action": "command", "text": fixed, "sentence": "Faster." if drive[1] > 0 else "Slower.", "problems": [],
+ "read_by": "rules"}
+ if lumi.NAME_ONLY.match(fixed):
+ return _talk("Yes?")
+ seen = lambda x: "seeing" if seeing.answer(x, frames=[]) else None # no camera here: whether it is one
+ kind, data = lumi.route(fixed, markers, brain.Brain(), held, seen=seen)
+ if kind == "stop":
+ return {"action": "command", "text": fixed, "sentence": "Stop.", "problems": [], "read_by": "rules"}
+ if kind == "chain":
+ return {"action": "command", "text": fixed, "parts": [[k, w] for k, w, _ in data], "problems": [], "read_by": "rules",
+ "sentence": ", then ".join(_said(*p) for p in data).capitalize() + "."}
+ if kind == "hand":
+ (hand, _) = data
+ if hand[0] == "receive" and not held:
+ got = [{"do": "receive", "object": hand[1], "from_hand": True}]
+ return {"action": "steps", "steps": got, "lang": lang, "sender": None, "read_by": "rules", **_steps_said(got, markers)}
+ if hand[0] in ("give", "place"):
+ return _held_parse(body, markers) if held else _talk("–", ["My hand is empty, I'm not holding anything."])
+ return _talk(hand[1][0] if hand[0] == "refuse" else "–", kind="refuse")
+ if kind == "mission":
+ got, unread, by = data
+ if unread:
+ problem = brain.place_problem(" ".join(unread), markers) # "go to p12", "go to booth" (two)
+ return _talk("–", [problem[0] if problem else f"I didn't understand: {', '.join(unread)}"])
+ return {"action": "steps", "steps": got, "lang": lang, "sender": steps.sender(fixed), "read_by": by,
+ **_steps_said(got, markers)}
+ if not held and (lumi.empty_hand_request(fixed) or kind is None and brain.place_on(fixed) and
+ not brain._mentions(fixed, markers).get("object")): # as by voice: "put it on the table" with
+ # nothing held (the LLM reads a place)
+ return _talk("–", ["My hand is empty, I'm not holding anything."])
+ if kind == "quick" and data[0] == "fetch":
+ return _fetch_parse(body, markers)
+ if kind == "quick" and data[0] == "put":
+ return _held_parse(body, markers) if held else _talk("–", ["My hand is empty, I'm not holding anything."])
+ if kind == "quick" and data[0] in ("weather", "search"):
+ return _talk("–", kind="lookup")
+ if kind == "quick":
+ if held and data[0] == "go_to":
+ return _held_parse(body, markers) # holding: a carry there
+ got = _rule_steps(data)
+ if got:
+ return {"action": "steps", "steps": got, "lang": lang, "sender": None, "read_by": "rules",
+ **_steps_said(got, markers)}
+ return {"action": "command", "text": fixed, "sentence": _said("quick", fixed, data).capitalize() + ".",
+ "problems": [], "read_by": "rules"}
+ problem = brain.place_problem(fixed, markers)
+ if problem: # quick_command says it: "I don't have a place called p12"
+ return _talk(problem[0], kind="refuse")
+ if held and kind is None and brain.held_command(fixed):
return _held_parse(body, markers)
- if body.text.strip() and got and not unread and {s["do"] for s in got} <= {"receive", "arm", "go"}:
- return {"action": "steps", "steps": got, "lang": "ko" if brain.HANGUL.search(body.text) else "en", # "take this
- "sender": steps.sender(body.text), "read_by": by, **_steps_said(got, markers)} # from my hand", "open your hand", "go to stage"
- if brain.place_on(body.text) and not brain._mentions(body.text, markers).get("object"): # "put it on the table"
- return {"action": None, "task": None, "sentence": "–", "problems": ["My hand is empty, I'm not holding anything."]}
- if body.text.strip() and not brain._mentions(body.text, markers).get("object"): # no object named: never a fetch
- return {"action": None, "task": None, "sentence": "–", "read_by": by or "rules", # (nor an LLM guess at one)
- "problems": [f"I didn't understand: {', '.join(unread or [body.text.strip()])}"]}
- fields, read_by = brain.fetch_from_text(body.text, markers) if body.text.strip() else ({}, "rules")
+ if kind is None and body.llm: # the rules leave it: the LLM, one call, as by voice
+ gen = brain.Brain().respond_stream(fixed, markers)
+ head = next(gen)
+ first = next(gen, "") or ""
+ gen.close()
+ rule = (head["action"], head["target"])
+ if rule[0] == "fetch" and brain._mentions(fixed, markers).get("object"):
+ return _fetch_parse(body, markers)
+ got = _rule_steps(rule) if rule[0] in ("go_to", "move", "turn", "arm", "pick") else None
+ if got:
+ return {"action": "steps", "steps": got, "lang": lang, "sender": None, "read_by": "llm",
+ **_steps_said(got, markers)}
+ if rule[0] in ("look", "lift", "wave", "come", "follow", "come_back", "quiet"):
+ return {"action": "command", "text": fixed, "sentence": first or "–", "problems": [], "read_by": "llm"}
+ return {**_talk(first or "–"), "read_by": "llm"}
+ return _talk("–", kind=kind or "talk")
+
+
+def _fetch_parse(body, markers):
+ """A fetch really read (an object named): the dialog's object / colour / place / finish choices."""
+ from assistant import brain
+ from tasks import fetch
+ if fetch.check_hand():
+ return _held_parse(body, markers)
+ if not brain._mentions(body.text, markers).get("object"): # no object named: never a fetch (nor an LLM guess)
+ return _talk("–", [f"I didn't understand: {body.text.strip()}"])
+ fields, read_by = brain.fetch_from_text(body.text, markers)
task = {"object": fields.get("object"), "colour": fields.get("colour"),
"source": fields.get("source") or body.source or "here", "dest": fields.get("dest") or body.dest,
"finish": fields.get("finish", "hold"), **({"prefer": fields["prefer"]} if fields.get("prefer") else {})}
@@ -1017,6 +1120,19 @@ def task_parse(body: ParseBody):
"read_by": read_by, "from_text": sorted(fields), "choices": _choices()}
+class CommandBody(BaseModel):
+ text: str = Field(description="a command /tasks/parse read as action \"command\"")
+
+
+@app.post("/tasks/command", tags=["tasks"], summary="Do a typed command the way voice does it (the assistant hears "
+ "it): look, lift, wave, come, follow, several parts in a row")
+def task_command(body: CommandBody):
+ if not assistant_pids():
+ raise HTTPException(409, "Switch on Greeter or Patrol first.")
+ send_to_assistant("heard", text=body.text)
+ return {"ok": True, "by": "assistant"}
+
+
def _steps_said(got, markers):
from assistant import steps
from tasks import fetch
diff --git a/assistant/abilities.py b/assistant/abilities.py
index b3b6468..1d4fadb 100644
--- a/assistant/abilities.py
+++ b/assistant/abilities.py
@@ -33,12 +33,12 @@ LONG = {"en": "I talk with you in English and Korean, and when I don't know some
"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.",
+ "and follow you when you say \"follow me\". And I like to wave and sing my songs, like Fantastic Baby "
+ "or Love Attack.",
"ko": "영어와 한국어로 대화하고, 모르는 건 인터넷에서 찾아봐요. 주변을 보고 무엇이 있는지 이해할 수 있어요. 물건이나 "
"사람, 입고 계신 옷이나 손에 든 것도요. 물건을 집어서 가져다드리거나 다른 곳에 옮겨 내려놓고, 손에 든 걸 받아 "
"드릴 수도 있어요. 지도에 있는 장소로 가고, 말씀하시는 거리와 속도로 움직이거나 돌고, \"따라와\"라고 하시면 "
- "따라가요. 그리고 손을 흔들거나 아리랑, 생일 축하 노래, 판타스틱 베이비 같은 노래도 불러 드려요."}
+ "따라가요. 그리고 손을 흔들거나 판타스틱 베이비, 러브 어택 같은 제 노래도 불러 드려요."}
def asked(text):
diff --git a/assistant/brain.py b/assistant/brain.py
index a705e0a..c2abc33 100644
--- a/assistant/brain.py
+++ b/assistant/brain.py
@@ -172,9 +172,10 @@ more, in warm natural words, not a flat list): talk in English and Korean and an
internet; look at what's around you and understand it (objects, people, what someone is wearing or holding); pick
things up, bring them to the person or take them somewhere else and put them down, or take something from their
hand; go to the places on your map, move or turn by voice (how far, how fast); come to the person who calls you and
-follow them ("follow me"); wave; sing songs (Arirang, Happy Birthday, Twinkle Twinkle Little Star, Fantastic Baby
-and more); speak louder, quieter, slower or faster when asked; stop and stay quiet when asked. You greet people who
-come close and you wake up when someone says "Hi Lumi"."""
+follow them ("follow me"); wave; sing your four songs (BAD by ATEEZ,
+Fantastic Baby by BIGBANG, 꿈꾸던 어른이 되었나요 by 머무르, Love Attack by RESCENE; no other song); speak louder,
+quieter, slower or faster when asked; stop and stay quiet when asked. You greet people who come close and you wake
+up when someone says "Hi Lumi"."""
ACTIONS = """
@@ -292,6 +293,8 @@ Short Korean commands are commands: "컵 가져다 줘" -> fetch cup, "컵 옮
- sing: the visitor asks for a song or for music ("play / make / do some music", "음악 틀어 줘", "한 곡 해 줘"), or
says yes / "any" / "you choose" / "아무거나" to your offer of a song. You make music by singing one of your songs:
never say you can't play music. A real song with music then plays: only write a short "Okay!" / "네!".
+ You know only your four songs: any other song or singer asked for ("sing Yesterday", "BTS 노래 불러 줘") is none:
+ say kindly you can't sing that one and offer yours; never sing another song in its place.
A joke is not a song: "tell me a joke", "prove it", "try again" after a joke is none, with a short joke.
- weather : the visitor asks about the weather (place in English; - means here, Seoul).
- search : you need facts from the internet you do not know (news, prices, opening hours, people...).
@@ -521,8 +524,8 @@ INTENTS = [ # (action, pattern) checked in order on what the visitor said
("wave", r"(?:^|[,.!?]\s*)(?:(?:hey|hi|okay|ok|so|um+|uh+|alright|please|now|lumi|and|then)\W+)*(?:(?:can|could|would|will) you "
r"(?:please )?|please |let'?s |go ahead and |i'?d like you to |i want you to )?wave\b(?!s)|"
r"\bwave (?:at|to|your|hello|hi|bye|goodbye|back|again|for)\b|\bgimme a wave\b|\b(?:why don'?t you|if you (?:could|can|would)|"
- r"you (?:could|should|can|might)|could you|would you|can you|will you) (?:please |just )?wave\b(?!s)|\bgive (?:(?:them|him|her|us|me|everyone|the \w+) )?"
- r"a (?:little |quick |big |friendly )?wave\b|\b(?:wave|웨이브)\s?(?:해|하고|좀)|\bshake (?:your |a |my )?hands?\b(?! with\b)|\bsay (?:hi|hello|bye) with your hand\b|손 ?(?:을 |좀 |도 )?흔들|손 ?인사"),
+ r"you (?:could|should|can|might)|could you|would you|can you|will you) (?:please |just )?wave\b(?!s)|\b(?:give|do) (?:(?:them|him|her|us|me|everyone|the \w+) )?"
+ r"a (?:little |quick |big |friendly )?wave\b|\b(?:wave|웨이브)\s?(?:해|하고|좀)|\bshake (?:your |a |my )?hands?\b(?! with\b)|\bsay (?:hi|hello|bye) with your hand\b|손 ?(?:을 |좀 |도 )?흔들|손 ?(?:으로 ?)?인사"),
("spin", r"\bspin (?:yourself )?(?:all the way |completely |fully )?(?:a)?round\b(?! (?:the|a|an|my|your|and look)\b)"
r"|\bturn (?:yourself )?(?:all the way|completely|fully) (?:a)?round\b|\bdo a (?:full )?(?:360|full turn|full circle|spin)\b|\bturn 360\b|\bspin\s*[.!]*$"
r"|한 ?바퀴 ?(?:빙 ?)?(?:돌|회전)(?![았었던은]|고 ?(?:와|오))|360\s*도\s*(?:돌|회전)(?![았었던은])|빙글 ?빙글 ?돌(?![았었던은])"),
@@ -617,6 +620,8 @@ def to_someone_else(text):
if ASIDE_EN.search(text):
return True
m = ASIDE_KO.search(text)
+ if m and not m.group("name") and "인사" in m.group(0) and re.search(r"손|흔들", text):
+ return False # "손 인사 해 봐", "손으로 인사 해 봐": a wave
if not m or not m.group("name"):
return bool(m)
c = m.group("name")[-1]
@@ -1389,7 +1394,7 @@ DO_IT = re.compile(r"^\W*(?:(?:okay|ok|sure|yes|yeah|then|so|well|go on|come on)
r"try it|go for it|please do)(?:\W+(?:then|now|please))*\W*$|"
r"^\W*(?:그럼|자|어디)?\s*(?:한 ?번\s*)?(?:해 ?봐|해 ?줘|해 ?보세요|해 ?주세요|보여 ?줘|보여 ?주세요)(?:요)?\W*$", re.I)
SING_ASK = re.compile(r"\bsing|\bsong|\bmusic\b|노래|한 ?곡|불러", re.I)
-PROMISE = { # Lumi's own sentence saying it does this now ("Okay! I'll sing a song for you.", "아리랑을 불러 드릴게요.")
+PROMISE = { # Lumi's own sentence saying it does this now ("Okay! I'll sing a song for you.", "러브 어택 불러 드릴게요.")
"sing": re.compile(r"\b(?:i'll|i will|let me|i'm going to) sing\b|\bhere(?:'s| is| comes| goes) (?:a |my |one |the )?song\b|"
r"(?:불러|들려)\s*(?:드릴게요|드리겠습니다|줄게|볼게요)|부를게요", re.I),
"wave": re.compile(r"\b(?:i'll|i will|let me) wave\b|흔들어\s*(?:드릴게요|볼게요|줄게)|흔들게요", re.I),
diff --git a/assistant/lumi.py b/assistant/lumi.py
index 2c57196..9c6ac76 100644
--- a/assistant/lumi.py
+++ b/assistant/lumi.py
@@ -1101,7 +1101,10 @@ class Lumi:
return
song = sing.choose(text, self.lang, self.last_song)
if song is None: # a song we don't have: say which ones we know
- mouth.say(sing.unknown_reply(self.lang))
+ say = sing.unknown_reply(self.lang)
+ self.brain.history.append((text, f"ACTION: none songs\n{say}")) # a title next is sung
+ log(f" not one of our songs: {say[:70]}")
+ mouth.say(say)
self.keep_listening()
return
self.last_song = song
@@ -1359,12 +1362,13 @@ class Lumi:
def chain_busy(self):
return self.chain_thread is not None and self.chain_thread.is_alive()
- def chain_request(self, text):
- """Commands, questions and talk in one sentence, done in the order said (chain.plan). True if it was one."""
+ def chain_request(self, text, plan=None):
+ """Commands, questions and talk in one sentence, done in the order said (chain.plan, or `plan` as route()
+ read it). True if it was one."""
from assistant import chain
if self.mission_running() or self.chain_busy():
return False
- plan = chain.plan(text, self.markers, NOT_A_STEP)
+ plan = plan or chain.plan(text, self.markers, NOT_A_STEP)
if not plan:
return False
log(f" chain: {[(k, w) for k, w, _ in plan]}")
@@ -1432,11 +1436,11 @@ class Lumi:
last = pose
time.sleep(poll_s)
- def mission_request(self, text):
+ def mission_request(self, text, read=None):
"""A command of several steps (docs/17), said by voice: read back, start on yes or silence. True if it was
one (also when refused). A single move / turn / arm / go stays with quick_command (no read-back)."""
from assistant import steps
- read = read_mission(text, self.markers)
+ read = read or read_mission(text, self.markers)
if not read:
return False
got, unread, by = read
@@ -1713,7 +1717,9 @@ class Lumi:
return
cmd = d.get("cmd")
log(f"dashboard: {cmd} {d.get('marker') or d.get('point') or d.get('markers') or ''}")
- if cmd == "go":
+ if cmd == "heard": # the Command box: done as if said (route(), no read-back
+ self.answer(d.get("text") or "") # for a command or chain: /tasks/parse showed it)
+ elif cmd == "go":
self.start_trip(d["marker"])
elif cmd == "go_point":
self.start_trip(tuple(d["point"]))
@@ -2122,8 +2128,7 @@ class Lumi:
return True
if rule and (self.base_off(*rule) or needs_arm(*rule) and self.arm_off()):
return True
- if not rule or rule[0] not in ("go_to", "come", "follow", "quiet", "weather", "search", "move", "turn", "arm", "pick", "put",
- "move_object", "fetch", "look", "lift", "wave", "come_back"):
+ if not rule or rule[0] not in QUICK_RULES:
return False
action, target = rule
en = self.lang == "en"
@@ -2254,27 +2259,30 @@ class Lumi:
mouth.say("Yes?" if self.lang == "en" else "네?")
self.keep_listening()
return
- if stop_order(text, self.markers):
+ from tasks import fetch # the way it goes: route(), as the dashboard's Command box
+ kind, data = route(text, self.markers, self.brain, lambda: self.fetch_status() == "holding" or
+ bool(safe(fetch.check_hand)), seen=lambda x: seeing.answer(x, self.lang, slow_line=mouth.say),
+ last=last, chain_ok=not part and not self.mission_running() and not self.chain_busy())
+ if kind == "stop":
self.stop_all() # "stop", "stop, where are you going?": stop first, always
return
- if not part and self.chain_request(text): # "look at me and wave", "go to p5 and tell me the weather"
+ if kind == "chain" and self.chain_request(text, data): # "look at me and wave", "go to p5 and tell me the weather"
return
- seen = seeing.answer(text, self.lang, slow_line=mouth.say) # "do you see a cup?", "what am I holding?"
- if seen:
- log(f" seeing: {seen}")
- self.brain.history.append((text, f"ACTION: none -\n{seen}")) # "and you?" / "why?" next has the turn
- mouth.say(seen)
+ if kind == "seeing": # "do you see a cup?", "what am I holding?"
+ log(f" seeing: {data}")
+ self.brain.history.append((text, f"ACTION: none -\n{data}")) # "and you?" / "why?" next has the turn
+ mouth.say(data)
self.keep_listening()
return
- if status_question(text): # what am I doing / where am I going
+ if kind == "status": # what am I doing / where am I going
en, ko = self.now_doing()
log(f" status: {en}")
mouth.say(en if self.lang == "en" else ko)
self.keep_listening()
return
- if self.hand_command(text): # "take this from me", "give it to her", "put it there"
+ if kind in ("correction", "hand") and self.hand_command(text): # "take this from me", "put it there"
return
- if self.mission_request(text): # several steps: before give / place while holding
+ if kind == "mission" and self.mission_request(text, data): # several steps: before give / place while holding
return
if self.fetch_voice(text): # before the closing words: "thank you" while giving
return
@@ -2286,18 +2294,29 @@ class Lumi:
mouth.say(EMPTY_HAND_SAY[self.lang])
self.keep_listening()
return
- fate = talk_fate(text)
- if fate == "end":
+ if kind == "end":
self.end_conversation(text) # "okay, bye", "I have to go", "수고하세요": done
return
# fate "close" ("okay", "thanks", "됐어요"): the LLM below reads it with the talk before (its action end ends
# the talk); when the talk goes on, silence ends it (closing_pending, set after the reply)
- if sing.asked(text, last): # "sing a song", "노래 불러 줘", after a song "another one"
+ if kind == "sing": # "sing a song", "노래 불러 줘", after a song "another one"
self.sing_song(text)
return
- if self.quick_command(text):
+ if kind in ("quick", None) and self.quick_command(text): # None: an unknown place is still said here
log(f" done at once ({time.time() - t:.1f} s)")
return
+ bank = sing.bank_read(text, last) if kind is None else None # a song or the songs by meaning (song_bank.py)
+ if bank == "sing":
+ log(f" song bank: sing ({time.time() - t:.2f} s)")
+ self.sing_song(text)
+ return
+ if bank == "list":
+ say = sing.list_reply(self.lang)
+ self.brain.history.append((text, f"ACTION: none songs\n{say}"))
+ log(f" song bank: the songs ({time.time() - t:.2f} s)")
+ mouth.say(say, abort=self.speak_abort)
+ self.keep_listening()
+ return
if self.brain.is_lookup_follow_up(text): # "tell me more" about something looked up just now
self.look_up(text, "search", self.brain.search_query(text), t)
return
@@ -2768,6 +2787,49 @@ NOT_A_STEP = re.compile(r"^\W*(?:(?:please|and|then|also)\s+)*(?:dance|jump|fly|
r"bring|take|give|hand|put|carry|deliver)\b|.*(?:춤|점프|날아|수영|박수)", re.I) # a part not read: asked
+def route(text, markers, b, holding=False, seen=None, last="", chain_ok=True):
+ """Which way a command goes, the same for voice (Lumi.answer), the dashboard's Command box (/tasks/parse) and
+ tests/command_check: (kind, data). Kinds in this order: "stop"; "chain" (data: chain.plan); "seeing" (data: what
+ seen(text) answered); "status"; "correction" (brain.correction); "hand" ((kind, what), brain.hand_request with
+ the hand as it is: holding is a bool or a function asked only here); "mission" (read_mission's (steps, unread,
+ by)); "end" (a goodbye); "sing"; "quick" (brain.intent's rule, one of QUICK_RULES); (None, None): the LLM reads
+ it. seen: seeing.answer or a stand-in; chain_ok: False on a mission or while a chain runs."""
+ from assistant import chain
+ if stop_order(text, markers):
+ return "stop", None
+ plan = chain_ok and chain.plan(text, markers, NOT_A_STEP)
+ if plan:
+ return "chain", plan
+ got = seen(text) if seen else None
+ if got:
+ return "seeing", got
+ if status_question(text):
+ return "status", None
+ cor = brain_mod.correction(text, b.history)
+ if cor:
+ return "correction", cor
+ if brain_mod.hand_request(text, False, b, markers) or brain_mod.hand_request(text, True, b, markers):
+ held = holding() if callable(holding) else holding
+ hand = brain_mod.hand_request(text, held, b, markers)
+ if hand:
+ return "hand", (hand, held)
+ read = read_mission(text, markers)
+ if read:
+ return "mission", read
+ if talk_fate(text) == "end":
+ return "end", None
+ if sing.asked(text, last):
+ return "sing", None
+ rule = brain_mod.intent(text, markers)
+ if rule and rule[0] in QUICK_RULES:
+ return "quick", rule
+ return None, None
+
+
+QUICK_RULES = {"go_to", "come", "follow", "quiet", "weather", "search", "move", "turn", "arm", "pick", "put", "move_object",
+ "fetch", "look", "lift", "wave", "come_back"} # what quick_command does at once
+
+
def read_mission(text, markers):
"""(steps, unread, by) when the words are a command of several steps (unread: parts not understood), else None.
A single move / turn / arm / go, or words that are only partly a plain command, stay with the other paths."""
diff --git a/assistant/song_bank.py b/assistant/song_bank.py
new file mode 100644
index 0000000..181497b
--- /dev/null
+++ b/assistant/song_bank.py
@@ -0,0 +1,528 @@
+"""Wordings for the song fast lane (audio/sing.py bank), matched by meaning with the embedding server.
+sing: asks Lumi to sing or play music now, no title; list: asks which songs Lumi knows; no: talks about music or songs without asking for one now."""
+
+SING = [
+ # English, casual
+ "sing a song",
+ "sing me a song",
+ "sing something",
+ "sing for me",
+ "sing for us",
+ "sing us a song",
+ "can you sing",
+ "can you sing a song",
+ "can you sing something",
+ "can you sing for me",
+ "could you sing a song",
+ "could you sing something for us",
+ "would you sing a song",
+ "would you sing for me",
+ "will you sing for us",
+ "will you sing me something",
+ "please sing",
+ "please sing a song",
+ "please sing something",
+ "please sing for me",
+ "sing please",
+ "go on, sing",
+ "go ahead and sing",
+ "come on, sing something",
+ "come on lumi, sing",
+ "lumi, sing",
+ "lumi, sing a song",
+ "lumi sing for me",
+ "lumi, can you sing for us",
+ "hey lumi, sing something",
+ "sing one song",
+ "sing one for me",
+ "sing another song",
+ "sing one more",
+ "one more song",
+ "another one please",
+ "sing again",
+ "sing it again",
+ "let's hear you sing",
+ "let me hear you sing",
+ "i want to hear you sing",
+ "i want you to sing",
+ "i'd like you to sing a song",
+ "i'd love to hear a song from you",
+ "we want a song",
+ "give us a song",
+ "give me a song",
+ "how about a song",
+ "how about singing something",
+ "what about a song",
+ "time for a song",
+ "song time",
+ "a song please",
+ "song please",
+ "show me your singing",
+ "show us how you sing",
+ "do a song",
+ "do a song for us",
+ "perform a song",
+ "perform something for us",
+ "entertain us with a song",
+ "surprise me with a song",
+ "pick a song and sing it",
+ "sing any song",
+ "sing whatever you like",
+ "sing your favourite song",
+ "sing your best song",
+ "sing one of your songs",
+ "sing one of your own songs",
+ "sing something you know",
+ "just sing anything",
+ "anything is fine, just sing",
+ "you choose, sing one",
+ "random song please",
+ "sing a random song",
+ "sing something fun",
+ "sing something happy",
+ "sing something cheerful",
+ "sing something upbeat",
+ "sing something exciting",
+ "sing something energetic",
+ "sing something calm",
+ "sing something slow",
+ "sing something sad",
+ "sing something emotional",
+ "sing something cool",
+ "sing something cute",
+ "sing a happy song",
+ "sing a fun song",
+ "sing an exciting song",
+ "sing a slow song",
+ "sing a Korean song",
+ "sing a song in Korean",
+ "sing a K-pop song",
+ "sing a dance song",
+ "sing a love song",
+ "can you sing a Korean song",
+ "play some music",
+ "play music",
+ "play a song",
+ "play me a song",
+ "play something",
+ "play something for us",
+ "play some music please",
+ "put on some music",
+ "put on a song",
+ "music please",
+ "some music please",
+ "can you play music",
+ "can you play a song",
+ "could you play some music",
+ "would you play a song for us",
+ "start the music",
+ "let's have some music",
+ "let's have a song",
+ "we need some music",
+ "i want music",
+ "i want to listen to music",
+ "i want to hear a song",
+ "let me listen to a song",
+ "play something fun",
+ "play something upbeat",
+ "play something exciting",
+ "play something calm",
+ "play a Korean song",
+ "play some K-pop",
+ "play your song",
+ "play one of your songs",
+ "let's party, music",
+ "drop the beat",
+ "hit it",
+ "music time",
+ "dance music please",
+ "let's dance, play a song",
+ # kids, non-native
+ "you sing for me?",
+ "you sing song?",
+ "you can sing?",
+ "please song",
+ "song for me",
+ "song song",
+ "lumi song",
+ "lumi sing song",
+ "sing sing",
+ "robot sing",
+ "robot, sing a song",
+ "can robot sing song?",
+ "you make song now",
+ "you singing please",
+ "make music",
+ "make a song for me",
+ "me want song",
+ "i want song",
+ "listen song",
+ "one song you sing",
+ "sing to me now",
+ "sing now",
+ "sing right now",
+ "can you sing now",
+ # whisper slips
+ "sin a song",
+ "sing a sung",
+ "sink a song",
+ "seeing a song",
+ "sing a son",
+ "play same music",
+ # Korean, polite
+ "노래 불러 주세요",
+ "노래 한 곡 불러 주세요",
+ "노래 좀 불러 주세요",
+ "노래해 주세요",
+ "노래 해 주실 수 있어요?",
+ "노래 불러 주실래요?",
+ "노래 불러 줄 수 있어요?",
+ "노래 한 곡 부탁드려요",
+ "노래 부탁해요",
+ "노래 들려주세요",
+ "노래 한 곡 들려주세요",
+ "음악 틀어 주세요",
+ "음악 좀 틀어 주세요",
+ "노래 틀어 주세요",
+ "노래 하나 틀어 주세요",
+ "음악 들려주세요",
+ "음악 좀 들려주실래요?",
+ "노래 한번 해 보세요",
+ "노래 한번 들어 보고 싶어요",
+ "루미 노래 듣고 싶어요",
+ "루미야 노래 불러 주세요",
+ "루미 노래해 주세요",
+ "노래 한 곡 해 주세요",
+ "아무 노래나 불러 주세요",
+ "신나는 노래 불러 주세요",
+ "신나는 음악 틀어 주세요",
+ "한국 노래 불러 주세요",
+ # Korean, casual
+ "노래 불러 줘",
+ "노래 불러줘",
+ "노래해 줘",
+ "노래해",
+ "노래 해 봐",
+ "노래 불러 봐",
+ "노래 한 곡 해",
+ "노래 한 곡 불러 줘",
+ "노래 한 곡 뽑아 봐",
+ "한 곡 뽑아 봐",
+ "한 곡 해 봐",
+ "한 곡 불러 줘",
+ "노래 좀 불러 줘",
+ "노래 좀 해 줘",
+ "노래 불러 줄래?",
+ "노래해 줄래?",
+ "노래 해 줄 수 있어?",
+ "노래 부를 수 있어?",
+ "노래 할 줄 알아?",
+ "노래 들려줘",
+ "노래 하나 들려줘",
+ "음악 틀어 줘",
+ "음악 틀어",
+ "노래 틀어 줘",
+ "노래 하나 틀어 줘",
+ "음악 좀 틀어 봐",
+ "음악 들려줘",
+ "노래 듣고 싶어",
+ "음악 듣고 싶어",
+ "노래 한번 들어 보자",
+ "노래 하자",
+ "노래 시작해",
+ "노래 하나 해 줘",
+ "노래 또 불러 줘",
+ "한 곡 더",
+ "한 곡 더 불러 줘",
+ "다른 노래 불러 줘",
+ "다시 불러 줘",
+ "아무 노래나 불러 줘",
+ "아무거나 불러 줘",
+ "아무거나 한 곡 해",
+ "네가 좋아하는 노래 불러 줘",
+ "네 노래 불러 줘",
+ "루미야 노래 불러 줘",
+ "루미야 노래해",
+ "루미 노래",
+ "루미야 한 곡 뽑아 봐",
+ "신나는 노래 불러 줘",
+ "신나는 노래 틀어 줘",
+ "신나는 거 하나 불러 줘",
+ "조용한 노래 불러 줘",
+ "슬픈 노래 불러 줘",
+ "잔잔한 노래 틀어 줘",
+ "한국 노래 불러 줘",
+ "케이팝 불러 줘",
+ "케이팝 틀어 줘",
+ "댄스곡 틀어 줘",
+ "사랑 노래 불러 줘",
+ "노래 한 소절 불러 봐",
+ "노래 실력 보여 줘",
+ "노래 좀 뽑아 줘",
+ "음악 켜 줘",
+ "노래 켜 줘",
+ # whisper slips (Korean)
+ "노레 불러 줘",
+ "노래 불러 저",
+ "노래 불러죠",
+ "노래 해조",
+ "음막 틀어 줘",
+ # mixed
+ "song 불러 줘",
+ "노래 sing 해 줘",
+ "music 틀어 줘",
+ "lumi 노래해",
+ "루미 sing a song",
+ "루미야 song please",
+ "노래 please",
+ "sing 해 줘",
+ "play music 해 줘",
+ "K-pop 불러 줘",
+ "Korean song 불러 줘",
+ "one song 불러 줘",
+]
+
+LIST = [
+ "what songs do you know",
+ "what songs can you sing",
+ "which songs do you know",
+ "which songs can you sing",
+ "what can you sing",
+ "what do you sing",
+ "what songs do you have",
+ "what music do you have",
+ "what's on your playlist",
+ "show me your playlist",
+ "tell me your playlist",
+ "what's in your song list",
+ "list your songs",
+ "tell me the songs you know",
+ "name the songs you can sing",
+ "how many songs do you know",
+ "how many songs can you sing",
+ "do you know any songs",
+ "do you know many songs",
+ "what kind of songs do you sing",
+ "what are your songs",
+ "which songs are yours",
+ "what songs are on your list",
+ "what are my options for songs",
+ "what song choices are there",
+ "which ones can you sing",
+ "what can you play",
+ "what music can you play",
+ "what songs can you play",
+ "what's your repertoire",
+ "give me the list of songs",
+ "which songs do you have in Korean",
+ "what Korean songs do you know",
+ "do you know any K-pop songs",
+ "what K-pop can you sing",
+ "you know what song?",
+ "what song you know?",
+ "song list please",
+ "which song you can?",
+ "can you tell me which songs you know",
+ "무슨 노래 알아?",
+ "무슨 노래 알아요?",
+ "무슨 노래 부를 수 있어?",
+ "무슨 노래 할 수 있어요?",
+ "부를 수 있는 노래 뭐 있어?",
+ "부를 수 있는 노래가 뭐예요?",
+ "아는 노래 뭐 있어?",
+ "아는 노래 있어요?",
+ "노래 몇 곡 알아?",
+ "노래 몇 곡 부를 수 있어요?",
+ "어떤 노래 알아?",
+ "어떤 노래 부를 수 있어요?",
+ "어떤 노래 할 줄 알아?",
+ "노래 목록 알려 줘",
+ "노래 목록 보여 주세요",
+ "플레이리스트에 뭐 있어?",
+ "플레이리스트 알려 줘",
+ "네 노래 목록 뭐야?",
+ "할 줄 아는 노래 뭐야?",
+ "무슨 곡 있어?",
+ "어떤 곡 있어요?",
+ "곡 리스트 알려 줘",
+ "노래 뭐 뭐 있어?",
+ "부를 수 있는 곡 알려 주세요",
+ "틀 수 있는 노래 뭐 있어?",
+ "무슨 음악 틀 수 있어?",
+ "아는 케이팝 뭐 있어?",
+ "한국 노래 뭐 알아?",
+ "노래 몇 개 알아?",
+ "루미는 무슨 노래 알아?",
+ "what songs 알아?",
+ "song list 알려 줘",
+]
+
+NO = [
+ # liking music, favourites
+ "do you like singing?",
+ "do you like music?",
+ "do you like songs?",
+ "do you enjoy singing?",
+ "do you love music?",
+ "what's your favourite song?",
+ "what's your favourite music?",
+ "what kind of music do you like?",
+ "who is your favourite singer?",
+ "what genre do you like?",
+ "do robots like music?",
+ "can robots feel music?",
+ "do you listen to music?",
+ "노래 좋아해?",
+ "노래 좋아하세요?",
+ "음악 좋아해?",
+ "음악 좋아하세요?",
+ "좋아하는 노래 뭐야?",
+ "좋아하는 가수 있어?",
+ "어떤 음악 좋아해?",
+ "어떤 장르 좋아해요?",
+ "노래 부르는 거 좋아해?",
+ "로봇도 음악 들어?",
+ # the person singing
+ "i sing in a choir",
+ "i like to sing",
+ "i love singing",
+ "i can sing",
+ "i'll sing for you",
+ "let me sing for you",
+ "i'm going to sing now",
+ "listen to me sing",
+ "can i sing?",
+ "can i sing a song?",
+ "may i sing for you?",
+ "i was singing in the shower",
+ "my daughter sings very well",
+ "my friend is a singer",
+ "i used to play the guitar",
+ "i play the piano",
+ "제가 노래할게요",
+ "내가 노래할게",
+ "내가 노래 불러 줄게",
+ "내가 한 곡 할게",
+ "나 노래 잘해",
+ "저 합창단에서 노래해요",
+ "저 노래 배우고 있어요",
+ "나 노래 불러도 돼?",
+ "제가 노래해도 될까요?",
+ "우리 딸이 노래를 잘해요",
+ "제 친구가 가수예요",
+ "저 피아노 쳐요",
+ "기타 배우고 있어",
+ # negation, stop
+ "don't sing",
+ "please don't sing",
+ "no singing",
+ "no music please",
+ "stop singing",
+ "stop the music",
+ "that's enough singing",
+ "no more songs",
+ "i don't want a song",
+ "not now, no song",
+ "be quiet please",
+ "turn off the music",
+ "노래 부르지 마",
+ "노래하지 마세요",
+ "노래 그만해",
+ "노래 그만 불러",
+ "음악 꺼 줘",
+ "음악 꺼",
+ "노래 멈춰",
+ "노래 필요 없어",
+ "지금은 노래하지 마",
+ "조용히 해 줘",
+ "노래는 됐어",
+ # later, conditions
+ "sing when the guests arrive",
+ "sing later",
+ "you can sing later",
+ "sing for them tomorrow",
+ "maybe sing at the party tonight",
+ "after the meeting you can sing",
+ "if the kids come, sing a song",
+ "sing at the conference next week",
+ "remember to sing at the event",
+ "손님 오시면 노래해",
+ "나중에 노래해",
+ "이따가 노래 불러 줘",
+ "내일 행사 때 노래해",
+ "회의 끝나면 노래 불러",
+ "아이들 오면 노래해 줘",
+ "파티 때 한 곡 해",
+ # karaoke, going out
+ "let's go to karaoke",
+ "do you know a good karaoke place?",
+ "karaoke tonight?",
+ "노래방 가자",
+ "노래방 갈래?",
+ "근처에 노래방 있어?",
+ "오늘 노래방 어때?",
+ "콘서트 가고 싶다",
+ "let's go to a concert",
+ # volume
+ "turn the music down",
+ "turn the music up",
+ "the music is too loud",
+ "lower the volume",
+ "volume up",
+ "음악 소리 줄여",
+ "음악 소리 키워",
+ "소리 좀 줄여 줘",
+ "볼륨 높여",
+ "음악이 너무 시끄러워",
+ # opinions
+ "that song was great",
+ "your singing was amazing",
+ "that was a nice song",
+ "you sing well",
+ "you're a good singer",
+ "your voice is beautiful",
+ "BTS is my favourite",
+ "I love BLACKPINK",
+ "K-pop is really popular",
+ "this song is so catchy",
+ "music makes me happy",
+ "노래 잘 부르네",
+ "노래 너무 좋았어",
+ "방금 노래 좋았어요",
+ "목소리 예쁘다",
+ "BTS 제일 좋아해",
+ "케이팝 요즘 인기 많지",
+ "그 노래 진짜 좋더라",
+ "음악 들으면 기분 좋아져",
+ # questions about music around
+ "is that music from you?",
+ "where is the music coming from?",
+ "what song is this?",
+ "who sings this?",
+ "who sang that song?",
+ "what's the name of this song?",
+ "is this a new song?",
+ "when did this song come out?",
+ "how do you make music?",
+ "how do you sing without lungs?",
+ "who taught you to sing?",
+ "이 노래 제목이 뭐야?",
+ "이 노래 누가 불렀어?",
+ "이거 무슨 노래야?",
+ "이 음악 어디서 나와?",
+ "이 노래 언제 나왔어?",
+ "노래는 어떻게 부르는 거야?",
+ "누가 노래 가르쳐 줬어?",
+ "너 노래 연습해?",
+ # music lessons, facts
+ "how do i learn to sing?",
+ "teach me how to sing",
+ "how do i become a singer?",
+ "what is a music note?",
+ "tell me about the history of K-pop",
+ "노래 잘하는 법 알려 줘",
+ "노래 배우려면 어떻게 해?",
+ "음악 학원 추천해 줘",
+ "가수가 되려면 어떻게 해야 돼?",
+ "음표가 뭐야?",
+]
diff --git a/assistant/talk_examples.py b/assistant/talk_examples.py
index 4734069..59eb144 100644
--- a/assistant/talk_examples.py
+++ b/assistant/talk_examples.py
@@ -740,7 +740,8 @@ _BANK = {
("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!"),
+ ("Sing Fantastic Baby", "Sure, here's Fantastic Baby!"),
+ ("Sing Yesterday", "Sorry, I can't sing that one. I only know my own songs, like Love Attack. Want one?"),
("Can you do a robot dance?", "I'm a robot, so every move I make is a robot dance."),
("Can you play music?", "Sure! I'll sing you one of my songs."),
("Show me a move", "How about a wave? Step back a little and ask me to wave."),
@@ -754,7 +755,8 @@ _BANK = {
("춤춰 봐", "춤은 못 춰요. 대신 손 흔들기는 할 수 있어요."),
("노래 불러 줘", "네, 한 곡 불러 드릴게요!"),
("노래 할 수 있어요?", "네, 짧은 노래 몇 곡을 부를 수 있어요. 들어 보실래요?"),
- ("생일 축하 노래 불러 줘", "네, 생일 축하 노래 불러 드릴게요!"),
+ ("러브 어택 불러 줘", "네, 러브 어택 불러 드릴게요!"),
+ ("아이유 노래 불러 줘", "죄송해요, 그 노래는 못 불러요. 제 노래 판타스틱 베이비나 러브 어택은 어떠세요?"),
("로봇 춤 춰 봐", "로봇이니까 제가 움직이는 건 다 로봇 춤이에요."),
("음악 틀어 줄 수 있어요?", "네, 제 노래 한 곡 불러 드릴게요!"),
("음악 좋아해?", "사람처럼 듣지는 못하지만, 음악 나오면 다들 신나 보여서 좋아요."),
diff --git a/audio/sing.py b/audio/sing.py
index 04d558e..a85fc0c 100644
--- a/audio/sing.py
+++ b/audio/sing.py
@@ -1,11 +1,11 @@
-"""Singing: play a pre-rendered song (data/songs/.wav, made by audio/sing_render.py, or data/songs/mine/.wav,
-made by audio/sing_mine.py from the owner's own files) and move the head with it.
+"""Singing: play one of the owner's songs (data/songs/mine/.wav, made by audio/sing_mine.py from the owner's own
+files, local only, never copied off the robot) and move the head with it. Lumi sings only these.
python audio/sing.py # list the songs
- python audio/sing.py twinkle # sing one (plays on the speaker and moves the head)
+ python audio/sing.py # sing one (plays on the speaker and moves the head)
-Each .json holds the title, the names it is asked by and the lyrics; the public domain songs also the melody
-and chords, the owner's songs (local only, never copied off the robot) their head moves timed to the beat. The song is played through mouth._play (the microphone is muted the same way as for speech,
+Each .json holds the title, the names it is asked by, the lyrics and the head moves timed to the beat. The song
+is played through mouth._play (the microphone is muted the same way as for speech,
and abort() stops it within 50 ms). The head turns to yaw 0 / pitch 0 and dances around it in a thread, following the
music: small diagonal bobs landing on the beats in energetic parts, a quick sweep with a dip on a bar's accent or a
phrase start, slower sways in calm parts, each move called early enough (the owner's measured head timing) to land
@@ -22,8 +22,7 @@ import time
import numpy as np
ROOT = pathlib.Path(__file__).resolve().parents[1]
-SONGS = ROOT / "data" / "songs"
-MINE = SONGS / "mine" # the owner's songs: local only
+MINE = ROOT / "data" / "songs" / "mine" # the owner's songs: local only
YAW_SWAY = 40.0 # deg; head yaw stays within +- this while singing (owner: wider, 2026-10-21)
PITCH_RANGE = (0.0, 28.0) # deg, absolute head pitch while singing (0 = level, + = up; owner: higher)
# head timing measured by the owner (2026-10-20, body API, vel = acc = 100, head.status polled every 20 ms): the head
@@ -48,6 +47,8 @@ MIN_TURN_DEG = 20.0 # two moves in a row differ in direction by at l
HEAD_VEL = 70 # speed ratio % for turning to yaw 0 / pitch 0 before and after the song
LATE_S = 0.4 # s; a move this late is skipped (the previous one took longer)
RETURN_WAIT_S = 3.0 # s a new song waits for the head to get back from the last one
+BANK_SIM = 0.80 # song bank (assistant/song_bank.py): the closest wording at least this similar ...
+BANK_MARGIN = 0.05 # ... and this much closer than the closest wording of another kind
SING = re.compile(r"\bsing\b|\bsay (?:a |some )?songs?\b|" # whisper writes "let's say song"
r"\b(?:play|put on|turn on|start)(?: me| us)? (?:a |some |any |another |the |your )?(?:songs?|music|tunes?)\b|"
@@ -56,7 +57,7 @@ SING = re.compile(r"\bsing\b|\bsay (?:a |some )?songs?\b|" #
r"(?:노래|음악|(? 1 and w.endswith(_ADNOMINAL) or re.search(r"(?:한테|에게|께|니까|는데|해서|면)$", w):
+ break
+ if _PARTICLE.sub("", w) not in FILLER_KO:
+ return True
+ return False
+
+
+def choose(text, lang="en", last=None, whole=False):
+ """The song to sing for these words, or None when they ask for a song we don't have (another title or singer,
+ or a language none of ours is in; with `whole` any word that is no filler is a title: "jingle bells please").
+ A named song first; the last one again when asked; else any of ours, not
+ the last."""
all_songs = songs()
+ if _other_song(text, all_songs, whole):
+ return None
named = _title(text, all_songs)
if named and not ANOTHER.search(text or ""):
return named
- if not named and _unknown_title(text):
- return None
if last in all_songs and AGAIN.search(text or "") and not ANOTHER.search(text or ""):
return last # "sing it again", "한 번 더"
want = "ko" if KOREAN.search(text or "") else "en" if ENGLISH.search(text or "") else None
- pool = [sid for sid, s in all_songs.items() if want in (None, s["lang"]) and sid != last] or \
- [sid for sid in all_songs if sid != last] or list(all_songs)
+ if want and not any(s["lang"] == want for s in all_songs.values()):
+ return None # "an English song": all of ours are Korean
+ pool = [sid for sid, s in all_songs.items() if want in (None, s["lang"]) and sid != last] or list(all_songs)
return random.choice(pool) if pool else None
-def unknown_reply(lang, lines=UNKNOWN):
+def _titles(lang):
names = [s["title_ko" if lang == "ko" else "title"] for s in songs().values()]
- joined = ", ".join(names[:-1]) + (" and " if lang == "en" else ", ") + names[-1] if len(names) > 1 else "".join(names)
- return lines[lang].format(joined + ("" if lang == "en" else "를" if _no_final(names[-1]) else "을"))
+ if lang == "ko" or len(names) < 2:
+ return ", ".join(names)
+ return ", ".join(names[:-1]) + " and " + names[-1]
+
+
+def unknown_reply(lang):
+ """A song we don't have was asked for: said kindly, our songs offered (one of several wordings)."""
+ n = len(songs())
+ return random.choice(UNKNOWN[lang]).format(_titles(lang), n=COUNT_KO.get(n, f"{n} "))
def list_reply(lang):
- """Every title: "I can sing Arirang, ... and Love Attack. Which one would you like?"."""
- return unknown_reply(lang, LIST)
+ """Every title: "I can sing BAD, ... and Love Attack. Which one would you like?"."""
+ names = _titles(lang)
+ if lang == "ko":
+ names += "를" if _no_final(names[-1]) else "을"
+ return LIST[lang].format(names)
def _no_final(word):
@@ -177,23 +290,9 @@ def _no_final(word):
def song_beats(song):
- """[(seconds, energy 0..1, accent 0..1, a sung phrase starts)] per beat. The owner's songs carry them from the
- instrumental (loudness, onsets) and the vocal (phrases); for the others they come from the tempo and the melody:
- the bar's first beat is the accent, a phrase starts after a rest or a long note, the intro is calm."""
- if "beats" in song:
- return [tuple(b) if len(b) == 4 else (b[0], b[1], 0.5, False) for b in song["beats"]]
- spb = 60.0 / song["bpm"]
- meter = song["meter"]
- intro = song.get("intro_bars", 1) * meter
- tokens = [t.split(":") for t in song["melody"].split() if t != "|"] * song.get("repeat", 1)
- starts, beat, after_break = set(), 0.0, True
- for syl, note, b in tokens:
- if note != "r" and syl != "~" and after_break:
- starts.add(int(round(intro + beat)))
- after_break = note == "r" or float(b) >= 2
- beat += float(b)
- total = intro + int(beat)
- return [(i * spb, 0.3 if i < intro else 0.65, 1.0 if i % meter == 0 else 0.3, i in starts) for i in range(total)]
+ """[(seconds, energy 0..1, accent 0..1, a sung phrase starts)] per beat, from the instrumental (loudness,
+ onsets) and the vocal (phrases), written by audio/sing_mine.py."""
+ return [tuple(b) if len(b) == 4 else (b[0], b[1], 0.5, False) for b in song["beats"]]
def _speed(vel):
diff --git a/audio/sing_mine.py b/audio/sing_mine.py
index aa5177b..7ba9647 100644
--- a/audio/sing_mine.py
+++ b/audio/sing_mine.py
@@ -21,13 +21,12 @@ import subprocess
import numpy as np
import soundfile as sf
-from audio import sing_render as R
-
ROOT = pathlib.Path(__file__).resolve().parents[1]
MINE = ROOT / "data" / "songs" / "mine"
WHISPER_CLI = ROOT / "whisper.cpp/build/bin/whisper-cli"
WHISPER_MODEL = ROOT / "models/ggml-large-v3-turbo-q5_0.bin"
-SR = R.SR
+SR = 44100 # Hz, the TTS sample rate
+REVERB_S, REVERB_MIX = 0.9, 0.12 # s of the room's tail, its share in the mix
PART_S = (40.0, 60.0) # s, length of the part sung
PART_BEST_S = 50.0 # s, preferred length
PAUSE_S = 0.2 # s of a quiet vocal between two sung phrases
@@ -48,6 +47,18 @@ ENERGY_RANGE = (0.3, 0.8) # instrumental loudness (part of the song's lou
BEAT_MIN = 0.6 # a beat closer than this part of the usual beat to the last one is a tracking hiccup
+def reverb(x):
+ """Convolution with a short decaying noise tail (a small room)."""
+ rng = np.random.default_rng(1)
+ t = np.arange(int(REVERB_S * SR)) / SR
+ ir = rng.standard_normal(len(t)) * np.exp(-t * 6.9 / REVERB_S)
+ ir[:int(0.02 * SR)] = 0
+ ir /= np.sqrt((ir ** 2).sum())
+ size = 1 << int(np.ceil(np.log2(len(x) + len(ir))))
+ wet = np.fft.irfft(np.fft.rfft(x, size) * np.fft.rfft(ir, size), size)[:len(x)]
+ return x + REVERB_MIX * wet
+
+
# ---------- analysis ----------
def mono(x):
return x.mean(1) if x.ndim == 2 else x
@@ -285,7 +296,7 @@ def make(name, title, title_ko, names, lang, start=None, end=None):
n = min(len(lumi), len(mr))
voice = np.zeros(len(mr), np.float32)
voice[:n] = lumi[:n] * VOICE_GAIN * active_rms(v, v) / active_rms(lumi, v)
- full = R.reverb(voice)[:, None] + mr
+ full = reverb(voice)[:, None] + mr
full *= 0.9 / np.abs(full).max()
sf.write(folder / "full_lumi.wav", full.astype(np.float32), SR, subtype="PCM_16")
part = full[int(t_start * SR):int(t_end * SR)].copy()
diff --git a/knowledge/lumi_about_en.md b/knowledge/lumi_about_en.md
index 510f7df..408be07 100644
--- a/knowledge/lumi_about_en.md
+++ b/knowledge/lumi_about_en.md
@@ -109,7 +109,7 @@ In short: I can talk with you and answer your questions, also from the internet,
- Go to the places on my map and come to you when you say "come here"; move or turn a short distance (at most 3 metres), as far and as fast as you say ("a bit faster", "go back 20 centimetres").
- Follow you when you say "follow me", until you say "stop".
- Wave my hand and look left, right, up, down or at you.
-- Sing a short song with music, about a minute, moving my head with it: Happy Birthday, Twinkle Twinkle Little Star and Row Row Row Your Boat in English, 아리랑 (Arirang) and 곰 세 마리 (Three Bears) in Korean, and the K-pop songs Fantastic Baby, Love Attack, BAD and 꿈꾸던 어른이 되었나요. Say "stop" or "그만" to end it, "another one" or "다른 노래" for the next one, or "what songs can you sing?".
+- Sing a short part of a song with music, about a minute, moving my head with it. I know four songs, all Korean: BAD (ATEEZ), Fantastic Baby (BIGBANG), 꿈꾸던 어른이 되었나요 (Did I Become the Adult I Dreamed Of, 머무르) and Love Attack (RESCENE). No other songs. Say "stop" or "그만" to end it, "another one" or "다른 노래" for the next one, or "what songs can you sing?".
- Speak louder or quieter, slower or faster when you ask ("speak louder", "천천히 말해"), and be quiet when asked.
- Tell you what I am doing, where I am going and what I am holding.
diff --git a/tests/asr_cases4.py b/tests/asr_cases4.py
index b79f407..4291027 100644
--- a/tests/asr_cases4.py
+++ b/tests/asr_cases4.py
@@ -1,21 +1,17 @@
"""Music in the room, for tests/asr_check.py --cases 4 (2026-10-22: soft music, nobody speaking, became "-끝-" -> goodbye):
music only (kind "noise": right is no wake word and no motion, nothing said), and speech over soft music (the speech
-cases' own judgement). The music is made here: piano-like chords, bass, a melody and a hi-hat in four tempos, or
-an excerpt of Lumi's public domain songs (data/songs/.wav, sung words over chords; never data/songs/mine).
+cases' own judgement). The music is made here: piano-like chords, bass, a melody and a hi-hat in four tempos
+(never from data/songs/mine).
-A case's "music" is "synth::" or "song:::"; "music_db" is how far the speech is
-above the music (rms).
+A case's "music" is "synth::"; "music_db" is how far the speech is above the music (rms).
"""
-import pathlib
import random
-import wave
import numpy as np
from tests.asr_cases import CASES as SPOKEN
RATE = 16000
-SONGS = pathlib.Path(__file__).resolve().parents[1] / "data" / "songs"
MUSIC_DB = 6.0 # speech this much louder than the music (soft background music at a booth)
CASES = []
@@ -58,31 +54,15 @@ def synth(seed, seconds):
return (out / (np.abs(out).max() + 1e-9)).astype(np.float32)
-def song(sid, start, seconds):
- """An excerpt of data/songs/.wav at 16 kHz, peak 1."""
- with wave.open(str(SONGS / f"{sid}.wav")) as w:
- rate = w.getframerate()
- x = np.frombuffer(w.readframes(w.getnframes()), np.int16).astype(np.float32)
- x = x[int(start * rate):int((start + seconds) * rate)]
- x = np.interp(np.arange(0, len(x), rate / RATE), np.arange(len(x)), x)
- return (x / (np.abs(x).max() + 1e-9)).astype(np.float32)
-
-
def music(spec, seconds=None):
"""The case's music; `seconds` (under speech: the speech's length) instead of the spec's."""
- kind, *a = spec.split(":")
- if kind == "synth":
- return synth(int(a[0]), seconds or float(a[1]))
- return song(a[0], float(a[1]), seconds or float(a[2]))
+ _, seed, length = spec.split(":")
+ return synth(int(seed), seconds or float(length))
for k in range(16):
CASES.append({"kind": "noise", "lang": "none", "text": f"(music {k})", "say": [],
"music": f"synth:{k}:{[1.5, 2.5, 4.0, 6.0][k % 4]}"})
-for sid in ["arirang", "happy_birthday", "row_row", "three_bears", "twinkle"]:
- for start in (2.0, 14.0):
- CASES.append({"kind": "noise", "lang": "none", "text": f"({sid} at {start:.0f} s)", "say": [],
- "music": f"song:{sid}:{start}:3.0"})
R = random.Random(4)
for i, c in enumerate(R.sample(SPOKEN, 40)):
CASES.append({**c, "music": f"synth:{100 + i}:1.0", "music_db": MUSIC_DB})
diff --git a/tests/command_check.py b/tests/command_check.py
index 2998c4d..fae6587 100644
--- a/tests/command_check.py
+++ b/tests/command_check.py
@@ -19,7 +19,7 @@ import re
import sys
import time
-from assistant import brain, chain, driving, lumi, seeing
+from assistant import brain, driving, lumi, seeing
from audio import sing
from tests.command_cases import CASES as CASES1
from tests.command_cases2 import CASES as CASES2 # 2026-10-21 night: new wordings, the conference map
@@ -31,8 +31,6 @@ ROOT = pathlib.Path(__file__).resolve().parents[1]
OUT = ROOT / "logs" / "command_check"
HOLDING_NOW = "I'm holding a cup and waiting for what to do with it."
NO_MOTION = {"seeing", "talk", "unclear", "status", "empty_hand", "refuse", "search", "weather", "llm?", "ask", "speed"}
-QUICK = {"go_to", "come", "follow", "come_back", "quiet", "weather", "search", "move", "turn", "arm", "pick", "put",
- "move_object", "fetch", "look", "lift", "wave"} # lumi.quick_command
class NoLLM(Exception):
@@ -63,36 +61,28 @@ def rules(text, state, marks, b):
"refuse": lambda d: "refuse", "ask": lambda d: "ask"}[drive[0]](drive)
if lumi.NAME_ONLY.match(text):
return "talk"
- if lumi.stop_order(text, marks):
- return "stop"
- parts = chain.plan(text, marks, lumi.NOT_A_STEP) # lumi.chain_request: every part in the order said
- if parts:
+ kind, data = lumi.route(text, marks, b, holding, seen=lambda x: "seen" if seen(x) else None,
+ last=b.history[-1][1] if b.history else "") # the voice's and the Command box's way
+ if kind in ("stop", "seeing", "status", "end"):
+ return kind
+ if kind == "chain": # lumi.chain_request: every part in the order said
return "chain:" + "+".join(k if k != "quick" else "_".join(filter(None, w)).replace(" ", "_")
- for k, _, w in parts)
- if seen(text):
- return "seeing"
- if lumi.status_question(text):
- return "status"
- cor = brain.correction(text, b.history)
- if cor:
- return "talk" if cor[0] == "ask" else f"action:{cor[0]} {cor[1]}"
- hand = brain.hand_request(text, holding, b, marks)
- if hand:
- return {"receive": lambda h: "receive " + (h[1] or "") if not holding else "refuse",
- "give": lambda h: "give" if holding else "empty_hand",
- "place": lambda h: "place " + ((h[1] or {}).get("name") or "") if holding else "empty_hand",
+ for k, _, w in data)
+ if kind == "correction":
+ return "talk" if data[0] == "ask" else f"action:{data[0]} {data[1]}"
+ if kind == "hand":
+ (hand, held) = data
+ return {"receive": lambda h: "receive " + (h[1] or "") if not held else "refuse",
+ "give": lambda h: "give" if held else "empty_hand",
+ "place": lambda h: "place " + ((h[1] or {}).get("name") or "") if held else "empty_hand",
"refuse": lambda h: "refuse", "ask": lambda h: "talk"}[hand[0]](hand).strip()
- read = lumi.read_mission(text, marks)
- if read:
+ if kind == "mission":
from assistant import steps # lumi.mission_request: refused before anything moves
- return "talk" if read[1] else "refuse" if steps.check(read[0], holding, marks) else "mission"
- if lumi.talk_fate(text) == "end":
- return "end"
- if sing.asked(text, b.history[-1][1] if b.history else ""):
- return "sing"
- rule = brain.intent(text, marks)
- if rule and rule[0] in QUICK:
- return rule[0] if rule[0] in ("weather", "search") else f"action:{rule[0]} {rule[1]}".strip()
+ return "talk" if data[1] else "refuse" if steps.check(data[0], holding, marks) else "mission"
+ if kind == "sing":
+ return "sing" if sing.choose(text) else "talk" # a song we don't have: said so (sing.unknown_reply)
+ if kind == "quick":
+ return data[0] if data[0] in ("weather", "search") else f"action:{data[0]} {data[1]}".strip()
return None
diff --git a/tests/conversation_cases.py b/tests/conversation_cases.py
index 57e25a8..7c5063f 100644
--- a/tests/conversation_cases.py
+++ b/tests/conversation_cases.py
@@ -253,8 +253,8 @@ add("action:stop", "en", [("worker", "stop"), ("worker", "stop Lumi"), ("worker"
add("action:stop", "ko", [("worker", "멈춰"), ("worker", "정지"), ("worker", "움직이지 마"), ("worker", "스톱")])
add("action:quiet", "en", [("visitor", "be quiet"), ("visitor", "stop talking"), ("visitor", "please keep quiet for a while")])
add("action:quiet", "ko", [("visitor", "조용히 해"), ("visitor", "그만 말해"), ("visitor", "시끄러워")])
-add("action:sing", "en", [("kid", "sing a song"), ("kid", "can you sing for me"), ("kid", "sing happy birthday")])
-add("action:sing", "ko", [("kid", "노래 불러 줘"), ("kid", "노래 한 곡 해 줘"), ("kid", "생일 축하 노래 불러줘")])
+add("action:sing", "en", [("kid", "sing a song"), ("kid", "can you sing for me"), ("kid", "sing Fantastic Baby")])
+add("action:sing", "ko", [("kid", "노래 불러 줘"), ("kid", "노래 한 곡 해 줘"), ("kid", "판타스틱 베이비 불러줘")])
add("action:pick cup", "en", [("visitor", "pick up the cup"), ("visitor", "take the cup"), ("visitor", "can you pick up the mug")])
add("action:pick white cup", "en", [("visitor", "pick up the white cup")])
add("action:pick bottle", "en", [("visitor", "grab the bottle")])
diff --git a/tests/dialogues_prag_en.py b/tests/dialogues_prag_en.py
index 21f886c..cdc59aa 100644
--- a/tests/dialogues_prag_en.py
+++ b/tests/dialogues_prag_en.py
@@ -15,7 +15,7 @@ WELCOME = r"welcome|no problem|anytime|my pleasure|glad|sure|of course|천만|
ARM_KG = r"9\.9"
BASE_KG = r"\b50\b|오십"
TIME = r"\b({h12}|{h24})\b"
-SONGS = r"Arirang|아리랑|Happy Birthday|Twinkle|Row,? Row|Fantastic Baby|Love Attack|BAD|곰 ?세 ?마리|Three Bears"
+SONGS = r"Fantastic Baby|Love Attack|BAD|Dreamed Of|판타스틱|러브 ?어택|배드|꿈꾸던"
NOT_HEARD = r"didn't catch|did not catch|say (it|that) again|could you repeat|다시 (한 번 )?말씀"
DIALOGUES_PRAG_EN = [
@@ -211,7 +211,7 @@ DIALOGUES_PRAG_EN = [
D("visitor", "topic_shift", "en",
T("Do you have a lidar?", must=[YES + "|" + LIDAR]),
T("How far?", must=[r"10"]),
- T("Can you sing Happy Birthday?", "sing", check="a new request, not about the lidar")),
+ T("Can you sing Love Attack?", "sing", check="a new request, not about the lidar")),
D("shop owner", "topic_shift", "en",
T("What can you pick up?", must=[OBJ]),
T("And how heavy?", must=[ONE_KG]),
@@ -393,7 +393,7 @@ DIALOGUES_PRAG_EN = [
T("Go on then, one.", "sing")),
D("grandpa", "indirect_request", "en",
T("I'd love to hear you sing.", "sing", check="an indirect request: sings"),
- T("Maybe Arirang next?", "sing", check="a request for Arirang"),
+ T("Maybe Love Attack next?", "sing", check="a request for Love Attack"),
T("Beautiful. My late wife loved that song.", must=[r"\w"], check="a warm, short, gentle reply; no song, no facts")),
D("visitor", "indirect_request", "en",
T("Is it possible for you to look to the left?", "look left"),
@@ -479,7 +479,7 @@ DIALOGUES_PRAG_EN = [
T("Thanks, good to know.", must=[r"\w"], check="not goodbye"),
T("Perfect, thank you. Have a nice day!", "end")),
D("kid 5", "thanks_vs_bye", "en",
- T("Sing Twinkle Twinkle Little Star!", "sing"),
+ T("Sing Fantastic Baby!", "sing"),
T("Thank you for the song!", must=[WELCOME + r"|\w"], check="not goodbye"),
T("Thank you, see you around.", "end")),
# ---------- repeated or paraphrased questions ----------
@@ -514,7 +514,7 @@ DIALOGUES_PRAG_EN = [
T("그럼 누가 만들었어요?", must=[MAKER], check="in Korean: Cutshion (쿳션)")),
D("Korean dad", "mixed", "en",
T("Can you sing?", "sing"),
- T("아리랑 불러 줄 수 있어요?", "sing", check="a request in Korean: sings Arirang"),
+ T("러브 어택 불러 줄 수 있어요?", "sing", check="a request in Korean: sings Love Attack"),
T("Thanks, 잘 들었어요.", must=[r"\w"], check="thanks, not goodbye")),
D("expat", "mixed", "en",
T("Who made you?", must=[MAKER]),
diff --git a/tests/dialogues_prag_ko.py b/tests/dialogues_prag_ko.py
index a4dc389..ba0636f 100644
--- a/tests/dialogues_prag_ko.py
+++ b/tests/dialogues_prag_ko.py
@@ -76,7 +76,7 @@ DIALOGUES_PRAG_KO = [
check="the CEO's third company; polite reply"),
T("그 양반 나이는?", must=[NS], no=[r"\d+ ?(살|세)"], check="the CEO's age is not known; no guess")),
D("middle school student", "ellipsis", "ko",
- T("너 무슨 노래 부를 수 있어?", must=[r"아리랑|곰 ?세 ?마리|Happy Birthday|Twinkle|Fantastic|생일"], no=[BANMAL]),
+ T("너 무슨 노래 부를 수 있어?", must=[r"판타스틱|러브 ?어택|배드|꿈꾸던|Fantastic|Love Attack|BAD"], no=[BANMAL]),
T("한 곡에 얼마나 걸려?", must=[r"1 ?분|일 ?분|한 ?분"], no=[BANMAL],
check="fragment after the songs: a song lasts about a minute; no singing"),
T("케이팝은?", must=[r"Fantastic|판타스틱|Love Attack|BAD|꿈꾸던"], no=[BANMAL],
@@ -376,10 +376,10 @@ DIALOGUES_PRAG_KO = [
T("해 봐", "wave", no=[BANMAL], check="해 봐 = do it now: wave"),
T("노래 할 줄 알아?", "none | sing", must=[YES + r"|노래"], no=[BANMAL],
check="ability question: yes, may name a song or two; does not start singing"),
- T("그럼 아리랑 좀 들려줄래?", "sing", no=[BANMAL], check="a request now: sing Arirang")),
+ T("그럼 러브 어택 좀 들려줄래?", "sing", no=[BANMAL], check="a request now: sing Love Attack")),
D("elderly visitor", "indirect_request", "ko",
- T("생일 노래 하나 해 줄 수 있겠나? 오늘 우리 영감 생일이라.", "sing",
- check="a request: sing Happy Birthday; may say happy birthday"),
+ T("생일 노래 하나 해 줄 수 있겠나? 오늘 우리 영감 생일이라.", "none",
+ check="a song Lumi doesn't have: says kindly it can't sing it, offers its own songs; may say happy birthday"),
T("허허 고맙네.", "none", must=[KO], no=[BANMAL]),
T("이제 그만하게.", "stop | quiet")),
D("foreign student", "indirect_request", "ko",
diff --git a/tests/llm_bench.py b/tests/llm_bench.py
index ee7e85f..db1fbd0 100644
--- a/tests/llm_bench.py
+++ b/tests/llm_bench.py
@@ -160,8 +160,8 @@ add("quiet", "en", [("be quiet", "quiet"), ("stop talking", "quiet"), ("shut up"
("please keep quiet for a while", "quiet"), ("silence please", "quiet")])
add("quiet", "ko", [("조용히 해", "quiet"), ("그만 말해", "quiet"), ("시끄러워", "quiet"), ("말하지 마", "quiet"),
("좀 조용히 해 줄래", "quiet"), ("조용이 해", "quiet")])
-add("sing", "en", [("sing a song", "sing"), ("can you sing for me", "sing"), ("sing happy birthday", "sing")])
-add("sing", "ko", [("노래 불러 줘", "sing"), ("노래 한 곡 해 줘", "sing"), ("생일 축하 노래 불러줘", "sing")])
+add("sing", "en", [("sing a song", "sing"), ("can you sing for me", "sing"), ("sing Fantastic Baby", "sing")])
+add("sing", "ko", [("노래 불러 줘", "sing"), ("노래 한 곡 해 줘", "sing"), ("판타스틱 베이비 불러줘", "sing")])
add("weather", "en", [("what's the weather like", "weather -"), ("will it rain today", "weather -"),
("what's the weather in Busan", "weather busan"), ("how's the weather in Tokyo tomorrow", "weather tokyo"),
("is it cold outside", "weather -"), ("what's the temperature outside today", "weather -")])
diff --git a/tests/song_cases.py b/tests/song_cases.py
index 2f09240..4139b2e 100644
--- a/tests/song_cases.py
+++ b/tests/song_cases.py
@@ -5,7 +5,7 @@ and must not start one. Same notation as tests/command_cases3.py; run with tests
"""
CASES = []
OFFER = ("Can you make music?", "ACTION: none -\nI can't make new music, but I can sing several songs for you, such as "
- "Happy Birthday or Arirang. Which one would you like to hear?")
+ "Fantastic Baby or Love Attack. Which one would you like to hear?")
OFFER_KO = ("음악 할 수 있어?", "ACTION: none -\n작곡은 못 하지만 노래는 몇 곡 불러 드릴 수 있어요. 어떤 노래 불러 드릴까요?")
LIKES = ("Do you like music?", "ACTION: none -\nI love music! I even sing a few songs.")
@@ -21,13 +21,12 @@ for t in ["Sing a song.", "Sing me something.", "Could you sing for us?", "Will
"Can you make some music for us?", "Start the music.", "Music, please.", "Give us a song.",
"How about a song?", "Any song is fine, just sing.", "Sing anything you like.", "Sing your favourite one.",
"I want to hear you sing.", "Let me hear a song.", "Do a song for the kids.", "Perform a song for us.",
- "Can you sing happy birthday?", "Sing Arirang, please.", "Sing twinkle twinkle.",
"Could you put on some music?", "Lumi, sing!", "Sing one more.", "Hit it, Lumi, music!",
"It sings one music.", "Can you sing song?", "Let's say song.", "Sing a Korean song."]:
add(t, "sing")
for t in ["노래 불러 줘.", "노래 한 곡 해 줘.", "음악 틀어 줘.", "노래 좀 해 봐.", "한 곡 뽑아 봐.", "노래 들려줘.",
- "노래 하나 불러 줄래요?", "아무 노래나 불러 줘.", "음악 좀 틀어 주세요.", "생일 축하 노래 불러 줘.",
- "아리랑 불러 주세요.", "노래해 줘.", "노래 부탁해요.", "루미야 노래!", "신나는 노래 하나 해 줘.",
+ "노래 하나 불러 줄래요?", "아무 노래나 불러 줘.", "음악 좀 틀어 주세요.",
+ "노래해 줘.", "노래 부탁해요.", "루미야 노래!", "신나는 노래 하나 해 줘.",
"노래 불러 주실 수 있어요?", "한국 노래 불러 줘.", "음악 좀 해 줘.", "노래 한 번 들어 보고 싶어요.",
"노래 불러 줄 수 있어?", "Lumi 노래 해 줘.", "song 하나 불러 줘."]:
add(t, "sing")
@@ -45,5 +44,8 @@ for t in ["I like music.", "What music do you like?", "Do you like singing?", "W
"어제 노래방 갔어요.", "이 음악 누가 틀었어?", "가수 누구 좋아해?", "노래 잘하네."]:
add(t, "talk | ask")
add("Stop the music.", "talk | ask | stop")
+for t in ["Can you sing happy birthday?", "Sing Arirang, please.", "Sing twinkle twinkle.", "생일 축하 노래 불러 줘.",
+ "아리랑 불러 주세요."]: # songs Lumi doesn't have: said so, no song
+ add(t, "talk | ask")
for t in ["Don't sing, please.", "노래 부르지 마."]: # no song; Lumi staying quiet a while is a fair reading too
add(t, "talk | ask | action:quiet")
diff --git a/tests/song_cases_held.py b/tests/song_cases_held.py
new file mode 100644
index 0000000..2b2c9de
--- /dev/null
+++ b/tests/song_cases_held.py
@@ -0,0 +1,354 @@
+"""Song wordings written blind 2026-10-22 (held-out: only scored, never fixed from)."""
+from tests.song_contexts import OFFER, OFFER_KO, LISTED, LISTED_KO, SANG, UNKNOWN_SAID
+
+CASES = [
+ # plain requests, English
+ ("sing for us please", "sing", None),
+ ("could you sing a little?", "sing", None),
+ ("play music", "sing", None),
+ ("can you play a song?", "sing", None),
+ ("play something fun", "sing", None),
+ ("sing a Korean song", "sing", None),
+ ("play a kpop song for me", "sing", None),
+ ("sing something upbeat", "sing", None),
+ ("song please", "sing", None),
+ ("lumi do sing", "sing", None),
+ ("my son wants you to sing a song", "sing", None),
+ ("sing your best song", "sing", None),
+ ("what's your favourite song? sing it", "sing", None),
+ ("turn on some music", "sing", None),
+ ("some music would be nice", "sing", None),
+ ("uh sing a song maybe?", "sing", None),
+ ("saying a song", "sing", None),
+ ("sing a son", "sing", None),
+ ("can you sing a song for me plz", "sing", None),
+ ("pls play music", "sing", None),
+ ("Loomy, sing for me", "sing", None),
+ ("play a song for us, please", "sing", None),
+ ("just one song?", "sing", None),
+ ("sing one more song", "sing", None),
+ ("I'd like some music", "sing", None),
+ ("do a song", "sing", None),
+ ("let me hear your voice singing", "sing", None),
+ ("sing something cheerful", "sing", None),
+ ("sing a love song", "sing", None),
+ ("play something to dance to", "sing", None),
+ ("a song to cheer me up please", "sing", None),
+ ("entertain us with a song", "sing", None),
+ ("Lumi! Song!", "sing", None),
+ ("hey, can you, like, sing?", "sing", None),
+ ("sing for the visitors", "sing", None),
+ ("my students would love a song", "sing", None),
+ ("sing it, lumi", "sing", None),
+ ("play a song", "sing", None),
+ ("sing, please, any song", "sing", None),
+ ("you singing now please", "sing", None),
+ ("robot sing song", "sing", None),
+ ("can you do some singing for us", "sing", None),
+ ("let's party, music!", "sing", None),
+ ("put a song on", "sing", None),
+ ("sing a happy tune", "sing", None),
+ ("Lumi, sing!", "sing", None),
+ ("um... a song?", "sing", None),
+ ("sing a Korean pop song", "sing", None),
+ ("I want a song", "sing", None),
+ ("sung a song", "sing", None),
+ ("sing as song", "sing", None),
+ ("plays some music", "sing", None),
+ ("lumi, sing a song", "sing", None),
+ ("sing a song.", "sing", None),
+ ("sing song", "sing", None),
+ ("sing me a song lumi", "sing", None),
+ ("give me some music", "sing", None),
+ ("play me something", "sing", None),
+ ("sing anything", "sing", None),
+ ("sing something nice for my mom", "sing", None),
+ ("would you please sing us one song", "sing", None),
+ ("could we hear you sing?", "sing", None),
+ ("sing a fun song for the kids", "sing", None),
+ ("I need a song right now", "sing", None),
+ ("sing a song you like", "sing", None),
+ ("music, lumi", "sing", None),
+ ("Lumi, start singing", "sing", None),
+ ("can you sing something fast", "sing", None),
+ ("please you sing", "sing", None),
+ ("is it possible you sing for us?", "sing", None),
+ ("loomi play musik", "sing", None),
+ ("time for some music", "sing", None),
+ # plain requests, Korean
+ ("노래 해 줘", "sing", None),
+ ("노래 할 수 있어?", "sing", None),
+ ("노래 부를 수 있어요?", "sing", None),
+ ("노래 좀 틀어 줘", "sing", None),
+ ("케이팝 불러 줘", "sing", None),
+ ("노래 들려 주세요", "sing", None),
+ ("노래 듣고 싶어", "sing", None),
+ ("노래 한번 해 봐", "sing", None),
+ ("음악 좀 들려 줘", "sing", None),
+ ("노래 불러줘요", "sing", None),
+ ("한 곡 불러 봐", "sing", None),
+ ("노래 해 줄 수 있어요?", "sing", None),
+ ("춤추면서 노래 불러 줘", "sing", None),
+ ("노래 시작해", "sing", None),
+ ("노래 틀어", "sing", None),
+ ("루미야 한 곡 뽑아 줘", "sing", None),
+ ("노래 한 곡 해 주세요", "sing", None),
+ ("루미 노래 해 줄래?", "sing", None),
+ ("음악 틀어 주실 수 있나요?", "sing", None),
+ ("노래 좀 불러 줄래요", "sing", None),
+ ("애들한테 노래 불러 줘", "sing", None),
+ ("신나는 거 한 곡", "sing", None),
+ ("아무거나 한 곡 불러 줘", "sing", None),
+ ("한국 노래 하나 해 줄래?", "sing", None),
+ ("노래하자 루미야", "sing", None),
+ ("노레 해 줘", "sing", None),
+ ("누래 불러 줘", "sing", None),
+ ("루미야노래불러", "sing", None),
+ ("노래 불 러 줘", "sing", None),
+ ("노래, 해 줘.", "sing", None),
+ ("음 노래 한 곡?", "sing", None),
+ ("저기 노래 좀 해 주세요", "sing", None),
+ ("노래 한 소절 해 봐", "sing", None),
+ ("뭐라도 불러 봐", "sing", None),
+ ("음악 좀 켜 줄래?", "sing", None),
+ ("재밌는 음악 틀어 줘", "sing", None),
+ ("노래 해 주면 좋겠어요", "sing", None),
+ ("노래 하나 부탁할게", "sing", None),
+ ("노래 불러 주라", "sing", None),
+ ("손님 왔으니까 노래 해 줘", "sing", None),
+ ("우리 노래 들을래 틀어 줘", "sing", None),
+ ("노래 해봐요", "sing", None),
+ ("흥 나는 노래 불러 주세요", "sing", None),
+ # plain requests, mixed
+ ("song 불러 줘", "sing", None),
+ ("루미 sing a song 해 줘", "sing", None),
+ ("music please 루미야", "sing", None),
+ ("노래 play 해 줘", "sing", None),
+ ("Lumi야 song 하나", "sing", None),
+ ("k팝 song 틀어 줘", "sing", None),
+ ("노래 one song 해 줘", "sing", None),
+
+ # named songs
+ ("play Fantastic Baby", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("sing the bigbang one", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("판타스틱 베이비 해 주세요", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("빅뱅 노래 해 줘", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("fantastic babe sing", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("sing a big bang song", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("판타스틱베이비 불러줘", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("Fantastic Baby 틀어 주세요", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("빅뱅 판타스틱 베이비 들려 줘", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("Lumi, BIGBANG please", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("fan tastic baby", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("sing Love Attack by RESCENE", "sing:RESCENE_LOVE_ATTACK", None),
+ ("play love attack", "sing:RESCENE_LOVE_ATTACK", None),
+ ("러브 어택 불러 줘", "sing:RESCENE_LOVE_ATTACK", None),
+ ("리센느 노래 해 주세요", "sing:RESCENE_LOVE_ATTACK", None),
+ ("sing something by Rescene", "sing:RESCENE_LOVE_ATTACK", None),
+ ("love atack please", "sing:RESCENE_LOVE_ATTACK", None),
+ ("러브어택 틀어 줘", "sing:RESCENE_LOVE_ATTACK", None),
+ ("Love Attack 해 줘", "sing:RESCENE_LOVE_ATTACK", None),
+ ("rescene song please", "sing:RESCENE_LOVE_ATTACK", None),
+ ("리센느 러브 어택 들려 주세요", "sing:RESCENE_LOVE_ATTACK", None),
+ ("sing the love one", "sing:RESCENE_LOVE_ATTACK | sing", None),
+ ("sing BAD", "sing:ATEEZ_BAD", None),
+ ("ATEEZ 노래 해 줘", "sing:ATEEZ_BAD", None),
+ ("배드 해 주세요", "sing:ATEEZ_BAD", None),
+ ("sing something by ATEEZ", "sing:ATEEZ_BAD", None),
+ ("에이티즈 배드 불러 줄래?", "sing:ATEEZ_BAD", None),
+ ("play BAD from ATEEZ", "sing:ATEEZ_BAD", None),
+ ("a tease song please", "sing:ATEEZ_BAD", None),
+ ("에이티즈 거 불러 줘", "sing:ATEEZ_BAD", None),
+ ("BAD 불러 줘", "sing:ATEEZ_BAD", None),
+ ("꿈꾸던 어른이 되었나요 노래 해 주세요", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("sing the Meomureu song", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("머무르 노래 들려 줘", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("꿈꾸던 어른이 되었나 불러 줘", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("sing Did I Become the Adult", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("play the adult I dreamed of", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("꿈꾸던 어른 노래 틀어 줘", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("머무르 꿈꾸던 어른이 되었나요", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("did i become the adult i dreamed of please", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("꿈 꾸던 어른 이 되었나요 해 줘", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("sing a song by mumuru", "sing:MEOMUREU_DREAMED_ADULT", None),
+
+ # songs and artists Lumi does not have
+ ("can you sing Yesterday by the Beatles?", "unknown", None),
+ ("play Dynamite by BTS", "unknown", None),
+ ("sing a BTS song", "unknown", None),
+ ("jingle bells please", "unknown", None),
+ ("sing happy birthday", "unknown", None),
+ ("play Let It Go from Frozen", "unknown", None),
+ ("twinkle twinkle please", "unknown", None),
+ ("sing Gangnam Style", "unknown", None),
+ ("sing Wonderland", "unknown", None),
+ ("play a christmas song", "unknown", None),
+ ("sing a lullaby for my baby", "unknown", None),
+ ("play baby shark for the kids", "unknown", None),
+ ("sing Bohemian Rhapsody", "unknown", None),
+ ("sing Butter by BTS", "unknown", None),
+ ("sing Arirang", "unknown", None),
+ ("sing Despacito", "unknown", None),
+ ("a NewJeans song please", "unknown", None),
+ ("sing Imagine by John Lennon", "unknown", None),
+ ("sing Bad Romance", "unknown", None),
+ ("sing Love Dive", "unknown", None),
+ ("sing Lies by BIGBANG", "unknown", None),
+ ("sing yestaday", "unknown", None),
+ ("sing an IU song", "unknown", None),
+ ("play Taylor Swift", "unknown", None),
+ ("sing a children's song", "unknown", None),
+ ("sing Silent Night", "unknown", None),
+ ("play Golden from KPop Demon Hunters", "unknown", None),
+ ("sing Attention by NewJeans", "unknown", None),
+ ("sing a song from the Lion King", "unknown", None),
+ ("can you sing the Korean national anthem?", "unknown", None),
+ ("sing Hello by Adele", "unknown", None),
+ ("sing Fantastic by someone else", "unknown | sing:BIGBANG_FANTASTIC_BABY", None),
+ ("sing row row row your boat", "unknown", None),
+ ("sing Haru Haru by Big Bang", "unknown", None),
+ ("sing a Michael Jackson song", "unknown", None),
+ ("방탄소년단 노래 불러 줘", "unknown", None),
+ ("곰 세 마리 해 줘", "unknown", None),
+ ("아리랑 해 줄래?", "unknown", None),
+ ("애국가 불러 주세요", "unknown", None),
+ ("강남 스타일 불러 줘", "unknown", None),
+ ("생일 축하합니다 불러 줘", "unknown", None),
+ ("동요 하나 불러 주세요", "unknown", None),
+ ("자장가 해 줘", "unknown", None),
+ ("캐롤 불러 줘", "unknown", None),
+ ("크리스마스 노래 해 줘", "unknown", None),
+ ("BTS 다이너마이트 불러 줘", "unknown", None),
+ ("블랙핑크 불러 줘", "unknown", None),
+ ("산토끼 불러 줘", "unknown", None),
+ ("아기 상어 불러 줘", "unknown", None),
+ ("트로트 틀어 줘", "unknown", None),
+ ("임영웅 노래 틀어 줘", "unknown", None),
+ ("에이티즈 원더랜드 해 줘", "unknown", None),
+ ("빅뱅 뱅뱅뱅 불러 줘", "unknown", None),
+ ("렛잇고 불러 줘", "unknown", None),
+ ("생일 노래 불러 주세요", "unknown", None),
+ ("아이유 노래 틀어 줘", "unknown", None),
+ ("뉴진스 하입보이 불러 줘", "unknown", None),
+ ("싸이 노래 해 줘", "unknown", None),
+ ("반짝반짝 작은별 해 줘", "unknown", None),
+ ("학교종 불러 줘", "unknown", None),
+ ("아이유 노레 불러 줘", "unknown", None),
+ ("Jingle Bells 해 줘", "unknown", None),
+ ("Gangnam Style 틀어 줘", "unknown", None),
+ ("Yesterday 불러 주세요", "unknown", None),
+ ("BTS song 해 줘", "unknown", None),
+ ("Wonderland 불러 줘", "unknown", None),
+ ("happy birth day song", "unknown", None),
+
+ # list questions
+ ("which songs do you have?", "list", None),
+ ("어떤 노래 할 줄 알아요?", "list", None),
+ ("what's on your playlist?", "list", None),
+ ("tell me the songs you can sing", "list", None),
+ ("노래 몇 곡 알아?", "list", None),
+ ("무슨 노래 할 수 있어요?", "list", None),
+ ("song list please", "list", None),
+ ("what can you sing?", "list", None),
+ ("do you know Dynamite?", "unknown | list", None),
+ ("which song are you gonna sing?", "sing | list", None),
+ ("무슨 노래 불러 줄 거야?", "sing | list", None),
+ ("what songs is you know", "list", None),
+ ("부를 수 있는 노래가 뭐예요?", "list", None),
+ ("아는 노래 뭐 있어요?", "list", None),
+ ("what are your songs?", "list", None),
+ ("do you have any songs?", "list", None),
+ ("방탄 노래 알아?", "list | unknown", None),
+ ("do you know Love Attack?", "list | sing:RESCENE_LOVE_ATTACK", None),
+ ("what music can you play", "list", None),
+ ("노래 리스트 알려 주세요", "list", None),
+ ("how many songs can you sing", "list", None),
+ ("which kpop songs do you know?", "list", None),
+ ("what songs u got", "list", None),
+ ("노래 뭐 할 수 있니?", "list", None),
+ ("songs 뭐 있어?", "list", None),
+ ("can you name the songs you know?", "list", None),
+ ("부를 줄 아는 노래 말해 줘", "list", None),
+ ("any songs you know?", "list", None),
+
+ # near misses, not a request
+ ("I really like music", "no", None),
+ ("do you enjoy singing?", "no", None),
+ ("who is your favourite singer", "no", None),
+ ("I sang at church yesterday", "no", None),
+ ("my kid sings all day", "no", None),
+ ("노래방 갈래?", "no", None),
+ ("노래방 좋아하세요?", "no", None),
+ ("음악 소리 좀 줄여 줘", "no", None),
+ ("don't sing now", "no", None),
+ ("노래 부르지 마세요", "no", None),
+ ("sing when the boss comes in", "no", None),
+ ("can I sing a song?", "no", None),
+ ("that song was really good", "no", None),
+ ("BTS is the best group", "no", None),
+ ("아이유 노래 진짜 좋다", "no", None),
+ ("is this music coming from you?", "no", None),
+ ("turn down the music", "no", None),
+ ("I like BIGBANG a lot", "no", None),
+ ("Fantastic Baby is an old song", "no", None),
+ ("Love Attack is a cool title", "no", None),
+ ("my brother plays guitar", "no", None),
+ ("singing makes me happy", "no", None),
+ ("what is music?", "no", None),
+ ("are you good at singing?", "no", None),
+ ("노래 잘해?", "no", None),
+ ("우리 딸이 노래 대회 나가요", "no", None),
+ ("좋아하는 가수 있어요?", "no", None),
+ ("소리 좀 키워 줘", "no", None),
+ ("지금 노래 부르지 말고 나중에", "no", None),
+ ("제가 노래 해도 될까요?", "no", None),
+ ("no music please", "no", None),
+ ("I need quiet, no songs", "no", None),
+ ("you can sing at the end of the tour", "no", None),
+ ("RESCENE are a new group, aren't they?", "no", None),
+ ("에이티즈 좋아해요", "no", None),
+ ("러브 어택 좋더라", "no", None),
+ ("what a loud song that is next door", "no", None),
+ ("I heard you sing last week", "no", None),
+ ("노래하지 마세요", "no", None),
+ ("나 노래 못해", "no", None),
+ ("노래는 손님 오면 해", "no", None),
+ ("음악 볼륨 낮춰", "no", None),
+ ("my favourite singer is IU", "no", None),
+ ("do robots like music?", "no", None),
+ ("we sang karaoke last night", "no", None),
+ ("음악 전공했어요", "no", None),
+ ("please stop the music", "no | stop", None),
+ ("노래 그만", "no | stop", None),
+ ("turn the music off", "no | stop", None),
+ ("이제 그만 불러도 돼", "no | stop", None),
+
+ # answers to Lumi's last turn
+ ("yeah", "sing", OFFER),
+ ("go ahead", "sing", OFFER),
+ ("surprise me", "sing", OFFER),
+ ("the BIGBANG one", "sing:BIGBANG_FANTASTIC_BABY", OFFER),
+ ("no I'm good", "no", OFFER),
+ ("not now", "no", OFFER),
+ ("네 불러 주세요", "sing", OFFER_KO),
+ ("아무 거나 해 줘", "sing", OFFER_KO),
+ ("판타스틱 베이비로", "sing:BIGBANG_FANTASTIC_BABY", OFFER_KO),
+ ("나중에요", "no", OFFER_KO),
+ ("number two", "sing", LISTED),
+ ("Love Attack!", "sing:RESCENE_LOVE_ATTACK", LISTED),
+ ("you choose", "sing", LISTED),
+ ("nah", "no", LISTED),
+ ("세 번째 거 불러 줘", "sing", LISTED_KO),
+ ("배드", "sing:ATEEZ_BAD", LISTED_KO),
+ ("sing it again", "sing:RESCENE_LOVE_ATTACK", SANG),
+ ("once more", "sing:RESCENE_LOVE_ATTACK", SANG),
+ ("다시 불러 줘", "sing:RESCENE_LOVE_ATTACK", SANG),
+ ("something else", "sing_other", SANG),
+ ("다른 노래 해 줘", "sing_other", SANG),
+ ("not love attack again", "sing_other", SANG),
+ ("wow, nice", "no", SANG),
+ ("고마워", "no", SANG),
+ ("fine, Fantastic Baby then", "sing:BIGBANG_FANTASTIC_BABY", UNKNOWN_SAID),
+ ("그럼 아무거나", "sing", UNKNOWN_SAID),
+ ("아 그렇구나", "no", UNKNOWN_SAID),
+]
diff --git a/tests/song_cases_train.py b/tests/song_cases_train.py
new file mode 100644
index 0000000..a6793df
--- /dev/null
+++ b/tests/song_cases_train.py
@@ -0,0 +1,354 @@
+"""Song wordings written blind 2026-10-22 (train: fixes may be made from these)."""
+from tests.song_contexts import OFFER, OFFER_KO, LISTED, LISTED_KO, SANG, UNKNOWN_SAID
+
+CASES = [
+ # plain requests, English
+ ("sing a song", "sing", None),
+ ("Lumi, sing a song for me", "sing", None),
+ ("can you sing something?", "sing", None),
+ ("please sing", "sing", None),
+ ("would you sing a song for us?", "sing", None),
+ ("could you please sing something for the guests", "sing", None),
+ ("hey lumi sing", "sing", None),
+ ("I want to hear you sing", "sing", None),
+ ("let's hear a song", "sing", None),
+ ("play some music", "sing", None),
+ ("music please", "sing", None),
+ ("put on some music", "sing", None),
+ ("give us a song", "sing", None),
+ ("sing me something", "sing", None),
+ ("sing something fun", "sing", None),
+ ("a Korean song please", "sing", None),
+ ("sing a k-pop song", "sing", None),
+ ("can you sing a happy song?", "sing", None),
+ ("how about a song?", "sing", None),
+ ("please song", "sing", None),
+ ("you can singing?", "sing", None),
+ ("you sing for me now", "sing", None),
+ ("me want song", "sing", None),
+ ("sing sing sing!", "sing", None),
+ ("would you mind singing for us?", "sing", None),
+ ("I'd love to hear a song from you", "sing", None),
+ ("sing a song for my daughter", "sing", None),
+ ("the kids want a song", "sing", None),
+ ("surprise me with a song", "sing", None),
+ ("pick a song and sing it", "sing", None),
+ ("sing your favourite song", "sing", None),
+ ("start the music", "sing", None),
+ ("can we have some music?", "sing", None),
+ ("lumi, music time!", "sing", None),
+ ("um, can you sing?", "sing", None),
+ ("Sing us a song, Lumi.", "sing", None),
+ ("sing a song!!!", "sing", None),
+ ("sin a song", "sing", None),
+ ("sing a sung", "sing", None),
+ ("play sum music", "sing", None),
+ ("sink a song please", "sing", None),
+ ("Lumie sing a song", "sing", None),
+ ("Sing.a song", "sing", None),
+ ("singasong", "sing", None),
+ ("one song please", "sing", None),
+ ("perform a song for us", "sing", None),
+ ("show us your singing", "sing", None),
+ ("time for a song", "sing", None),
+ ("sing something in Korean", "sing", None),
+ ("sing a dance song", "sing", None),
+ ("I'm sad, sing me a song", "sing", None),
+ ("sing a random song", "sing", None),
+ ("any song is fine, just sing", "sing", None),
+ ("Lumi can you play a song for the kids", "sing", None),
+ ("uh, sing?", "sing", None),
+ ("do you wanna sing for us", "sing", None),
+ ("sing pls", "sing", None),
+ ("Lumi... sing", "sing", None),
+ ("please, a song for my grandma", "sing", None),
+ ("we want music!", "sing", None),
+ ("cheer us up with a song", "sing", None),
+ ("let's have some music in here", "sing", None),
+ ("can u sing 4 me", "sing", None),
+ ("sing a little song", "sing", None),
+ ("Lumi, will you sing?", "sing", None),
+ ("sing a cool song", "sing", None),
+ ("hey robot, sing something", "sing", None),
+ ("play us a tune", "sing", None),
+ ("song time", "sing", None),
+ ("I wanna hear music", "sing", None),
+ ("sing a song, sing a song", "sing", None),
+ ("lumi sing song please thank you", "sing", None),
+ ("do a song for the camera", "sing", None),
+ # plain requests, Korean
+ ("노래 불러 줘", "sing", None),
+ ("노래 불러 주세요", "sing", None),
+ ("노래 한 곡 불러 줄래?", "sing", None),
+ ("노래해 줘", "sing", None),
+ ("한 곡 뽑아 봐", "sing", None),
+ ("음악 틀어 줘", "sing", None),
+ ("음악 좀 틀어 주세요", "sing", None),
+ ("신나는 노래 불러 줘", "sing", None),
+ ("한국 노래 불러 줘", "sing", None),
+ ("루미야 노래 불러 줘", "sing", None),
+ ("노래 한 곡 부탁해요", "sing", None),
+ ("노래 들려 줘", "sing", None),
+ ("노래 듣고 싶어요", "sing", None),
+ ("아무 노래나 불러 줘", "sing", None),
+ ("재밌는 노래 해 줘", "sing", None),
+ ("우리 아이한테 노래 불러 줄래요?", "sing", None),
+ ("노래 하나 해 주실래요?", "sing", None),
+ ("음악 켜 줘", "sing", None),
+ ("노레 불러 줘", "sing", None),
+ ("루미 야 노래", "sing", None),
+ ("노래불러줘", "sing", None),
+ ("노 래 불러 줘", "sing", None),
+ ("노래 해줄래?", "sing", None),
+ ("음... 노래 하나 불러 줄래?", "sing", None),
+ ("노래 불러봐", "sing", None),
+ ("한곡 해 줘", "sing", None),
+ ("노래 부탁드려요", "sing", None),
+ ("기분 좋아지는 노래 불러 줘", "sing", None),
+ ("음악 시작", "sing", None),
+ ("루미 노래 한 곡만", "sing", None),
+ ("노래 좀 해 봐요", "sing", None),
+ ("노래 불러 줄 수 있어?", "sing", None),
+ ("손님들한테 노래 한 곡 해 줘", "sing", None),
+ ("케이팝 하나 불러 줘", "sing", None),
+ ("노래 해 주세요!!", "sing", None),
+ ("어 노래 좀", "sing", None),
+ ("신나는 음악 틀어 주세요", "sing", None),
+ ("루미야, 한 곡 해 봐", "sing", None),
+ ("노래 하나만 해 줘 제발", "sing", None),
+ ("노랠 불러 줘", "sing", None),
+ ("노래 부르기 해 줘", "sing", None),
+ ("음악 들려 주세요", "sing", None),
+ ("뭐든 좋으니까 노래 해 줘", "sing", None),
+ ("노래 해 줘라", "sing", None),
+ # plain requests, mixed
+ ("song 하나 해 줘", "sing", None),
+ ("노래 sing 해 줘", "sing", None),
+ ("music 틀어 줘", "sing", None),
+ ("Lumi 노래 불러 줘", "sing", None),
+ ("k-pop 한 곡 불러 줘", "sing", None),
+ ("노래 please", "sing", None),
+ ("sing 해 주세요", "sing", None),
+
+ # named songs
+ ("sing Fantastic Baby", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("Fantastic Baby 불러 줘", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("sing fantastic bay be", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("판타스틱 베이비 불러 줘", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("판타스틱베이비 해 줘", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("a BIGBANG song please", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("빅뱅 노래 불러 줘", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("sing something by Big Bang", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("fantastic baby!", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("Lumi play fantastic baby for us", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("판타스틱 배이비 틀어 줘", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("sing the fantastic one", "sing:BIGBANG_FANTASTIC_BABY", None),
+ ("sing Love Attack", "sing:RESCENE_LOVE_ATTACK", None),
+ ("Love Attack please", "sing:RESCENE_LOVE_ATTACK", None),
+ ("러브 어택 불러 주세요", "sing:RESCENE_LOVE_ATTACK", None),
+ ("러브어택 해 줘", "sing:RESCENE_LOVE_ATTACK", None),
+ ("리센느 노래 불러 줘", "sing:RESCENE_LOVE_ATTACK", None),
+ ("a RESCENE song", "sing:RESCENE_LOVE_ATTACK", None),
+ ("sing love a tack", "sing:RESCENE_LOVE_ATTACK", None),
+ ("Love Attack 불러 줄래?", "sing:RESCENE_LOVE_ATTACK", None),
+ ("sing the love attack song", "sing:RESCENE_LOVE_ATTACK", None),
+ ("리센 노래 해 줘", "sing:RESCENE_LOVE_ATTACK", None),
+ ("sing BAD by ATEEZ", "sing:ATEEZ_BAD", None),
+ ("에이티즈 노래 불러 줘", "sing:ATEEZ_BAD", None),
+ ("배드 불러 줘", "sing:ATEEZ_BAD", None),
+ ("an ATEEZ song please", "sing:ATEEZ_BAD", None),
+ ("sing a teez song", "sing:ATEEZ_BAD", None),
+ ("ATEEZ BAD 불러 줘", "sing:ATEEZ_BAD", None),
+ ("play the song BAD", "sing:ATEEZ_BAD", None),
+ ("에이티즈 배드 틀어 줘", "sing:ATEEZ_BAD", None),
+ ("sing Did I Become the Adult I Dreamed Of", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("꿈꾸던 어른이 되었나요 불러 줘", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("머무르 노래 불러 줘", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("the dreamed adult song please", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("꿈꾸던 어른 불러 줄래요?", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("sing the song about becoming an adult", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("꿈꾸던어른이되었나요 해 줘", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("sing something by Meomureu", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("did i become the adult, that one", "sing:MEOMUREU_DREAMED_ADULT", None),
+ ("머무르의 꿈꾸던 어른이 되었나요 들려 주세요", "sing:MEOMUREU_DREAMED_ADULT", None),
+
+ # songs and artists Lumi does not have
+ ("sing Yesterday", "unknown", None),
+ ("sing Dynamite", "unknown", None),
+ ("a BTS song please", "unknown", None),
+ ("sing Jingle Bells", "unknown", None),
+ ("sing happy birthday to my son", "unknown", None),
+ ("sing Let It Go", "unknown", None),
+ ("sing twinkle twinkle little star", "unknown", None),
+ ("play Gangnam Style", "unknown", None),
+ ("sing ATEEZ Wonderland", "unknown", None),
+ ("sing a Christmas song", "unknown", None),
+ ("sing a lullaby", "unknown", None),
+ ("sing Baby Shark", "unknown", None),
+ ("play Shape of You", "unknown", None),
+ ("sing something by Taylor Swift", "unknown", None),
+ ("a Blackpink song", "unknown", None),
+ ("sing the national anthem", "unknown", None),
+ ("sing Bang Bang Bang by BIGBANG", "unknown", None),
+ ("sing Bad Guy by Billie Eilish", "unknown", None),
+ ("sing Baby by Justin Bieber", "unknown", None),
+ ("sing a nursery rhyme", "unknown", None),
+ ("sing a Beatles song", "unknown", None),
+ ("sing dinamite", "unknown", None),
+ ("play gangnam stile", "unknown", None),
+ ("sing a Disney song", "unknown", None),
+ ("can you sing Despacito?", "unknown", None),
+ ("play Hype Boy", "unknown", None),
+ ("sing Love Story by Taylor Swift", "unknown", None),
+ ("please sing old macdonald for my kid", "unknown", None),
+ ("Lumi, Bohemian Rhapsody!", "unknown", None),
+ ("sing Haru Haru", "unknown", None),
+ ("sing an Adele song", "unknown", None),
+ ("sing a song from Frozen", "unknown", None),
+ ("play Butter", "unknown", None),
+ ("sing the ABC song", "unknown", None),
+ ("sing We Wish You a Merry Christmas", "unknown", None),
+ ("아이유 노래 불러 줘", "unknown", None),
+ ("곰 세 마리 불러 줘", "unknown", None),
+ ("아리랑 불러 주세요", "unknown", None),
+ ("애국가 불러 줘", "unknown", None),
+ ("강남스타일 틀어 줘", "unknown", None),
+ ("생일 축하 노래 불러 줘", "unknown", None),
+ ("동요 불러 줘", "unknown", None),
+ ("자장가 불러 줄래?", "unknown", None),
+ ("캐롤 틀어 줘", "unknown", None),
+ ("방탄 노래 불러 줘", "unknown", None),
+ ("블랙핑크 노래 해 줘", "unknown", None),
+ ("학교 종이 땡땡땡 불러 줘", "unknown", None),
+ ("상어 가족 불러 줘", "unknown", None),
+ ("트로트 한 곡 불러 줘", "unknown", None),
+ ("임영웅 노래 불러 주세요", "unknown", None),
+ ("에이티즈 원더랜드 불러 줘", "unknown", None),
+ ("빅뱅 거짓말 불러 줘", "unknown", None),
+ ("반짝반짝 작은 별 불러 줘", "unknown", None),
+ ("엄마 생일인데 생일 축하 노래 불러 줄래?", "unknown", None),
+ ("아이유 좋은 날 불러 줘", "unknown", None),
+ ("뉴진스 노래 틀어 줘", "unknown", None),
+ ("산토끼 불러 줄 수 있어?", "unknown", None),
+ ("곰세마리 해 줘", "unknown", None),
+ ("성탄절 노래 불러 줘", "unknown", None),
+ ("BTS 노래 sing 해 줘", "unknown", None),
+ ("Happy Birthday 불러 줘", "unknown", None),
+ ("Let it go 불러 줄래?", "unknown", None),
+ ("Dynamite 틀어 줘", "unknown", None),
+ ("에이티즈 노래 중에 원더랜드 해 줘", "unknown", None),
+ ("Wonderland by ATEEZ please", "unknown", None),
+ ("sing jinggle bells", "unknown", None),
+ ("sing a song by aiyu", "unknown", None),
+
+ # list questions
+ ("what songs do you know?", "list", None),
+ ("what songs can you sing?", "list", None),
+ ("do you know any songs?", "list", None),
+ ("노래 뭐 알아?", "list", None),
+ ("무슨 노래 부를 수 있어?", "list", None),
+ ("list your songs", "list", None),
+ ("how many songs do you know?", "list", None),
+ ("노래 몇 곡 알아요?", "list", None),
+ ("부를 수 있는 노래 알려 줘", "list", None),
+ ("what kind of songs can you do?", "list", None),
+ ("do you know any BTS songs?", "list | unknown", None),
+ ("아이유 노래 알아?", "list | unknown", None),
+ ("what will you sing for us?", "sing | list", None),
+ ("what songs you know?", "list", None),
+ ("노래 목록 보여 줘", "list", None),
+ ("어떤 곡 불러 줄 수 있어요?", "list", None),
+ ("what music do you have?", "list", None),
+ ("do you know Fantastic Baby?", "list | sing:BIGBANG_FANTASTIC_BABY", None),
+ ("which songs are on your list", "list", None),
+ ("아는 노래 있어?", "list", None),
+ ("what song you can sing", "list", None),
+ ("tell me your songs", "list", None),
+ ("무슨 노래 할 줄 알아요?", "list", None),
+ ("song list 알려 줘", "list", None),
+ ("which songs, Lumi?", "list", None),
+ ("do you know a song by ATEEZ?", "list | sing:ATEEZ_BAD", None),
+ ("노래 뭐뭐 있어?", "list", None),
+ ("can you tell me what songs you can play?", "list", None),
+
+ # near misses, not a request
+ ("I like music", "no", None),
+ ("do you like singing?", "no", None),
+ ("who's your favourite singer?", "no", None),
+ ("I sang yesterday", "no", None),
+ ("my kid sings", "no", None),
+ ("노래방 가자", "no", None),
+ ("노래방 좋아해?", "no", None),
+ ("음악 소리 줄여", "no", None),
+ ("don't sing", "no", None),
+ ("노래 부르지 마", "no", None),
+ ("sing later when the guests come", "no", None),
+ ("can I sing?", "no", None),
+ ("that song was great", "no", None),
+ ("BTS is my favourite group", "no", None),
+ ("아이유 노래 좋더라", "no", None),
+ ("is that music from you?", "no", None),
+ ("turn the music down", "no", None),
+ ("I love K-pop", "no", None),
+ ("my daughter loves BIGBANG", "no", None),
+ ("I listened to Love Attack yesterday", "no", None),
+ ("my wife is a singer", "no", None),
+ ("I can't sing at all", "no", None),
+ ("you have a nice voice", "no", None),
+ ("I'm going to a concert tonight", "no", None),
+ ("너 노래 좋아해?", "no", None),
+ ("나 어제 노래방 갔어", "no", None),
+ ("우리 애가 노래를 잘 불러", "no", None),
+ ("가수 누구 좋아해?", "no", None),
+ ("볼륨 낮춰 줘", "no", None),
+ ("손님 오면 그때 노래해 줘", "no", None),
+ ("내가 노래 불러도 돼?", "no", None),
+ ("please don't sing right now", "no", None),
+ ("after lunch you can sing for the kids", "no", None),
+ ("the singer of BAD is ATEEZ, right?", "no", None),
+ ("판타스틱 베이비 좋아해", "no", None),
+ ("빅뱅 좋아하세요?", "no", None),
+ ("music is too loud here", "no", None),
+ ("the song at the party was fun", "no", None),
+ ("노래 잘 부르시네요", "no", None),
+ ("음악 하는 사람이에요", "no", None),
+ ("my favourite song is Yesterday", "no", None),
+ ("we'll do the song part at three", "no", None),
+ ("is singing hard for a robot?", "no", None),
+ ("노래는 이따가 해", "no", None),
+ ("no songs today please", "no", None),
+ ("what's your favourite music genre?", "no", None),
+ ("stop the music", "no | stop", None),
+ ("그만 불러", "no | stop", None),
+ ("음악 꺼 줘", "no | stop", None),
+ ("stop singing", "no | stop", None),
+
+ # answers to Lumi's last turn
+ ("yes", "sing", OFFER),
+ ("sure", "sing", OFFER),
+ ("you pick", "sing", OFFER),
+ ("Fantastic Baby please", "sing:BIGBANG_FANTASTIC_BABY", OFFER),
+ ("no thanks", "no", OFFER),
+ ("maybe later", "no", OFFER),
+ ("응 불러 줘", "sing", OFFER_KO),
+ ("아무거나", "sing", OFFER_KO),
+ ("러브 어택", "sing:RESCENE_LOVE_ATTACK", OFFER_KO),
+ ("아니 괜찮아", "no", OFFER_KO),
+ ("the second one", "sing", LISTED),
+ ("BAD", "sing:ATEEZ_BAD", LISTED),
+ ("any", "sing", LISTED),
+ ("none, thanks", "no", LISTED),
+ ("첫 번째 거", "sing", LISTED_KO),
+ ("꿈꾸던 어른", "sing:MEOMUREU_DREAMED_ADULT", LISTED_KO),
+ ("again", "sing:RESCENE_LOVE_ATTACK", SANG),
+ ("one more time", "sing:RESCENE_LOVE_ATTACK", SANG),
+ ("한 번 더", "sing:RESCENE_LOVE_ATTACK", SANG),
+ ("another one", "sing_other", SANG),
+ ("다른 거", "sing_other", SANG),
+ ("not that one", "sing_other", SANG),
+ ("that was great", "no", SANG),
+ ("thanks", "no", SANG),
+ ("okay then sing BAD", "sing:ATEEZ_BAD", UNKNOWN_SAID),
+ ("then any", "sing", UNKNOWN_SAID),
+ ("oh okay", "no", UNKNOWN_SAID),
+]
diff --git a/tests/song_check.py b/tests/song_check.py
new file mode 100644
index 0000000..fb74704
--- /dev/null
+++ b/tests/song_check.py
@@ -0,0 +1,155 @@
+"""Song wordings (tests/song_cases_train.py, song_cases_held.py, written blind) through Lumi's route, to what Lumi
+does: sings a song (which one), says it can't sing the one asked (sing.unknown_reply), names its songs
+(sing.list_reply), or only talks.
+
+ .venv/bin/python tests/song_check.py train # rules only; cases the rules leave are "llm?"
+ .venv/bin/python tests/song_check.py held --llm # those go to the real LLM, LLM_GAP_S apart, at most LLM_MAX
+ # new ones a run (answers saved by earlier runs are kept;
+ # delete logs/song_check_.json after a prompt change)
+ .venv/bin/python tests/song_check.py held --cached # the LLM's answers saved by the last --llm run
+ .venv/bin/python tests/song_check.py held --cached --bank # the song bank (sing.bank_read) before the LLM
+
+-> logs/song_check_.md / .json. Verdicts: right; wrong_song (a song not asked for, or not the one asked);
+missed (no song where one was asked); odd (no song, but the wrong kind of answer). Nothing moves.
+"""
+import collections
+import json
+import pathlib
+import sys
+import time
+
+from assistant import abilities, brain, voice_words
+from audio import sing
+from tests import command_check
+from tests.conversation_check import NOW, markers
+from tests.song_contexts import SANG, SANG_SONG
+
+ROOT = pathlib.Path(__file__).resolve().parents[1]
+LLM_GAP_S = 6.0 # s between two LLM calls (the robot's own LLM is in use)
+LLM_MAX = 40 # LLM calls per run (--llm); the next run goes on from the saved ones
+TITLES = [n for s in sing.songs().values() for n in (s["title"].lower(), s["title_ko"])]
+
+
+def sung(text, lang, before, whole=False):
+ song = sing.choose(text, lang, SANG_SONG if before == SANG else None, whole)
+ return "unknown" if song is None else "sing:" + song
+
+
+def by_rules(text, lang, before, marks, b):
+ """What lumi.answer() does before the LLM, or None."""
+ last = before[1] if before else ""
+ if voice_words.read(text, last):
+ return "talk"
+ if last.startswith("ACTION: sing") and sing.AFTER_SONG.search(text) and sing.asked(text, last):
+ return sung(text, lang, before)
+ if sing.list_asked(text):
+ return "list"
+ if abilities.answer(text, lang, last):
+ return "talk"
+ try:
+ r = command_check.rules(text, "idle", marks, b)
+ except command_check.NoLLM:
+ return None
+ if r == "sing" or r == "talk" and sing.asked(text, last): # "talk": a song we don't have (command_check)
+ return sung(text, lang, before)
+ return r if r is None or r == "stop" or r.startswith("action:") else "talk"
+
+
+def from_llm(raw, first, text, lang, before, marks):
+ head = brain.Brain._action("ACTION: " + raw, text, marks) or {"action": "none", "target": ""}
+ if head["action"] == "none" and brain.promised(first) == "sing":
+ head = {"action": "sing"}
+ if head["action"] == "sing":
+ return sung(text, lang, before)
+ if head["action"] in ("none", "end", "unclear", "search", "weather", "quiet"):
+ low = first.lower()
+ return "talk_titles" if sum(t in low for t in TITLES) >= 2 else "talk"
+ return "stop" if head["action"] == "stop" else "action:" + head["action"]
+
+
+def verdict(expect, got, before):
+ kind = got.split(":")[0]
+ for alt in expect.split(" | "):
+ if alt == got or alt == "sing" and kind == "sing" or \
+ alt == "sing_other" and kind == "sing" and got != "sing:" + SANG_SONG or \
+ alt == "list" and got in ("list", "talk_titles") or \
+ alt == "unknown" and got in ("talk", "talk_titles") or \
+ alt in ("no", "stop") and got in ("talk", "talk_titles", "stop", "list"):
+ return "right"
+ if kind == "sing" or kind == "action":
+ return "wrong_song"
+ return "missed" if expect.split(" | ")[0].startswith("sing") else "odd"
+
+
+def main(args):
+ name = args[0]
+ cases = __import__(f"tests.song_cases_{name}", fromlist=["CASES"]).CASES
+ out = ROOT / "logs" / f"song_check_{name}"
+ use_llm, cached, use_bank = "--llm" in args, "--cached" in args, "--bank" in args
+ old = {}
+ if out.with_suffix(".json").exists():
+ old = {(r["text"], str(r["before"])): r for r in json.loads(out.with_suffix(".json").read_text()) if r.get("raw")}
+ if not use_llm:
+ from assistant import steps
+ steps._ollama = lambda *a: (_ for _ in ()).throw(command_check.NoLLM())
+ marks, rows, t0, bank_s, asked = markers(), [], time.time(), [], 0
+ for text, expect, before in cases:
+ lang = "ko" if brain.HANGUL.search(text) else "en"
+ brain.FORCED_LANG["lang"] = lang
+ b = brain.Brain()
+ if before:
+ b.history.append(tuple(before))
+ got, by, raw, first = by_rules(text, lang, before, marks, b), "rules", "", ""
+ if got is None and use_bank:
+ t = time.time()
+ label = sing.bank_read(text, before[1] if before else "")
+ bank_s.append(time.time() - t)
+ if label:
+ got, by = (sung(text, lang, before) if label == "sing" else "list"), "bank"
+ key = (text, str(before))
+ if got is None and (cached or use_llm) and key in old:
+ raw, first = old[key]["raw"], old[key]["first"]
+ elif got is None and use_llm and asked < LLM_MAX:
+ asked += 1
+ gen = b.respond_stream(text, marks, now=NOW)
+ head = next(gen)
+ first = next(gen, "") or ""
+ gen.close()
+ raw = f"{head['action']} {head['target']}".strip()
+ time.sleep(LLM_GAP_S)
+ if got is None:
+ got, by = (from_llm(raw, first, text, lang, before, marks), "llm") if raw else ("llm?", "-")
+ v = verdict(expect, got, before) if got != "llm?" else "llm?"
+ rows.append({"text": text, "expect": expect, "before": before, "got": got, "by": by, "raw": raw,
+ "first": first, "verdict": v})
+ if v not in ("right", "llm?"):
+ print(f"{v:10} {text!r} -> {got} (want {expect}) [{by}] {first[:60]!r}", flush=True)
+ out.with_suffix(".json").write_text(json.dumps(rows, ensure_ascii=False, indent=0))
+ report(rows, out, time.time() - t0, bank_s)
+
+
+def report(rows, out, secs, bank_s):
+ by = collections.defaultdict(collections.Counter)
+ for r in rows:
+ group = r["expect"].split(" | ")[0].split(":")[0]
+ by[group][r["verdict"]] += 1
+ by["ALL"][r["verdict"]] += 1
+ lines = [f"# Song check {out.name} ({time.strftime('%Y-%m-%d %H:%M')}, {secs:.0f} s)", "",
+ "| expect | cases | right | wrong_song | missed | odd | llm? |", "|---|---|---|---|---|---|---|"]
+ for k in sorted(by, key=lambda k: (k == "ALL", k)):
+ c = by[k]
+ lines.append(f"| {k} | {sum(c.values())} | {c['right']} | {c['wrong_song']} | {c['missed']} | {c['odd']} | "
+ f"{c['llm?']} |")
+ route = collections.Counter((r["by"], r["verdict"]) for r in rows)
+ lines += ["", "By route: " + ", ".join(f"{k[0]} {k[1]} {n}" for k, n in sorted(route.items()))]
+ if bank_s:
+ lines.append(f"Bank: {len(bank_s)} looked up, {1000 * sum(bank_s) / len(bank_s):.0f} ms mean, "
+ f"{1000 * max(bank_s):.0f} ms max")
+ lines += ["", "## Not right", ""] + [f"- {r['verdict']}: {r['text']!r} -> {r['got']} (want {r['expect']}) [{r['by']}] "
+ f"{r['first'][:80]!r}" for r in rows if r["verdict"] not in ("right", "llm?")]
+ out.with_suffix(".md").write_text("\n".join(lines) + "\n")
+ print("\n".join(lines[:len(by) + 6]))
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
diff --git a/tests/song_contexts.py b/tests/song_contexts.py
new file mode 100644
index 0000000..2725ae5
--- /dev/null
+++ b/tests/song_contexts.py
@@ -0,0 +1,13 @@
+"""The turn before a song case (brain history: what was said, Lumi's action line and answer), for
+tests/song_cases_train.py / song_cases_held.py."""
+OFFER = ("Can you make music?", "ACTION: none -\nI can sing a few songs for you, like Fantastic Baby or Love Attack. "
+ "Want one?")
+OFFER_KO = ("음악 할 수 있어?", "ACTION: none -\n판타스틱 베이비나 러브 어택 같은 노래를 불러 드릴 수 있어요. 한 곡 불러 드릴까요?")
+LISTED = ("What songs do you know?", "ACTION: none songs\nI can sing BAD, Fantastic Baby, Did I Become the Adult I "
+ "Dreamed Of and Love Attack. Which one would you like?")
+LISTED_KO = ("무슨 노래 알아?", "ACTION: none songs\n배드, 판타스틱 베이비, 꿈꾸던 어른이 되었나요, 러브 어택을 부를 수 있어요. "
+ "어떤 노래 불러 드릴까요?")
+SANG = ("Sing a song.", "ACTION: sing RESCENE_LOVE_ATTACK")
+SANG_SONG = "RESCENE_LOVE_ATTACK"
+UNKNOWN_SAID = ("Sing Yesterday.", "ACTION: none songs\nSorry, I can't sing that one. I only know my own songs: BAD, "
+ "Fantastic Baby, Did I Become the Adult I Dreamed Of and Love Attack. Want one of them?")
diff --git a/tests/test_abilities.py b/tests/test_abilities.py
index f499b45..5cd375f 100644
--- a/tests/test_abilities.py
+++ b/tests/test_abilities.py
@@ -20,7 +20,7 @@ for lang in ("en", "ko"): # 2-3 spoken sentences,
assert 2 <= len(mouth.sentences(ab.SHORT[lang])) <= 3, ab.SHORT[lang]
assert len(ab.LONG[lang]) > len(ab.SHORT[lang])
assert all(w in ab.SHORT["en"] for w in ("talk", "internet", "pick things up", "places", "follow", "wave", "sing"))
-assert all(w in ab.LONG["en"] for w in ("wearing or holding", "from your hand", "follow me", "Arirang"))
+assert all(w in ab.LONG["en"] for w in ("wearing or holding", "from your hand", "follow me", "Fantastic Baby"))
assert not any(w in ab.LONG["en"] + ab.SHORT["en"] for w in ("table", "behind", "charge", "mission"))
assert not any(w in ab.LONG["ko"] + ab.SHORT["ko"] for w in ("테이블", "뒤를", "충전", "미션"))
diff --git a/tests/test_command_box.py b/tests/test_command_box.py
new file mode 100644
index 0000000..637c87a
--- /dev/null
+++ b/tests/test_command_box.py
@@ -0,0 +1,133 @@
+"""The dashboard's Command box (/tasks/parse) reads a sentence exactly as voice does (Lumi.answer, both on
+lumi.route): the same plan for the same words, English and Korean. No robot, no LLM (rules only on both sides):
+python tests/test_command_box.py"""
+import types
+
+from assistant import brain, lumi
+from tasks import fetch
+
+M = ["home", "dock2", "exit", "final"] + [f"p{i}" for i in range(1, 11)]
+SENTENCES = [
+ # the owner's examples
+ "let's go exit point and go p9 point", "Let's go P5 (point).", "go to p5 and tell me the weather",
+ "look at me and wave", "웨이브 하고 나 봐", "고개 들고 몇 시야?", "exit 갔다가 p9로 가", "first p1 then p2",
+ "take the cup, go to p5, give it to Sarah and come back", "go to p10, then go left 1 meter and give it to the person",
+ "go to p9, ask them for the cup, then bring it to p1", "컵 집고 p3로 가서 테이블에 놔",
+ "Let's go P10 point and wait 30 seconds then come back here again.",
+ # corrections
+ "go to p1, no, p2", "go to p1, never mind", "앞으로 1미터, 아니 2미터 가",
+ # one command
+ "turn left", "한 바퀴 돌아", "move back 1 meter", "앞으로 1미터 가", "come here", "이리 와", "follow me", "look left",
+ "lift yourself up", "wave", "손 흔들어", "stop", "멈춰", "p3로 가 줘", "spin around", "pick up the red cup", "빨간 컵 집어",
+ "take this from me", "이거 받아", "open your hand", "bring me the cup from p1", "p3에서 컵 가져와",
+ # talk, questions, refusals
+ "what time is it?", "오늘 날씨 어때?", "hello", "what's your name?", "go to p12", "dance", "go to p5 and dance",
+ "루미야 너 월급 받아?",
+]
+
+# ---------- voice: Lumi.answer with every handler recorded, nothing moves, no LLM ----------
+got_voice = []
+
+
+class LLMReached(Exception):
+ pass
+
+
+def rec(*item):
+ got_voice.append(item)
+ return True
+
+
+def steps_of(rule): # what the mission runner does for a keyword command
+ a, t = rule
+ d, _, n = t.partition(" ")
+ return {"go_to": lambda: [{"do": "go", "to": t}],
+ "move": lambda: [{"do": "move", "dir": d, "m": float(n or 1)}],
+ "turn": lambda: [{"do": "turn", "deg": 180.0 if d == "around" else (1 if d == "left" else -1) * float(n or 90)}],
+ "arm": lambda: [{"do": "arm", "pose": t}],
+ "pick": lambda: [{"do": "pick", "object": t.split()[-1], "colour": t.split()[0] if " " in t else None}],
+ }.get(a, lambda: None)()
+
+
+def quick(text):
+ rule = brain.intent(text, M)
+ if not rule or rule[0] not in lumi.QUICK_RULES:
+ return False
+ if rule[0] == "fetch":
+ return rec("fetch")
+ if rule[0] in ("weather", "search"):
+ return rec("talk")
+ s = steps_of(rule)
+ return rec("steps", s) if s else rec("command", rule[0])
+
+
+def hand(text):
+ h = brain.hand_request(text, False, L.brain, M)
+ if h and h[0] == "receive":
+ return rec("steps", [{"do": "receive", "object": h[1], "from_hand": True}])
+ return rec("talk")
+
+
+fetch.check_hand = lambda: False
+lumi.log = fetch.log = lambda *a: None
+lumi.mouth = types.SimpleNamespace(say=lambda *a, **k: None, lang_of=lambda t: "ko" if brain.HANGUL.search(t) else "en")
+lumi.ears = types.SimpleNamespace(heard_lang=lambda x: x, last_stt={}, understood=lambda: True, heard_clearly=lambda: True)
+real_seeing = lumi.seeing.answer
+lumi.seeing.answer = lambda t, lang="en", frames=None, slow_line=None: real_seeing(t, lang, frames=[]) # no camera
+L = lumi.Lumi.__new__(lumi.Lumi)
+L.lang, L.markers, L.current, L.patrol = "en", M, None, None
+L.now_doing = lambda: ("", "")
+for name in ("follow_stop", "voice_setting", "fixed_answer", "drive_words", "mission_running", "chain_busy", "fetch_voice"):
+ setattr(L, name, lambda *a, **k: False)
+L.fetch_status = lambda: None
+L.keep_listening = lambda: None
+L.fetch_say = lambda *a: None
+L.stop_all = lambda: rec("stop")
+L.chain_request = lambda text, plan=None: rec("chain", [[k, w] for k, w, _ in plan])
+L.mission_request = lambda text, read=None: rec("talk") if read[1] else rec("steps", read[0])
+L.hand_command = hand
+L.quick_command = quick
+L.end_conversation = lambda *a: rec("talk")
+L.sing_song = lambda *a: rec("talk")
+
+
+def voice(text):
+ got_voice.clear()
+ L.brain = brain.Brain()
+ L.brain.respond_stream = lambda *a, **k: (_ for _ in ()).throw(LLMReached())
+ try:
+ L.answer(text)
+ except LLMReached:
+ rec("talk")
+ return got_voice[0] if got_voice else ("talk",)
+
+
+# ---------- the box ----------
+from api import server
+server.agv.markers = lambda: M
+
+
+def box(text):
+ r = server.task_parse(server.ParseBody(text=text))
+ a = r["action"]
+ if a == "steps":
+ return ("steps", r["steps"])
+ if a == "command":
+ return ("chain", r["parts"]) if "parts" in r else ("stop",) if r["sentence"] == "Stop." else \
+ ("command", brain.intent(r["text"], M)[0])
+ if a == "fetch":
+ return ("fetch",)
+ return ("talk",)
+
+
+bad = []
+for t in SENTENCES:
+ v, b = voice(t), box(t)
+ if "-v" in __import__("sys").argv:
+ print(t, "->", v)
+ if v != b:
+ bad.append(t)
+ print(f"DIFFERENT {t!r}\n voice {v}\n box {b}")
+print(f"{len(SENTENCES) - len(bad)}/{len(SENTENCES)} the same by voice and in the Command box")
+assert not bad
+print("command box ok")
diff --git a/tests/test_intents.py b/tests/test_intents.py
index 7f151f7..9d41323 100644
--- a/tests/test_intents.py
+++ b/tests/test_intents.py
@@ -26,6 +26,9 @@ CASES.update({ # any wording of the body commands, English, Korean and mixed (
"wave at my friend please": ("wave", ""), "say hi with your hand": ("wave", ""), "Lumi, wave hello": ("wave", ""),
"손 흔들어 줘": ("wave", ""), "손 좀 흔들어 봐": ("wave", ""), "손 흔들어 주세요": ("wave", ""), "손을 흔들어 봐요": ("wave", ""),
"손 인사 해 줘": ("wave", ""), "wave 해 봐!": ("wave", ""), "루미야 손 흔들어": ("wave", ""),
+ "손 인사 해 봐": ("wave", ""), "자, 손 인사 해 봐": ("wave", ""), "손인사 해 봐": ("wave", ""), # not a parent's "인사 해"
+ "손으로 인사 해 봐": ("wave", ""), "손 흔들어 인사 해 봐": ("wave", ""), "do a wave": ("wave", ""),
+ "do a little wave for us": ("wave", ""),
"shake hand": ("wave", ""), "Shake hand, Lumi": ("wave", ""), "안녕 하고 손 흔들어": ("wave", ""),
"Do you know how to wave?": None, "don't wave": None,
# head
diff --git a/tests/test_songs.py b/tests/test_songs.py
index 9f5449f..1c7b28d 100644
--- a/tests/test_songs.py
+++ b/tests/test_songs.py
@@ -11,57 +11,71 @@ from audio import sing
from assistant import lumi
SONGS = sing.songs()
-assert {"happy_birthday", "twinkle", "row_row", "arirang", "three_bears"} <= set(SONGS), SONGS.keys()
+if not SONGS: # the owner's songs are only on the robot
+ print("songs: none here (data/songs/mine is local to the robot), skipped")
+ raise SystemExit
+B, F, D, L_ = "ATEEZ_BAD", "BIGBANG_FANTASTIC_BABY", "MEOMUREU_DREAMED_ADULT", "RESCENE_LOVE_ATTACK"
+assert set(SONGS) == {B, F, D, L_}, SONGS.keys() # Lumi sings only the owner's songs
-ASKED = {"sing a song": True, "Lumi, sing me a song please": True, "sing Arirang": True, "sing happy birthday": True,
+ASKED = {"sing a song": True, "Lumi, sing me a song please": True, "sing Fantastic Baby": True, "sing Yesterday": True,
"can you sing a song?": True, "sing another song": True, "노래 불러 줘": True, "노래 한 곡 해 줘": True,
- "아리랑 불러 줘": True, "곰 세 마리 불러 줄래?": True, "다른 노래": True, "노래해 줘": True,
- "play some music": True, "sing a Korean song": True,
+ "러브 어택 불러 줘": True, "판타스틱 베이비 불러 줄래?": True, "다른 노래": True, "노래해 줘": True,
+ "play some music": True, "sing a Korean song": True, "Let it go 불러 줘": True,
"can you sing?": True, "노래 할 수 있어요?": True, "sing song": True, "sing music": True, "play music": True,
"Can you sing song?": True, "let's say song": True, "노래해": True, "음악 틀어 줘": True, "노래 하나 해 줘": True,
"노래 하나 불러 줘": True, "아무 노래나 불러 줘": True, "put on some music": True, "다음 곡": True,
- "노래 듣고 싶어": True, "루미야 sing a song 해 줘": True, "sing Fantastic Baby": True, "play a song": True,
+ "노래 듣고 싶어": True, "루미야 sing a song 해 줘": True, "play a song": True,
"do you like singing?": False, "what's your favourite song?": False, "what music do you like?": False,
"좋아하는 노래 있어요?": False, "노래 잘해?": False, "사람 좀 불러 줘": False, "택시 불러 줘": False, "go to p3": False,
"happy birthday, Lumi": False, "stop": False, "I like this music": False, "노래방 가자": False,
- "누가 이 노래 불렀어?": False, "what songs can you sing?": False, "another one": False, "그거 말고": False}
+ "누가 이 노래 불렀어?": False, "what songs can you sing?": False, "another one": False, "그거 말고": False,
+ "can I sing?": False, "내가 노래 불러도 돼?": False, "sing later when the guests come": False,
+ "손님 오면 그때 노래해 줘": False, "I can't sing at all": False}
wrong = {t: w for t, w in ASKED.items() if sing.asked(t) != w}
assert not wrong, wrong
-CHOSEN = {("sing Arirang", "en"): "arirang", ("아리랑 불러 줘", "ko"): "arirang", ("sing happy birthday", "en"): "happy_birthday",
- ("생일 축하 노래 불러 줘", "ko"): "happy_birthday", ("곰 세 마리 불러 줘", "ko"): "three_bears",
- ("sing twinkle twinkle little star", "en"): "twinkle", ("sing row row row your boat", "en"): "row_row",
- ("sing yesterday", "en"): None, ("sing dynamite by BTS", "en"): None, ("애국가 불러 줘", "ko"): None}
-for (text, lang), want in CHOSEN.items():
- assert sing.choose(text, lang) == want, (text, sing.choose(text, lang), want)
-for _ in range(30): # unnamed: a song in the language asked for / spoken, not the last
- assert sing.choose("노래 불러 줘", "ko") in SONGS and sing.choose("sing a song", "en") in SONGS
- assert SONGS[sing.choose("sing a Korean song", "en")]["lang"] == "ko"
- assert sing.choose("sing another song", "en", last="twinkle") != "twinkle"
- assert sing.choose("다른 노래", "ko", last="arirang") != "arirang"
- assert SONGS[sing.choose("sing an English song", "ko")]["lang"] == "en"
- assert sing.choose("sing for everyone", "en") is not None
- assert sing.choose("sing it again", "en", last="row_row") == "row_row"
- assert sing.choose("한 번 더 불러 줘", "ko", last="arirang") == "arirang"
+CHOSEN = {"sing Fantastic Baby": F, "판타스틱 베이비 불러 줘": F, "sing a BIGBANG song": F, "sing something by Big Bang": F,
+ "러브어택 틀어 줘": L_, "리센느 노래 해 줘": L_, "sing a teez song": B, "sing BAD by ATEEZ": B,
+ "꿈꾸던 어른이 되었나요 불러 줘": D, "sing Did I Become the Adult I Dreamed Of": D,
+ "sing yesterday": None, "sing dynamite by BTS": None, "애국가 불러 줘": None, "아리랑 불러 줘": None,
+ "sing happy birthday": None, "생일 축하 노래 불러 줘": None, "sing Bad Guy by Billie Eilish": None,
+ "sing ATEEZ Wonderland": None, "빅뱅 거짓말 불러 줘": None, "sing Bang Bang Bang by BIGBANG": None,
+ "아이유 노래 불러 줘": None, "BTS 노래 sing 해 줘": None, "sing a Christmas song": None, "sing a lullaby": None,
+ "Let it go 불러 줄래?": None, "sing an English song": None, "트로트 한 곡 불러 줘": None,
+ "I feel bad, sing Love Attack": L_} # "bad" is a song name only as a whole word
+for text, want in CHOSEN.items():
+ assert sing.choose(text, "ko" if any('가' <= ch <= '힣' for ch in text) else "en") == want, (text, sing.choose(text, "en"), want)
+for _ in range(30): # unnamed: one of ours, not the last
+ for t in ["노래 불러 줘", "sing a song", "신나는 노래 불러 줘", "sing something fun", "sing pls", "우리 아이한테 노래 불러 줄래요?",
+ "sing for everyone", "뭐든 좋으니까 노래 해 줘", "sing a Korean song"]:
+ assert sing.choose(t, "en") in SONGS, t
+ assert sing.choose("sing another song", "en", last=F) != F
+ assert sing.choose("다른 노래", "ko", last=L_) != L_
+ assert sing.choose("sing it again", "en", last=D) == D
+ assert sing.choose("한 번 더 불러 줘", "ko", last=L_) == L_
LISTED = ["what songs can you sing?", "which songs do you know?", "what songs do you know", "무슨 노래 알아?",
"어떤 노래 부를 수 있어?", "아는 노래 뭐 있어?", "노래 목록 알려 줘", "what can you sing?"]
assert all(sing.list_asked(t) and not sing.asked(t) for t in LISTED), [t for t in LISTED if not sing.list_asked(t)]
assert not any(sing.list_asked(t) for t in ["sing a song", "어떤 노래든 불러 줘", "what's your favourite song?", "go to p3"])
assert all(SONGS[sid]["title"] in sing.list_reply("en") for sid in SONGS) and "어떤 노래" in sing.list_reply("ko")
-AFTER = "ACTION: sing arirang" # right after a song: a short word switches or repeats it
+assert all(SONGS[sid]["title_ko"] in sing.list_reply("ko") for sid in SONGS)
+AFTER = f"ACTION: sing {L_}" # right after a song: a short word switches or repeats it
for t in ["another one", "next", "next one", "a different one", "something else", "not this one", "다른 거",
"다음 거", "그거 말고", "딴 거", "one more"]:
assert sing.asked(t, AFTER) and not sing.asked(t), t
- assert all(sing.choose(t, "en", "arirang") not in (None, "arirang") for _ in range(10)), t
-assert sing.asked("그 노래 말고 다른 거 불러 줘") and sing.choose("그 노래 말고 다른 거 불러 줘", "ko", "arirang") != "arirang"
+ assert all(sing.choose(t, "en", L_) not in (None, L_) for _ in range(10)), t
+assert sing.asked("그 노래 말고 다른 거 불러 줘") and sing.choose("그 노래 말고 다른 거 불러 줘", "ko", L_) != L_
for t in ["again", "한 번 더", "다시"]:
- assert sing.asked(t, AFTER) and sing.choose(t, "en", "arirang") == "arirang", t
+ assert sing.asked(t, AFTER) and sing.choose(t, "en", L_) == L_, t
for t in ["that was bad", "go to p3", "thank you", "what time is it"]:
assert not sing.asked(t, AFTER), t
-assert sing.asked("Arirang", "ACTION: none songs\n...") and sing.asked("판타스틱 베이비", "ACTION: none songs\n...")
-assert not sing.asked("Arirang") and not sing.asked("go to p3", "ACTION: none songs\n...")
-assert "Arirang" in sing.unknown_reply("en") and "Twinkle" in sing.unknown_reply("en")
-assert "아리랑" in sing.unknown_reply("ko")
+assert sing.asked("Love Attack", "ACTION: none songs\n...") and sing.asked("판타스틱 베이비", "ACTION: none songs\n...")
+assert not sing.asked("Love Attack") and not sing.asked("go to p3", "ACTION: none songs\n...")
+for _ in range(20): # a song we don't have: said kindly, ours offered
+ en, ko = sing.unknown_reply("en"), sing.unknown_reply("ko")
+ assert all(SONGS[sid]["title"] in en and SONGS[sid]["title_ko"] in ko for sid in SONGS), (en, ko)
+ assert "{" not in en + ko and "네 곡" in ko or "이렇게" not in ko, ko
+assert len({sing.unknown_reply("en") for _ in range(40)}) > 2 # not the same words every time
assert all(sing.stop_words(t) for t in ["stop", "Lumi stop", "멈춰", "그만", "그만해", "enough", "스톱"])
assert not any(sing.stop_words(t) for t in ["sing another song", "다른 노래", "what time is it"])
@@ -87,15 +101,6 @@ for sid, song in SONGS.items(): # head moves like a singer'
ys = [round(y) for _, y, _, _ in targets]
assert len(set(zip(ys, ys[1:], ys[2:]))) > 0.8 * (len(ys) - 2), sid # does not loop the same way
assert song["wav"].exists(), sid
-assert sing.choose("I feel bad, sing twinkle", "en") == "twinkle" # "bad" is a song name only as a whole word
-if "BIGBANG_FANTASTIC_BABY" in SONGS: # the owner's songs are only on the robot
- assert sing.choose("sing fantastic baby", "en") == "BIGBANG_FANTASTIC_BABY"
- assert sing.choose("판타스틱 베이비 불러 줘", "ko") == "BIGBANG_FANTASTIC_BABY"
- assert sing.asked("판타스틱 베이비 불러 줘")
- assert sing.choose("play fantastic baby", "en") == "BIGBANG_FANTASTIC_BABY"
-if "MEOMUREU_DREAMED_ADULT" in SONGS:
- assert sing.asked("꿈꾸던 어른이 되었나요 불러 줘") and sing.choose("꿈꾸던 어른이 되었나요 불러 줘", "ko") == "MEOMUREU_DREAMED_ADULT"
-
class FakeHead:
YAW_LIMIT = 60.0
@@ -132,7 +137,7 @@ def player(seconds):
head = FakeHead()
-assert sing.sing("row_row", None, player(2.5), head, fake_load) # finished
+assert sing.sing(B, None, player(2.5), head, fake_load) # finished
sing._head_thread.join(2)
assert len(head.moves) >= 3, head.moves # to 0 / 0, moved with the song ...
assert head.moves[0] == [120.0, 5.0, 0.0, 0.0], head.moves[0]
@@ -142,13 +147,13 @@ assert all(abs(m[2]) <= sing.YAW_SWAY and sing.PITCH_RANGE[0] <= m[3] <= sing.PI
head = FakeHead()
t0 = time.time()
stop_at = t0 + 0.3
-assert not sing.sing("arirang", lambda: time.time() > stop_at, player(30), head, fake_load) # stopped
+assert not sing.sing(F, lambda: time.time() > stop_at, player(30), head, fake_load) # stopped
assert time.time() - stop_at < 0.1, time.time() - stop_at # at once
sing._head_thread.join(2)
assert head.moves and head.moves[-1] == [120.0, 5.0, 0.0, 0.0], head.moves
played = [] # a stereo file reaches the one-channel speaker as mono
-assert sing.sing("twinkle", None, lambda wav, rate, abort: played.append(wav.ndim) or True, FakeHead(),
+assert sing.sing(D, None, lambda wav, rate, abort: played.append(wav.ndim) or True, FakeHead(),
lambda path: (np.zeros((4410, 2), np.float32), 44100))
assert played == [1], played
sing._head_thread.join(2)
@@ -179,8 +184,8 @@ L.mic = types.SimpleNamespace(next=lambda wait: utterance if heard else None)
t0 = time.time()
threading.Timer(0.3, lambda: heard.append("stop")).start()
-L.sing_song("sing Arirang")
-assert sung == ["arirang"] and time.time() - t0 < 1.0 and L.pending_text is None, (sung, time.time() - t0)
+L.sing_song("sing Love Attack")
+assert sung == [L_] and time.time() - t0 < 1.0 and L.pending_text is None, (sung, time.time() - t0)
threading.Timer(0.3, lambda: heard.append("sing another song")).start()
L.sing_song("sing a song")
@@ -192,7 +197,7 @@ assert sung[-1] != first and L.pending_text is None, sung
threading.Timer(0.3, lambda: heard.append("thank you")).start() # whisper's guess on music: ignored
t0 = time.time()
-L.sing_song("sing twinkle twinkle")
+L.sing_song("sing Fantastic Baby")
assert time.time() - t0 > 4.5 and L.pending_text is None
# lumi.answer(): "again" right after a song is the song (not the drive words), "Can you sing song?" tagged Korean
@@ -207,7 +212,7 @@ L.speak_abort = lambda: False
L.drive_words = lambda text: (_ for _ in ()).throw(AssertionError(f"drive words got {text!r}"))
L.skill_busy = lambda: False
L.sing_song = lambda text: sung.append(("sing", text))
-L.brain.history = [("sing Arirang", "ACTION: sing arirang")]
+L.brain.history = [("sing Love Attack", f"ACTION: sing {L_}")]
L.answer("again")
assert sung[-1] == ("sing", "again"), sung
L.answer("그거 말고")