From b2023a878fb731c1f6028d77f2ad05049b9970a8 Mon Sep 17 00:00:00 2001 From: yasumorishima Date: Sat, 29 Aug 2026 20:30:50 +0900 Subject: [PATCH 1/2] ja: read brackets and absolute value in Japanese MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The seeded wording transliterated the English cues and kept the English word order, which puts the closing cue before the group it closes. Japanese names the shape when the group opens and postposes the closing cue (Yamaguchi, Kawane and Sawazaki 1996, item 8): ( 括弧 / 丸括弧 ) 括弧閉じ / 丸括弧閉じ [ 角括弧 ] 角括弧閉じ { 中括弧 } 中括弧閉じ The Terse/Verbose split is kept where en has one: 丸 (the shape) drops out in Terse the same way "paren" does in English. Absolute value: 「絶対値 の x」 is ungrammatical because の attaches the other way round in Japanese, so "the absolute value of x" would have to be 「x の絶対値」. The cited reading keeps the written order and simply drops the preposition, so |x| is 絶対値 x. With AbsEnd the closing cue moves after the contents and the transliteration リリース ("release", from "end") becomes 閉じ. audit-translations ja: Rule differences unchanged at 22, untranslated 3681 to 3680. --- Rules/Languages/ja/ClearSpeak_Rules.yaml | 3 +-- Rules/Languages/ja/unicode.yaml | 24 ++++++++++++------------ tests/Languages/ja/ja.rs | 24 ++++++++++++++++++++++-- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/Rules/Languages/ja/ClearSpeak_Rules.yaml b/Rules/Languages/ja/ClearSpeak_Rules.yaml index 54bee5a9..879f249c 100644 --- a/Rules/Languages/ja/ClearSpeak_Rules.yaml +++ b/Rules/Languages/ja/ClearSpeak_Rules.yaml @@ -468,14 +468,13 @@ if: "$Verbosity!='Terse'" then: [ot: ""] # phrase('the' absolute value of 25) - x: "$WordToSay" - - t: "の" # phrase(the absolute value 'of' 25) - x: "*[1]" - test: if: "$ClearSpeak_AbsoluteValue = 'AbsEnd'" then: - pause: short - - t: "リリース" # phrase('end' absolute value) - x: "$WordToSay" + - t: "閉じ" # phrase('end' absolute value) - pause: short - name: set diff --git a/Rules/Languages/ja/unicode.yaml b/Rules/Languages/ja/unicode.yaml index 808dc0bc..a5cd4ef9 100644 --- a/Rules/Languages/ja/unicode.yaml +++ b/Rules/Languages/ja/unicode.yaml @@ -84,16 +84,16 @@ if: $SpeechStyle = 'ClearSpeak' or $SpeechStyle = 'SimpleSpeak' then_test: if: "$Verbosity='Terse'" - then: [t: "開き"] # 0x28 - else: [t: "開き丸括弧"] # 0x28 + then: [t: "括弧"] # 0x28 + else: [t: "丸括弧"] # 0x28 else: [t: "左丸括弧"] # 0x28 - ")": # 0x29 - test: if: $SpeechStyle = 'ClearSpeak' or $SpeechStyle = 'SimpleSpeak' then_test: if: "$Verbosity='Terse'" - then: [t: "閉じ"] # 0x29 - else: [t: "閉じ丸括弧"] # 0x29 + then: [t: "括弧閉じ"] # 0x29 + else: [t: "丸括弧閉じ"] # 0x29 else: [t: "右丸括弧"] # 0x29 - "*": # 0x2a @@ -155,14 +155,14 @@ - "[": # 0x5b - test: if: $SpeechStyle = 'ClearSpeak' or $SpeechStyle = 'SimpleSpeak' - then: [t: "オープンブラケット"] - else: [t: "左ブラケット"] + then: [t: "角括弧"] + else: [t: "左角括弧"] - "\\": [t: "バックスラッシュ"] # 0x5c - "]": # 0x5d - test: if: $SpeechStyle = 'ClearSpeak' or $SpeechStyle = 'SimpleSpeak' - then: [t: "クローズブラケット"] - else: [t: "右ブラケット"] + then: [t: "角括弧閉じ"] + else: [t: "右角括弧"] - "^": # 0x5e - test: if: "parent::m:modified-variable or parent::m:mover" @@ -173,8 +173,8 @@ - "{": # 0x7b - test: if: $SpeechStyle = 'ClearSpeak' or $SpeechStyle = 'SimpleSpeak' - then: [t: "オープンブレイス"] - else: [t: "左の括弧"] + then: [t: "中括弧"] + else: [t: "左中括弧"] - "|": # 0x7c # note: for ClearSpeak and SimpleSpeak, "|" inside of sets is handled at the mrow level, same for 'sets' - with: @@ -202,8 +202,8 @@ - "}": # 0x7d - test: if: $SpeechStyle = 'ClearSpeak' or $SpeechStyle = 'SimpleSpeak' - then: [t: "クローズ ブラス"] - else: [t: "右括弧"] + then: [t: "中括弧閉じ"] + else: [t: "右中括弧"] - "~": [t: "チルド"] # 0x7e - " ": # 0xa0 diff --git a/tests/Languages/ja/ja.rs b/tests/Languages/ja/ja.rs index 50ac7a48..c2ff7cd6 100644 --- a/tests/Languages/ja/ja.rs +++ b/tests/Languages/ja/ja.rs @@ -125,7 +125,18 @@ fn multiplication_and_division() -> Result<()> { #[test] fn parenthesized_expression() -> Result<()> { let expr = "(1+2)"; - test("ja", "ClearSpeak", expr, "開き丸括弧, 1 プラス 2, 閉じ丸括弧")?; + test("ja", "ClearSpeak", expr, "丸括弧, 1 プラス 2, 丸括弧閉じ")?; + return Ok(()); +} + +/// Square and curly brackets follow the same pattern: the opening bracket names +/// the shape and the closing one adds the postposed cue (Yamaguchi et al. 1996). +#[test] +fn square_and_curly_brackets() -> Result<()> { + let square = "[1+2]"; + test("ja", "ClearSpeak", square, "角括弧, 1 プラス 2, 角括弧閉じ")?; + let curly = "{1+2}"; + test("ja", "ClearSpeak", curly, "中括弧, 1 プラス 2, 中括弧閉じ")?; return Ok(()); } @@ -133,7 +144,16 @@ fn parenthesized_expression() -> Result<()> { #[test] fn absolute_value() -> Result<()> { let expr = "|x|"; - test("ja", "ClearSpeak", expr, "絶対値 の x")?; + test("ja", "ClearSpeak", expr, "絶対値 x")?; + return Ok(()); +} + +/// With AbsEnd the closing cue is spoken after the contents, not before it, so +/// the bar that ends the group is heard where it actually is. +#[test] +fn absolute_value_abs_end() -> Result<()> { + let expr = "|x|"; + test_ClearSpeak("ja", "AbsoluteValue", "AbsEnd", expr, "絶対値 x, 絶対値 閉じ")?; return Ok(()); } From e97745d1c46ffaff54794de2050f45bf2c52b6fd Mon Sep 17 00:00:00 2001 From: yasumorishima Date: Sat, 29 Aug 2026 20:43:00 +0900 Subject: [PATCH 2/2] ja: match the test expectations to the actual output --- tests/Languages/ja/ja.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Languages/ja/ja.rs b/tests/Languages/ja/ja.rs index c2ff7cd6..8a19e38b 100644 --- a/tests/Languages/ja/ja.rs +++ b/tests/Languages/ja/ja.rs @@ -125,7 +125,7 @@ fn multiplication_and_division() -> Result<()> { #[test] fn parenthesized_expression() -> Result<()> { let expr = "(1+2)"; - test("ja", "ClearSpeak", expr, "丸括弧, 1 プラス 2, 丸括弧閉じ")?; + test("ja", "ClearSpeak", expr, "丸括弧 1 プラス 2, 丸括弧閉じ")?; return Ok(()); } @@ -134,9 +134,9 @@ fn parenthesized_expression() -> Result<()> { #[test] fn square_and_curly_brackets() -> Result<()> { let square = "[1+2]"; - test("ja", "ClearSpeak", square, "角括弧, 1 プラス 2, 角括弧閉じ")?; + test("ja", "ClearSpeak", square, "角括弧 1 プラス 2, 角括弧閉じ")?; let curly = "{1+2}"; - test("ja", "ClearSpeak", curly, "中括弧, 1 プラス 2, 中括弧閉じ")?; + test("ja", "ClearSpeak", curly, "中括弧 1 プラス 2, 中括弧閉じ")?; return Ok(()); } @@ -153,7 +153,7 @@ fn absolute_value() -> Result<()> { #[test] fn absolute_value_abs_end() -> Result<()> { let expr = "|x|"; - test_ClearSpeak("ja", "AbsoluteValue", "AbsEnd", expr, "絶対値 x, 絶対値 閉じ")?; + test_ClearSpeak("ja", "ClearSpeak_AbsoluteValue", "AbsEnd", expr, "絶対値 x, 絶対値 閉じ")?; return Ok(()); }