3 ms·
Many, if not most, computer models represent data as a tree. Some data, however, can't really be represented by a tree, because a "thing" can have multiple pare
by thomascgalvin 4y ago
Many, if not most, computer models represent data as a tree. Some data, however, can't really be represented by a tree, because a "thing" can have multiple parents.
The example in the link:
Example, with lines marked up:
<line>I, by attorney, bless thee from thy mother,</line>
<line>Who prays continually for Richmond's good.</line>
<line>So much for that.—The silent hours steal on,</line>
<line>And flaky darkness breaks within the east.</line>
With sentences marked up:
<sentence>I, by attorney, bless thee from thy mother,
Who prays continually for Richmond's good.</sentence>
<sentence>So much for that.</sentence>
<sentence>—The silent hours steal on, And flaky darkness breaks within the east.</sentence>
If you care about lines and sentences, this is difficult to represent as a tree.
- TreeRingCounter 4y agoPerfect, thanks.
- lioeters 4y agoOne way to solve this could be to provide separate start/end tags without inner content. <line-start/><sentence-start/>I, by attorney, bless thee from thy mother,<line-end/> <line-start/>Who prays continually for Richmond's good.<sentence-end/><line-end/>
- thomascgalvin 4y agoYeah, that's how the linked article does it, but that's ... icky? It's still a token spanning multiple parents, it's just masquerading as a couple of self-closing tags. Which, of course, is the point of the article, and why this is a difficult problem.
- lioeters 4y agoAh you're right, I should have read the article before commenting, haha. I agree it's not an ideal solution. A disadvantage I imagine is that this syntax pushes the problem onto the parser/consumer to keep track of overlapping regions. > Milestones are empty elements that mark the beginning and end of a component, typically using the XML ID mechanism to indicate which "begin" element goes with which "end" element. https://en.wikipedia.org/wiki/Overlapping_markup#Milestones https://en.wikipedia.org/wiki/Overlapping_markup#Milestones