Prevent large speech-alignment jumps when matchers disagree#68
Open
dustinogle wants to merge 1 commit into
Open
Prevent large speech-alignment jumps when matchers disagree#68dustinogle wants to merge 1 commit into
dustinogle wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Makes speech-text alignment more conservative when word- and character-level matchers disagree, preventing large cursor jumps caused by overly optimistic fuzzy word matches.
Changes:
- Updates
SpeechTextAlignment.bestOffsetto cap how far the word matcher can lead the character anchor during disagreement. - Expands inline documentation describing the new agreement/disagreement behavior and rationale.
- Adds a standalone Swift test runner with targeted assertions for
bestOffsetandshouldCommit.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| Textream/Textream/SpeechTextAlignment.swift | Caps word-based offset advances in disagreement cases to prevent runaway jumps. |
| Tests/SpeechTextAlignmentTests.swift | Adds an executable assertion-based test harness covering agreement/disagreement and commit gating scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+6
| import Foundation | ||
|
|
||
| // Standalone tests for SpeechTextAlignment.bestOffset / shouldCommit. | ||
| // | ||
| // These can be run WITHOUT the Xcode project / project-file edits because | ||
| // SpeechTextAlignment.swift is a pure-Foundation enum. Compile & run: |
Comment on lines
+15
to
+17
| @main | ||
| struct SpeechTextAlignmentTests { | ||
| static func main() { |
| print("") | ||
| if failures.isEmpty { | ||
| print("All \(runCount) assertions passed.") | ||
| exit(0) |
| } else { | ||
| print("\(failures.count) of \(runCount) assertions failed:") | ||
| for f in failures { print(f) } | ||
| exit(1) |
Comment on lines
+15
to
+17
| @main | ||
| struct SpeechTextAlignmentTests { | ||
| static func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes word tracking more conservative when the fuzzy word matcher and character matcher disagree sharply. This bounds the word matcher relative to the character anchor, reducing large cursor jumps, awkward pauses, and lost tracking when speech recognition is imperfect.
Validation
The normal responsive catch-up behavior remains intact for small disagreements.