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
4 changes: 2 additions & 2 deletions Rules/Languages/ja/ClearSpeak_Rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
- t: "平方根" # phrase(8 is the 'square root' of 64)
- test:
if: "$Verbosity!='Terse'"
then: [t: ""] # phrase(the square root 'of' 5)
then: [t: "オブ"] # phrase(the square root 'of' 5)
else: [pause: short]
- x: "*[1]"
- test:
Expand Down Expand Up @@ -89,7 +89,7 @@
- t: "乗根" # phrase(the square 'root' of 36)
- test:
if: "$Verbosity!='Terse'"
then: [t: ""] # phrase(the square root 'of' 36)
then: [t: "オブ"] # phrase(the square root 'of' 36)
- x: "*[1]"
- test:
if: "$ClearSpeak_Roots = 'RootEnd' or $ClearSpeak_Roots = 'PosNegSqRootEnd'"
Expand Down
8 changes: 4 additions & 4 deletions Rules/Languages/ja/SharedRules/calculus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
then:
- test:
if: "$Verbosity!='Terse'"
then: [t: ""] # phrase(function 'of' one variable) -- note OneCore voices spell out "div"
then: [t: "オブ"] # phrase(function 'of' one variable) -- note OneCore voices spell out "div"
- test:
if: "not(IsNode(*[1], 'leaf'))"
then: [pause: short]
Expand All @@ -23,7 +23,7 @@
- test:
if: "$Verbosity='Terse'"
then: [t: "ダイバージェンス"] # phrase('div' is short for divergence) -- note OneCore voices spell out "div"
else: [t: "発散"] # phrase('divergence of' this function from the mean)
else: [t: "発散 オブ"] # phrase('divergence of' this function from the mean)
- test:
if: "not(IsNode(*[1], 'leaf'))"
then: [pause: short]
Expand All @@ -36,7 +36,7 @@
- t: "回転" # phrase(the 'curl of' a field)
- test:
if: "$Verbosity!='Terse'"
then: [t: ""] # phrase(function 'of' one variable) -- note OneCore voices spell out "div"
then: [t: "オブ"] # phrase(function 'of' one variable) -- note OneCore voices spell out "div"
- test:
if: "not(IsNode(*[1], 'leaf'))"
then: [pause: short]
Expand All @@ -48,7 +48,7 @@
replace:
- test:
if: "$Verbosity!='Terse'"
then: [t: "勾配"] # phrase(the hill has a 'gradient of' five percent)
then: [t: "勾配 オブ"] # phrase(the hill has a 'gradient of' five percent)
else: [t: "デル"] # phrase(the delete key is labeled 'del')
- test:
if: "not(IsNode(*[1], 'leaf'))"
Expand Down
8 changes: 4 additions & 4 deletions Rules/Languages/ja/SharedRules/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
- t: "ルート"
- test:
if: "$Verbosity!='Terse'"
then: [t: ""] # phrase("the root 'of' x")
then: [t: "オブ"] # phrase("the root 'of' x")
- x: "*[1]"
- pause: short
- test:
Expand All @@ -145,7 +145,7 @@
- t: "根指数" # phrase("the 'root with index' 3 of 5")
- x: "*[1]"
- pause: short
- t: "" # phrase("the root 'of' x")
- t: "オブ" # phrase("the root 'of' x")
- x: "*[2]"
- pause: short
- test:
Expand Down Expand Up @@ -636,7 +636,7 @@
match: .
replace:
- x: "*[1]"
- t: "" # phrase(the sine 'of' x )
- t: "オブ" # phrase(the sine 'of' x )
- pause: auto
- x: "*[position() > 1]"

