Skip to content

ja: read an n-th root as n 乗根 - #5

Closed
yasumorishima wants to merge 1 commit into
jafrom
ja-roots
Closed

yasumorishima wants to merge 1 commit into
jafrom
ja-roots

Conversation

@yasumorishima

@yasumorishima yasumorishima commented Aug 29, 2026 •

Copy link
Copy Markdown
Owner

Fourth of the small PRs from daisy#715, independent of daisy#720, daisy#721 and the negative-number one.

山口雄仁・川根深・澤崎陽彦「日本語による数式読み上げ法の基本構成について」日本数学教育学会誌 78(9), 239–247 (1996), item (5) and the appendix

n-th roots

⁵√x is 「5 乗根」 — the index, then 乗根. English builds an ordinal for this ("the fifth root"), so the rules called ToOrdinal(*[2]), and for a variable index they appended the -th pronunciation hint. Japanese has neither form: the number is read as it is and 乗根 follows. Both are removed from the root rules in ClearSpeak_Rules.yaml, SimpleSpeak_Rules.yaml and overview.yaml.

Closing marker

根号終わり → 根号終了, the term the reference uses (and consistent with 分数終了 in daisy#720).

The literal msqrt / mroot fallbacks

These are the rules for raw MathML with no intent, where the English comment says "not sure what really should be said for these since we should not assume they are square roots".

  • msqrt said 「根」. That is the character used inside words like 平方根 and 立方根, but on its own it is not a spoken word in Japanese. 「ルート」 is, and the reference names it as the everyday alternative to 平方根, so it is the natural choice for the case where we do not know more.
  • mroot said 「インデックスとルート」 ("index and root") for "root with index", and closed with 「エンドルートシンボル」, which is "end root symbol" spelled out in katakana rather than translated. These become 「根指数」 and 「根号終了」. The rule's structure is unchanged.

Tests

nth_root (⁵√x → 「5 乗根 の x」) in both styles, and variable_index_root (ⁿ√x → 「n 乗根 の x」).

Deliberately left alone

The reference also says the connector depends on what is inside the radical: 「平方根 9」 with nothing between them when it is a single token, and 「平方根オブ … 根号終了」 when it is not. The rules currently choose the connector by Verbosity instead. Changing that means the match no longer mirrors en, and I have an open question in daisy#715 about whether a language may diverge structurally where the linguistic facts require it. I would rather settle that first than make the same unilateral call a third time, so 「平方根 の x」 is untouched here.

Summary by CodeRabbit

  • Improvements

    • Improved Japanese speech output for square roots and nth roots.
    • Uses clearer, consistent phrasing for root endings.
    • Non-square/cube roots are now announced directly as “乗根,” including numeric and variable indices.
    • Removed unnecessary ordinal pronunciation for root indices.
  • Tests

    • Added coverage for numeric and variable-index nth-root pronunciation in Japanese.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6f1e7ee2-2683-455c-9eb4-2ec7235f402d

📥 Commits

Reviewing files that changed from the base of the PR and between 7a6e3ad and c75c664.

📒 Files selected for processing (5)
  • Rules/Languages/ja/ClearSpeak_Rules.yaml
  • Rules/Languages/ja/SharedRules/default.yaml
  • Rules/Languages/ja/SimpleSpeak_Rules.yaml
  • Rules/Languages/ja/overview.yaml
  • tests/Languages/ja/ja.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Japanese root speech rules now use consistent root-end wording and direct nth-root index pronunciation. New tests cover numeric and variable root indices.

Changes

Japanese root speech

Layer / File(s) Summary
Root terminology and end markers
Rules/Languages/ja/ClearSpeak_Rules.yaml, Rules/Languages/ja/SharedRules/default.yaml, Rules/Languages/ja/SimpleSpeak_Rules.yaml
Root phrases and root-end announcements use the updated Japanese wording across speech rules.
Direct nth-root pronunciation
Rules/Languages/ja/ClearSpeak_Rules.yaml, Rules/Languages/ja/SimpleSpeak_Rules.yaml, Rules/Languages/ja/overview.yaml, tests/Languages/ja/ja.rs
Non-square and non-cube roots speak the index directly followed by 乗根. Tests cover numeric and variable indices.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to c75c6

This change updates Japanese n-th-root and root-closing speech rules with corresponding tests; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: moritz-gross

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: Japanese n-th roots are read as "n 乗根".
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. (4 skipped: 4 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. (4 skipped: 4 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ja-roots

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yasumorishima

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@yasumorishima

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@yasumorishima

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@yasumorishima

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@yasumorishima

Copy link
Copy Markdown
Owner Author

Submitted upstream as daisy#723. Closing the preflight PR; CI results and any CodeRabbit findings stay readable here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant