Streamline built-in speech dictionary rules#19518
Closed
codeofdusk wants to merge 1 commit into
Closed
Conversation
Member
|
@codeofdusk do you still plan on working on this? |
Member
|
Closing. Feel free to reopen when tested and ready |
Contributor
Author
|
@seanbudd I don't see an option to reopen this PR, are you able to do this from your end? |
Member
|
It can no longer be reopened through the GitHub UX |
5 tasks
Contributor
Author
OK, replaced by #20433. |
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.
Link to issue number:
None
Summary of the issue:
The built-in speech dictionary includes regular expressions that split text such as
NVDAObject,HTMLParser, andissue123for speech. The previous digit-suffix expression could perform very poorly on long word-character runs that do not contain trailing digits. This can hurt speech responsiveness for pathological text, long mixed-case text, and text containing many digit boundaries.Description of how this pull request fixes the issue:
Replaced the three built-in dictionary regexes with zero-width boundary matches and literal space insertion. This avoids capture groups and, most importantly, replaces the old digit-suffix regex with a direct word-to-digit boundary check.
The lookarounds are ordered so the forward assertion is checked first. Most positions fail based on the next character, so this avoids unnecessary previous-character checks and improves performance further.
Testing strategy:
Verified equivalent output between
masterand this branch on:Tested with this benchmarking script (LLM generated).
Default NVDA regex engine (
re):Also tested with the optional modern regular expression engine. The same main improved scenarios held.
Known issues with pull request:
With the default NVDA regex engine, all benchmark scenarios are now faster than
master.With the optional modern
regexengine, the number-suffix dense benchmark remains slower thanmaster. That engine is opt-in, and the main intended improvement is for no-match and mixed-case text, especially long word-character runs without digits, where the old expression was pathological.Code Review Checklist: