Skip to content

ja: read fractions in Japanese word order - #720

Open
yasumorishima wants to merge 2 commits into
daisy:jafrom
yasumorishima:ja-fraction-order
Open

ja: read fractions in Japanese word order#720
yasumorishima wants to merge 2 commits into
daisy:jafrom
yasumorishima:ja-fraction-order

Conversation

@yasumorishima

Copy link
Copy Markdown
Contributor

First of the small PRs promised in #715. It fixes the one item in the seeded Japanese that changes the meaning of the maths rather than the wording.

The problem

simple_fraction asserted 21/22 → 「21 分の 22」. In Japanese 「A 分の B」 is B/A — the denominator is spoken first — so the seeded rules and the seeded test agreed with each other that 21/22 should be spoken as 22/21.

The rule I followed

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

If numerator and denominator are both plain numbers, use ordinary Japanese word order (denominator 分の numerator). Otherwise keep the written order and say 分数 A オーバー B 分数終了. Katsuhito Yamaguchi is behind ChattyInfty / InftyReader, the math TTS actually used by blind students in Japan.

Changes

  • common-fraction in both ClearSpeak and SimpleSpeak now emits *[2] 分の *[1].
  • Dropped the numeric range guards (text()<20, 2 <= text() <= 10) and ToOrdinal(..., true(), ...) there. Those exist because English only has ordinals for small numbers; Japanese builds no separate ordinal form, so one pattern covers any pair of numbers.
  • Every other fraction rule keeps the written order and now says オーバー rather than 分の, which would otherwise assert the opposite order.
  • ClearSpeak's general fraction said 分子 との 分数 … デノミネーター; it now uses the same 分数 … オーバー … 分数終了 frame.
  • 分数終わり → 分数終了, matching the reference's terminology (and the 根号終了 / 上付き終了 markers that will follow in later PRs).
  • per-fraction said パーカー, which is a hooded sweatshirt. "5 meters per second" is 5 メートル 毎 秒.

One definition, five copies

ClearSpeak copies the "both parts are plain numbers" predicate in five other places: the EndFrac test inside fraction-over-simple (twice, numerator and denominator) and the four nested-* exponent rules that ask whether the base is a common fraction. grep -c "text()<20" gave 5 in ja against 6 in en. With common-fraction widened and the copies left alone, 3/128 would have counted as a common fraction where it is spoken and not counted where those rules look, so the second commit brings all five to the same test.

No new tests for the nested-* shapes here: their wording (「に上げられた … パワー」) is itself wrong Japanese and belongs to the next PR, so pinning it now would only have to be rewritten.

Tests

simple_fraction updated, and it now checks SimpleSpeak as well as ClearSpeak. Added numeric_fraction_large_denominator (3/128 — outside the old English ordinal range) and fraction_of_variables (x/y → x オーバー y, both styles).

One thing to flag

This makes audit-translations ja report 5 rule differences where ja currently reports 0 (measured both ways on this branch and on ja). They are the changed match pattern and the removed variables: [IsPlural: ...] in common-fraction and common-fraction-mixed-number.

The divergence is deliberate: those guards and that variable encode English morphology that Japanese does not have. @moritz-gross — you offered to help with audit-translations, so rather than opening a separate issue: is structural divergence from en something a language is allowed to do, or would you prefer the rule shape kept identical with the body made a no-op? I will follow whichever you want.

A fraction of two numbers is read denominator-first in Japanese: 21/22 is
"22 分の 21". The seeded rules emitted numerator, 分の, denominator, so the
tests were asserting that 21/22 is spoken as 22/21. That is a meaning
change, not a wording preference, so the rule and its test move together.

Reference: 山口雄仁・川根深・澤崎陽彦, 日本語による数式読み上げ法の基本構成に
ついて, 日本数学教育学会誌 78(9), 239-247 (1996), item (4): when numerator and
denominator are both plain numbers, use ordinary Japanese word order
(denominator 分の numerator); otherwise keep the written order and say
分数 A オーバー B 分数終了.

Following that split:

- common-fraction (both mn, no decimal separator) now says 分母 分の 分子.
  The English range limits (numerator < 20, denominator 2..10) existed
  because English only has ordinals for small numbers; Japanese has no
  separate ordinal form to build, so the pattern is uniform and ToOrdinal
  is no longer used here.
- the remaining fraction rules keep the written order and now say オーバー
  rather than 分の, which would otherwise claim the opposite order.
- ClearSpeak's general fraction said 分子 との 分数 ... デノミネーター; it now
  uses the same 分数 ... オーバー ... 分数終了 frame.
- 分数終わり -> 分数終了, matching the terminology of the reference (and the
  根号終了 / 上付き終了 markers that will follow).

Also in this file: per-fraction said パーカー, which is a hooded sweatshirt.
"5 meters per second" is 5 メートル 毎 秒.
The previous commit widened common-fraction, but ClearSpeak copies that
predicate in five other places: the EndFrac test inside fraction-over-simple
(twice, for numerator and denominator) and the four nested-* exponent rules
that ask whether the base is a common fraction. Left alone, 3/128 would count
as a common fraction where it is spoken and not count where those rules look,
so the two would disagree.

The copies now use the same test: both children are mn without a decimal
separator. The English range limits (numerator < 20, denominator 2..10) are
gone for the same reason as before -- they bound what English has ordinals
for, and Japanese builds no ordinal form.

No wording changes here; the phrasing of the exponent rules themselves is a
separate change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant