blob: 12d536c63d473c501829886c81528a6447bff784 [file] [log] [blame]
Akron15175132017-09-07 18:12:55 +02001var treeSnippet =
2 "<span class=\"context-left\"></span>" +
3 "<span class=\"match\">" +
4 " <span title=\"xip/c:MC\">" +
5 " <span title=\"xip/c:TOP\">" +
6 " <span title=\"xip/c:PP\">" +
7 " <span title=\"xip/c:PREP\">Mit</span>" +
8 " <span title=\"xip/c:NP\">" +
9 " <span title=\"xip/c:DET\">dieser</span>" +
10 " <span title=\"xip/c:NPA\">" +
11 " <span title=\"xip/c:NOUN\">Methode</span>" +
12 " </span>" +
13 " </span>" +
14 " </span>" +
15 " <span title=\"xip/c:VERB\">ist</span>" +
16 " <span title=\"xip/c:NP\">" +
17 " <span title=\"xip/c:PRON\">es</span>" +
18 " </span>" +
19 " <span title=\"xip/c:AP\">" +
20 " <span title=\"xip/c:ADV\">nun</span>" +
21 " <span title=\"xip/c:ADJ\">möglich</span>" +
22 " </span>" +
23 " <span title=\"xip/c:ADV\">z. B.</span>" +
24 " <span title=\"xip/c:NPA\">" +
25 " <span title=\"xip/c:NP\">" +
26 " <span title=\"xip/c:NOUN\">Voice</span>" +
27 " </span>" +
28 " </span>" + "(" +
29 " <span title=\"xip/c:INS\">" +
30 " <span title=\"xip/c:NPA\">" +
31 " <span title=\"xip/c:NP\">" +
32 " <span title=\"xip/c:NOUN\">Sprache</span>" +
33 " </span>" +
34 " </span>" +
35 " </span>" + ")" +
36 " <span title=\"xip/c:VERB\">bevorzugt</span>" +
37 " <span title=\"xip/c:PP\">" +
38 " <span title=\"xip/c:PREP\">in</span>" +
39 " <span title=\"xip/c:NP\">" +
40 " <span title=\"xip/c:PRON\">der</span>" +
41 " </span>" +
42 " <span title=\"xip/c:NPA\">" +
43 " <span title=\"xip/c:NP\">" +
44 " <span title=\"xip/c:NOUN\">Bridge</span>" +
45 " </span>" +
46 " </span>" +
47 " </span>" +
48 " <span title=\"xip/c:INFC\">" +
49 " <span title=\"xip/c:INS\">" +
50 " <span title=\"xip/c:VERB\">weiterzugeben</span>" +
51 " </span>" +
52 " </span>" +
53 " </span>" +
54 " </span>" +
55 "</span>" +
56 "<span class=\"context-right\"></span>";
57
Akronf5dc5102017-05-16 20:32:57 +020058requirejs.config({
Akron15175132017-09-07 18:12:55 +020059 baseUrl: '../js/src',
60 paths : {
61 'lib': '../lib'
62 }
Akronf5dc5102017-05-16 20:32:57 +020063});
64
Akron15175132017-09-07 18:12:55 +020065require(['match/relations', 'match/tree'], function (relClass, treeClass) {
Akronf5dc5102017-05-16 20:32:57 +020066 var rel = relClass.create();
Akron3a4a08e2017-05-23 22:34:18 +020067
68 /*
69 * Start and end may be spans, i.e. arrays
70 */
71
72 rel
73 .addToken("Der")
74 .addToken("alte")
75 .addToken("Mann")
76 .addToken("ging")
77 .addToken("über")
78 .addToken("die")
79 .addToken("breite")
80 .addToken("nasse")
81 .addToken("Straße")
82 ;
83
84 rel
85 .addRel({ start: 0, end: 1, label: "a"})
86 .addRel({ start: 0, end: 1, label: "b" })
87 .addRel({ start: 1, end: 2, label: "c", direction: "bi" })
88 .addRel({ start: 0, end: 2, label: "d" })
89 .addRel({ start: [2,4], end: 5, label: "e", direction: "uni" })
90 .addRel({ start: [5,6], end: 7, label: "g" })
91 .addRel({ start: 4, end: [6,8], label: "f", direction: "bi" })
92 ;
Akron15175132017-09-07 18:12:55 +020093
94 document.getElementById("treeRel").appendChild(rel.element());
95
96 // Todo: Probably rename to rel.draw()
Akronf5dc5102017-05-16 20:32:57 +020097 rel.show();
Akron15175132017-09-07 18:12:55 +020098
99 var tree = treeClass.create(treeSnippet);
100 document.getElementById("treeHier").appendChild(tree.element());
Akronf5dc5102017-05-16 20:32:57 +0200101});
Akron15175132017-09-07 18:12:55 +0200102