Update CLAUDE.md with release tagging instructions and enhance is_question logic to detect question marks anywhere in the text
This commit is contained in:
+8
-10
@@ -119,19 +119,17 @@ def for_speech(text: str) -> str:
|
||||
|
||||
|
||||
def is_question(text: str) -> bool:
|
||||
"""True if the reply *ends* by asking the user something — the cue for
|
||||
the pet to keep listening instead of making you say the wake word again.
|
||||
"""True if the spoken reply contains a question mark — the cue for the
|
||||
pet to keep listening instead of making you say the wake word again.
|
||||
|
||||
Deliberately only looks at the end. A reply that asks something in
|
||||
passing ("What time is it? It's 7:15.") isn't waiting on an answer,
|
||||
whereas one that finishes on a question mark is. The test runs on the
|
||||
spoken form, so a '?' that only exists inside a stripped code block or a
|
||||
URL doesn't count, and trailing decoration (emoji, quotes, brackets) is
|
||||
peeled off first so "Ready to go? 🚀" still reads as a question."""
|
||||
The check runs on the spoken form, so a '?' that only exists inside a
|
||||
stripped code block or a URL doesn't count, and trailing decoration
|
||||
(emoji, quotes, brackets) is peeled off first so "Ready to go? 🚀"
|
||||
still reads as a question."""
|
||||
spoken = for_speech(text)
|
||||
while spoken and not (spoken[-1].isalnum() or spoken[-1] == "?"):
|
||||
while spoken and not (spoken[-1].isalnum() or spoken[-1] in "?."):
|
||||
spoken = spoken[:-1]
|
||||
return spoken.endswith("?")
|
||||
return "?" in spoken
|
||||
|
||||
|
||||
def for_display(text: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user