From c2a250e7ee2414a8e41584540067062fca0c9095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yasunori=20Morishima=EF=BC=88=E7=9B=9B=E5=B3=B6=E5=BA=B7?= =?UTF-8?q?=E5=BE=B3=EF=BC=89?= Date: Thu, 3 Sep 2026 23:37:55 +0900 Subject: [PATCH] ja: read nPk permutations with the school phrase, in display order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pochhammer speech rule (reached from the nPk P-notation intents) copied the en argument reversal and glued 順列の between the arguments, so 5 P 2 was spoken as 2 順列の 5 — word salad in Japanese. en says "2 permutations of 5" after Wikipedia's "k-permutations of n"; nb and sv rebuilt the phrase entirely ("antalet permutationer av 2 element ur 5"). Japanese has a standard school phrase that reads the notation in display order, so the reversal is simply not needed: 5 個から 2 個取る順列, "permutations taking 2 out of 5". The rule is marked audit-ignore the way nb's is, since the x:/T: sequence no longer mirrors en. A speech test covers the msubsup form in ClearSpeak and SimpleSpeak. audit-translations: untranslated text 3674 -> 3673, rule differences 28 -> 28, missing/extra rules 0 -> 0. This is the item #731's description left alone on purpose (順列の — "the right Japanese wording is a decision rather than a swap"). Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_016JCoREgn1pJzcbdnUx4iuh --- Rules/Languages/ja/SharedRules/general.yaml | 10 ++++++---- tests/Languages/ja/ja.rs | 12 ++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Rules/Languages/ja/SharedRules/general.yaml b/Rules/Languages/ja/SharedRules/general.yaml index 75f113e5..1642e6fa 100644 --- a/Rules/Languages/ja/SharedRules/general.yaml +++ b/Rules/Languages/ja/SharedRules/general.yaml @@ -105,14 +105,16 @@ - t: "同じ式が評価されるマイナス" # phrase(this result is 'minus the same expression evaluated at' an earlier point) - x: "*[2]" -- name: permutation - # Not a default because the order of the args is reversed +- name: permutation # audit-ignore + # en reverses the args ("k permutations of n"); Japanese reads nPk in display + # order with the standard school phrase: 5P2 = "5 個から 2 個取る順列" tag: pochhammer match: "count(*)=2 and contains(@data-intent-property, ':infix:')" replace: - - x: "*[2]" - - t: "順列の" # phrase(the solution involves several 'permutations of' values) - x: "*[1]" + - T: "個から" # phrase(the solution involves several 'permutations of' values) + - x: "*[2]" + - T: "個取る順列" - name: intervals tag: [open-interval, open-closed-interval, closed-interval, closed-open-interval] diff --git a/tests/Languages/ja/ja.rs b/tests/Languages/ja/ja.rs index bdc1fcca..41d1f0f0 100644 --- a/tests/Languages/ja/ja.rs +++ b/tests/Languages/ja/ja.rs @@ -629,3 +629,15 @@ fn divides_and_similar() -> Result<()> { } return Ok(()); } + +/// nPk permutation notation is read with the standard Japanese school phrase +/// and in display order: (superscript 5) P (subscript 2) is +/// "5 個から 2 個取る順列" ("permutations taking 2 out of 5"). +/// en reverses the arguments ("2 permutations of 5"); Japanese does not need to. +#[test] +fn permutation_p_notation() -> Result<()> { + let expr = "P25"; + test("ja", "ClearSpeak", expr, "5 個から 2 個取る順列")?; + test("ja", "SimpleSpeak", expr, "5 個から 2 個取る順列")?; + return Ok(()); +}