Skip to content

Commit f447e15

Browse files
authored
Merge pull request #834 from Speech-Rule-Engine/fix/link_output
ensure consistent output of link postfix for label, ssml, root node
2 parents 1f41894 + 8e39d59 commit f447e15

File tree

14 files changed

+236
-11
lines changed

14 files changed

+236
-11
lines changed

testsuite/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ REPL. There are two ways to ensure that all the necessary files in SRE can be fo
359359

360360
``` javascript
361361
process.env['SRE_JSON_PATH'] = '../lib/mathmaps';
362-
(await import('./js/module_loader.js')).load('gt');
362+
const gt = await (await import('./js/module_loader.js')).loadPromise('gt');
363363
...
364364
```
365365

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"factory": "deepSpeech",
3+
"tests": "ALL",
4+
"information": "Deep speech href tests.",
5+
"base": "input/semantic/href.json"
6+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"factory": "enrichMathml",
3+
"active": "EnrichExamples",
4+
"information": "Enrich mathml href tests.",
5+
"base": "input/semantic/href.json",
6+
"tests": {
7+
"href_0": {
8+
"expected": "<math><mi href=\"a\" type=\"identifier\" role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" attributes=\"href:a\" postfix=\"link\">a</mi></math>"
9+
},
10+
"href_1": {
11+
"expected": "<math><mrow href=\"c\" type=\"infixop\" role=\"addition\" id=\"3\" children=\"0,2\" content=\"1\" attributes=\"href:c\" postfix=\"link\"><mi type=\"identifier\" role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" parent=\"3\">a</mi><mo type=\"operator\" role=\"addition\" id=\"1\" parent=\"3\" operator=\"infixop,+\">+</mo><mi type=\"identifier\" role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\" parent=\"3\">b</mi></mrow></math>"
12+
},
13+
"href_2": {
14+
"expected": "<math type=\"infixop\" role=\"addition\" id=\"3\" children=\"0,2\" content=\"1\"><mi type=\"identifier\" role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" parent=\"3\">a</mi><mo href=\"c\" type=\"operator\" role=\"addition\" id=\"1\" parent=\"3\" attributes=\"href:c\" postfix=\"link\" operator=\"infixop,+\">+</mo><mi type=\"identifier\" role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\" parent=\"3\">b</mi></math>"
15+
},
16+
"href_3": {
17+
"expected": "<math type=\"infixop\" role=\"addition\" id=\"3\" children=\"0,2\" content=\"1\"><mi href=\"a\" type=\"identifier\" role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" parent=\"3\" attributes=\"href:a\" postfix=\"link\">a</mi><mo type=\"operator\" role=\"addition\" id=\"1\" parent=\"3\" operator=\"infixop,+\">+</mo><mi href=\"b\" type=\"identifier\" role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\" parent=\"3\" attributes=\"href:b\" postfix=\"link\">b</mi></math>"
18+
},
19+
"href_4": {
20+
"expected": "<math><mrow href=\"c\" type=\"infixop\" role=\"addition\" id=\"3\" children=\"0,2\" content=\"1\" attributes=\"href:c\" postfix=\"link\"><mi href=\"a\" type=\"identifier\" role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" parent=\"3\" attributes=\"href:a\" postfix=\"link\">a</mi><mo type=\"operator\" role=\"addition\" id=\"1\" parent=\"3\" operator=\"infixop,+\">+</mo><mi href=\"b\" type=\"identifier\" role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\" parent=\"3\" attributes=\"href:b\" postfix=\"link\">b</mi></mrow></math>"
21+
},
22+
"href_5": {
23+
"expected": "<math href=\"a\"><mi type=\"identifier\" role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" attributes=\"href:a\" postfix=\"link\">a</mi></math>"
24+
},
25+
"href_6": {
26+
"expected": "<math href=\"c\"><mrow type=\"infixop\" role=\"addition\" id=\"3\" children=\"0,2\" content=\"1\" attributes=\"href:c\" postfix=\"link\"><mi type=\"identifier\" role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" parent=\"3\">a</mi><mo type=\"operator\" role=\"addition\" id=\"1\" parent=\"3\" operator=\"infixop,+\">+</mo><mi type=\"identifier\" role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\" parent=\"3\">b</mi></mrow></math>"
27+
}
28+
}
29+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"factory": "enrichSpeech",
3+
"tests": "ALL",
4+
"information": "Enrich speech href tests.",
5+
"base": "input/semantic/href.json"
6+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"factory": "enrichStructure",
3+
"information": "Enrich structure href tests.",
4+
"base": "input/semantic/href.json",
5+
"tests": {
6+
"href_0": {
7+
"expected": "<math structure=\"0\"><mi href=\"a\" type=\"identifier\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" attributes=\"href:a\" postfix=\"link\" aria-level=\"0\" aria-posinset=\"1\" aria-setsize=\"1\" role=\"treeitem\">a</mi></math>"
8+
},
9+
"href_1": {
10+
"expected": "<math structure=\"(3 0 1 2)\"><mrow href=\"c\" type=\"infixop\" id=\"3\" children=\"0,2\" content=\"1\" attributes=\"href:c\" postfix=\"link\" owns=\"0 1 2\" aria-level=\"0\" aria-posinset=\"1\" aria-setsize=\"1\" role=\"treeitem\" aria-owns=\"0 1 2\"><mi type=\"identifier\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" parent=\"3\" aria-level=\"1\" aria-posinset=\"1\" aria-setsize=\"3\" role=\"treeitem\">a</mi><mo type=\"operator\" id=\"1\" parent=\"3\" operator=\"infixop,+\" aria-level=\"1\" aria-posinset=\"2\" aria-setsize=\"3\" role=\"treeitem\">+</mo><mi type=\"identifier\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\" parent=\"3\" aria-level=\"1\" aria-posinset=\"3\" aria-setsize=\"3\" role=\"treeitem\">b</mi></mrow></math>"
11+
},
12+
"href_2": {
13+
"expected": "<math type=\"infixop\" id=\"3\" children=\"0,2\" content=\"1\" owns=\"0 1 2\" aria-level=\"0\" aria-posinset=\"1\" aria-setsize=\"1\" role=\"treeitem\" aria-owns=\"0 1 2\" structure=\"(3 0 1 2)\"><mi type=\"identifier\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" parent=\"3\" aria-level=\"1\" aria-posinset=\"1\" aria-setsize=\"3\" role=\"treeitem\">a</mi><mo href=\"c\" type=\"operator\" id=\"1\" parent=\"3\" attributes=\"href:c\" postfix=\"link\" operator=\"infixop,+\" aria-level=\"1\" aria-posinset=\"2\" aria-setsize=\"3\" role=\"treeitem\">+</mo><mi type=\"identifier\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\" parent=\"3\" aria-level=\"1\" aria-posinset=\"3\" aria-setsize=\"3\" role=\"treeitem\">b</mi></math>"
14+
},
15+
"href_3": {
16+
"expected": "<math type=\"infixop\" id=\"3\" children=\"0,2\" content=\"1\" owns=\"0 1 2\" aria-level=\"0\" aria-posinset=\"1\" aria-setsize=\"1\" role=\"treeitem\" aria-owns=\"0 1 2\" structure=\"(3 0 1 2)\"><mi href=\"a\" type=\"identifier\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" parent=\"3\" attributes=\"href:a\" postfix=\"link\" aria-level=\"1\" aria-posinset=\"1\" aria-setsize=\"3\" role=\"treeitem\">a</mi><mo type=\"operator\" id=\"1\" parent=\"3\" operator=\"infixop,+\" aria-level=\"1\" aria-posinset=\"2\" aria-setsize=\"3\" role=\"treeitem\">+</mo><mi href=\"b\" type=\"identifier\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\" parent=\"3\" attributes=\"href:b\" postfix=\"link\" aria-level=\"1\" aria-posinset=\"3\" aria-setsize=\"3\" role=\"treeitem\">b</mi></math>"
17+
},
18+
"href_4": {
19+
"expected": "<math structure=\"(3 0 1 2)\"><mrow href=\"c\" type=\"infixop\" id=\"3\" children=\"0,2\" content=\"1\" attributes=\"href:c\" postfix=\"link\" owns=\"0 1 2\" aria-level=\"0\" aria-posinset=\"1\" aria-setsize=\"1\" role=\"treeitem\" aria-owns=\"0 1 2\"><mi href=\"a\" type=\"identifier\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" parent=\"3\" attributes=\"href:a\" postfix=\"link\" aria-level=\"1\" aria-posinset=\"1\" aria-setsize=\"3\" role=\"treeitem\">a</mi><mo type=\"operator\" id=\"1\" parent=\"3\" operator=\"infixop,+\" aria-level=\"1\" aria-posinset=\"2\" aria-setsize=\"3\" role=\"treeitem\">+</mo><mi href=\"b\" type=\"identifier\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\" parent=\"3\" attributes=\"href:b\" postfix=\"link\" aria-level=\"1\" aria-posinset=\"3\" aria-setsize=\"3\" role=\"treeitem\">b</mi></mrow></math>"
20+
},
21+
"href_5": {
22+
"expected": "<math href=\"a\" structure=\"0\"><mi type=\"identifier\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" attributes=\"href:a\" postfix=\"link\" aria-level=\"0\" aria-posinset=\"1\" aria-setsize=\"1\" role=\"treeitem\">a</mi></math>"
23+
},
24+
"href_6": {
25+
"expected": "<math href=\"c\" structure=\"(3 0 1 2)\"><mrow type=\"infixop\" id=\"3\" children=\"0,2\" content=\"1\" attributes=\"href:c\" postfix=\"link\" owns=\"0 1 2\" aria-level=\"0\" aria-posinset=\"1\" aria-setsize=\"1\" role=\"treeitem\" aria-owns=\"0 1 2\"><mi type=\"identifier\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" parent=\"3\" aria-level=\"1\" aria-posinset=\"1\" aria-setsize=\"3\" role=\"treeitem\">a</mi><mo type=\"operator\" id=\"1\" parent=\"3\" operator=\"infixop,+\" aria-level=\"1\" aria-posinset=\"2\" aria-setsize=\"3\" role=\"treeitem\">+</mo><mi type=\"identifier\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\" parent=\"3\" aria-level=\"1\" aria-posinset=\"3\" aria-setsize=\"3\" role=\"treeitem\">b</mi></mrow></math>"
26+
}
27+
}
28+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"factory": "rebuildEnriched",
3+
"tests": "ALL",
4+
"information": "Rebuild enriched href tests.",
5+
"base": "input/semantic/href.json"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"factory": "rebuild",
3+
"tests": "ALL",
4+
"information": "Rebuild stree href tests.",
5+
"base": "input/semantic/href.json"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"factory": "semanticApi",
3+
"tests": "ALL",
4+
"information": "Semantic api href tests.",
5+
"base": "input/semantic/href.json"
6+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"factory": "semanticExploration",
3+
"information": "Semantic exploration href tests.",
4+
"base": "input/semantic/href.json",
5+
"tests": {
6+
"href_0": {
7+
"expected": 0
8+
},
9+
"href_1": {
10+
"expected": [
11+
3,
12+
0,
13+
1,
14+
2
15+
]
16+
},
17+
"href_2": {
18+
"expected": [
19+
3,
20+
0,
21+
1,
22+
2
23+
]
24+
},
25+
"href_3": {
26+
"expected": [
27+
3,
28+
0,
29+
1,
30+
2
31+
]
32+
},
33+
"href_4": {
34+
"expected": [
35+
3,
36+
0,
37+
1,
38+
2
39+
]
40+
},
41+
"href_5": {
42+
"expected": 0
43+
},
44+
"href_6": {
45+
"expected": [
46+
3,
47+
0,
48+
1,
49+
2
50+
]
51+
}
52+
}
53+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"factory": "stree",
3+
"information": "Semantic tree href tests.",
4+
"base": "input/semantic/href.json",
5+
"tests": {
6+
"href_0": {
7+
"expected": "<stree><identifier role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" href=\"a\">a</identifier></stree>"
8+
},
9+
"href_1": {
10+
"expected": "<stree><infixop role=\"addition\" id=\"3\" href=\"c\">+<content><operator role=\"addition\" id=\"1\">+</operator></content><children><identifier role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\">a</identifier><identifier role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\">b</identifier></children></infixop></stree>"
11+
},
12+
"href_2": {
13+
"expected": "<stree><infixop role=\"addition\" id=\"3\">+<content><operator role=\"addition\" id=\"1\" href=\"c\">+</operator></content><children><identifier role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\">a</identifier><identifier role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\">b</identifier></children></infixop></stree>"
14+
},
15+
"href_3": {
16+
"expected": "<stree><infixop role=\"addition\" id=\"3\">+<content><operator role=\"addition\" id=\"1\">+</operator></content><children><identifier role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" href=\"a\">a</identifier><identifier role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\" href=\"b\">b</identifier></children></infixop></stree>"
17+
},
18+
"href_4": {
19+
"expected": "<stree><infixop role=\"addition\" id=\"3\" href=\"c\">+<content><operator role=\"addition\" id=\"1\">+</operator></content><children><identifier role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" href=\"a\">a</identifier><identifier role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\" href=\"b\">b</identifier></children></infixop></stree>"
20+
},
21+
"href_5": {
22+
"expected": "<stree><identifier role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\" href=\"a\">a</identifier></stree>"
23+
},
24+
"href_6": {
25+
"expected": "<stree><infixop role=\"addition\" id=\"3\" href=\"c\">+<content><operator role=\"addition\" id=\"1\">+</operator></content><children><identifier role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"0\">a</identifier><identifier role=\"latinletter\" font=\"italic\" annotation=\"clearspeak:simple\" id=\"2\">b</identifier></children></infixop></stree>"
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)