Expand Down Expand Up @@ -736,7 +736,7 @@
- test:
if: "$Verbosity != 'Terse' and not(contains(@data-intent-property, ':literal:')) and
not(count(*)=2 and (IsInDefinition(*[1], 'TrigFunctionNames') or IsInDefinition(name(.), 'TerseFunctionNames')) and IsNode(*[2], 'simple'))"
then: [t: "", pause: auto] # phrase(sine 'of' 5)
then: [t: "オブ", pause: auto] # phrase(sine 'of' 5)
- insert:
nodes: "*"
replace:
Expand Down
2 changes: 1 addition & 1 deletion Rules/Languages/ja/SharedRules/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
if: "$Verbosity!='Terse'"
then: [ot: ""] # phrase('the' square root of 25 equals 5)
- x: "*[1]"
- t: "" # phrase(the square root 'of' 25 equals 5)
- t: "オブ" # phrase(the square root 'of' 25 equals 5)
- x: "*[2]"

- name: repeating-decimal
Expand Down
4 changes: 2 additions & 2 deletions Rules/Languages/ja/SimpleSpeak_Rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
- t: "平方根" # phrase(the 'square root' of x)
- test:
if: "$Verbosity!='Terse'"
then: [t: ""] # phrase(the square root 'of' x)
then: [t: "オブ"] # phrase(the square root 'of' x)
else: [pause: short]
- x: "*[1]"
- pause: short
Expand Down Expand Up @@ -66,7 +66,7 @@
- t: "乗根" # phrase(the square 'root' of)
- test:
if: "$Verbosity!='Terse'"
then: [t: ""] # phrase(the square root 'of' x)
then: [t: "オブ"] # phrase(the square root 'of' x)
- x: "*[1]"
- pause: short
- test:
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 @@ -259,7 +259,7 @@
"number-of": "prefix=個数",
"partial-derivative": "prefix=偏微分",
"right-angle": "prefix=直角",
"square-root-of": "prefix=平方根の",
"square-root-of": "prefix=平方根 オブ",
"there-does-not-exist": "prefix=存在しない",
"there-exists": "prefix=存在する",

Expand Down
4 changes: 2 additions & 2 deletions Rules/Languages/ja/overview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
then:
- test:
if: "$Verbosity!='Terse'"
then: [t: ""]
then: [t: "オブ"]
- x: "*[1]"

- name: overview-default
Expand All @@ -60,7 +60,7 @@
then:
- test:
if: "$Verbosity!='Terse'"
then: [t: ""]
then: [t: "オブ"]
- x: "*[1]"

