Skip to content

Commit 338cab4

Browse files
a692570claude
andcommitted
feat: expand voice commands with punctuation and formatting shortcuts
Adds: new line, comma, period, full stop, question mark, exclamation mark, exclamation point, open quote, close quote, dash, colon, semicolon. All are exact-match on full transcript, consistent with existing commands. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1630c89 commit 338cab4

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

commands.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,41 @@
44
def parse_command(transcript: str, correction_active: bool = False):
55
stripped = (transcript or "").strip()
66
lowered = stripped.lower()
7+
78
if lowered == "scratch that":
89
return {"kind": "scratch", "display": ""}
910
if lowered == "new paragraph":
1011
return {"kind": "insert", "text": "\n\n", "display": "\\n\\n"}
12+
if lowered == "new line":
13+
return {"kind": "insert", "text": "\n", "display": "\\n"}
1114
if lowered == "bullet":
12-
return {"kind": "insert", "text": "\n ", "display": " "}
15+
return {"kind": "insert", "text": "\n- ", "display": "- "}
1316
if lowered.startswith("bullet "):
1417
text = stripped[7:].strip()
15-
return {"kind": "insert", "text": f"\n {text}", "display": f" {text}"}
18+
return {"kind": "insert", "text": f"\n- {text}", "display": f"- {text}"}
1619
if lowered.startswith("actually "):
1720
text = stripped[9:].strip()
1821
if text and correction_active:
1922
return {"kind": "replace", "text": text, "display": text}
23+
24+
# Punctuation commands
25+
if lowered == "comma":
26+
return {"kind": "insert", "text": ", ", "display": ","}
27+
if lowered in ("period", "full stop"):
28+
return {"kind": "insert", "text": ". ", "display": "."}
29+
if lowered == "question mark":
30+
return {"kind": "insert", "text": "? ", "display": "?"}
31+
if lowered in ("exclamation mark", "exclamation point"):
32+
return {"kind": "insert", "text": "! ", "display": "!"}
33+
if lowered == "open quote":
34+
return {"kind": "insert", "text": "\u201c", "display": "\u201c"}
35+
if lowered == "close quote":
36+
return {"kind": "insert", "text": "\u201d", "display": "\u201d"}
37+
if lowered == "dash":
38+
return {"kind": "insert", "text": " -- ", "display": "--"}
39+
if lowered == "colon":
40+
return {"kind": "insert", "text": ": ", "display": ":"}
41+
if lowered == "semicolon":
42+
return {"kind": "insert", "text": "; ", "display": ";"}
43+
2044
return None

0 commit comments

Comments
 (0)