-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restrict interval intent inference -- avoid nested "interval"s. Fixes #…
…329 As part of this, I've added a new file to test intent inferences.
- Loading branch information
Showing
4 changed files
with
142 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/// Tests for: | ||
/// * functions including trig functions, logs, and functions to powers | ||
/// * implied times/functional call and explicit times/function call | ||
/// * parens | ||
/// These are all intertwined, so they are in one file | ||
use crate::common::*; | ||
|
||
#[test] | ||
fn binomial() { | ||
let mathml = "<math><mrow intent='binomial($n, $m)'> | ||
<mo>(</mo> | ||
<mfrac linethickness='0'> <mn arg='n'>7</mn> <mn arg='m'>3</mn> </mfrac> | ||
<mo>)</mo> | ||
</mrow></math>"; | ||
let intent = "<math data-from-mathml='math'> | ||
<binomial> | ||
<mn data-from-mathml='mn' arg='n'>7</mn> | ||
<mn data-from-mathml='mn' arg='m'>3</mn> | ||
</binomial> | ||
</math>"; | ||
test_intent(mathml, intent, vec![]); | ||
} | ||
|
||
#[test] | ||
fn closed_interval() { | ||
let expr = r#"<math> | ||
<mo stretchy="false">[</mo> | ||
<mi>a</mi> | ||
<mo>,</mo> | ||
<mi>b</mi> | ||
<mo stretchy="false">]</mo> | ||
</math>"#; | ||
let target = "<math data-from-mathml='math'> | ||
<closed-interval data-from-mathml='mrow' data-changed='added'> | ||
<mi data-from-mathml='mi'>a</mi> | ||
<mi data-from-mathml='mi'>b</mi> | ||
</closed-interval> | ||
</math>"; | ||
test_intent(expr, target, vec![]); | ||
} | ||
|
||
#[test] | ||
fn nested_interval_bug_329() { | ||
let expr = r#"<math> | ||
<mo stretchy="false">[</mo> | ||
<mi>A</mi> | ||
<mo>,</mo> | ||
<mo stretchy="false">[</mo> | ||
<mi>B</mi> | ||
<mo>,</mo> | ||
<mi>C</mi> | ||
<mo stretchy="false">]</mo> | ||
<mo stretchy="false">]</mo> | ||
</math>"#; | ||
let target = "<math data-from-mathml='math'> | ||
<mrow data-from-mathml='mrow' data-changed='added'> | ||
<mo data-from-mathml='mo' stretchy='false'>[</mo> | ||
<mrow data-from-mathml='mrow' data-changed='added'> | ||
<mi data-from-mathml='mi'>A</mi> | ||
<mo data-from-mathml='mo'>,</mo> | ||
<mrow data-from-mathml='mrow' data-changed='added'> | ||
<mo data-from-mathml='mo' stretchy='false'>[</mo> | ||
<mrow data-from-mathml='mrow' data-changed='added'> | ||
<mi data-from-mathml='mi'>B</mi> | ||
<mo data-from-mathml='mo'>,</mo> | ||
<mi data-from-mathml='mi'>C</mi> | ||
</mrow> | ||
<mo data-from-mathml='mo' stretchy='false'>]</mo> | ||
</mrow> | ||
</mrow> | ||
<mo data-from-mathml='mo' stretchy='false'>]</mo> | ||
</mrow> | ||
</math>"; | ||
test_intent(expr, target, vec![]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
mod common; | ||
|
||
mod Languages { | ||
mod intent; | ||
mod zh; | ||
mod en; | ||
mod fi; | ||
|