{"action":"created","issue":{"url":"https://api.github.com/repos/ag-gipp/mast-java-demo/issues/4","repository_url":"https://api.github.com/repos/ag-gipp/mast-java-demo","labels_url":"https://api.github.com/repos/ag-gipp/mast-java-demo/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/ag-gipp/mast-java-demo/issues/4/comments","events_url":"https://api.github.com/repos/ag-gipp/mast-java-demo/issues/4/events","html_url":"https://github.com/ag-gipp/mast-java-demo/issues/4","id":215661212,"number":4,"title":"Implement speech rule engine to cmml conversion","user":{"login":"physikerwelt","id":2777736,"avatar_url":"https://avatars0.githubusercontent.com/u/2777736?v=3","gravatar_id":"","url":"https://api.github.com/users/physikerwelt","html_url":"https://github.com/physikerwelt","followers_url":"https://api.github.com/users/physikerwelt/followers","following_url":"https://api.github.com/users/physikerwelt/following{/other_user}","gists_url":"https://api.github.com/users/physikerwelt/gists{/gist_id}","starred_url":"https://api.github.com/users/physikerwelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/physikerwelt/subscriptions","organizations_url":"https://api.github.com/users/physikerwelt/orgs","repos_url":"https://api.github.com/users/physikerwelt/repos","events_url":"https://api.github.com/users/physikerwelt/events{/privacy}","received_events_url":"https://api.github.com/users/physikerwelt/received_events","type":"User","site_admin":false},"labels":[{"id":557458227,"url":"https://api.github.com/repos/ag-gipp/mast-java-demo/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":{"login":"vstange","id":26301768,"avatar_url":"https://avatars0.githubusercontent.com/u/26301768?v=3","gravatar_id":"","url":"https://api.github.com/users/vstange","html_url":"https://github.com/vstange","followers_url":"https://api.github.com/users/vstange/followers","following_url":"https://api.github.com/users/vstange/following{/other_user}","gists_url":"https://api.github.com/users/vstange/gists{/gist_id}","starred_url":"https://api.github.com/users/vstange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vstange/subscriptions","organizations_url":"https://api.github.com/users/vstange/orgs","repos_url":"https://api.github.com/users/vstange/repos","events_url":"https://api.github.com/users/vstange/events{/privacy}","received_events_url":"https://api.github.com/users/vstange/received_events","type":"User","site_admin":false},"assignees":[{"login":"vstange","id":26301768,"avatar_url":"https://avatars0.githubusercontent.com/u/26301768?v=3","gravatar_id":"","url":"https://api.github.com/users/vstange","html_url":"https://github.com/vstange","followers_url":"https://api.github.com/users/vstange/followers","following_url":"https://api.github.com/users/vstange/following{/other_user}","gists_url":"https://api.github.com/users/vstange/gists{/gist_id}","starred_url":"https://api.github.com/users/vstange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vstange/subscriptions","organizations_url":"https://api.github.com/users/vstange/orgs","repos_url":"https://api.github.com/users/vstange/repos","events_url":"https://api.github.com/users/vstange/events{/privacy}","received_events_url":"https://api.github.com/users/vstange/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2017-03-21T08:26:42Z","updated_at":"2017-03-21T12:00:49Z","closed_at":null,"body":"the npm package `speech-rule-engine` generates a semantic tree using data annotation which is equivalent to content mathml\r\n@vstange maye you can first look at the output of the following nodejs code before we discuss the details\r\nrun `npm -i speech-rule-engine` to install the package\r\n```javascript\r\nvar sre = require('speech-rule-engine');\r\nvar sample = \"<math xmlns=\\\"http://www.w3.org/1998/Math/MathML\\\" display=\\\"block\\\">\\n    <semantics>\\n        <mrow>\\n            <mi>a</mi>\\n            <mo>+</mo>\\n            <mi>b</mi>\\n        </mrow>\\n        <annotation encoding=\\\"application/x-tex\\\">a+b</annotation>\\n    </semantics>\\n</math>\";\r\n\r\nconsole.log(sre.toEnriched(sample).toString());\r\n\r\nconsole.log(sre.toSemantic(sample).toString());\r\n\r\nconsole.log(JSON.stringify(sre.toJson(sample),null,2));\r\n```\r\nyou should receive the following output\r\n```\r\n<math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mro\r\nw data-semantic-type=\"infixop\" data-semantic-role=\"addition\" data-semantic-id=\"3\r\n\" data-semantic-children=\"0,2\" data-semantic-content=\"1\"><mi data-semantic-type=\r\n\"identifier\" data-semantic-role=\"latinletter\" data-semantic-font=\"italic\" data-s\r\nemantic-id=\"0\" data-semantic-parent=\"3\">a</mi><mo data-semantic-type=\"operator\"\r\ndata-semantic-role=\"addition\" data-semantic-id=\"1\" data-semantic-parent=\"3\" data\r\n-semantic-operator=\"infixop,+\">+</mo><mi data-semantic-type=\"identifier\" data-se\r\nmantic-role=\"latinletter\" data-semantic-font=\"italic\" data-semantic-id=\"2\" data-\r\nsemantic-parent=\"3\">b</mi></mrow><annotation encoding=\"application/x-tex\">a+b</a\r\nnnotation></semantics></math>\r\n<stree><infixop role=\"addition\" id=\"3\">+<content><operator role=\"addition\" id=\"1\r\n\">+</operator></content><children><identifier role=\"latinletter\" font=\"italic\" i\r\nd=\"0\">a</identifier><identifier role=\"latinletter\" font=\"italic\" id=\"2\">b</ident\r\nifier></children></infixop></stree>\r\n{\r\n  \"stree\": {\r\n    \"infixop\": {\r\n      \"role\": \"addition\",\r\n      \"id\": \"3\",\r\n      \"$t\": \"+\",\r\n      \"content\": {\r\n        \"operator\": {\r\n          \"role\": \"addition\",\r\n          \"id\": \"1\",\r\n          \"$t\": \"+\"\r\n        }\r\n      },\r\n      \"children\": {\r\n        \"identifier\": [\r\n          {\r\n            \"role\": \"latinletter\",\r\n            \"font\": \"italic\",\r\n            \"id\": \"0\",\r\n            \"$t\": \"a\"\r\n          },\r\n          {\r\n            \"role\": \"latinletter\",\r\n            \"font\": \"italic\",\r\n            \"id\": \"2\",\r\n            \"$t\": \"b\"\r\n          }\r\n        ]\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\nThe relevant part of the output is the MathML representation is the XML output\r\n```xml\r\n<math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\">\r\n\t<semantics>\r\n\t\t<mrow data-semantic-type=\"infixop\" data-semantic-role=\"addition\" data-semantic-id=\"3 \" data-semantic-children=\"0,2\" data-semantic-content=\"1\">\r\n\t\t\t<mi data-semantic-type= \"identifier\" data-semantic-role=\"latinletter\" data-semantic-font=\"italic\" data-semantic-id=\"0\" data-semantic-parent=\"3\">a</mi>\r\n\t\t\t<mo data-semantic-type=\"operator\" data-semantic-role=\"addition\" data-semantic-id=\"1\" data-semantic-parent=\"3\" data-semantic-operator=\"infixop,+\">+</mo>\r\n\t\t\t<mi data-semantic-type=\"identifier\" data-semantic-role=\"latinletter\" data-semantic-font=\"italic\" data-semantic-id=\"2\" data-semantic-parent=\"3\">b</mi>\r\n\t\t</mrow>\r\n\t\t<annotation encoding=\"application/x-tex\">a+b</annotation>\r\n\t</semantics>\r\n</math>\r\n```\r\nwhich is slightly different from the LaTeXML output\r\n```xml\r\n<math xmlns=\"http://www.w3.org/1998/Math/MathML\" id=\"p1.1.m1.1\" class=\"ltx_Math\" alttext=\"a+b\" display=\"inline\">\r\n  <semantics id=\"p1.1.m1.1a\">\r\n    <mrow id=\"p1.1.m1.1.4\" xref=\"p1.1.m1.1.4.cmml\">\r\n      <mi id=\"p1.1.m1.1.1\" xref=\"p1.1.m1.1.1.cmml\">a</mi>\r\n      <mo id=\"p1.1.m1.1.2\" xref=\"p1.1.m1.1.2.cmml\">+</mo>\r\n      <mi id=\"p1.1.m1.1.3\" xref=\"p1.1.m1.1.3.cmml\">b</mi>\r\n    </mrow>\r\n    <annotation-xml encoding=\"MathML-Content\" id=\"p1.1.m1.1b\">\r\n      <apply id=\"p1.1.m1.1.4.cmml\" xref=\"p1.1.m1.1.4\">\r\n        <plus id=\"p1.1.m1.1.2.cmml\" xref=\"p1.1.m1.1.2\"/>\r\n        <ci id=\"p1.1.m1.1.1.cmml\" xref=\"p1.1.m1.1.1\">𝑎</ci>\r\n        <ci id=\"p1.1.m1.1.3.cmml\" xref=\"p1.1.m1.1.3\">𝑏</ci>\r\n      </apply>\r\n    </annotation-xml>\r\n  </semantics>\r\n</math>\r\n```\r\nor in strict cmml\r\n```xml\r\n<math xmlns=\"http://www.w3.org/1998/Math/MathML\" id=\"p1.1.m1.1\" class=\"ltx_Math\" alttext=\"a+b\" display=\"inline\">\r\n  <semantics id=\"p1.1.m1.1a\">\r\n    <mrow id=\"p1.1.m1.1.4\" xref=\"p1.1.m1.1.4.cmml\">\r\n      <mi id=\"p1.1.m1.1.1\" xref=\"p1.1.m1.1.1.cmml\">a</mi>\r\n      <mo id=\"p1.1.m1.1.2\" xref=\"p1.1.m1.1.2.cmml\">+</mo>\r\n      <mi id=\"p1.1.m1.1.3\" xref=\"p1.1.m1.1.3.cmml\">b</mi>\r\n    </mrow>\r\n    <annotation-xml encoding=\"MathML-Content\" id=\"p1.1.m1.1b\">\r\n      <apply id=\"p1.1.m1.1.4.cmml\" xref=\"p1.1.m1.1.4\">\r\n        <csymbol cd=\"arith1\" id=\"p1.1.m1.1.2.cmml\" xref=\"p1.1.m1.1.2\">plus</csymbol>\r\n        <ci id=\"p1.1.m1.1.1.cmml\" xref=\"p1.1.m1.1.1\">𝑎</ci>\r\n        <ci id=\"p1.1.m1.1.3.cmml\" xref=\"p1.1.m1.1.3\">𝑏</ci>\r\n      </apply>\r\n    </annotation-xml>\r\n  </semantics>\r\n</math>\r\n```\r\n.\r\n\r\nThe idea is to transform the spech rule engine into a similar form which can be visualized by the mast tool. For instance the example above could become\r\n```XML\r\n<math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\">\r\n  <semantics>\r\n    <mrow id=\"p3\" xref=\"c3\">\r\n      <mi id=\"p0\" xref=\"c2\">a</mi>\r\n      <mo id=\"p1\" xref=\"c0\">+</mo>\r\n      <mi id=\"p2\" xref=\"c2\">b</mi>\r\n    </mrow>\r\n    <annotation-xml encoding=\"MathML-Content\">\r\n      <apply id=\"c3\" xref=\"p3\">\r\n        <csymbol id=\"c0\" xref=\"p1\" cd=\"sre-operator\" data-semantic-operator=\"infixop,+\" >addition</csymbol>\r\n        <ci id=\"c1\" xref=\"p0\" data-semantic-role=\"latinletter\" data-semantic-font=\"italic\">a</ci>\r\n        <ci id=\"c2\" xref=\"p2\" data-semantic-role=\"latinletter\" data-semantic-font=\"italic\">b</ci>\r\n      </apply>\r\n    </annotation-xml>\r\n    <annotation encoding=\"application/x-tex\">a+b</annotation>\r\n  </semantics>\r\n</math>\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ag-gipp/mast-java-demo/issues/comments/288057435","html_url":"https://github.com/ag-gipp/mast-java-demo/issues/4#issuecomment-288057435","issue_url":"https://api.github.com/repos/ag-gipp/mast-java-demo/issues/4","id":288057435,"user":{"login":"physikerwelt","id":2777736,"avatar_url":"https://avatars0.githubusercontent.com/u/2777736?v=3","gravatar_id":"","url":"https://api.github.com/users/physikerwelt","html_url":"https://github.com/physikerwelt","followers_url":"https://api.github.com/users/physikerwelt/followers","following_url":"https://api.github.com/users/physikerwelt/following{/other_user}","gists_url":"https://api.github.com/users/physikerwelt/gists{/gist_id}","starred_url":"https://api.github.com/users/physikerwelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/physikerwelt/subscriptions","organizations_url":"https://api.github.com/users/physikerwelt/orgs","repos_url":"https://api.github.com/users/physikerwelt/repos","events_url":"https://api.github.com/users/physikerwelt/events{/privacy}","received_events_url":"https://api.github.com/users/physikerwelt/received_events","type":"User","site_admin":false},"created_at":"2017-03-21T12:00:49Z","updated_at":"2017-03-21T12:00:49Z","body":"Note that this line\r\n```XML\r\n<mrow data-semantic-type=\"infixop\" data-semantic-role=\"addition\" data-semantic-id=\"3 \" data-semantic-children=\"0,2\" data-semantic-content=\"1\">\r\n```\r\ndefines the structure of the conent part of the tree expression."}}
{"actor":{"display_login":"physikerwelt"}}