Akron | f5dc510 | 2017-05-16 20:32:57 +0200 | [diff] [blame] | 1 | requirejs.config({ |
| 2 | baseUrl: '../js/src' |
| 3 | }); |
| 4 | |
| 5 | require(['match/relations'], function (relClass) { |
| 6 | var rel = relClass.create(); |
| 7 | document.getElementById("tree").appendChild(rel.element()); |
Akron | 3a4a08e | 2017-05-23 22:34:18 +0200 | [diff] [blame^] | 8 | |
| 9 | /* |
| 10 | * Start and end may be spans, i.e. arrays |
| 11 | */ |
| 12 | |
| 13 | rel |
| 14 | .addToken("Der") |
| 15 | .addToken("alte") |
| 16 | .addToken("Mann") |
| 17 | .addToken("ging") |
| 18 | .addToken("über") |
| 19 | .addToken("die") |
| 20 | .addToken("breite") |
| 21 | .addToken("nasse") |
| 22 | .addToken("Straße") |
| 23 | ; |
| 24 | |
| 25 | rel |
| 26 | .addRel({ start: 0, end: 1, label: "a"}) |
| 27 | .addRel({ start: 0, end: 1, label: "b" }) |
| 28 | .addRel({ start: 1, end: 2, label: "c", direction: "bi" }) |
| 29 | .addRel({ start: 0, end: 2, label: "d" }) |
| 30 | .addRel({ start: [2,4], end: 5, label: "e", direction: "uni" }) |
| 31 | .addRel({ start: [5,6], end: 7, label: "g" }) |
| 32 | .addRel({ start: 4, end: [6,8], label: "f", direction: "bi" }) |
| 33 | ; |
| 34 | |
Akron | f5dc510 | 2017-05-16 20:32:57 +0200 | [diff] [blame] | 35 | rel.show(); |
| 36 | }); |