Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • M MathJax
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 304
    • Issues 304
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • MathJax
  • MathJax
  • Wiki
  • Semantic Embedding Examples

Semantic Embedding Examples · Changes

Page history
Updated Semantic Embedding Examples (markdown) authored Apr 20, 2015 by Volker Sorge's avatar Volker Sorge
Hide whitespace changes
Inline Side-by-side
Semantic-Embedding-Examples.md
View page @ d247c76b
Some simple examples of embedded semantic tree. Note that for readability the attributes have been abbreviated.
A list of issues:
* Currently I am rebuilding the MathML tree, by cloning the original node. Is that what we want?
* What do we do with empty element or empty mrows. For illustration see below on Implicit multiplication.
* Usually the MathML does not change significantly. There are exceptions, though. Mmultiscripts for example.
Some simple examples of embedded semantic tree. Note that for readability the attributes of the MathML elements have been abbreviated. Usually they have a 'semantic-' prefix.
## Single Operation
......@@ -42,12 +37,12 @@ Semantic Tree:
Semantically enriched MathML:
```html
<math>
<mrow semantic-type="infixop" semantic-role="addition" id="5" semantic-content="1,3" semantic-children="0,2,4">
<mi semantic-type="identifier" semantic-role="latinletter" id="0" semantic-parent="5">a</mi>
<mo semantic-type="operator" semantic-role="addition" id="1" semantic-operator="infixop,+" semantic-parent="5">+</mo>
<mi semantic-type="identifier" semantic-role="latinletter" id="2" semantic-parent="5">b</mi>
<mo semantic-type="operator" semantic-role="addition" id="3" semantic-operator="infixop,+" semantic-parent="5">+</mo>
<mi semantic-type="identifier" semantic-role="latinletter" id="4" semantic-parent="5">c</mi>
<mrow type="infixop" role="addition" id="5" content="1,3" children="0,2,4">
<mi type="identifier" role="latinletter" id="0" parent="5">a</mi>
<mo type="operator" role="addition" id="1" operator="infixop,+" parent="5">+</mo>
<mi type="identifier" role="latinletter" id="2" parent="5">b</mi>
<mo type="operator" role="addition" id="3" operator="infixop,+" parent="5">+</mo>
<mi type="identifier" role="latinletter" id="4" parent="5">c</mi>
</mrow>
</math>
```
......@@ -68,13 +63,13 @@ Original MathML:
Semantically enriched MathML:
```html
<math>
<mrow semantic-type="relseq" semantic-role="equality" id="6" semantic-content="1" semantic-children="0,5">
<mn semantic-type="number" semantic-role="integer" id="0" semantic-parent="6">5</mn>
<mo semantic-type="relation" semantic-role="equality" id="1" semantic-operator="relseq,=" semantic-parent="6">=</mo>
<mrow semantic-type="infixop" semantic-role="addition" id="5" semantic-content="3" semantic-children="2,4" semantic-parent="6">
<mn semantic-type="number" semantic-role="integer" id="2" semantic-parent="5">3</mn>
<mo semantic-type="operator" semantic-role="addition" id="3" semantic-operator="infixop,+" semantic-parent="5">+</mo>
<mn semantic-type="number" semantic-role="integer" id="4" semantic-parent="5">2</mn>
<mrow type="relseq" role="equality" id="6" content="1" children="0,5">
<mn type="number" role="integer" id="0" parent="6">5</mn>
<mo type="relation" role="equality" id="1" operator="relseq,=" parent="6">=</mo>
<mrow type="infixop" role="addition" id="5" content="3" children="2,4" parent="6">
<mn type="number" role="integer" id="2" parent="5">3</mn>
<mo type="operator" role="addition" id="3" operator="infixop,+" parent="5">+</mo>
<mn type="number" role="integer" id="4" parent="5">2</mn>
</mrow>
</mrow>
</math>
......@@ -96,13 +91,13 @@ Original MathML:
Enriched MathML:
```html
<math>
<mrow semantic-type="relseq" semantic-role="equality" id="6" semantic-content="1" semantic-children="0,5">
<mi semantic-type="number" semantic-role="integer" id="0" semantic-parent="6">5</mi>
<mo semantic-type="relation" semantic-role="equality" id="1" semantic-operator="relseq,=" semantic-parent="6">=</mo>
<mrow semantic-type="infixop" semantic-role="addition" id="5" semantic-content="3" semantic-children="2,4" semantic-parent="6">
<mi semantic-type="number" semantic-role="integer" id="2" semantic-parent="5">3</mi>
<mo semantic-type="operator" semantic-role="addition" id="3" semantic-operator="infixop,+" semantic-parent="5">+</mo>
<mi semantic-type="number" semantic-role="integer" id="4" semantic-parent="5">2</mi>
<mrow type="relseq" role="equality" id="6" content="1" children="0,5">
<mi type="number" role="integer" id="0" parent="6">5</mi>
<mo type="relation" role="equality" id="1" operator="relseq,=" parent="6">=</mo>
<mrow type="infixop" role="addition" id="5" content="3" children="2,4" parent="6">
<mi type="number" role="integer" id="2" parent="5">3</mi>
<mo type="operator" role="addition" id="3" operator="infixop,+" parent="5">+</mo>
<mi type="number" role="integer" id="4" parent="5">2</mi>
</mrow>
</mrow>
</math>
......@@ -127,18 +122,18 @@ Original MathML:
Semantically enriched MathML:
```html
<math>
<mrow semantic-type="infixop" semantic-role="addition" id="9" semantic-content="5" semantic-children="8,6">
<mrow semantic-type="infixop" semantic-role="subtraction" id="8" semantic-content="3" semantic-children="7,4" semantic-parent="9">
<mrow semantic-type="infixop" semantic-role="addition" id="7" semantic-content="1" semantic-children="0,2" semantic-parent="8">
<mi semantic-type="identifier" semantic-role="latinletter" id="0" semantic-parent="7">a</mi>
<mo semantic-type="operator" semantic-role="addition" id="1" semantic-operator="infixop,+" semantic-parent="7">+</mo>
<mi semantic-type="identifier" semantic-role="latinletter" id="2" semantic-parent="7">b</mi>
<mrow type="infixop" role="addition" id="9" content="5" children="8,6">
<mrow type="infixop" role="subtraction" id="8" content="3" children="7,4" parent="9">
<mrow type="infixop" role="addition" id="7" content="1" children="0,2" parent="8">
<mi type="identifier" role="latinletter" id="0" parent="7">a</mi>
<mo type="operator" role="addition" id="1" operator="infixop,+" parent="7">+</mo>
<mi type="identifier" role="latinletter" id="2" parent="7">b</mi>
</mrow>
<mo semantic-type="operator" semantic-role="subtraction" id="3" semantic-operator="infixop,-" semantic-parent="8">-</mo>
<mi semantic-type="identifier" semantic-role="latinletter" id="4" semantic-parent="8">c</mi>
<mo type="operator" role="subtraction" id="3" operator="infixop,-" parent="8">-</mo>
<mi type="identifier" role="latinletter" id="4" parent="8">c</mi>
</mrow>
<mo semantic-type="operator" semantic-role="addition" id="5" semantic-operator="infixop,+" semantic-parent="9">+</mo>
<mi semantic-type="identifier" semantic-role="latinletter" id="6" semantic-parent="9">d</mi>
<mo type="operator" role="addition" id="5" operator="infixop,+" parent="9">+</mo>
<mi type="identifier" role="latinletter" id="6" parent="9">d</mi>
</mrow>
</math>
```
......@@ -165,23 +160,23 @@ Original MathML:
Semantically enriched MathML:
```html
<math>
<mrow semantic-type="infixop" semantic-role="addition" id="10" semantic-content="1,6" semantic-children="0,13,14">
<mi semantic-type="identifier" semantic-role="latinletter" id="0" semantic-parent="10">a</mi>
<mo semantic-type="operator" semantic-role="addition" id="1" semantic-operator="infixop,+" semantic-parent="10">+</mo>
<mrow semantic-type="infixop" semantic-role="multiplication" id="13" semantic-content="3" semantic-children="2,12" semantic-parent="10">
<mi semantic-type="identifier" semantic-role="latinletter" id="2" semantic-parent="13">b</mi>
<mo semantic-type="operator" semantic-role="multiplication" id="3" semantic-operator="infixop,∘" semantic-parent="13">∘</mo>
<mrow semantic-type="infixop" semantic-role="implicit" id="12" semantic-content="11" semantic-children="4,5" semantic-parent="13">
<mi semantic-type="identifier" semantic-role="latinletter" id="4" semantic-parent="12">c</mi>
<mrow semantic-type="operator" semantic-role="multiplication" id="11" semantic-children="" semantic-operator="infixop,⁢" semantic-parent="12"/>
<mi semantic-type="identifier" semantic-role="latinletter" id="5" semantic-parent="12">d</mi>
<mrow type="infixop" role="addition" id="10" content="1,6" children="0,13,14">
<mi type="identifier" role="latinletter" id="0" parent="10">a</mi>
<mo type="operator" role="addition" id="1" operator="infixop,+" parent="10">+</mo>
<mrow type="infixop" role="multiplication" id="13" content="3" children="2,12" parent="10">
<mi type="identifier" role="latinletter" id="2" parent="13">b</mi>
<mo type="operator" role="multiplication" id="3" operator="infixop,∘" parent="13">∘</mo>
<mrow type="infixop" role="implicit" id="12" content="11" children="4,5" parent="13">
<mi type="identifier" role="latinletter" id="4" parent="12">c</mi>
<mrow type="operator" role="multiplication" id="11" children="" operator="infixop,⁢" parent="12"/>
<mi type="identifier" role="latinletter" id="5" parent="12">d</mi>
</mrow>
</mrow>
<mo semantic-type="operator" semantic-role="addition" id="6" semantic-operator="infixop,+" semantic-parent="10">+</mo>
<mrow semantic-type="infixop" semantic-role="multiplication" id="14" semantic-content="8" semantic-children="7,9" semantic-parent="10">
<mi semantic-type="identifier" semantic-role="latinletter" id="7" semantic-parent="14">e</mi>
<mo semantic-type="operator" semantic-role="multiplication" id="8" semantic-operator="infixop,∘" semantic-parent="14">∘</mo>
<mi semantic-type="identifier" semantic-role="latinletter" id="9" semantic-parent="14">f</mi>
<mo type="operator" role="addition" id="6" operator="infixop,+" parent="10">+</mo>
<mrow type="infixop" role="multiplication" id="14" content="8" children="7,9" parent="10">
<mi type="identifier" role="latinletter" id="7" parent="14">e</mi>
<mo type="operator" role="multiplication" id="8" operator="infixop,∘" parent="14">∘</mo>
<mi type="identifier" role="latinletter" id="9" parent="14">f</mi>
</mrow>
</mrow>
</math>
......@@ -222,10 +217,10 @@ Semantic Tree:
Semantically enriched MathML:
```html
<math>
<mrow semantic-type="infixop" semantic-role="implicit" id="3" semantic-content="2" semantic-children="0,1">
<mi semantic-type="identifier" semantic-role="latinletter" id="0" semantic-parent="3">a</mi>
<mrow semantic-type="operator" semantic-role="multiplication" id="2" semantic-children="" semantic-operator="infixop,⁢" semantic-parent="3"/>
<mi semantic-type="identifier" semantic-role="latinletter" id="1" semantic-parent="3">b</mi>
<mrow type="infixop" role="implicit" id="3" content="2" children="0,1">
<mi type="identifier" role="latinletter" id="0" parent="3">a</mi>
<mrow type="operator" role="multiplication" id="2" children="" operator="infixop,⁢" parent="3"/>
<mi type="identifier" role="latinletter" id="1" parent="3">b</mi>
</mrow>
</math>
......@@ -241,10 +236,10 @@ Original MathML:
Semantically enriched MathML:
<math>
<mrow semantic-type="infixop" semantic-role="implicit" id="3" semantic-content="2" semantic-children="0,1">
<mi semantic-type="identifier" semantic-role="latinletter" id="0" semantic-parent="3">a</mi>
<mrow semantic-type="operator" semantic-role="multiplication" id="2" semantic-children="" semantic-operator="infixop,⁢" semantic-parent="3"/>
<mi semantic-type="identifier" semantic-role="latinletter" id="1" semantic-parent="3">b</mi>
<mrow type="infixop" role="implicit" id="3" content="2" children="0,1">
<mi type="identifier" role="latinletter" id="0" parent="3">a</mi>
<mrow type="operator" role="multiplication" id="2" children="" operator="infixop,⁢" parent="3"/>
<mi type="identifier" role="latinletter" id="1" parent="3">b</mi>
</mrow>
</math>
......@@ -268,23 +263,23 @@ Original MathML:
Semantically enriched MathML:
<math>
<mrow semantic-type="infixop" semantic-role="addition" id="10" semantic-content="1,6" semantic-children="0,13,14">
<mi semantic-type="identifier" semantic-role="latinletter" id="0" semantic-parent="10">a</mi>
<mo semantic-type="operator" semantic-role="addition" id="1" semantic-operator="infixop,+" semantic-parent="10">+</mo>
<mrow semantic-type="infixop" semantic-role="multiplication" id="13" semantic-content="3" semantic-children="2,12" semantic-parent="10">
<mi semantic-type="identifier" semantic-role="latinletter" id="2" semantic-parent="13">b</mi>
<mo semantic-type="operator" semantic-role="multiplication" id="3" semantic-operator="infixop,∘" semantic-parent="13">∘</mo>
<mrow semantic-type="infixop" semantic-role="implicit" id="12" semantic-content="11" semantic-children="4,5" semantic-parent="13">
<mi semantic-type="identifier" semantic-role="latinletter" id="4" semantic-parent="12">c</mi>
<mrow semantic-type="operator" semantic-role="multiplication" id="11" semantic-children="" semantic-operator="infixop,⁢" semantic-parent="12"/>
<mi semantic-type="identifier" semantic-role="latinletter" id="5" semantic-parent="12">d</mi>
<mrow type="infixop" role="addition" id="10" content="1,6" children="0,13,14">
<mi type="identifier" role="latinletter" id="0" parent="10">a</mi>
<mo type="operator" role="addition" id="1" operator="infixop,+" parent="10">+</mo>
<mrow type="infixop" role="multiplication" id="13" content="3" children="2,12" parent="10">
<mi type="identifier" role="latinletter" id="2" parent="13">b</mi>
<mo type="operator" role="multiplication" id="3" operator="infixop,∘" parent="13">∘</mo>
<mrow type="infixop" role="implicit" id="12" content="11" children="4,5" parent="13">
<mi type="identifier" role="latinletter" id="4" parent="12">c</mi>
<mrow type="operator" role="multiplication" id="11" children="" operator="infixop,⁢" parent="12"/>
<mi type="identifier" role="latinletter" id="5" parent="12">d</mi>
</mrow>
</mrow>
<mo semantic-type="operator" semantic-role="addition" id="6" semantic-operator="infixop,+" semantic-parent="10">+</mo>
<mrow semantic-type="infixop" semantic-role="multiplication" id="14" semantic-content="8" semantic-children="7,9" semantic-parent="10">
<mi semantic-type="identifier" semantic-role="latinletter" id="7" semantic-parent="14">e</mi>
<mo semantic-type="operator" semantic-role="multiplication" id="8" semantic-operator="infixop,∘" semantic-parent="14">∘</mo>
<mi semantic-type="identifier" semantic-role="latinletter" id="9" semantic-parent="14">f</mi>
<mo type="operator" role="addition" id="6" operator="infixop,+" parent="10">+</mo>
<mrow type="infixop" role="multiplication" id="14" content="8" children="7,9" parent="10">
<mi type="identifier" role="latinletter" id="7" parent="14">e</mi>
<mo type="operator" role="multiplication" id="8" operator="infixop,∘" parent="14">∘</mo>
<mi type="identifier" role="latinletter" id="9" parent="14">f</mi>
</mrow>
</mrow>
</math>
\ No newline at end of file
</math>
Clone repository

MathJax Wiki

  • Contributing
    • Contributor License Agreement etc
    • Quick guide to translating mathjax
  • Development
    • Development Process
      • Release Process Checklist
      • Documentation Update Process
      • Source Control Policies
      • GitHub
    • Design Documents
      • MathJax Roadmap
      • CDN Hosting
        • CDN requirements
        • CDN Hosting at Google Cloud Storage
      • Performance Discussion
      • Profiling and Diagnostics Tools
      • Documentation generation guide
      • Testing
        • Platforms supported
        • Test Machines
  • MathJax web presence