Re: intents and defaults and structure

On 14/06/2021 13:45, Deyan Ginev wrote:
> Hi Neil, all,
>
> I assume by "operator dictionary" you're referring to:
> https://www.w3.org/TR/MathML3/appendixc.html
>
> These indeed induce one grammar for math syntax. It is hard to
> understand *which* grammar that is. Is there some testbed of supported
> expressions/notations that it is expected to cover? Math grammars are
> quite hard to develop and maintain, so I would be a bit anxious of
> adopting one "officially" without a good plan.
>
> To draw a random example from the operator dictionary, I saw % is
> marked as infix with priority 640. But in the expression "15% x = 10",
> it is meant to be read "fifteen percent of x equals to ten". And not
> "fifteen modulo x equals ten", as in programming languages, which may
> have been the reason behind choosing the infix form. Consider also the
> standalone "0.15 = 15%" and "15% = 150‰", to illustrate it's really
> postfix when intending "percent" - which is the usual meaning in K-14
> materials.


Note that the form attribute (the green columns) there is part of the 
_input matching_ so that is telling you if you have an infix % then it 
should get 3mu spacing either side.

If the % is not in infix position then it tells you nothing so "0.15 = 
15%" for example. Also if  15% x =10 were marked up with enough mrows so 
<mrow>15%</mrow>... the % would end up in postfix position and get no 
additional space.  Of course the issue that generators don't always add 
enough mrows complicates things, but I wanted to clarify that the 
operator dictionary entry is specifying how to space an infix % not 
saying that % should be infix.



>
> So rather than it being a silver bullet, I think the operator
> dictionary may need some vetting and reconsideration.


Oh sure yes every time we look at that we change something

>   The way I see
> it, we would also have a much easier time if we do not standardize an
> entire grammar, just because that's the highest difficulty task we can
> set for ourselves. It is, in my experience, much harder to get right
> than assembling long lists of concept names and notation forms.
>
> If I read you correctly, you agree that whichever way we enrich/infer
> the mrows, we need to decide on a list of intents that will be
> expected as default remediation. I think we have some clear common
> agreement here, also with Sam's document that started fleshing these
> out as examples
> (https://mathml-refresh.github.io/discussion-papers/intent). For
> example, if the exclamation mark (!) is intended to be remediated as
> the "factorial" by default, that has to be made explicit, as well as
> the notation where that intent is activated.



Yes the operator dictionary lists ! as postfix with a high priority 
which formally only tells you what to do if it is last in its mrow.  You 
also want to infer that ! is postfix even if there are no mrows and you 
just have 3!+2!=8 but the operator dictionary in mathml3 doesn't really 
tell you that, although the priorities together with the grouping rule at

https://www.w3.org/TR/MathML3/chapter3.html#id.3.3.1.3.2


does tell you that the generator should have added more mrow and not 
left ! and + at the same level.

>
> On my end, I would offer we (try to) create something new that is very
> narrowly described and scoped. Say by listing all mathematical
> notations we have encountered, and then cherry-picking (and creating
> tests for) notations we want recognized by default, from a pragmatic
> mathematical standpoint. One working definition may be "standard
> notations in K-14 education that have no mutual overlap". And my
> instinct is that if we end up with very small and usable defaults,
> they will be easier to both test against and apply in practice. But we
> also need to develop them to a degree where the defaults meet "natural
> expectation", which is a tension in the opposite direction of
> simplicity. To achieve all of that, I resonated quite strongly with
> Brian's suggestion during our last meeting - we ought to do a couple
> of iterations of concept validation coding and demos and develop a
> test suite. There's a real risk of making a readout worse if the
> defaults are more often wrong than correct, and our best bet to avoid
> that is actually check how they work on the materials we intend them
> for, before we release them to the world.


This sounds like a good plan....

>
> I also welcome more discussion, thanks for starting one!
>
> Greetings,
> Deyan
>
>
>
> Deyan
>
> On Sun, Jun 13, 2021 at 6:09 PM Neil Soiffer <soiffer@alum.mit.edu> wrote:
>> I'm writing this email to get some discussion going outside of the meetings. Deyan is also working on this and is working on his own reasoning on this topic. The topic we have started to discuss in the meetings is MathML structure and how that might or might not work well with intents, especially for defaults.
>>
>> First off, if an intent is given, there is no ambiguity for the part of the structure given by the intent and the current proposal(s) make no requirements on MathML structure other than it be valid MathML. That doesn't mean that other parts of the structure (e.g, the arg="..." parts) are unambiguous. But it does mean that any software trying to come up with a "meaning" for speech (or otherwise) should not break a stated intent.
>>
>> The question we have begun to explore is what can we state about a default in the absence of explicit intents.
>>
>> Why do we care about defaults?
>> To me, a big advantage of using intent over some alternatives like parallel markup is that using "intent" can support progressive enhancement. If we come up with some defaults, then authors only need to use 'intent' when the defaults aren't correct. So if we can figure out reasonable defaults, we can minimize the content that needs work/remediation so that it can be spoken unambiguously. Additionally, rather than require MathML generators change to use parallel markup or some other output, current output remains valid although it may not unambiguously represent author intent. The extent to which it can be disambiguated is tied to how much context is used to make the defaults. It will never be perfect without author's helping out though.
>>
>> My Two Cents
>> Since this message is to provoke discussion and is not meant to be a fleshed out proposal (it's very long as it is), I'll just state my current thoughts and add a little rationale to them, but not get into the details....
>>
>> My feeling is that defaults should be based on a canonical parse of the MathML expression that is defined by the operator dictionary and as overridden by any attrs on the <mo> elements. This does not mean that MathML that uses "flat" mrows doesn't have a default, it just means that when parsed, it will have whatever defaults we end up giving. As an example, if an mrow has "a", "+", "5", "!" as direct children, a default for factorial would be used because the canonical form given by the operator dictionary would group the "5" and "!" in a single mrow and that would match a factorial default.
>>
>> By mapping expressions to a canonical parse, we can write defaults in a relatively simple manner and not require MathML writers to generate a specific representation (something Deyan's post shows doesn't happen now). It doesn't even require software that wants to apply a default to do the parse, although I think supporting all the various ways of representing a default a default would be hard without parsing. Currently the more sophisticated speech renderers do parse the input to infer intent, so using defaults fit naturally into those speech renderers.
>>
>> One thing the operator dictionary does not solve is operand/operand conflict (horizontal juxtaposition of operands). Typically these are either meant to be function call or multiplication (or more precisely, a multiplication-like operation), but it could be an implied plus for mixed fractions or an implied comma in something like M_{11}. How this is specified will determine a canonical parse for those cases.
>>
>> Another area of concern is mixing n-ary operators. We've discussed how +/- might parse, along with how a series of relational operators should be given/thought about. I think they should be flat, but reasonable people differ. Clearly something that needs further discussion before defaults can be written for them.
>>
>> A final area of concern is matching open/close fences. The operator dictionary has all of the fences with the same priority and I think it makes sense that a "[" can match against a ")" to form an mrow, but there might be some subtle issues that make this a poor default. Note that the French interval notation "]0, (" will not form the intended mrow structure without the author overriding the "form" for the brackets; if overridden it will parse intuitively and a default could be written for that notation.
>>
>> Hopefully some food for thought and that this will provoke some discussion outside of the meetings.
>>
>>      Neil
>>
>>
>>

Disclaimer

The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is:
30 St. Giles, Oxford, OX1 3LE, United Kingdom.

This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business. 

Received on Tuesday, 15 June 2021 13:14:09 UTC