- name: matrix-override
Expand Down
6 changes: 3 additions & 3 deletions Rules/Languages/ja/unicode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
preceding-sibling::*[1][IsInDefinition(., 'GeometryShapes')] or
(@data-changed='added' and ancestor-or-self::*[contains(@data-intent-property, ':literal:')])
)"
then: [t: ""]
then: [t: "オブ"]
- "⁢": [t: ""] # 0x2062
- "⁣": [t: ""] # 0x2063
- "⁤": [t: "および"] # 0x2064
Expand Down Expand Up @@ -412,7 +412,7 @@
- test:
if: "$Verbosity!='Terse'"
then: [ot: ""]
- t: "ラプラシアンの"
- t: "ラプラシアン オブ"
- "∉": # 0x2209
# rule is identical to 0x2208
- test:
Expand Down Expand Up @@ -472,7 +472,7 @@
- test:
if: "$Verbosity!='Terse'"
then: [ot: ""]
- t: "平方根の"
- t: "平方根 オブ"
- "∝": # 0x221d
- test:
if: "$Verbosity!='Terse'"
Expand Down
82 changes: 50 additions & 32 deletions tests/Languages/ja/ja.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn fraction_of_variables() -> Result<()> {
#[test]
fn square_root() -> Result<()> {
let expr = "<math><msqrt><mn>9</mn></msqrt></math>";
test("ja", "ClearSpeak", expr, "平方根 9")?;
test("ja", "ClearSpeak", expr, "平方根 オブ 9")?;
return Ok(());
}

Expand Down Expand Up @@ -109,7 +109,25 @@ fn negative_number() -> Result<()> {
fn gradient() -> Result<()> {
let expr = "<math><mo>&#x2207;</mo><mi mathvariant='normal'>F</mi></math>";
test_prefs("ja", "SimpleSpeak", vec![("Verbosity", "Terse")], expr, "デル 大文字 f")?;
test_prefs("ja", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr, "勾配 の 大文字 f")?;
test_prefs("ja", "SimpleSpeak", vec![("Verbosity", "Verbose")], expr, "勾配 オブ 大文字 f")?;
return Ok(());
}

/// These four reach the generic function-application rule through the
/// function= entries in definitions.yaml, so they take オブ like any other
/// function. SharedRules/calculus.yaml also names them, but neither ja nor en
/// includes that file today, so it is not the path under test here.
#[test]
fn vector_calculus_operators() -> Result<()> {
for (intent, expected) in [
("curl", "回転 オブ x"),
("divergence", "発散 オブ x"),
("gradient", "勾配 オブ x"),
("laplacian", "ラプラシアン オブ x"),
] {
let expr = format!("<math><mrow intent='{intent}($x)'><mi arg='x'>x</mi></mrow></math>");
test("ja", "ClearSpeak", &expr, expected)?;
}
return Ok(());
}

Expand Down Expand Up @@ -197,7 +215,7 @@ fn interval_open_closed() -> Result<()> {
#[test]
fn cube_root() -> Result<()> {
let expr = "<math><mroot><mn>8</mn><mn>3</mn></mroot></math>";
test("ja", "ClearSpeak", expr, "立方根 8")?;
test("ja", "ClearSpeak", expr, "立方根 オブ 8")?;
return Ok(());
}

Expand All @@ -206,16 +224,16 @@ fn cube_root() -> Result<()> {
#[test]
fn nth_root() -> Result<()> {
let expr = "<math><mroot><mi>x</mi><mn>5</mn></mroot></math>";
test("ja", "ClearSpeak", expr, "5 乗根 x")?;
test("ja", "SimpleSpeak", expr, "5 乗根 x")?;
test("ja", "ClearSpeak", expr, "5 乗根 オブ x")?;
test("ja", "SimpleSpeak", expr, "5 乗根 オブ x")?;
return Ok(());
}

/// The same holds when the index is a variable (English appends "-th" here).
#[test]
fn variable_index_root() -> Result<()> {
let expr = "<math><mroot><mi>x</mi><mi>n</mi></mroot></math>";
test("ja", "ClearSpeak", expr, "n 乗根 x")?;
test("ja", "ClearSpeak", expr, "n 乗根 オブ x")?;
return Ok(());
}

Expand All @@ -231,7 +249,7 @@ fn subscript() -> Result<()> {
#[test]
fn sine_function() -> Result<()> {
let expr = "<math><mi>sin</mi><mo>&#x2061;</mo><mi>x</mi></math>";
test("ja", "SimpleSpeak", expr, "サイン x")?;
test("ja", "SimpleSpeak", expr, "サイン オブ x")?;
return Ok(());
}

Expand Down Expand Up @@ -322,11 +340,11 @@ fn geometry_verbose_from_to() -> Result<()> {
#[test]
fn trigonometric_function_names() -> Result<()> {
for (name, expected) in [
("cos", "コサイン x"),
("tan", "タンジェント x"),
("sec", "セカント x"),
("csc", "コセカント x"),
("cot", "コタンジェント x"),
("cos", "コサイン オブ x"),
("tan", "タンジェント オブ x"),
("sec", "セカント オブ x"),
("csc", "コセカント オブ x"),
("cot", "コタンジェント, オブ x"),
] {
let expr = format!("<math><mi>{name}</mi><mo>&#x2061;</mo><mi>x</mi></math>");
test("ja", "SimpleSpeak", &expr, expected)?;
Expand All @@ -338,12 +356,12 @@ fn trigonometric_function_names() -> Result<()> {
#[test]
fn hyperbolic_function_names() -> Result<()> {
for (name, expected) in [
("sinh", "双曲線正弦 x"),
("cosh", "双曲線余弦 x"),
("tanh", "双曲線正接 x"),
("sech", "双曲線正割 x"),
("csch", "双曲線余割 x"),
("coth", "双曲線余接 x"),
("sinh", "双曲線正弦 オブ x"),
("cosh", "双曲線余弦 オブ x"),
("tanh", "双曲線正接 オブ x"),
("sech", "双曲線正割 オブ x"),
("csch", "双曲線余割 オブ x"),
("coth", "双曲線余接 オブ x"),
] {
let expr = format!("<math><mi>{name}</mi><mo>&#x2061;</mo><mi>x</mi></math>");
test("ja", "SimpleSpeak", &expr, expected)?;
Expand All @@ -365,10 +383,10 @@ fn hyperbolic_function_terse() -> Result<()> {
#[test]
fn complex_number_parts() -> Result<()> {
for (intent, expected) in [
("real-part", "実部 x"),
("imaginary-part", "虚部 x"),
("complex-conjugate", "複素共役 x"),
("complex-arg", "偏角 x"),
("real-part", "実部 オブ x"),
("imaginary-part", "虚部 オブ x"),
("complex-conjugate", "複素共役 オブ x"),
("complex-arg", "偏角 オブ x"),
] {
let expr = format!("<math><mrow intent='{intent}($x)'><mi arg='x'>x</mi></mrow></math>");
test("ja", "ClearSpeak", &expr, expected)?;
Expand All @@ -380,12 +398,12 @@ fn complex_number_parts() -> Result<()> {
#[test]
fn inverse_trigonometric_names() -> Result<()> {
for (intent, expected) in [
("arcsine", "逆正弦 x"),
("arccosine", "逆余弦 x"),
("arctangent", "逆正接 x"),
("arcsecant", "逆正割 x"),
("arccosecant", "逆余割 x"),
("arccotangent", "逆余接 x"),
("arcsine", "逆正弦 オブ x"),
("arccosine", "逆余弦 オブ x"),
("arctangent", "逆正接 オブ x"),
("arcsecant", "逆正割 オブ x"),
("arccosecant", "逆余割 オブ x"),
("arccotangent", "逆余接 オブ x"),
] {
let expr = format!("<math><mrow intent='{intent}($x)'><mi arg='x'>x</mi></mrow></math>");
test("ja", "ClearSpeak", &expr, expected)?;
Expand Down Expand Up @@ -530,15 +548,15 @@ fn definite_integral() -> Result<()> {
#[test]
fn set_terminology() -> Result<()> {
let expr = "<math><mrow intent='set($x,$y)'><mi arg='x'>x</mi><mi arg='y'>y</mi></mrow></math>";
test("ja", "ClearSpeak", expr, "集合 x コンマ, y")?;
test("ja", "ClearSpeak", expr, "集合 オブ x コンマ, y")?;
return Ok(());
}

/// 規範 is a social norm; the norm of a vector is ノルム.
#[test]
fn norm_terminology() -> Result<()> {
let expr = "<math><mrow intent='norm($x)'><mi arg='x'>x</mi></mrow></math>";
test("ja", "ClearSpeak", expr, "ノルム x")?;
test("ja", "ClearSpeak", expr, "ノルム オブ x")?;
return Ok(());
}

Expand All @@ -555,7 +573,7 @@ fn limit_terminology() -> Result<()> {
#[test]
fn statistics_mode() -> Result<()> {
let expr = "<math><mrow intent='mode($x)'><mi arg='x'>x</mi></mrow></math>";
test("ja", "ClearSpeak", expr, "最頻値 x")?;
test("ja", "ClearSpeak", expr, "最頻値 オブ x")?;
return Ok(());
}

Expand Down Expand Up @@ -592,7 +610,7 @@ fn number_set_names() -> Result<()> {
#[test]
fn geometry_translation() -> Result<()> {
let expr = "<math><mrow intent='translation($x)'><mi arg='x'>x</mi></mrow></math>";
test("ja", "ClearSpeak", expr, "平行移動 x")?;
test("ja", "ClearSpeak", expr, "平行移動 オブ x")?;
return Ok(());
}

Expand Down