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
16 changes: 8 additions & 8 deletions Rules/Languages/ja/ClearSpeak_Rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -612,17 +612,17 @@
- x: "$LineCount"
- test:
- if: "($ClearSpeak_MultiLineLabel = 'Auto' and self::m:piecewise) or $ClearSpeak_MultiLineLabel = 'Case'"
then: [t: "ケースケース"] # phrase(this is the first 'case' of three cases)
then: [T: "ケース"] # phrase(this is the first 'case' of three cases)
- else_if: "$ClearSpeak_MultiLineLabel = 'Auto' or $ClearSpeak_MultiLineLabel = 'Line' or $ClearSpeak_MultiLineLabel = 'None'" # already dealt with Auto/Case
then: [t: "ライン"] # phrase(this is the first 'line' of three lines)
then: [T: ""] # phrase(this is the first 'line' of three lines)
- else_if: "$ClearSpeak_MultiLineLabel = 'Constraint'"
then: [t: "制約条件"] # phrase(this is the first 'constraint' of three constraints)
- else_if: "$ClearSpeak_MultiLineLabel = 'Equation'"
then: [t: "設備"] # phrase(this is the first 'equation' of three equations)
then: [T: ""] # phrase(this is the first 'equation' of three equations)
- else_if: "$ClearSpeak_MultiLineLabel = 'Row'"
then: [t: "行"] # phrase(this is the first 'row' of three rows)
- else_if: "$ClearSpeak_MultiLineLabel = 'Step'"
then: [t: "ステップステップ"] # phrase(this is the first 'step' of three steps)
then: [T: "ステップ"] # phrase(this is the first 'step' of three steps)
# else 'None -- don't say anything'
- test:
- if: "$LineCount != 1"
Expand All @@ -642,17 +642,17 @@
- pause: medium
- test:
- if: "($ClearSpeak_MultiLineLabel = 'Auto' and parent::m:piecewise) or $ClearSpeak_MultiLineLabel = 'Case'"
then: [t: "ケースケース"] # phrase(in this 'case' x is not equal to y)
then: [T: "ケース"] # phrase(in this 'case' x is not equal to y)
- else_if: "$ClearSpeak_MultiLineLabel = 'Auto' or $ClearSpeak_MultiLineLabel = 'Line'" # already dealt with Auto/Case
then: [t: "ライン"] # phrase(the straight 'line' between x and y)
then: [T: ""] # phrase(the straight 'line' between x and y)
- else_if: "$ClearSpeak_MultiLineLabel = 'Constraint'"
then: [t: "制約条件"] # phrase(there is a 'constraint' on possible values)
- else_if: "$ClearSpeak_MultiLineLabel = 'Equation'"
then: [t: "設備"] # phrase(the 'equation' pi r squared gives the area of a circle)
then: [T: ""] # phrase(the 'equation' pi r squared gives the area of a circle)
- else_if: "$ClearSpeak_MultiLineLabel = 'Row'"
then: [t: "行"] # phrase(the values on the top 'row' are relevant)
- else_if: "$ClearSpeak_MultiLineLabel = 'Step'"
then: [t: "ステップステップ"] # phrase(this is a 'step' by step process)
then: [T: "ステップ"] # phrase(this is a 'step' by step process)
# else 'None -- don't say anything'
- x: "count(preceding-sibling::*[not(contains(@data-intent-property, ':continued-row:'))]) + 1"
- test:
Expand Down
2 changes: 1 addition & 1 deletion Rules/Languages/ja/SharedRules/calculus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
tag: laplacian
match: "count(*) <= 1" # can be on ∇^2 or on enclosing mrow
replace:
- t: "ラ・プラハシアン" # phrase('laplacian' of x) -- "LahPlahsian" sounds better with speech engines tested
- T: "ラプラシアン" # phrase('laplacian' of x) -- "LahPlahsian" sounds better with speech engines tested
- test:
if: "count(*) = 1"
then:
Expand Down
39 changes: 20 additions & 19 deletions Rules/Languages/ja/SharedRules/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@
- test: # only bother announcing if there is more than one prescript
if: "count($Prescripts) > 2"
then:
- t: "付き" # phrase(substitute x 'with' y)
- x: "count($Prescripts) div 2"
- t: "プレスクリプト" # phrase(in this equation certain 'prescripts' apply)
- T: "個の前置き添字" # phrase(in this equation certain 'prescripts' apply)
- T: "付き" # phrase(substitute x 'with' y)
- pause: short
- test:
if: "not($Prescripts[1][self::m:none])"
Expand Down Expand Up @@ -332,9 +332,9 @@
- test:
if: "count($Prescripts) > 4" # give up and just dump them out so at least the content is there
then:
- t: "プレスクリプトの改変" # phrase(in this case there are values 'and alternating prescripts')
- T: "および交互の前置き添字" # phrase(in this case there are values 'and alternating prescripts')
- x: "$Prescripts[position() > 4]"
- t: "終了原稿" # phrase(This is where 'end prescripts' occurs)
- T: "前置き添字終了" # phrase(This is where 'end prescripts' occurs)
- test:
if: "$Postscripts"
then:
Expand All @@ -349,9 +349,9 @@
- test:
if: "$Prescripts"
then: [t: "および"] # phrase(10 is greater than 8 'and' less than 15)
- t: "付き" # phrase(substitute x 'with' y)
- x: "count($Postscripts) div 2"
- t: "投稿原稿" # phrase(this material includes several 'postscripts')
- T: "個の後置き添字" # phrase(this material includes several 'postscripts')
- T: "付き" # phrase(substitute x 'with' y)
- pause: short
- test:
if: "not($Postscripts[1][self::m:none])"
Expand Down Expand Up @@ -417,9 +417,9 @@
- test:
if: "count($Postscripts) > 8" # give up and just dump them out so at least the content is there
then:
- t: "スクリプトの変更と変更" # phrase(this situation involves complexities 'and alternating scripts')
- T: "および交互の添字" # phrase(this situation involves complexities 'and alternating scripts')
- x: "$Postscripts[position() > 8]"
- t: "エンドスクリプト" # phrase(At this point 'end scripts' occurs)
- T: "添字終了" # phrase(At this point 'end scripts' occurs)

