Repository navigation
Conversation
`_verbalize_math` replaces named commands (Greek letters, \infty, ...)
before it verbalizes scripts, so `$x^\pi$` became `x^ pi ` and the
script reader then took only the next character: speech said "x to the
p i", "x sub a lpha", "e to the l ambda t", and `$a^\theta$` even hit
the transpose rule ("a transpose heta"). Braced `x^{\pi}` was fine.
A mapped command that directly follows ^ or _ (optionally after
whitespace) is now replaced inside braces, so the script reader takes
the whole word: "x to the pi", "x sub alpha". Braced scripts, ^\circ
and ^\top are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
XAE-A-Xii
force-pushed
the
fix/speech-unbraced-command-scripts
branch
from
December 5, 2026 12:15
7121a6c to
e3d882e
Compare
This branch has not been deployed
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.
Description
Read-aloud split a Greek letter (or any other mapped command) that's used as an unbraced exponent or subscript.
_verbalize_math(deeptutor/services/voice/speech_text.py) runs_replace_named_commandsbefore_verbalize_scripts, so$x^\pi$becamex^ pi. The script reader then skips the space and takes a single character:x^\piandx_\alphaare common unbraced spellings in lecture notes and model output.A mapped command that directly follows
^or_(optionally after whitespace) is now replaced inside braces,x^{pi}, which the script reader already handles. The results are "x to the pi", "x sub alpha", "e to the lambda t", "x to the infinity" and "a to the theta". Braced scripts,90^\circ("90 degrees") andA^\top("A transpose") are unchanged.Related Issues
Module(s) Affected
agentsapiconfigcoreknowledgeloggingservicestoolsutilsweb(Frontend)docs(Documentation)scriptstests...Checklist
dev(notmain— see the base-branch selector above).pre-commit run --all-filesand fixed any issues.Additional Notes
tests/services/test_speech_unbraced_command_script.pyis written in the same style astest_speech_transpose_superscript.py. It checks six unbraced cases (^\pi,_\alpha,^\lambda t,^\infty,^\theta,^ \beta), plus three guards that already passed: braced^{\pi},^\circand^\top.Before the fix:
6 failed, 3 passed. Mutations are caught too: dropping the optional whitespace fails 1 case, matching only^fails 2, and omitting the braces fails all 6.Three locale tests (
tests/i18n/test_{hungarian,italian,turkish}_locale.py) can't be collected locally, because they needdata/user/settings/main.yamlfrom a configured install. That's the same ondev.pre-commit run --fileson both changed files passes every hook.--all-filesfailsmypyondevitself inservices/embedding/adapters/volcengine.py, from #1015, which this PR doesn't touch.🤖 Generated with Claude Code