Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Rules/Languages/ja/ClearSpeak_Rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions Rules/Languages/ja/unicode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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:
Expand Down Expand Up @@ -202,8 +202,8 @@
- "}": # 0x7d
- test:
if: $SpeechStyle = 'ClearSpeak' or $SpeechStyle = 'SimpleSpeak'
then: [t: "クローズ ブラス"]
else: [t: "右括弧"]
then: [t: "中括弧閉じ"]
else: [t: "右中括弧"]

- "~": [t: "チルド"] # 0x7e
- " ": # 0xa0
Expand Down
24 changes: 22 additions & 2 deletions tests/Languages/ja/ja.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,35 @@ fn multiplication_and_division() -> Result<()> {
#[test]
fn parenthesized_expression() -> Result<()> {
let expr = "<math><mrow><mo>(</mo><mn>1</mn><mo>+</mo><mn>2</mn><mo>)</mo></mrow></math>";
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 = "<math><mrow><mo>[</mo><mn>1</mn><mo>+</mo><mn>2</mn><mo>]</mo></mrow></math>";
test("ja", "ClearSpeak", square, "角括弧 1 プラス 2, 角括弧閉じ")?;
let curly = "<math><mrow><mo>{</mo><mn>1</mn><mo>+</mo><mn>2</mn><mo>}</mo></mrow></math>";
test("ja", "ClearSpeak", curly, "中括弧 1 プラス 2, 中括弧閉じ")?;
return Ok(());
}

/// Verifies the Japanese ClearSpeak wording for an absolute value.
#[test]
fn absolute_value() -> Result<()> {
let expr = "<math><mrow><mo>|</mo><mi>x</mi><mo>|</mo></mrow></math>";
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 = "<math><mrow><mo>|</mo><mi>x</mi><mo>|</mo></mrow></math>";
test_ClearSpeak("ja", "ClearSpeak_AbsoluteValue", "AbsEnd", expr, "絶対値 x, 絶対値 閉じ")?;
return Ok(());
}

Expand Down