- name: default
tag: mtable
Expand All @@ -428,7 +428,6 @@
- NumColumns: "count(*[1]/*) - IfThenElse(*/self::m:mlabeledtr, 1, 0)"
match: "."
replace:
- t: "テーブルと" # phrase(the 'table with' 3 rows)
- x: count(*)
- test:
if: count(*)=1
Expand All @@ -438,8 +437,9 @@
- x: "$NumColumns"
- test:
if: "NumColumns=1"
then: [t: "コラム"] # phrase(the table with 3 rows and 1 'column')
else: [t: "コラム"] # phrase(the table with 3 rows and 4 'columns')
then: [T: "列"] # phrase(the table with 3 rows and 1 'column')
else: [T: "列"] # phrase(the table with 3 rows and 4 'columns')
- T: "の表" # phrase(the 'table with' 3 rows)
- pause: long
- x: "*"

Expand Down Expand Up @@ -474,7 +474,7 @@
# if: not($IsColumnSilent) and ($ClearSpeak_Matrix = 'SpeakColNum' or count(preceding-sibling::*) != 0)
if: "not($IsColumnSilent)"
then:
- t: "コラム" # phrase(the first 'column' of the matrix)
- T: "" # phrase(the first 'column' of the matrix)
- x: "count(preceding-sibling::*)+IfThenElse(parent::m:mlabeledtr, 0, 1)"
- pause: medium
- x: "*"
Expand Down Expand Up @@ -524,19 +524,20 @@
- test:
if: ".[ contains(concat(' ', normalize-space(@notation), ' '), ' left ') or contains(concat(' ', normalize-space(@notation), ' '), ' right ') or contains(@notation,'top') or contains(@notation,'bottom') ]"
then:
- t: "ライン" # phrase(draw a straight 'line' on the page)
- test:
if: ".[contains(concat(' ', normalize-space(@notation), ' '), ' left ')]"
then: [t: "左から", pause: short] # phrase(line on 'left' of the expression)
then: [T: "左に"] # phrase(line on 'left' of the expression)
- test:
if: ".[contains(concat(' ', normalize-space(@notation), ' '), ' right ')]"
then: [t: "アクセス", pause: short] # phrase(line on 'right' of the expression)
then: [T: "右に"] # phrase(line on 'right' of the expression)
- test:
if: ".[contains(@notation,'top')]"
then: [t: "トップトップ", pause: short] # phrase(line on 'top' of the expression)
then: [T: "上に"] # phrase(line on 'top' of the expression)
- test:
if: ".[contains(@notation,'bottom')]"
then: [t: "ボトム", pause: short] # phrase(line on the 'bottom' of the expression)
then: [T: "下に"] # phrase(line on the 'bottom' of the expression)
- T: "線"
- pause: short # phrase(draw a straight 'line' on the page)
- test:
if: ".[ contains(@notation,'updiagonalstrike') or contains(@notation,'downdiagonalstrike') or contains(@notation,'verticalstrike') or contains(@notation,'horizontalstrike') ]"
then:
Expand Down Expand Up @@ -609,14 +610,14 @@
- test:
if: ".[contains(@notation,'radical')]"
then: [t: "平方根", pause: short] # phrase(5 is the 'square root' of 25)
- t: "エンクロージャー" # phrase(parentheses are 'enclosing' part of the equation)
- T: "囲み" # phrase(parentheses are 'enclosing' part of the equation)
- test:
if: "*[self::m:mtext and .=' ']"
then: [t: "スペース"] # otherwise there is complete silence # phrase(there is a 'space' between the words)
else: [x: "*"]
- test:
if: "$Impairment = 'Blindness' and ( $SpeechStyle != 'SimpleSpeak' or not(IsNode(*[1], 'leaf')) )"
then: [t: "エンドエンクロージャ"] # phrase(reached the 'end enclosure' point)
then: [T: "囲み終了"] # phrase(reached the 'end enclosure' point)
- pause: short

