Closed brichwin closed 2 years ago
I think you made a mistake pasting in the MathML. It's not content MathML and when I try it, there is no problem in either https://nsoiffer.github.io/MathCATDemo/ (which is V0.1.22) or on my current version of MathCAT.
I'm not surprised that MathCAT would do poorly with content MathML. On my todo list is to do something about illegal MathML (wrong elements).
Can you retry with the content MathML you used.
Thanks,
Neil
On Wed, Jun 8, 2022 at 1:12 PM Brian Richwine @.***> wrote:
For fun, I fed some content MathML to MathCat 0.1.23 and got an expected error from get_spoken_text() but received an Ok result and gibberish braille instead of an expected error from get_braille("".to_string()):
u⠼k⠼ow⠼⠐ath⠐lele⠐e⠼tapplyu⠼k⠼ow⠼⠐ath⠐lele⠐e⠼teqe⠐ptyu⠼k⠼ow⠼⠐ath⠐lele⠐e⠼tciu⠼k⠼ow⠼⠐ath⠐lele⠐e⠼t⠐atrixu⠼k⠼ow⠼⠐ath⠐lele⠐e⠼t⠐atrixrowe⠐ptyu⠼k⠼ow⠼⠐ath⠐lele⠐e⠼tcie⠐ptyu⠼k⠼ow⠼⠐ath⠐lele⠐e⠼tciu⠼k⠼ow⠼⠐ath⠐lele⠐e⠼t⠐atrixrowe⠐ptyu⠼k⠼ow⠼⠐ath⠐lele⠐e⠼tcie⠐ptyu⠼k⠼ow⠼⠐ath⠐lele⠐e⠼tci
The MathML was:
— Reply to this email directly, view it on GitHub https://github.com/NSoiffer/MathCAT/issues/39, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALZM3GMPCRR3KW6NTR7HSTVOD5D7ANCNFSM5YHXSZZQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Oh, yes. Sorry - That is the wrong MathML. Here is what I had used:
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
<apply>
<eq />
<ci>A</ci>
<matrix>
<matrixrow>
<ci>x</ci>
<ci>y</ci>
</matrixrow>
<matrixrow>
<ci>z</ci>
<ci>w</ci>
</matrixrow>
</matrix>
</apply>
</mrow>
</math>
For my testing, I modified the main.rs included in the repo so I could pass MathML as an argument and then get a JSON result back. I then called the mathcat.exe file from node.js. It's inefficient, but was a quick way for me to do testing. In case it matters, the main.rs I used was:
// *** MathCAT doesn't normally want to build a binary ***
// *** This file is here because it is useful for trying out things ***
fn main() {
use libmathcat::interface::*;
use std::env;
let args: Vec<String> = env::args().collect();
let expr = &args[1];
let rules_dir = std::env::current_exe().unwrap().parent().unwrap().join("./Rules");
let rules_dir = rules_dir.as_os_str().to_str().unwrap().to_string();
if let Err(e) = set_rules_dir(rules_dir) {
panic!("Error: exiting -- {}", errors_to_string(&e)); }
if let Err(e) = set_mathml(expr.to_string()) {
panic!("Error: exiting -- {}", errors_to_string(&e));
};
// println!("Version = '{}'", get_version());
set_preference("TTS".to_string(), "none".to_string()).unwrap();
// set_preference("Bookmark".to_string(), "true".to_string()).unwrap();
set_preference("SpeechStyle".to_string(), "ClearSpeak".to_string()).unwrap();
let mut json_string = String::new();
json_string.push_str("{ clearspeak:'");
match get_spoken_text() {
Ok(speech) => json_string.push_str(&speech),
Err(e) => json_string.push_str("ERROR"),
}
json_string.push_str("', braille:'");
set_preference("BrailleCode".to_string(), "Nemeth".to_string()).unwrap();
match get_braille("".to_string()) {
Ok(braille) => json_string.push_str(&braille),
Err(e) => json_string.push_str("ERROR"),
}
json_string.push_str("'}");
println!("{}", json_string);
}
I'm wavering back and forth between:
Any preference?
'1' is unfriendly to users but better in many cases (I think) for programs that call MathCAT. '2' might result in somewhat bizarre, but '3' is pretty disruptive.
I went with '1' (an error if not valid presentation MathML)
For fun, I fed some content MathML to MathCat 0.1.23 and got an expected error from
get_spoken_text()
but received an Ok result and gibberish braille instead of an expected error fromget_braille("".to_string())
:The MathML was: