-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intent Properties: ordering & references #449
Comments
some possible answers
|
A single example that exhibits all questions in the original description appears to be: <mrow intent="$op:prefix($x,$y)">
<mi arg="x">x</mi>
<mo arg="op" intent=":infix:postfix">+</mo>
<mi arg="y">y</mi>
</mrow> |
so I think that example should act like
after that everything is system specific but possibly it starts on the
|
@davidcarlisle: I'm confused by your example. Where does the "plus" come from? Are you saying the system should process the reference item and then lift the processed item? In MathCAT, after a few iterations, I ended up doing the opposite: I converted a literal head into what MathCAT will treat it as. A reference (that isn't a further reference), is then treated as if it is lifted and replaces the reference (this behavior is in the templated string implementation in MathCAT). So `intent='foo:prefix(x)' becomes
If we start with
the arguments just get replaced so the result is
This implementation is making choices about multiple properties: the parent properties are being used and the child ones are ignored at the parent level. It is left on the child to use when processing the child. MathCAT could have lifted the intent to get the property Note: |
@NSoiffer Deep in #446, you had a nice rationalization for why outer properties should override inner ones: #446 (comment); basically that outer So, in @dginev example
the effective If it's the "+" vs "plus" that bothers you, think of the intent as |
I am still not seeing why you put the outer property first ,ie in the middle?
so
But I suspect it's different ways to say same thing as
I get the same conclusion by a different route.
Yes that's why I used |
Ah, I see: So the argument "outer dominates inner" seems convincing enough, perhaps. But for listed properties of a single element, does first or last dominate? I'm not sure I have a preference at this point, but you're right: the choice affects how we assemble an "effective" ordered property list. |
It seems Bruce feel order matters and that in fact, the order is left-to-right. Is that correct? I don't think David has indicated an order preference since he is using brackets to group the substitution. However given the statement "it's different ways to say same thing", maybe he is? Also, for this example, there is an assumption that "plus" is what is said for I'm seeing a lot of complication from the way at least David thinks this should be used (content being sucked into intent). Maybe I'm missing something. Can one of you write out an algorithm how you think this should work? |
There are two parts to the property ordering question: (1) Does outer or inner properties take precedence? (2) for multiple properties on a single element, does the first or last take precedence? To my tastes, either outer+first or inner+last are more consistent with tree traversal, so those combinations feel natural to me and are easiest to think about. At least for me. For either of those cases, when you synthesize the effective properties for the "+", you get As for the second question, the reference
(or something equally perverse). |
It would definitely help to have a real life example. Here's something closer, but still made up (although probably something similar would be in arXiv)
Here you might expect "positive a". But if I were to write it, I wouldn't reference the Under what I propose should happen, this would get rewritten as
I'm still not clear on what David is proposing other than you end up with intent and not MathML and then the intent is spoken somehow. Maybe after a hearty English dinner, he'll be ready to tackle this :-) |
despite seeing it in action in mathcat traces I still find the description of intent as generated mathml somewhat unintuitive. If we view intent as "generating speech" I see the speech string from If a referenced arg has an intent that is used for its speech string One way to formulate the above is to say the default intent of an mo is its content (which does not mean that default has to be legal as an explicit value) If we do describe intent in terms of constructing an intent-free mathml element tree, I certainly need to change my mental model. Where would this tree live, would that be the accessibility tree generated for this fragment of the document? |
Maybe I'm too stuck with the implementation vision I have, but I see intent as a key for how to speak a string, not what to speak unless it is a literal. So Part of the problem we have is that the examples so far for Do we have an example where |
I'd agree with all that, but I (could) phrase it as saying if the referenced element is a token element with no
by "template" here you mean a fragment of mathml?
see https://mathml-refresh.github.io/intent-lists/intent4.html#IDxtransposepre-sup |
@NSoiffer mathcat has several ways of reading by column: by line: by row: by case: by equation I don't think it currently works but I'd like to be able to use a table style property hint like the fixity hints so for exmple
would give the "by cases" reading above even if mathcat would not have picked that from the current context. If I then use I currently think I mean "slot in the cases-reading of the table at this point" I think you are saying you are not generating string but a shadow mathml fragment and it should mean drop in some mathml constructed with |
The whole ordering issue is a bit of a corner case, so it's hard to come up with compelling cases; but @davidcarlisle 's cases example is a good one. I think of a reference as both a reference to the element it points to, and which will be replaced by the speech generated by formatting that element into speech, in the context of any properties assigned to the reference. Of course, any properties given in the referenced element will also play a role in the generated speech, but @davidcarlisle example shows why the outer properties should dominate the inner ones. Although it may be perfectly reasonable to implement intent by rewriting the MathML tree (although I'd expect lots of flat |
My implementation intuition for the small example would be: <mrow intent="$op:prefix($x,$y)">
<mi arg="x">x</mi>
<mo arg="op" intent=":infix:postfix">+</mo>
<mi arg="y">y</mi>
</mrow>
Leaving us with the final "fully expanded" intent:
To try and summarize this intuition, it would be: |
I pretty much agree with @dginev outline with one or two exceptions, provided you clarify that the AST represents the expanded intent (not the speech, which confused me on the first couple of readings). I think that if outer properties win (which they should), then the first horizontal property should win. This is not from any compelling usecase perspective, but to have a conceptually simple principle that "first property wins". If you do a tree traversal, when you get to the content of The "may depend on local context" seems counter-intuitive, since a reference effectively plucks the element out of it's existing context and puts it into a new one (Hence @NSoiffer perspective that this is a rearrangement of the MathML tree). |
Right, apologies if that was left unclear.
I see. I was viewing them as "metadata assignments" with implementer eyes. And using the intuition of "the last assignment wins". In the steps above the outer property is attached after the inner one is assembled, so it is "last", hence it wins. If the horizontal properties follow the left-to-right convention, the rightmost is last. For But I can get used to either. I can even get used to that being undefined behavior / an error.
Sure, but there is no "plucking out", there is a partial parallel AST for intent. The Presentation tree is still there, and still completely sufficient for a sighted reader to understand the notations. Hence its local context is also meaningful. Note that the example is in
Right, the |
that wasn't my intention: I think you should be able to expand first either expanding as a literal (possiby extended) intent attribute or,as you say an AST of the function tree from the intent. What I don't still really understand despite watching mathcat in action is viewing intent as a rewrite of the mathml tree. |
Re: I was viewing them as "metadata assignments" That's exactly where I started out! Until various examples from @NSoiffer and @davidcarlisle convinced me that outer should dominate. And then, looking at the tree made me prefer the first on horizontal lists, otherwise it's too back-and-forthy. |
A shared intuition! Too rare to miss out on :>
Depending on how the reference expansion is implemented, the outer dominating overlaps the "last assignment" justification - I tried to walk through one way of realizing that.
No back-and-forthiness in my walk-through at least. Just keep assigning, whatever gets done last, sticks. |
There's "virtual" plucking out, and the implementation could be in terms of a "virtual" AST, so the conversion to speech of could already be done at the time You say "local context is also meaningful", but that seems wrong to me. Can you think of a use case where that would be so? |
But you've built in the assumption of the order of traversal, which seems an implementation detail. My intuition was from looking at the tree. Or, since the topic is accessibility, if the tree was being read out literally. And in those cases it's very back-and-forthy. |
Ah, well, the current issue is actually raising a valid point - once we allow multiple properties on the same intent value, the order of traversal and the exact steps in which references get expanded and filled in within the outer intent expression - are no longer an implementation detail, but need to be specified. Even if we specify them as "conflicting properties are an error, don't do that" |
Right, we do have to specify the precedence of properties, although I'm not so sure we have to specify the exact steps. I'm just saying we should make that choice based on what will be less confusing to users, rather than implementation assumptions. |
Treating "conflicting properties" as "errors" would be least confusing to users, since it will reduce the cognitive load of the spec. |
Ah, you mean that "It didn't do what I expected" is better than "It didn't do what I expected"? Yeah. ("That was a Joke, son! I say, That was a Joke!" Foghorn Leghorn) |
Re: an example for "local context is meaningful" From examples I have looked at, this comes into play where we mix-and-match nodes with intent, and nodes without (i.e. Having said that, and observing that Say positive charge postfix and superfix notations: <mrow intent="$op:prefix($arg)">
<mn arg="arg">1</mn>
<mo arg="op">+</mo>
</mrow> <msup intent="$op:prefix($arg)">
<mi arg="arg">K</mi>
<mo arg="op">+</mo>
</msup> If a hypothetical Edit: There is an unrelated curveball hidden in my examples here, which touches on language generation. Some (but not all) concepts have adverbial forms, and a |
So, I don't quite see what's expected in this mix-and-match situation. You have an apparently postfix "+", but you say to treat it as prefix. And then you have a hypothetical ChemistCAT which presumably has a rule for postfix "+", which says |
This issue is meant to pull together some threads on how properties are handled, whether there is an order, and what happens if there is a conflict. Any other conceptual issues related to properties are also appropriate here. Their syntax is part of #448.
I am probably missing some issues raised elsewhere (#446, ???), but here's a starting list:
It would be good to ground some of these examples with real life cases. Hopefully people can generate some.
The text was updated successfully, but these errors were encountered: