intent_function_glue_before in src/infer_intent.rs returns a hardcoded
English "of" for the last argument of an arity template:
https://github.com/daisy/MathCAT/blob/main/src/infer_intent.rs#L316-L330
// words has arg_count-1 entries for args 1..arg_count-1; last arg is preceded by "of"
if arg_index == arg_count {
return "of".to_string();
}
So any non-English language that adopts the arity-template form gets an English
word in the middle of its output. Measured in Polish with
"sum": "function=suma | po | od,do":
spoken: suma po i of x
expected: suma po i, x (or whatever the language's "of" equivalent is)
The binary-separator form (a single | option, e.g. | divided by) is not
affected, because the separator word itself comes from definitions.yaml.
Consequence today: a translator who follows the documented syntax gets a broken
result, and the working alternative is to not use arity templates. That is what
hu does — "sum": "function=összeg" with no template — and what I ended up
doing for pl in #738 rather than shipping mixed-language speech.
A fix would presumably read the word from the language's rule files, the same way
IntentFunctionArgSeparator resolves comma. I have not attempted it, since it
touches the engine rather than a translation, and I would rather not guess at the
intended design here.
Happy to test a fix against the Polish rules if that is useful.
intent_function_glue_beforeinsrc/infer_intent.rsreturns a hardcodedEnglish
"of"for the last argument of an arity template:https://github.com/daisy/MathCAT/blob/main/src/infer_intent.rs#L316-L330
So any non-English language that adopts the arity-template form gets an English
word in the middle of its output. Measured in Polish with
"sum": "function=suma | po | od,do":The binary-separator form (a single
|option, e.g.| divided by) is notaffected, because the separator word itself comes from
definitions.yaml.Consequence today: a translator who follows the documented syntax gets a broken
result, and the working alternative is to not use arity templates. That is what
hudoes —"sum": "function=összeg"with no template — and what I ended updoing for
plin #738 rather than shipping mixed-language speech.A fix would presumably read the word from the language's rule files, the same way
IntentFunctionArgSeparatorresolvescomma. I have not attempted it, since ittouches the engine rather than a translation, and I would rather not guess at the
intended design here.
Happy to test a fix against the Polish rules if that is useful.