ja: read exponents in Japanese - #721
Merged
Merged
Conversation
This was referenced Aug 29, 2026
This was referenced Aug 29, 2026
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.
Second of the small PRs from #715, and independent of #720 (different rules).
How Japanese reads an exponent
ToOrdinalhas nothing to build here, and the English-thpronunciation hint does not apply either.That second tier solves the problem the English comments in these files worry about. Because 乗 already closes a simple exponent, a nested exponent would otherwise end 「… 乗 乗」 — the exact analogue of "...power power". Using 上付き for the nested case avoids it.
Changes
The last two are worth spelling out:
raised to the exponenthad become 緊急事態に育つ, "to grow in an emergency", andraised to the powerhad become 力に育つ, "to grow into strength". Neither is about mathematics.function-powerneeded reordering rather than a word swap. English puts the exponent first ("the fourth power of sine"); Japanese puts the base first — sin⁴ is 「サイン の 4 乗」 — so the rule now emits*[1], 「の」,*[2], 「乗」.ToOrdinaland thepronounce: [text: "-th", ...]hint are removed from the power rules for the reason above. In ClearSpeak this also means$ClearSpeak_Exponents = 'Ordinal'no longer suppresses the closing 「乗」: that preference selects English's short ordinal form ("x squared" vs "x to the second power"), and Japanese has only the one form, so dropping 乗 there would leave 「x の 5」, which does not say that 5 is an exponent.Tests
squaredupdated, and now checks SimpleSpeak as well as ClearSpeak. Addedcubed,integer_exponent(x⁵), andvariable_exponent(xⁿ), each in both styles, pluscomplex_exponent(x^(y+1) → 「x の上付き y プラス 1 上付き終了」) so the superscript frame is pinned too.Not covered here: negative exponents. x⁻² currently comes out as 「x の 負の 2 乗」, and 「マイナス 2 乗」 is what the reference's worked example implies (it reads −b as 「マイナス b」). But 負の/正の is the prefix reading of negative numbers generally, and 正の is correct where it appears in
general.yamlfor "the set of positive integers", so that is a separate change rather than something to slip in here.