- name: semantics
Expand Down
12 changes: 6 additions & 6 deletions Rules/Languages/ja/SharedRules/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,10 @@
- x: "$LineCount"
- test:
- if: "self::m:piecewise"
then: [t: "ケースケース"] # phrase(this is the first 'case' of three cases)
then: [T: "ケース"] # phrase(this is the first 'case' of three cases)
- else_if: "self::m:system-of-equations"
then: [t: "設備"] # phrase(this is the first 'equation' of three equations)
else: [t: "ライン"] # phrase(this is the first 'line' of three lines)
then: [T: ""] # phrase(this is the first 'equation' of three equations)
else: [T: ""] # phrase(this is the first 'line' of three lines)
- test:
- if: "$LineCount != 1"
then: [ct: ""] # plural
Expand All @@ -522,10 +522,10 @@
- pause: medium
- test:
- if: "parent::m:piecewise"
then: [t: "ケースケース"] # phrase('case' 1 of 10 cases)
then: [T: "ケース"] # phrase('case' 1 of 10 cases)
- else_if: "parent::m:system-of-equations"
then: [t: "設備"] # phrase('equation' 1 of 10 equations)
else: [t: "ライン"] # phrase('line 1 of 10 lines)
then: [T: ""] # phrase('equation' 1 of 10 equations)
else: [T: ""] # phrase('line 1 of 10 lines)
- x: "count(preceding-sibling::*[not(contains(@data-intent-property, ':continued-row:'))]) + 1"
- test:
if: "self::m:mlabeledtr"
Expand Down
2 changes: 1 addition & 1 deletion Rules/Languages/ja/definitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
## Default fixity prefix
"angle": "prefix=角",
"angle-measure": "prefix=角の大きさ",
"change": "prefix=変更点",
"change": "prefix=変化量",
"for-all": "prefix=すべての",
"measured-angle": "prefix=測定角",
"not": "prefix=でない",
Expand Down
2 changes: 1 addition & 1 deletion Rules/Languages/ja/overview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
- x: count(*[2]/*)
- t: "かける"
- x: count(*[2]/*[self::m:mtr][1]/*)
- t: "テーブル"
- T: "の表"

- name: short-mrow
tag: mrow
Expand Down
6 changes: 3 additions & 3 deletions Rules/Languages/ja/unicode-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -691,9 +691,9 @@
if: "following-sibling::*"
then_test:
if: "$Verbosity!='Terse'"
then: [t: "ラプラシアン の"] # "LahPlahsian" sounds better than "laplacian" in speech engines tested
else: [t: "ラ・プラハシアン"]
else: [t: "ラ・プラハシアン"]
then: [T: "ラプラシアン の"] # "LahPlahsian" sounds better than "laplacian" in speech engines tested
else: [T: "ラプラシアン"]
else: [T: "ラプラシアン"]

- "∇": [t: "ナブラ"] # 0x2207
- "∉": # 0x2209
Expand Down
31 changes: 31 additions & 0 deletions tests/Languages/ja/ja.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,3 +641,34 @@ fn permutation_p_notation() -> Result<()> {
test("ja", "SimpleSpeak", expr, "5 個から 2 個取る順列")?;
return Ok(());
}

/// Multi-line labels: a system of equations labelled as cases is announced as
/// "2 ケース" and each line as "ケース 1", "ケース 2" (the seed doubled the word
/// and used 設備 "equipment" for equation).
#[test]
fn multiline_case_label() -> Result<()> {
let expr = "<math>
<mrow>
<mtable>
<mtr> <mtd> <mrow> <mi>x</mi><mo>+</mo><mi>y</mi></mrow> </mtd> <mtd><mo>=</mo> </mtd> <mtd><mn>7</mn></mtd> </mtr>
<mtr> <mtd> <mrow> <mn>2</mn><mi>x</mi><mo>+</mo><mn>3</mn><mi>y</mi></mrow></mtd> <mtd><mo>=</mo></mtd> <mtd><mrow><mn>17</mn></mrow></mtd> </mtr>
</mtable></mrow>
</math>";
// SimpleSpeak reaches the same labels through SharedRules/general.yaml, and
// classifies this as a system of equations rather than cases: 2 式, 式 1, 式 2.
test("ja", "SimpleSpeak", expr, "2 式; 式 1; x プラス y, イコール 7; 式 2; 2 x プラス 3 y; イコール 17")?;
test_ClearSpeak("ja", "ClearSpeak_MultiLineLabel", "Case", expr,
"2 ケース; ケース 1; x プラス y, イコール 7; ケース 2; 2 x プラス 3 y; イコール 17")?;
return Ok(());
}

/// menclose with a line on one side: the side comes first and the noun last,
/// "左に 線" ("a line on the left"); the seed said ライン アクセス for line-on-right.
#[test]
fn menclose_line_on_left() -> Result<()> {
let expr = "<math>
<menclose notation='left'> <mfrac><mn>3</mn><mn>2</mn></mfrac> </menclose>
</math>";
test("ja", "ClearSpeak", expr, "左に 線, 囲み 2 分の 3 囲み終了")?;
return Ok(());
}