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
57 changes: 33 additions & 24 deletions Rules/Languages/de/ClearSpeak_Rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -532,37 +532,46 @@
- x: "*[2]"
- pause: short
- test:
if: "not($is_intervals_start_infinity)"
if: "not($is_intervals_start_infinity) and starts-with(name(.), 'open')"
then:
- T: "nicht einschließlich"
- x: "*[1]"
- test:
if: "not($is_intervals_start_infinity) and not(starts-with(name(.), 'open'))"
then:
- test:
if: "starts-with(name(.), 'open')"
then: [T: "no"]
- T: "einschließlich"
- x: "*[1]"
# logic to deal with [not] arg #1
- test:
if: "not($is_intervals_start_infinity or $is_intervals_end_infinity)"
then_test:
- if: "name(.)='open-interval'"
then: [T: "ohne"]
- else_if: "name(.)='closed-interval'"
then: [T: "mit"]
else: [T: "ohne"]
# some ugly logic dealing with connectives: or, but, but, and (cleaner to be part of next clause?)
- test:
if: not($is_intervals_end_infinity)
if: "not($is_intervals_start_infinity or $is_intervals_end_infinity) and name(.)='open-interval'"
then:
- test:
# there is some asymmetry to the test because of the and/or/but logic above
if: not( name(.)='open-interval' or name(.)='closed-interval' ) or $is_intervals_start_infinity
then:
- test:
if: "name(.) = 'open-interval' or name(.) = 'closed-open-interval'"
then: [T: "ohne"]
- T: "einschließlich"
- T: "und nicht einschließlich"
- x: "*[2]"
- test:
if: "not($is_intervals_start_infinity or $is_intervals_end_infinity) and name(.)='open-closed-interval'"
then:
- T: "aber einschließlich"
- x: "*[2]"
- test:
if: "not($is_intervals_start_infinity or $is_intervals_end_infinity) and name(.)='closed-open-interval'"
then:
- T: "aber nicht einschließlich"
- x: "*[2]"
- test:
if: "not($is_intervals_start_infinity or $is_intervals_end_infinity) and name(.)='closed-interval'"
then:
- T: "und"
- x: "*[2]"
- test:
if: "$is_intervals_start_infinity and not($is_intervals_end_infinity) and (name(.)='open-interval' or name(.)='closed-open-interval')"
then:
- T: "nicht einschließlich"
- x: "*[2]"
- test:
if: "$is_intervals_start_infinity and not($is_intervals_end_infinity) and (name(.)='open-closed-interval' or name(.)='closed-interval')"
then:
- T: "einschließlich"
- x: "*[2]"

# onto the [not] [including]... part
- name: binomial-frac-vector
tag: matrix
match:
Expand Down
1 change: 1 addition & 0 deletions tests/Languages/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

mod ClearSpeak {
mod functions;
mod intervals;
mod large_ops;
mod menclose;
mod mfrac;
Expand Down
149 changes: 149 additions & 0 deletions tests/Languages/de/ClearSpeak/intervals.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
//! Regression tests for German ClearSpeak interval endpoint wording.
//! Each endpoint combination should use one German connector and no untranslated words.

use crate::common::*;
use anyhow::Result;

#[test]
fn interval_open_open() -> Result<()> {
let expr = "<math>
<mrow><mo>(</mo>
<mrow><mi>c</mi><mo>,</mo><mi>d</mi></mrow>
<mo>)</mo></mrow>
</math>";
test_ClearSpeak(
"de",
"ClearSpeak_Paren",
"Interval",
expr,
"das Intervall c bis d, nicht einschließlich c und nicht einschließlich d",
)
}

#[test]
fn interval_open_closed() -> Result<()> {
let expr = "<math>
<mrow><mo>(</mo>
<mrow><mi>c</mi><mo>,</mo><mi>d</mi></mrow>
<mo>]</mo></mrow>
</math>";
test_ClearSpeak(
"de",
"ClearSpeak_Paren",
"Interval",
expr,
"das Intervall c bis d, nicht einschließlich c aber einschließlich d",
)
}

#[test]
fn interval_closed_open() -> Result<()> {
let expr = "<math>
<mrow><mo>[</mo>
<mrow><mi>c</mi><mo>,</mo><mi>d</mi></mrow>
<mo>)</mo></mrow>
</math>";
test_ClearSpeak(
"de",
"ClearSpeak_Paren",
"Interval",
expr,
"das Intervall c bis d, einschließlich c aber nicht einschließlich d",
)
}

#[test]
fn interval_closed_closed() -> Result<()> {
let expr = "<math>
<mrow><mo>[</mo>
<mrow><mi>c</mi><mo>,</mo><mi>d</mi></mrow>
<mo>]</mo></mrow>
</math>";
test_ClearSpeak(
"de",
"ClearSpeak_Paren",
"Interval",
expr,
"das Intervall c bis d, einschließlich c und d",
)
}

#[test]
fn interval_negative_infinity_to_open_endpoint() -> Result<()> {
let expr = "<math>
<mrow><mo>(</mo>
<mrow><mo>-</mo><mi>∞</mi><mo>,</mo><mi>d</mi></mrow>
<mo>)</mo></mrow>
</math>";
test_ClearSpeak(
"de",
"ClearSpeak_Paren",
"Interval",
expr,
"das Intervall negative unendlich bis d, nicht einschließlich d",
)
}

#[test]
fn interval_negative_infinity_to_closed_endpoint() -> Result<()> {
let expr = "<math>
<mrow><mo>(</mo>
<mrow><mo>-</mo><mi>∞</mi><mo>,</mo><mi>d</mi></mrow>
<mo>]</mo></mrow>
</math>";
test_ClearSpeak(
"de",
"ClearSpeak_Paren",
"Interval",
expr,
"das Intervall negative unendlich bis d, einschließlich d",
)
}

#[test]
fn interval_open_endpoint_to_infinity() -> Result<()> {
let expr = "<math>
<mrow><mo>(</mo>
<mrow><mi>c</mi><mo>,</mo><mi>∞</mi></mrow>
<mo>)</mo></mrow>
</math>";
test_ClearSpeak(
"de",
"ClearSpeak_Paren",
"Interval",
expr,
"das Intervall c bis unendlich, nicht einschließlich c",
)
}

#[test]
fn interval_closed_endpoint_to_infinity() -> Result<()> {
let expr = "<math>
<mrow><mo>[</mo>
<mrow><mi>c</mi><mo>,</mo><mi>∞</mi></mrow>
<mo>)</mo></mrow>
</math>";
test_ClearSpeak(
"de",
"ClearSpeak_Paren",
"Interval",
expr,
"das Intervall c bis unendlich, einschließlich c",
)
}

#[test]
fn interval_between_infinities_has_no_endpoint_qualifier() -> Result<()> {
let expr = "<math>
<mrow><mo>(</mo>
<mrow><mo>-</mo><mi>∞</mi><mo>,</mo><mi>∞</mi></mrow>
<mo>)</mo></mrow>
</math>";
test_ClearSpeak(
"de",
"ClearSpeak_Paren",
"Interval",
expr,
"das Intervall negative unendlich bis unendlich",
)
}
Loading