Skip to content
Open
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
2 changes: 1 addition & 1 deletion Rules/Languages/ja/SharedRules/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
match: "."
replace:
- x: "*[1]"
- T: "循環節" # phrase('with repeating digits')
- T: "循環せつ" # phrase('with repeating digits')
- spell: "*[2]"

- name: msubsup-skip-super
Expand Down
12 changes: 6 additions & 6 deletions Rules/Languages/ja/SharedRules/geometry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@
- test:
if: "$Verbosity='Verbose'"
then:
- T: "角" # phrase('the measure of the angle' ABC)
- T: "かく" # phrase('the measure of the angle' ABC)
else:
- T: "角" # phrase('measure of angle' ABC)
- T: "かく" # phrase('measure of angle' ABC)
- x: "*[1]"
- x: "*[2]"
- x: "*[3]"
- T: "の大きさ" # Japanese says the angle first: 角 ABC の大きさ
- T: "の大きさ" # Japanese says the angle first: かく ABC の大きさ

# The angle-measure intent: definitions.yaml can only give it as a prefix (角の大きさ A),
# which keeps the English order, so say it here the same way as measure-of-angle.
Expand All @@ -68,11 +68,11 @@
match: "count(*)>0 and not(contains(@data-intent-property, ':silent:'))"
replace:
- test:
# the operand already says 角 for m∠ABC or an angle intent; don't say it twice
# the operand already says かく for m∠ABC or an angle intent; don't say it twice
if: "not(*[1][(self::m:angle and not(contains(@data-intent-property, ':silent:'))) or (self::m:mrow and *[1][self::m:mo and .='∠'])])"
then: [T: "角"] # phrase('measure of angle' ABC)
then: [T: "かく"] # phrase('measure of angle' ABC)
- x: "*"
- T: "の大きさ" # Japanese says the angle first: 角 A の大きさ
- T: "の大きさ" # Japanese says the angle first: かく A の大きさ


- name: coordinate
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 @@ -262,7 +262,7 @@
"laplacian": "function=ラプラシアン",

## Default fixity prefix
"angle": "prefix=角",
"angle": "prefix=かく",
"angle-measure": "prefix=角の大きさ",
"change": "prefix=変化量",
"for-all": "prefix=すべての",
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 @@ -805,7 +805,7 @@
- T: "比例"
- "∞": [T: "無限大"] # 0x221e
- "∟": [t: "直角"] # 0x221f
- "∠": [T: "角"] # 0x2220
- "∠": [T: "かく"] # 0x2220
- "∡": [T: "測定角"] # 0x2221
- "∢": [T: "球面角"] # 0x2222
- "∣": [T: "割り切る"] # 0x2223
Expand Down Expand Up @@ -2802,7 +2802,7 @@
- "": [t: "ノット 大なり オア イコール"] # 0xea1e
- "": [t: "ノット マイナス付き近似的イコール"] # 0xea1f
- "": [t: "上にドット付きノット 要素オブ"] # 0xea22
- "": [t: "縦線付きノット 角"] # 0xea2c
- "": [T: "縦線付きノット かく"] # 0xea2c
- "": [t: "ノット 斜め平行"] # 0xea2d
- "": [t: "ノット 縦棒"] # 0xea2e
- "": [t: "ノット 二重縦棒"] # 0xea2f
Expand Down Expand Up @@ -3041,7 +3041,7 @@
- "": [t: "左下の長方形"] # 0xec81
- "": [T: "右上側の長方形"] # 0xec90
- "": [t: "右下の長方形"] # 0xec91
- "": [t: "組立除法 角"] # 0xec92
- "": [T: "組立除法 隅"] # 0xec92
- "": [t: "組立除法 横の延長部"] # 0xec93
- "": [t: "組立除法 縦の延長部"] # 0xec94
- "": [t: "天井床カッコ 延長部"] # 0xec95
Expand Down
52 changes: 33 additions & 19 deletions tests/Languages/ja/ja.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,13 @@ fn simplespeak_interval_names_are_japanese() -> Result<()> {
return Ok(());
}

/// 循環節 is the dictionary term for the repeating digits of a recurring decimal.
/// 循環節 is the dictionary term for the repeating digits of a recurring decimal; Open JTalk reads
/// the kanji ジュンカンブシ, so 節 is written せつ.
#[test]
fn repeating_decimal_says_junkansetsu() -> Result<()> {
let expr = "<math><mn>0.1</mn><mo>&#x2062;</mo><mover><mn>23</mn><mo>¯</mo></mover></math>";
test("ja", "SimpleSpeak", expr, "0.1 循環節 2 3")?;
test("ja", "ClearSpeak", expr, "0.1 循環節 2 3")?;
test("ja", "SimpleSpeak", expr, "0.1 循環せつ 2 3")?;
test("ja", "ClearSpeak", expr, "0.1 循環せつ 2 3")?;
return Ok(());
}

Expand Down Expand Up @@ -625,34 +626,47 @@ fn geometry_verbose_from_to() -> Result<()> {
return Ok(());
}

/// The measure of an angle is 「角 ABC の大きさ」: Japanese names the angle first.
/// The measure of an angle is 「角 ABC の大きさ」: Japanese names the angle first. 角 is written
/// かく because Open JTalk reads 角 before a pause as スミ (∠ABC = 90° was スミ, ...).
/// 「角の大きさ ABC」 kept the English order.
#[test]
fn measure_of_angle() -> Result<()> {
let expr = "<math><mrow intent='measure-of-angle($x,$y,$z)'><mi arg='x'>x</mi><mi arg='y'>y</mi><mi arg='z'>z</mi></mrow></math>";
test("ja", "ClearSpeak", expr, "角 x y z の大きさ")?;
test_prefs("ja", "ClearSpeak", vec![("Verbosity", "Verbose")], expr, "角 x y z の大きさ")?;
test("ja", "SimpleSpeak", expr, "角 x y z の大きさ")?;
test("ja", "ClearSpeak", expr, "かく x y z の大きさ")?;
test_prefs("ja", "ClearSpeak", vec![("Verbosity", "Verbose")], expr, "かく x y z の大きさ")?;
test("ja", "SimpleSpeak", expr, "かく x y z の大きさ")?;
return Ok(());
}

/// The angle-measure intent is said the same way: 角 A の大きさ.
/// ∠ABC = 90° with the letters not grouped: ∠ is followed by a pause, where 角 was read スミ.
/// Two MathType names also ended in a lone 角: the angle one is かく too, and the synthetic
/// division corner is 隅, like the corner brackets ⌜ 左上隅.
#[test]
fn angle_sign_before_a_pause() -> Result<()> {
let expr = "<math><mo>∠</mo><mi>A</mi><mi>B</mi><mi>C</mi><mo>=</mo><mn>90</mn><mo>°</mo></math>";
test("ja", "ClearSpeak", expr, "かく, おおもじ エー, おおもじ b おおもじ c; イコール 90 度")?;
test("ja", "ClearSpeak", "<math><mo>&#xEA2C;</mo></math>", "縦線付きノット かく")?;
test("ja", "ClearSpeak", "<math><mo>&#xEC92;</mo></math>", "組立除法 隅")?;
return Ok(());
}

/// The angle-measure intent is said the same way: かく A の大きさ.
#[test]
fn angle_measure_intent() -> Result<()> {
let expr = "<math><mrow intent='angle-measure($x)'><mi arg='x'>x</mi></mrow></math>";
test("ja", "ClearSpeak", expr, "角 x の大きさ")?;
test("ja", "SimpleSpeak", expr, "角 x の大きさ")?;
// m∠ABC: the operand already says 角, so it is not said twice.
test("ja", "ClearSpeak", expr, "かく x の大きさ")?;
test("ja", "SimpleSpeak", expr, "かく x の大きさ")?;
// m∠ABC: the operand already says かく, so it is not said twice.
let angle_arg = "<math><mrow intent='angle-measure($x)'><mrow arg='x' intent='angle($p)'><mi arg='p'>x</mi></mrow></mrow></math>";
test("ja", "ClearSpeak", angle_arg, "角 x の大きさ")?;
test("ja", "SimpleSpeak", angle_arg, "角 x の大きさ")?;
test("ja", "ClearSpeak", angle_arg, "かく x の大きさ")?;
test("ja", "SimpleSpeak", angle_arg, "かく x の大きさ")?;
let sign_arg = "<math><mrow intent='angle-measure($x)'><mi>m</mi><mrow arg='x'><mo>&#x2220;</mo><mi>x</mi></mrow></mrow></math>";
test("ja", "ClearSpeak", sign_arg, "角 x の大きさ")?;
test("ja", "SimpleSpeak", sign_arg, "角 x の大きさ")?;
// A silent angle does not say 角 itself, so it is said here.
test("ja", "ClearSpeak", sign_arg, "かく x の大きさ")?;
test("ja", "SimpleSpeak", sign_arg, "かく x の大きさ")?;
// A silent angle does not say かく itself, so it is said here.
let silent_arg = "<math><mrow intent='angle-measure($x)'><mrow arg='x' intent='angle:silent($p)'><mi arg='p'>x</mi></mrow></mrow></math>";
test("ja", "ClearSpeak", silent_arg, "角 x の大きさ")?;
test("ja", "SimpleSpeak", silent_arg, "角 x の大きさ")?;
test("ja", "ClearSpeak", silent_arg, "かく x の大きさ")?;
test("ja", "SimpleSpeak", silent_arg, "かく x の大きさ")?;
// A silent angle-measure says only its operand.
let silent_measure = "<math><mrow intent='angle-measure:silent($x)'><mi arg='x'>x</mi></mrow></math>";
test("ja", "ClearSpeak", silent_measure, "x")?;
Expand Down Expand Up @@ -2084,7 +2098,7 @@ fn leaf_intent_uses_intent_mappings() -> Result<()> {
("plus", "エー プラス b"),
("member-of", "エー げんオブ b"),
("factorial", "エー 階乗 b"),
("angle", "エー 角 b"),
("angle", "エー かく b"),
("gradient", "エー 勾配 b"),
("not-in-mappings", "エー not in mappings b"),
] {
Expand Down