Skip to content

Commit 2aabf13

Browse files
DatafyingTechclaude
andcommitted
Add a real demo recording, and stop spoken punctuation doubling up
The README now opens with a 26-second recording of the app actually working: a real voice into a real microphone, Parakeet on the GPU, the local gemma3:4b cleanup, and the real injection path typing into a text field. The millisecond figures on screen are the measured times from that take, and the opening example is now one of those scenes rather than an invented one. tools/record_demo.py rebuilds it, and prefers a human recording in docs/images/_voice/ over synthesized speech, falling back to Windows SAPI so the harness still runs on a machine with no recordings. tools/record_my_voice.py captures those three lines in the right format. The recordings themselves are gitignored: they are the author's voice, not project data. Recording the first scene surfaced a real bug. Parakeet usually punctuates the sentence itself, so saying "question mark" at the end of an already-terminated sentence produced "by Friday??". Runs of terminal punctuation now collapse to the mark the speaker actually asked for, while a deliberate ellipsis is left alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent f64e47f commit 2aabf13

8 files changed

Lines changed: 649 additions & 3 deletions

File tree

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@
1717

1818
# Binary assets: never touch these.
1919
*.png binary
20+
*.gif binary
21+
*.mp4 binary
2022
*.wav binary
2123
*.ico binary

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,19 @@ Everything runs on your own machine. No account, no subscription, no cloud, no w
1818

1919
## What it does
2020

21-
You hold **Ctrl+Win**, say *"um so can you send Sarah the report by Friday, no wait, make that Monday"*,
22-
and let go. About half a second later this lands in your email, chat box, or code editor:
21+
![LocalFlow in action](docs/images/demo.gif)
2322

24-
> Can you send Sarah the report by Monday?
23+
*Nothing here is staged. A real person speaking into a real microphone, transcribed by Parakeet on
24+
the GPU, cleaned up by a local gemma3:4b, and typed into the text field by the real injection code.
25+
The millisecond figures on screen are the actual measured times from that take. Reproduce it with
26+
`python -m tools.record_demo`.*
27+
28+
You hold **Ctrl+Win**, say *"send a report to Mark, no no wait, I meant to say send it to Sarah and
29+
CC me"*, and let go. Under half a second later, this lands in your email, chat box, or code editor:
30+
31+
> Send a report to Sarah and CC me.
32+
33+
That is the second scene in the recording above, and it took 394 ms end to end.
2534

2635
The filler words are gone. The punctuation and capitals are there. It understood that you corrected
2736
yourself and kept only what you meant. It never left your computer.

docs/images/demo.gif

294 KB
Loading

docs/images/demo.mp4

124 KB
Binary file not shown.

localflow/cleanup.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ def spoken_punctuation(text: str) -> str:
155155
text = re.sub(rf"[\s,]*{pat}[\s,]*", _lit(sym), text, flags=re.IGNORECASE)
156156
else: # spaced
157157
text = re.sub(rf"[\s,]*{pat}[\s,]*", _lit(" " + sym + " "), text, flags=re.IGNORECASE)
158+
# The ASR often punctuates for us, so a spoken "question mark" at the end of a sentence
159+
# it already ended lands as "Friday??". Collapse a run of terminal marks to the last one
160+
# the speaker actually asked for.
161+
def _collapse(m: re.Match[str]) -> str:
162+
run = m.group(0)
163+
return run if run == "..." else run[-1] # keep a deliberate ellipsis
164+
165+
text = re.sub(r"[.!?]{2,}", _collapse, text)
166+
text = re.sub(r",\s*([.!?])", r"", text)
158167
return text
159168

160169

tests/test_cleanup.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,11 @@ def test_backtrack_new_triggers(cfg, raw, expected):
462462
def test_apply_backtrack_disabled(cfg):
463463
cfg["backtrack"] = False
464464
assert cleanup.apply_backtrack("a scratch that b", cfg) == ("a scratch that b", 0)
465+
466+
def test_spoken_punctuation_does_not_double_up(cfg):
467+
# Parakeet often punctuates the sentence itself, so a spoken "question mark" on the end
468+
# of an already-terminated sentence used to produce "Friday??".
469+
assert clean("hey Sarah comma can you send me that report by Friday question mark",
470+
cfg).text == "Hey Sarah, can you send me that report by Friday?"
471+
assert clean("Are we done? question mark", cfg).text == "Are we done?"
472+
assert clean("this is a test period", cfg).text == "This is a test."

0 commit comments

Comments
 (0)