Does one rendering have multiple MathML expressions? - mathml

I am currently working on mathematical expression recognition. I am going through the CROHME dataset and found this:
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mi xml:id="y_1">y</mi>
<mrow>
<mo xml:id="=_1">=</mo>
<mrow>
<mi xml:id="A_1">A</mi>
<mrow>
<mi xml:id="x_1">x</mi>
<mrow>
<mo xml:id="+_1">+</mo>
<msup>
<mi xml:id="A_2">A</mi>
<mn xml:id="2_1">2</mn>
</msup>
</mrow>
</mrow>
</mrow>
</mrow>
</mrow>
</math>
which renders to (with http://www.mathmlcentral.com/Tools/FromMathML.jsp)
The application of mrow seems rather arbitrary to me. Isn't this expression semantically identical to
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mi xml:id="y_1">y</mi>
<mo xml:id="=_1">=</mo>
<mi xml:id="A_1">A</mi>
<mi xml:id="x_1">x</mi>
<mo xml:id="+_1">+</mo>
<msup>
<mi xml:id="A_2">A</mi>
<mn xml:id="2_1">2</mn>
</msup>
</mrow>
</math>
or
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<mi xml:id="y_1">y</mi>
<mo xml:id="=_1">=</mo>
<mrow>
<mi xml:id="A_1">A</mi>
<mi xml:id="x_1">x</mi>
</mrow>
<mo xml:id="+_1">+</mo>
<msup>
<mi xml:id="A_2">A</mi>
<mn xml:id="2_1">2</mn>
</msup>
</mrow>
</math>
What is the difference between those three MathML expressions? Should they all render to the same?

mrow exists to allow long expressions inside elements/tags that can one have a limited number of children. For example, the square root of "x + y" must be write as
<math>
<msqrt>
<mrow>
<mi>x</mi>
<mo>+</mo>
<mi>y</mi>
</mrow>
</msqrt>
</math>
Rendering software must render
<math>
<mi>x</mi>
</math>
and
<math>
<mrow>
<mi>x</mi>
</mrow>
</math>
in the same way.
Backing to your question,
Isn't this expression semantically identical
we are talking about presentation MathML so don't make sense talk about semantic.
What is the difference between those three MathML expressions?
The difference is the MathML tree of the expressions. If you are going to process the expression by some software it can make some assumptions based on MathML tree and have different behaviors based on it.
Should they all render to the same?
Yes.

Related

Error "...FQTV DATA NOT SUPPORTED.." to Add Frequent Flyer Using PassengerDetailsRQ

I would like to add a frequent flyer using PassengerDetails as follow...
<PassengerDetailsRQ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.0.0">
<PostProcessing RedisplayReservation="true" xmlns="http://webservices.sabre.com/sabreXML/2011/10">
<EndTransactionRQ>
<EndTransaction Ind="true" />
<Source ReceivedFrom="AddingFF" />
</EndTransactionRQ>
</PostProcessing>
<PreProcessing xmlns="http://webservices.sabre.com/sabreXML/2011/10">
<UniqueID ID="XXXXXX" />
</PreProcessing>
<SpecialReqDetails xmlns="http://webservices.sabre.com/sabreXML/2011/10" />
<TravelItineraryAddInfoRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10">
<CustomerInfo>
<CustLoyalty MembershipID="123456789" NameNumber="1.1" ProgramID="AV" SegmentNumber="1" />
</CustomerInfo>
</TravelItineraryAddInfoRQ>
</PassengerDetailsRQ>
But in the response, I received this error
.SEGMENT SPECIFIC FQTV DATA NOT SUPPORTED FOR THESE AIRLINES
However, I looked the list (command PT*) and it has the airline AV.
So, I didn't understand that error.
Does anybody got this error?
And other question, what does FQTV mean?
Without the complete information is hard to give a complete response, for which you might want to check with the helpdesk.
Anyway, you might need to put the carrier the person is actually traveling by adding TravelingCarrierCode="YY"
<CustLoyalty MembershipID="123456789" NameNumber="1.1" ProgramID="AV" SegmentNumber="1" TravelingCarrierCode="YY"/>
Regarding your FQTV question, it means Frequent Traveler
Issue solved.
In this case, the problem was the segment number.
I can't send it for any cias.
To solve my problem I just needed to send the request without the segment number attribute.
To know if it is necessary to send the segment number or not just execute the following command PT*{cia} (PT*AV).
Example to cia AV:
PT*AV
FQTV PARTICIPATING AIRLINE EXCHANGE/PARTNERSHIP AGREEMENTS
----------------------------------------------------------
USE. FF(OC)(FF NUMBER)/(RC)-N.N TO TRANSMIT FLIGHT INFO
OC-OWNING RC-RECEIVING
CARRIER CARRIER
/*/ SEGMENT SPECIFIC ALLOWED
AV-134 AVIANCA
ACCEPTS FF ACCOUNT NUMBERS IN THE PROGRAMS LISTED
AC AI AM AV A3* BR CA CM ET* IB* LH LR* NH*
NZ* OS OZ SA* SK SQ* TA* TG* TK* TP UA

<itunes:duration> wrong on RSS feed created by Jekyll

I have a Jekyll site that I have a podcast feed that I created.
---
---
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="http://mikewills.me/rss-podcast.xml" rel="self" type="application/rss+xml" />
<title>{{ site.name }}</title>
<description>{{ site.description }}</description>
<link>{{ site.url }}</link>
{% for post in site.categories.podcast limit:15 %}
<item>
<title>{{ post.title }}</title>
<description>
<![CDATA[
{{ post.content | xml_escape }}
]]>
</description>
<pubDate>{{ post.date | date: "%a, %d %b %Y %H:%M:%S %z" }}</pubDate>
<link>{{ site.url }}{{ post.url }}</link>
<guid isPermaLink="true">{{ site.url }}{{ post.url }}</guid>
{% if post.podcasturl %}<enclosure url="{{ post.podcasturl }}" length="{{ post.podcastsize }}" type="{{ post.podcasttype }}" />{% endif %}
</item>
{% endfor %}
</channel>
</rss>
Everything else works except for the <itunes:duration> tag. When I enter in podcastlength: 2:07 it outputs as <itunes:duration>127.0</itunes:duration>. Based on what I have researched, this is how everyone else is outputting the length. For some reason Jekyll seems to be breaking that down to seconds instead of 2 minutes and 7 seconds. What might I be doing wrong here?
If you are interested, full RSS source is here and an example post is here.
Hey from the far future.
I ran in to exactly this issue last week. Spotify reached out to me explaning i had somehow managed to get a decimal number (instead of a time-stamp) in my podcast feed.
Hey I had this exact issue!
In my post.markdown file I had written:
audio_mp3_duration: 35:56
---
The fun thing with the liquid programming language here is that it will somehow try to calculate the above, so I had to specifically wrap my string like so:
audio_mp3_duration: '43:01'
---
Turns out it was this exact problem ;)
What #Julien Genestoux suggested worked.
"What if you put commas around "2.07" to force Jekyll to think of it as a string and hence not convert it? – Julien Genestoux Jul 30 at 13:31"
The <itunes:duration> tag must contain data in this format:
HH:MM:SS
therefore, in your specific case, 2 minutes and 7 seconds should be
<itunes:duration>2:07</itunes:duration>
See also the official podcast specs by Apple.
In case Jekyll doesn't convert the duration to the proper format, it could be a bug and you should notify the developers.

Source port with default fallback value?

I have an XProc step where I would like the input source to work like this:
if a URL is provided on the command line using -isource=foo.xml, then the document at that URL is used as the source document;
if no URL is provided, then the document default.xml should be used.
Is it possible to obtain this behaviour in XProc?
As suggested by Florent on the XProc mailing list, using a p:document inside the p:input works just fine as a default. Specifying something else from outside simply overrides it:
<p:declare-step version="1.0" xmlns:p="http://www.w3.org/ns/xproc"
name="main">
<p:input port="source">
<p:document href="default.xml"/>
</p:input>
<p:output port="result"/>
<p:identity/>
</p:declare-step>
Run it with:
calabash test.xpl
and:
calabash --input source=myinput.xml test.xpl
to see the difference..
HTH!

Syntax for the Region tag in KML

I have several hundred placemarks that are all in one folder. I'm trying to make the labels appear only below a certain altitude. (The placemarks were created by exporting a layer from ArcGIS, and I presume that the altitude should be specified in the units used by the coordinate system of the layer, in this case, in feet; correct me if I'm wrong.) However, nothing I do with the <Region> tag seems to work; the labels happily appear at all altitudes. Here is the code that I'm using; can anyone tell what is wrong with it?
<Document id="DocumentName">
<name>NameGoesHere</name>
<Snippet></Snippet>
<Folder id="NameOfTheFolder">
<name>NameGoesHere</name>
<Region id="highAltitude">
<LatLonAltBox>
<north>40</north>
<south>37</south>
<east>-74</east>
<west>-79</west>
<minAltitude>50000</minAltitude>
<maxAltitude>500000</maxAltitude>
</LatLonAltBox>
<LabelStyle id="styleNameHere">
<scale>0</scale>
</LabelStyle>
</Region>
<Snippet></Snippet>
...
<placemark> ... </placemark>
<placemark> ... </placemark>
<placemark> ... </placemark>
...
</Folder>
</Document>
The point of all this code is to suppress labels at altitudes above 50,000 feet, but it does nothing of the sort. Toward the end of the code, after the </Folder> tag but before the </Document> tag, there is some code, generated when the file was exported, that specifies label styles. But whether or not I delete the <scale> part of it, it seems to have no effect. That code is as follows:
<Style id="Stylename">
<IconStyle>
...
</IconStyle>
<LabelStyle>
<color> ... </color>
<scale> ... </scale>
</LabelStyle>
<PolyStyle>
...
</PolyStyle>
</Style>
I suspect that I'm doing something wrong here in terms of syntax, but, because I've had no experience with KML at all until a few days ago, I'm not sure what the issue is. I appreciate any ideas as to why this isn't working.
You need to define the Lod (Level of Detail) in the Region otherwise it will always appear.
<Region id="highAltitude">
<LatLonAltBox>
...
</LatLonAltBox>
<Lod>
<minLodPixels>256</minLodPixels>
</Lod>
<Region>
The minLodPixels defines the size of the region where if it is less than this minimum number of pixels on the screen then the region is not shown.
https://developers.google.com/kml/documentation/kmlreference#lod
Also, the LabelStyle is not valid within the Region. That must appear in a <Style> element. If KML doesn't behave as you'd expect 9 out of 10 times the syntax is wrong -- try to validate it using a KML validator.

How to display user text automatically according to its natural direction

I want to support the display of user inputted text in Unicode according to its general direction instead of the default left-to-right direction. For example, in the Arabic text below, the English word (4th) appears to be split apart:
اُردو کا بعض اوقات ہندی کے ساتھ موازنہ کیا جاتا ہے. اُردو اور ہندی میں بُنیادی فرق یہ ہے کہ اُردو نستعلیق رسم الخط میں لکھی جاتی ہے اور عربی و فارسی الفاظ استعمال کرتی ہے. جبکہ ہندی دیوناگری رسم الخط میں لکھی جاتی ہے اور سنسکرت الفاظ زیادہ استعمال کرتی ہے. کچھ ماہرینِ لسانیات اُردو اور ہندی کو ایک ہی زبان کی دو معیاری صورتیں گردانتے ہیں. تاہم، دوسرے اِن کو معاش اللسانی تفرّقات کی بنیاد پر الگ سمجھتے ہیں۔ بلکہ حقیقت یہ ہے کہ ہندی ، اُردو سے نکلی۔اسی طرح اگر اردو اور ھندی زبان کو ایک سمجھا جاۓ تو یہ دنیا کی چوتھی (4th) بڑی زبان ہے۔
Is there a CSS or HTML method that automatically considers the natural direction of the text flow? I read this article from W3C which discusses the way to set text direction, but did not find any solution that does so automatically.
The fact that there is a way to automatically detect the natural direction of text flow is what is causing you trouble: the bidirectional algorithm is not perfect. Sometimes you need to give it some extra hints, as explained in Unicode controls vs. markup for bidi support.
The Unicode bidirectional algorithm determines the directionality of text on the basis of the directional properties of each character. Occasionally the algorithm needs a little help to determine the flow of objects in the text that mixes Arabic or Hebrew characters with those of other scripts. In other cases you might want to override the effect of the bidirectional algorithm altogether.
You can fix this manually by adding U+202A ʟᴇғᴛ-ᴛᴏ-ʀɪɢʜᴛ ᴇᴍʙᴇᴅᴅɪɴɢ and U+202C ᴘᴏᴘ ᴅɪʀᴇᴄᴛɪᴏɴᴀʟ ғᴏʀᴍᴀᴛᴛɪɴɢ characters to the text, as I did below:
اُردو کا بعض اوقات ہندی کے ساتھ موازنہ کیا جاتا ہے. اُردو اور ہندی میں بُنیادی فرق یہ ہے کہ اُردو نستعلیق رسم الخط میں لکھی جاتی ہے اور عربی و فارسی الفاظ استعمال کرتی ہے. جبکہ ہندی دیوناگری رسم الخط میں لکھی جاتی ہے اور سنسکرت الفاظ زیادہ استعمال کرتی ہے. کچھ ماہرینِ لسانیات اُردو اور ہندی کو ایک ہی زبان کی دو معیاری صورتیں گردانتے ہیں. تاہم، دوسرے اِن کو معاش اللسانی تفرّقات کی بنیاد پر الگ سمجھتے ہیں۔ بلکہ حقیقت یہ ہے کہ ہندی ، اُردو سے نکلی۔اسی طرح اگر اردو اور ھندی زبان کو ایک سمجھا جاۓ تو یہ دنیا کی چوتھی‪ (4th) ‬بڑی زبان ہے۔
...‪(4th)‬...
You can also use the <bdi> element in HTML5, or a <span> in HTML4.
...<bdi dir="ltr">(4th)</bdi>...
...<span dir="ltr">(4th)</span>...
For more info about the bidirectional algorithm see What you need to know about the bidi algorithm and inline markup.
If this text comes from the user, I guess there is nothing you can do about it. I would just treat it as any other kind of faulty user input; like a typo.
First of all tricky question, but very well documented and an upvote for that.
I tried the same and faced the same issue. I read in an article that you can do this using dojo. The link I am going to give you is mobile based I guess. Hope this will give a start up to you.
https://dojotoolkit.org/reference-guide/1.9/dojox/mobile/bidi.html
Doesn't the browser decide to use rtl of ltr automatically based on the visitors preference? I'm not quite sure of that, but I think it does.
Not really an answer but this might be interesting for you:
In CSS3 there is a new value for the text-align property, namely start. According to the W3C standards this will 'align to the start edge of the line box'. So if the visitors preference is rtl it will align right, and vica-versa.

Resources