blob: 1bc0ddf2250e1f342cdfcce7e0bf1c860ca06d7e [file] [log] [blame]
Nils Diewalda944fab2015-04-08 21:02:04 +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
98var 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
138var 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
146var 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",
Nils Diewald6283d692015-04-23 20:32:53 +0000227 "key":"title",
Nils Diewalda944fab2015-04-08 21:02:04 +0000228 "value":"Der Birnbaum",
229 "match":"match:eq"
230 },
231 {
232 "@type":"koral:doc",
Nils Diewald6283d692015-04-23 20:32:53 +0000233 "key":"pubPlace",
Nils Diewalda944fab2015-04-08 21:02:04 +0000234 "value":"Mannheim",
235 "match":"match:eq"
236 },
237 {
238 "@type":"koral:docGroup",
239 "operation":"operation:or",
240 "operands":[
241 {
242 "@type":"koral:doc",
Nils Diewald6283d692015-04-23 20:32:53 +0000243 "key":"subTitle",
Nils Diewalda944fab2015-04-08 21:02:04 +0000244 "value":"Aufzucht und Pflege",
245 "match":"match:eq"
246 },
247 {
248 "@type":"koral:doc",
Nils Diewald6283d692015-04-23 20:32:53 +0000249 "key":"subTitle",
Nils Diewalda944fab2015-04-08 21:02:04 +0000250 "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",
Nils Diewald6283d692015-04-23 20:32:53 +0000266 "key":"pubDate",
Nils Diewalda944fab2015-04-08 21:02:04 +0000267 "type":"type:date",
268 "value":"2015-03-05",
269 "match":"match:geq"
270 }
271 ]
272};
273
Nils Diewald0e6992a2015-04-14 20:13:52 +0000274var hintArray = {
Nils Diewalda944fab2015-04-08 21:02:04 +0000275 "-" : [
276 ["Connexor", "cnx/", "Constituency, Lemma, Morphology, Part-of-Speech, Syntax"],
277 ["CoreNLP", "corenlp/", "Named Entities"],
278 ["Mate", "mate/", "Lemma, Morphology, Part-of-Speech"],
279 ["OpenNLP", "opennlp/", "Part-of-Speech"],
280 ["TreeTagger", "tt/", "Lemma, Part-of-Speech"],
281 ["Xerox Parser", "xip/", "Constituency, Lemma, Part-of-Speech"]
282 ],
283 "corenlp/" : [
284 ["Named Entity", "ne=" , "Combined"],
285 ["Named Entity", "ne_dewac_175m_600=" , "ne_dewac_175m_600"],
286 ["Named Entity", "ne_hgc_175m_600=", "ne_hgc_175m_600"]
287 ],
288 "corenlp/ne=" : namedEntities,
289 "corenlp/ne_dewac_175m_600=" : namedEntities,
290 "corenlp/ne_hgc_175m_600=" : namedEntities,
291 "cnx/" : [
292 ["Constituency", "c="],
293 ["Lemma", "l="],
294 ["Morphology", "m="],
295 ["Part-of-Speech", "p="],
296 ["Syntax", "syn="]
297 ],
298 "cnx/c=" : [
299 ["np", "np ", "Nominal Phrase"]
300 ],
301 // http://www.ids-mannheim.de/cosmas2/projekt/referenz/connexor/morph.html
302 "cnx/m=" : [
303 ["Abbr","Abbr ", "Nouns: Abbreviation"],
304 ["CMP","CMP ", "Adjective: Comparative"],
305 ["IMP", "IMP ", "Mood: Imperative"],
306 ["IND", "IND ", "Mood: Indicative"],
307 ["INF", "INF ", "Infinitive"],
308 ["ORD","ORD ", "Numeral: Ordinal"],
309 ["PAST", "PAST ", "Tense: past"],
310 ["PCP", "PCP ", "Participle"],
311 ["PERF", "PERF ", "Perfective Participle"],
312 ["PL","PL ", "Nouns: Plural"],
313 ["PRES", "PRES ", "Tense: present"],
314 ["PROG", "PROG ", "Progressive Participle"],
315 ["Prop","Prop ", "Nouns: Proper Noun"],
316 ["SUB", "SUB ", "Mood: Subjunctive"],
317 ["SUP","SUP ", "Adjective: Superlative"]
318 ],
319 // http://www.ids-mannheim.de/cosmas2/projekt/referenz/connexor/morph.html
320 "cnx/p=" : [
321 ["A", "A ", "Adjective"],
322 ["ADV", "ADV ", "Adverb"],
323 ["CC", "CC ", "Coordination Marker"],
324 ["CS", "CS ", "Clause Marker"],
325 ["DET", "DET ", "Determiner"],
326 ["INTERJ", "INTERJ ", "Interjection"],
327 ["N", "N ", "Noun"],
328 ["NUM", "NUM ", "Numeral"],
329 ["PREP", "PREP ", "Preposition"],
330 ["PRON", "PRON ", "Pro-Nominal"],
331 ["V", "V ", "Verb"]
332 ],
333 // http://www.ids-mannheim.de/cosmas2/projekt/referenz/connexor/syntax.html
334 "cnx/syn=" : [
335 ["@ADVL", "@ADVL ", "Adverbial Head"],
336 ["@AUX", "@AUX ", "Auxiliary Verb"],
337 ["@CC", "@CC ", "Coordination"]
338 ["@MAIN", "@MAIN ", "Main Verb"],
339 ["@NH", "@NH ", "Nominal Head"],
340 ["@POSTMOD", "@POSTMOD ", "Postmodifier"],
341 ["@PREMARK", "@PREMARK ", "Preposed Marker"],
342 ["@PREMOD", "@POSTMOD ", "Premodifier"]
343 ],
344 "opennlp/" : [
345 ["Part-of-Speech", "p="]
346 ],
347 "opennlp/p=" : sttsArray,
348 "xip/" : [
349 ["Constituency", "c="],
350 // Inactive: ["Dependency", "d="],
351 ["Lemma", "l="],
352 ["Part-of-Speech", "p="],
353 ],
354 // "xip/c=" : [],
355 // Inactive: "xip/d=" : [],
356 // "xip/p=" : [],
357 "tt/" : [
358 ["Lemma", "l="],
359 ["Part-of-Speech", "p="]
360 ],
361 "tt/p=" : sttsArray,
362 "mate/" : [
363 // Inactive: "d" : ["d=", "Dependency"],
364 ["Lemma", "l="],
365 ["Morphology", "m="],
366 ["Part-of-Speech", "p="]
367 ],
368 // Inactive: mate/d=
369 "mate/p=" : mateSttsArray,
370 "mate/m=" : [
371 ["Case", "case:"],
372 ["Degree", "degree:"],
373 ["Gender", "gender:"],
374 ["Mood", "mood:"],
375 ["Number", "number:"],
376 ["Person", "person:"],
377 ["Tense","tense:"],
378 ["No type", "<no-type> "]
379 ],
380 "mate/m=case:" : [
381 ["acc", "acc ", "Accusative"],
382 ["dat","dat ", "Dative"],
383 ["gen", "gen ","Genitive"],
384 ["nom","nom ", "Nominative"],
385 ["*","* ", "Undefined"]
386 ],
387 "mate/m=degree:" : [
388 ["comp","comp ", "Comparative"],
389 ["pos","pos ", "Positive"],
390 ["sup","sup ", "Superative"]
391 ],
392 "mate/m=gender:" : [
393 ["fem", "fem ", "Feminium"],
394 ["masc", "masc ", "Masculinum"],
395 ["neut","neut ", "Neuter"],
396 ["*","* ","Undefined"]
397 ],
398 "mate/m=mood:" : [
399 ["imp","imp ", "Imperative"],
400 ["ind","ind ", "Indicative"],
401 ["subj","subj ", "Subjunctive"]
402 ],
403 "mate/m=number:" : [
404 ["pl","pl ","Plural"],
405 ["sg","sg ","Singular"],
406 ["*","* ","Undefined"]
407 ],
408 "mate/m=person:" : [
409 ["1","1 ", "First Person"],
410 ["2","2 ", "Second Person"],
411 ["3","3 ", "Third Person"]
412 ],
413 "mate/m=tense:" : [
414 ["past","past ", "Past"],
415 ["pres","pres ", "Present"]
416 ]
417};
418
Nils Diewald845282c2015-05-14 07:53:03 +0000419var queryExample = {"wrap":{"layer":"orth","match":"match:eq","foundry":"opennlp","key":"Baum","@type":"korap:term"},"@type":"korap:token"};
420
421queryExample = {
422 "@context" : "http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld",
423 "collection" : {
424 "@type" : "koral:doc",
425 "key" : "pubDate",
426 "value" : "2005-05-25",
427 "type" : "type:date",
428 "match" : "match:geq"
429 },
430 "query" : {}
431};
432
433queryExample = {
434 "@type" : "koral:docGroup",
435 "operation" : "operation:and",
436 "operands" : [{
437 "@type":"koral:doc",
438 "key":"title",
439 "match":"match:eq",
440 "value":"Der Birnbaum",
441 "type":"type:string"
442 },{
443 "@type":"koral:doc",
444 "key":"pubPlace",
445 "match":"match:eq",
446 "value":"Mannheim",
447 "type":"type:string"
448 }
449 ]
450 };
451
452queryExample = {
453 "@context" : "http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld",
454 "collection" : {},
455 "query" : {
456 "@type":"koral:group",
457 "operation" : "operation:sequence",
458 "operands" : [
459 {
460 "@type" : "koral:token",
461 "wrap" : {
462 "@type" : "koral:termGroup",
463 "relation" : "relation:and",
464 "operands" : [ {
465 "@type" : "koral:term",
466 "foundry" : "tt",
467 "key" : "ADJA",
468 "layer" : "pos",
469 "match" : "match:eq"
470 },
471 {
472 "@type" : "koral:term",
473 "foundry" : "cnx",
474 "key" : "@PREMOD",
475 "layer" : "syn",
476 "match" : "match:eq"
477 } ]
478 }
479 },
480 {
481 "@type" : "koral:token",
482 "wrap" : {
483 "@type" : "koral:term",
484 "key" : "octopus",
485 "layer" : "lemma",
486 "match" : "match:eq"
487 }
488 } ]
489 }
490};
491
492
493queryExample = {
494 "@context" : "http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld",
495 "collection" : {
496 "@type" : "koral:doc",
497 "key" : "pubDate",
498 "value" : "2005-05-25",
499 "type" : "type:date",
500 "match" : "match:geq"
501 },
502 "query" : {
503 "@type" : "koral:token",
504 "wrap" : {
505 "@type" : "koral:term",
506 "key" : "octopus",
507 "layer" : "lemma",
508 "match" : "match:eq"
509 }
510 }
511};
512
513queryExample = {
514 "@type":"koral:doc",
515 "key":"subTitle",
516 "value":"Gedichte",
517 "match":"match:eq",
518 "rewrites" : [
519 {
520 "@type": "koral:rewrite",
521 "src" : "policy",
522 "operation" : "operation:injection",
523 }
524 ]
525};
526
Nils Diewald0e6992a2015-04-14 20:13:52 +0000527
528requirejs.config({
529 baseUrl: '../js/src',
530 paths : {
531 'lib': '../lib'
Nils Diewalda944fab2015-04-08 21:02:04 +0000532 }
Nils Diewald0e6992a2015-04-14 20:13:52 +0000533});
Nils Diewalda944fab2015-04-08 21:02:04 +0000534
Nils Diewald845282c2015-05-14 07:53:03 +0000535// KorAP.currentQuery = queryExample;
536
Nils Diewald0e6992a2015-04-14 20:13:52 +0000537require(['init'], function (init) {
Nils Diewalda944fab2015-04-08 21:02:04 +0000538
Nils Diewald0e6992a2015-04-14 20:13:52 +0000539 KorAP.hintArray = hintArray;
Nils Diewalda944fab2015-04-08 21:02:04 +0000540
Nils Diewald6283d692015-04-23 20:32:53 +0000541 // Set current virtual collection
542 KorAP.currentVC = vcExample;
543
Nils Diewald0e6992a2015-04-14 20:13:52 +0000544 // Parse and show the table
545 // Override getMatchInfo API call
546 KorAP.API.getMatchInfo = function(match, callObj, cb) {
547 if (callObj["spans"] !== undefined && callObj["spans"] === true) {
548 cb({ "snippet": treeSnippet2 });
549 }
550 else {
551 cb({ "snippet": snippet });
552 }
553 };
554
555 /**
556 * Do some things at the beginning.
557 */
Nils Diewalda944fab2015-04-08 21:02:04 +0000558
Nils Diewalda944fab2015-04-08 21:02:04 +0000559 // document.getElementById('vc-choose').click();
Nils Diewalda944fab2015-04-08 21:02:04 +0000560 // init.tutorial.show();
561
Nils Diewald0e6992a2015-04-14 20:13:52 +0000562 /*
563 KorAP.HintMenu.hide = function () {};
564 init.hint.show();
Nils Diewald2488d052015-04-09 21:46:02 +0000565
Nils Diewald0e6992a2015-04-14 20:13:52 +0000566 var menu = KorAP.MatchTreeMenu.create(
567 undefined,
568 menuContent
569 );
570 menu.hide = function () {};
571 document.getElementById('menu').appendChild(menu.element());
572 menu.limit(3);
573 menu.show();
574 menu.focus();
575 */
Nils Diewalda944fab2015-04-08 21:02:04 +0000576});