|
4 | 4 | def parse_command(transcript: str, correction_active: bool = False): |
5 | 5 | stripped = (transcript or "").strip() |
6 | 6 | lowered = stripped.lower() |
| 7 | + |
7 | 8 | if lowered == "scratch that": |
8 | 9 | return {"kind": "scratch", "display": ""} |
9 | 10 | if lowered == "new paragraph": |
10 | 11 | return {"kind": "insert", "text": "\n\n", "display": "\\n\\n"} |
| 12 | + if lowered == "new line": |
| 13 | + return {"kind": "insert", "text": "\n", "display": "\\n"} |
11 | 14 | if lowered == "bullet": |
12 | | - return {"kind": "insert", "text": "\n• ", "display": "• "} |
| 15 | + return {"kind": "insert", "text": "\n- ", "display": "- "} |
13 | 16 | if lowered.startswith("bullet "): |
14 | 17 | 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}"} |
16 | 19 | if lowered.startswith("actually "): |
17 | 20 | text = stripped[9:].strip() |
18 | 21 | if text and correction_active: |
19 | 22 | 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 | + |
20 | 44 | return None |
0 commit comments