blob: 0a72f73e9a81c1b2f79df29eaa73cc7ae9083209 [file] [log] [blame]
Nils Diewalda297f062015-04-02 00:23:46 +00001var snippet = "<span title=\"cnx/l:meist\">" +
2 " <span title=\"cnx/p:ADV\">" +
3 " <span title=\"cnx/syn:@PREMOD\">" +
4 " <span title=\"mate/l:meist\">" +
5 " <span title=\"mate/p:ADV\">" +
6 " <span title=\"opennlp/p:ADV\">meist</span>" +
7 " </span>" +
8 " </span>" +
9 " </span>" +
10 " </span>" +
11 "</span>" +
12 "<span title=\"cnx/l:deutlich\">" +
13 " <span title=\"cnx/p:A\">" +
14 " <span title=\"cnx/syn:@PREMOD\">" +
15 " <span title=\"mate/l:deutlich\">" +
16 " <span title=\"mate/m:degree:pos\">" +
17 " <span title=\"mate/p:ADJD\">" +
18 " <span title=\"opennlp/p:ADJD\">deutlich</span>" +
19 " </span>" +
20 " </span>" +
21 " </span>" +
22 " </span>" +
23 " </span>" +
24 "</span>" +
25 "<span title=\"cnx/l:fähig\">" +
26 " <span title=\"cnx/l:leistung\">" +
27 " <span title=\"cnx/p:A\">" +
28 " <span title=\"cnx/syn:@NH\">" +
29 " <span title=\"mate/l:leistungsfähig\">" +
30 " <span title=\"mate/m:degree:comp\">" +
31 " <span title=\"mate/p:ADJD\">" +
32 " <span title=\"opennlp/p:ADJD\">leistungsfähiger</span>" +
33 " </span>" +
34 " </span>" +
35 " </span>" +
36 " </span>" +
37 " </span>" +
38 " </span>" +
39 "</span>";
40
41var treeSnippet =
42 "<span class=\"context-left\"></span>" +
43 "<span class=\"match\">" +
44 " <span title=\"xip/c:MC\">" +
45 " <span title=\"xip/c:TOP\">" +
46 " <span title=\"xip/c:PP\">" +
47 " <span title=\"xip/c:PREP\">Mit</span>" +
48 " <span title=\"xip/c:NP\">" +
49 " <span title=\"xip/c:DET\">dieser</span>" +
50 " <span title=\"xip/c:NPA\">" +
51 " <span title=\"xip/c:NOUN\">Methode</span>" +
52 " </span>" +
53 " </span>" +
54 " </span>" +
55 " <span title=\"xip/c:VERB\">ist</span>" +
56 " <span title=\"xip/c:NP\">" +
57 " <span title=\"xip/c:PRON\">es</span>" +
58 " </span>" +
59 " <span title=\"xip/c:AP\">" +
60 " <span title=\"xip/c:ADV\">nun</span>" +
61 " <span title=\"xip/c:ADJ\">möglich</span>" +
62 " </span>" +
63 " <span title=\"xip/c:ADV\">z. B.</span>" +
64 " <span title=\"xip/c:NPA\">" +
65 " <span title=\"xip/c:NP\">" +
66 " <span title=\"xip/c:NOUN\">Voice</span>" +
67 " </span>" +
68 " </span>" + "(" +
69 " <span title=\"xip/c:INS\">" +
70 " <span title=\"xip/c:NPA\">" +
71 " <span title=\"xip/c:NP\">" +
72 " <span title=\"xip/c:NOUN\">Sprache</span>" +
73 " </span>" +
74 " </span>" +
75 " </span>" + ")" +
76 " <span title=\"xip/c:VERB\">bevorzugt</span>" +
77 " <span title=\"xip/c:PP\">" +
78 " <span title=\"xip/c:PREP\">in</span>" +
79 " <span title=\"xip/c:NP\">" +
80 " <span title=\"xip/c:PRON\">der</span>" +
81 " </span>" +
82 " <span title=\"xip/c:NPA\">" +
83 " <span title=\"xip/c:NP\">" +
84 " <span title=\"xip/c:NOUN\">Bridge</span>" +
85 " </span>" +
86 " </span>" +
87 " </span>" +
88 " <span title=\"xip/c:INFC\">" +
89 " <span title=\"xip/c:INS\">" +
90 " <span title=\"xip/c:VERB\">weiterzugeben</span>" +
91 " </span>" +
92 " </span>" +
93 " </span>" +
94 " </span>" +
95 "</span>" +
96 "<span class=\"context-right\"></span>";
97
Nils Diewald58141332015-04-07 16:18:45 +000098var treeSnippet2 =
99 "<span class=\"context-left\"><\/span>"+
100 "<span class=\"match\">"+
101 "<span title=\"xip\/c:NPA\">"+
102 "<span title=\"xip\/c:NP\">"+
103 "<span title=\"xip\/c:NOUN\">HDTV<\/span>"+
104 "<\/span>"+
105 "<\/span> "+
106 "<span title=\"xip\/c:NPA\">" +
107 "<span title=\"xip\/c:NP\">"+
108 "<span title=\"xip\/c:NOUN\">Samples<\/span>"+
109 "<\/span>"+
110 "<\/span> "+
111 "<span title=\"xip\/c:ADV\">from<\/span> "+
112 "<span title=\"xip\/c:NPA\">"+
113 "<span title=\"xip\/c:NP\">"+
114 "<span title=\"xip\/c:NOUN\">European<\/span>"+
115 "<\/span>"+
116 "<\/span> ("+
117 "<span title=\"xip\/c:INS\">"+
118 "<span title=\"xip\/c:NPA\">"+
119 "<span title=\"xip\/c:NP\">"+
120 "<span title=\"xip\/c:NOUN\">and<\/span>"+
121 "<\/span>"+
122 "<\/span> "+
123 "<span title=\"xip\/c:ADV\">other<\/span>"+
124 "<\/span>) "+
125 "<span title=\"xip\/c:ADV\">broadcasters<\/span> "+
126 "<span title=\"xip\/c:NPA\">"+
127 "<span title=\"xip\/c:NP\">"+
128 "<span title=\"xip\/c:NOUN\">and<\/span>"+
129 "<\/span>"+
130 "<\/span> "+
131 "<span title=\"xip\/c:VERB\">test<\/span> "+
132 "<span title=\"xip\/c:ADV\">transmissions<\/span> "+
133 "<span title=\"xip\/c:PREP\">in<\/span> "+
134 "<span title=\"xip\/c:NOUN\">Europe<\/span>"+
135 "<\/span>"+
136 "<span class=\"context-right\"><\/span>";
137
Nils Diewalda297f062015-04-02 00:23:46 +0000138var menuContent = [
139 ['cnx/c', 'cnx', 'c'],
140 ['mate/c', 'mate', 'c'],
141 ['base/c', 'base', 'c'],
142 ['xip/c', 'xip', 'c'],
143 ['tt/c', 'tt', 'c']
144];
145
Nils Diewald5c5a7472015-04-02 22:13:38 +0000146var namedEntities = [
147 ["I-LOC", "I-LOC ", "Location"],
148 ["I-MISC", "I-MISC ", "Miscellaneous"],
149 ["I-ORG", "I-ORG ", "Organization"],
150 ["I-PER", "I-PER ", "Person"]
151];
152
153// http://www.ids-mannheim.de/cosmas2/projekt/referenz/stts/morph.html
154// http://nachhalt.sfb632.uni-potsdam.de/owl-docu/stts.html
155var sttsArray = [
156 // "$.", "$(", "$,"
157 ["ADJA","ADJA ", "Attributive Adjective"],
158 ["ADJD","ADJD ", "Predicative Adjective"],
159 ["ADV","ADV ", "Adverb"],
160 ["APPO","APPO ", "Postposition"],
161 ["APPR","APPR ", "Preposition"],
162 ["APPRART","APPRART ", "Preposition with Determiner"],
163 ["APZR","APZR ","Right Circumposition"],
164 ["ART","ART ", "Determiner"],
165 ["CARD","CARD ", "Cardinal Number"],
166 ["FM","FM ", "Foreign Material"],
167 ["ITJ","ITJ ", "Interjection"],
168 ["KOKOM","KOKOM ", "Comparison Particle"],
169 ["KON","KON ", "Coordinating Conjuncion"],
170 ["KOUI","KOUI ", "Subordinating Conjunction with 'zu'"],
171 ["KOUS","KOUS ", "Subordinating Conjunction with Sentence"],
172 ["NE","NE ", "Named Entity"],
173 ["NN","NN ", "Normal Nomina"],
174 ["PAV", "PAV ", "Pronominal Adverb"],
175 ["PDAT","PDAT ","Attributive Demonstrative Pronoun"],
176 ["PDS","PDS ", "Substitutive Demonstrative Pronoun"],
177 ["PIAT","PIAT ", "Attributive Indefinite Pronoun without Determiner"],
178 ["PIDAT","PIDAT ", "Attributive Indefinite Pronoun with Determiner"],
179 ["PIS","PIS ", "Substitutive Indefinite Pronoun"],
180 ["PPER","PPER ", "Personal Pronoun"],
181 ["PPOSAT","PPOSAT ", "Attributive Possessive Pronoun"],
182 ["PPOSS","PPOSS ", "Substitutive Possessive Pronoun"],
183 ["PRELAT","PRELAT ", "Attributive Relative Pronoun"],
184 ["PRELS","PRELS ", "Substitutive Relative Pronoun"],
185 ["PRF","PRF ", "Reflexive Pronoun"],
186 ["PROAV","PROAV ", "Pronominal Adverb"],
187 ["PTKA","PTKA ","Particle with Adjective"],
188 ["PTKANT","PTKANT ", "Answering Particle"],
189 ["PTKNEG","PTKNEG ", "Negation Particle"],
190 ["PTKVZ","PTKVZ ", "Separated Verbal Particle"],
191 ["PTKZU","PTKZU ", "'zu' Particle"],
192 ["PWAT","PWAT ", "Attributive Interrogative Pronoun"],
193 ["PWAV","PWAV ", "Adverbial Interrogative Pronoun"],
194 ["PWS","PWS ", "Substitutive Interrogative Pronoun"],
195 ["TRUNC","TRUNC ","Truncated"],
196 ["VAFIN","VAFIN ", "Auxiliary Finite Verb"],
197 ["VAINF","VAINF ", "Auxiliary Infinite Verb"],
198 ["VAIMP","VAIMP ", "Auxiliary Finite Imperative Verb"],
199 ["VAPP","VAPP ", "Auxiliary Perfect Participle"],
200 ["VMFIN","VMFIN ", "Modal Finite Verb"],
201 ["VMINF","VMINF ", "Modal Infinite Verb"],
202 ["VMPP","VMPP ", "Modal Perfect Participle"],
203 ["VVFIN","VVFIN ","Finite Verb"],
204 ["VVIMP","VVIMP ", "Finite Imperative Verb"],
205 ["VVINF","VVINF ", "Infinite Verb"],
206 ["VVIZU","VVIZU ", "Infinite Verb with 'zu'"],
207 ["VVPP","VVPP ", "Perfect Participle"],
208 ["XY", "XY ", "Non-Word"]
209];
210
211var mateSttsArray = sttsArray.slice(0);
212mateSttsArray.push(
213 ["<root-POS>","<root-POS>","Root Part of Speech"]
214);
215
216
217var vcExample = {
218 "@type":"koral:docGroup",
219 "operation":"operation:or",
220 "operands":[
221 {
222 "@type":"koral:docGroup",
223 "operation":"operation:and",
224 "operands":[
225 {
226 "@type":"koral:doc",
227 "key":"Titel",
228 "value":"Der Birnbaum",
229 "match":"match:eq"
230 },
231 {
232 "@type":"koral:doc",
233 "key":"Veröffentlichungsort",
234 "value":"Mannheim",
235 "match":"match:eq"
236 },
237 {
238 "@type":"koral:docGroup",
239 "operation":"operation:or",
240 "operands":[
241 {
242 "@type":"koral:doc",
243 "key":"Untertitel",
244 "value":"Aufzucht und Pflege",
245 "match":"match:eq"
246 },
247 {
248 "@type":"koral:doc",
249 "key":"Untertitel",
250 "value":"Gedichte",
251 "match":"match:eq",
252 "rewrites" : [
253 {
254 "@type": "koral:rewrite",
255 "src" : "policy",
256 "operation" : "operation:injection",
257 }
258 ]
259 }
260 ]
261 }
262 ]
263 },
264 {
265 "@type":"koral:doc",
266 "key":"Veröffentlichungsdatum",
267 "type":"type:date",
268 "value":"2015-03-05",
269 "match":"match:geq"
270 }
271 ]
272};
273
274
275KorAP.hintArray = {
276 "-" : [
277 ["Connexor", "cnx/", "Constituency, Lemma, Morphology, Part-of-Speech, Syntax"],
278 ["CoreNLP", "corenlp/", "Named Entities"],
279 ["Mate", "mate/", "Lemma, Morphology, Part-of-Speech"],
280 ["OpenNLP", "opennlp/", "Part-of-Speech"],
281 ["TreeTagger", "tt/", "Lemma, Part-of-Speech"],
282 ["Xerox Parser", "xip/", "Constituency, Lemma, Part-of-Speech"]
283 ],
284 "corenlp/" : [
285 ["Named Entity", "ne=" , "Combined"],
286 ["Named Entity", "ne_dewac_175m_600=" , "ne_dewac_175m_600"],
287 ["Named Entity", "ne_hgc_175m_600=", "ne_hgc_175m_600"]
288 ],
289 "corenlp/ne=" : namedEntities,
290 "corenlp/ne_dewac_175m_600=" : namedEntities,
291 "corenlp/ne_hgc_175m_600=" : namedEntities,
292 "cnx/" : [
293 ["Constituency", "c="],
294 ["Lemma", "l="],
295 ["Morphology", "m="],
296 ["Part-of-Speech", "p="],
297 ["Syntax", "syn="]
298 ],
299 "cnx/c=" : [
300 ["np", "np ", "Nominal Phrase"]
301 ],
302 // http://www.ids-mannheim.de/cosmas2/projekt/referenz/connexor/morph.html
303 "cnx/m=" : [
304 ["Abbr","Abbr ", "Nouns: Abbreviation"],
305 ["CMP","CMP ", "Adjective: Comparative"],
306 ["IMP", "IMP ", "Mood: Imperative"],
307 ["IND", "IND ", "Mood: Indicative"],
308 ["INF", "INF ", "Infinitive"],
309 ["ORD","ORD ", "Numeral: Ordinal"],
310 ["PAST", "PAST ", "Tense: past"],
311 ["PCP", "PCP ", "Participle"],
312 ["PERF", "PERF ", "Perfective Participle"],
313 ["PL","PL ", "Nouns: Plural"],
314 ["PRES", "PRES ", "Tense: present"],
315 ["PROG", "PROG ", "Progressive Participle"],
316 ["Prop","Prop ", "Nouns: Proper Noun"],
317 ["SUB", "SUB ", "Mood: Subjunctive"],
318 ["SUP","SUP ", "Adjective: Superlative"]
319 ],
320 // http://www.ids-mannheim.de/cosmas2/projekt/referenz/connexor/morph.html
321 "cnx/p=" : [
322 ["A", "A ", "Adjective"],
323 ["ADV", "ADV ", "Adverb"],
324 ["CC", "CC ", "Coordination Marker"],
325 ["CS", "CS ", "Clause Marker"],
326 ["DET", "DET ", "Determiner"],
327 ["INTERJ", "INTERJ ", "Interjection"],
328 ["N", "N ", "Noun"],
329 ["NUM", "NUM ", "Numeral"],
330 ["PREP", "PREP ", "Preposition"],
331 ["PRON", "PRON ", "Pro-Nominal"],
332 ["V", "V ", "Verb"]
333 ],
334 // http://www.ids-mannheim.de/cosmas2/projekt/referenz/connexor/syntax.html
335 "cnx/syn=" : [
336 ["@ADVL", "@ADVL ", "Adverbial Head"],
337 ["@AUX", "@AUX ", "Auxiliary Verb"],
338 ["@CC", "@CC ", "Coordination"]
339 ["@MAIN", "@MAIN ", "Main Verb"],
340 ["@NH", "@NH ", "Nominal Head"],
341 ["@POSTMOD", "@POSTMOD ", "Postmodifier"],
342 ["@PREMARK", "@PREMARK ", "Preposed Marker"],
343 ["@PREMOD", "@POSTMOD ", "Premodifier"]
344 ],
345 "opennlp/" : [
346 ["Part-of-Speech", "p="]
347 ],
348 "opennlp/p=" : sttsArray,
349 "xip/" : [
350 ["Constituency", "c="],
351 // Inactive: ["Dependency", "d="],
352 ["Lemma", "l="],
353 ["Part-of-Speech", "p="],
354 ],
355 // "xip/c=" : [],
356 // Inactive: "xip/d=" : [],
357 // "xip/p=" : [],
358 "tt/" : [
359 ["Lemma", "l="],
360 ["Part-of-Speech", "p="]
361 ],
362 "tt/p=" : sttsArray,
363 "mate/" : [
364 // Inactive: "d" : ["d=", "Dependency"],
365 ["Lemma", "l="],
366 ["Morphology", "m="],
367 ["Part-of-Speech", "p="]
368 ],
369 // Inactive: mate/d=
370 "mate/p=" : mateSttsArray,
371 "mate/m=" : [
372 ["Case", "case:"],
373 ["Degree", "degree:"],
374 ["Gender", "gender:"],
375 ["Mood", "mood:"],
376 ["Number", "number:"],
377 ["Person", "person:"],
378 ["Tense","tense:"],
379 ["No type", "<no-type> "]
380 ],
381 "mate/m=case:" : [
382 ["acc", "acc ", "Accusative"],
383 ["dat","dat ", "Dative"],
384 ["gen", "gen ","Genitive"],
385 ["nom","nom ", "Nominative"],
386 ["*","* ", "Undefined"]
387 ],
388 "mate/m=degree:" : [
389 ["comp","comp ", "Comparative"],
390 ["pos","pos ", "Positive"],
391 ["sup","sup ", "Superative"]
392 ],
393 "mate/m=gender:" : [
394 ["fem", "fem ", "Feminium"],
395 ["masc", "masc ", "Masculinum"],
396 ["neut","neut ", "Neuter"],
397 ["*","* ","Undefined"]
398 ],
399 "mate/m=mood:" : [
400 ["imp","imp ", "Imperative"],
401 ["ind","ind ", "Indicative"],
402 ["subj","subj ", "Subjunctive"]
403 ],
404 "mate/m=number:" : [
405 ["pl","pl ","Plural"],
406 ["sg","sg ","Singular"],
407 ["*","* ","Undefined"]
408 ],
409 "mate/m=person:" : [
410 ["1","1 ", "First Person"],
411 ["2","2 ", "Second Person"],
412 ["3","3 ", "Third Person"]
413 ],
414 "mate/m=tense:" : [
415 ["past","past ", "Past"],
416 ["pres","pres ", "Present"]
417 ]
418};
419
Nils Diewalda297f062015-04-02 00:23:46 +0000420// Parse and show the table
421// Override getMatchInfo API call
Nils Diewald58141332015-04-07 16:18:45 +0000422KorAP.API.getMatchInfo = function(match, callObj, cb) {
Nils Diewalda297f062015-04-02 00:23:46 +0000423 if (callObj["spans"] !== undefined && callObj["spans"] === true) {
Nils Diewald58141332015-04-07 16:18:45 +0000424 cb({ "snippet": treeSnippet2 });
Nils Diewalda297f062015-04-02 00:23:46 +0000425 }
426 else {
Nils Diewald58141332015-04-07 16:18:45 +0000427 cb({ "snippet": snippet });
Nils Diewalda297f062015-04-02 00:23:46 +0000428 }
429};
430
Nils Diewald5c5a7472015-04-02 22:13:38 +0000431
Nils Diewalda297f062015-04-02 00:23:46 +0000432/**
433 * Do some things at the beginning.
434 */
Nils Diewald58141332015-04-07 16:18:45 +0000435document.addEventListener('DOMContentLoaded', function () {
Nils Diewalda297f062015-04-02 00:23:46 +0000436
437 // Decorate actions
Nils Diewald58141332015-04-07 16:18:45 +0000438 var init = KorAP.init();
Nils Diewalda297f062015-04-02 00:23:46 +0000439
440 var menu = KorAP.MatchTreeMenu.create(
441 undefined,
442 menuContent
443 );
444
Nils Diewald58141332015-04-07 16:18:45 +0000445 // document.getElementById('vc-choose').click();
Nils Diewald5c5a7472015-04-02 22:13:38 +0000446
Nils Diewald58141332015-04-07 16:18:45 +0000447// init.tutorial.show();
Nils Diewald5c5a7472015-04-02 22:13:38 +0000448
Nils Diewalda297f062015-04-02 00:23:46 +0000449 // Don't hide!!!
450 menu.hide = function () {};
451 document.getElementById('menu').appendChild(menu.element());
452 menu.limit(3);
453 menu.show();
454 menu.focus();
Nils Diewald58141332015-04-07 16:18:45 +0000455});