Files
coucou/scripts/test-flow-keys.sh
T
Claude 362c7a797d Flow dictation: keep the last word and the whole sentence
From the first long dictations: the last word was lost when the key came
up while saying it, and a long stretch in the middle of a sentence was
missing.

- After the key comes up, the microphone stays open 0.6 s, then Coucou
  waits for the recognizer's final result (up to 1.5 s) even with one
  language: it carries the last words. The chat's mic gets the same wait.
- DictationTranscript merges each result with the words seen before: a
  result that looks like a fresh start (Apple's recognizer can start over
  after a pause) closes the text so far, and a word heard earlier that no
  newer word covers in time is put back where it was (a dropped middle
  stretch). Normal results keep the recognizer's own formatting.
- Tests for the merge (growth, correction, shifted times, dropped middle,
  fresh start, no times) in scripts/test-flow-keys.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-10-14 03:59:17 +02:00

9 lines
352 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
TEST_DIR="$(mktemp -d "${TMPDIR:-/tmp}/coucou-flow-keys.XXXXXX")"
trap 'rm -rf "$TEST_DIR"' EXIT
swiftc NotchBuddy/Sources/App/FlowKeyLogic.swift NotchBuddy/Sources/App/DictationTranscript.swift \
tests/FlowKeyLogicTests.swift -o "$TEST_DIR/flow-keys-tests"
"$TEST_DIR/flow-keys-tests"