blob: 3c4bf0e77a9a042762eedcfe1a10b1c3b2687c6f [file] [log] [blame]
Nils Diewald0e6992a2015-04-14 20:13:52 +00001requirejs.config({
2 baseUrl: '../js/src',
3 paths : {
4 'lib': '../lib'
5 }
6});
7
8// Parse and show the table
9// Override getMatchInfo API call
10require(['init'], function () {
11
Nils Diewald4347ee92015-05-04 20:32:48 +000012 var snippet = "<span title=\"cnx/l:meist\">" +
Nils Diewald0e6992a2015-04-14 20:13:52 +000013 " <span title=\"cnx/p:ADV\">" +
14 " <span title=\"cnx/syn:@PREMOD\">" +
15 " <span title=\"mate/l:meist\">" +
16 " <span title=\"mate/p:ADV\">" +
17 " <span title=\"opennlp/p:ADV\">meist</span>" +
18 " </span>" +
19 " </span>" +
20 " </span>" +
21 " </span>" +
22 "</span>" +
23 "<span title=\"cnx/l:deutlich\">" +
24 " <span title=\"cnx/p:A\">" +
25 " <span title=\"cnx/syn:@PREMOD\">" +
26 " <span title=\"mate/l:deutlich\">" +
27 " <span title=\"mate/m:degree:pos\">" +
28 " <span title=\"mate/p:ADJD\">" +
29 " <span title=\"opennlp/p:ADJD\">deutlich</span>" +
30 " </span>" +
31 " </span>" +
32 " </span>" +
33 " </span>" +
34 " </span>" +
35 "</span>" +
36 "<span title=\"cnx/l:fähig\">" +
37 " <span title=\"cnx/l:leistung\">" +
38 " <span title=\"cnx/p:A\">" +
39 " <span title=\"cnx/syn:@NH\">" +
40 " <span title=\"mate/l:leistungsfähig\">" +
41 " <span title=\"mate/m:degree:comp\">" +
42 " <span title=\"mate/p:ADJD\">" +
43 " <span title=\"opennlp/p:ADJD\">leistungsfähiger</span>" +
44 " </span>" +
45 " </span>" +
46 " </span>" +
47 " </span>" +
48 " </span>" +
49 " </span>" +
50 "</span>";
51
Akron98a933f2016-08-11 00:19:17 +020052 var treeSnippet =
Nils Diewald0e6992a2015-04-14 20:13:52 +000053 "<span class=\"context-left\"></span>" +
54 "<span class=\"match\">" +
55 " <span title=\"xip/c:MC\">" +
56 " <span title=\"xip/c:TOP\">" +
57 " <span title=\"xip/c:PP\">" +
58 " <span title=\"xip/c:PREP\">Mit</span>" +
59 " <span title=\"xip/c:NP\">" +
60 " <span title=\"xip/c:DET\">dieser</span>" +
61 " <span title=\"xip/c:NPA\">" +
62 " <span title=\"xip/c:NOUN\">Methode</span>" +
63 " </span>" +
64 " </span>" +
65 " </span>" +
66 " <span title=\"xip/c:VERB\">ist</span>" +
Akron98a933f2016-08-11 00:19:17 +020067 " <mark>" +
68 " <span title=\"xip/c:NP\">" +
69 " <span title=\"xip/c:PRON\">es</span>" +
70 " </span>" +
71 " <span title=\"xip/c:AP\">" +
72 " <span title=\"xip/c:ADV\">nun</span>" +
73 " <span title=\"xip/c:ADJ\">möglich</span>" +
74 " </span>" +
75 " </mark>" +
Nils Diewald0e6992a2015-04-14 20:13:52 +000076 " <span title=\"xip/c:ADV\">z. B.</span>" +
77 " <span title=\"xip/c:NPA\">" +
78 " <span title=\"xip/c:NP\">" +
79 " <span title=\"xip/c:NOUN\">Voice</span>" +
80 " </span>" +
81 " </span>" + "(" +
82 " <span title=\"xip/c:INS\">" +
83 " <span title=\"xip/c:NPA\">" +
84 " <span title=\"xip/c:NP\">" +
85 " <span title=\"xip/c:NOUN\">Sprache</span>" +
86 " </span>" +
87 " </span>" +
88 " </span>" + ")" +
89 " <span title=\"xip/c:VERB\">bevorzugt</span>" +
90 " <span title=\"xip/c:PP\">" +
91 " <span title=\"xip/c:PREP\">in</span>" +
92 " <span title=\"xip/c:NP\">" +
93 " <span title=\"xip/c:PRON\">der</span>" +
94 " </span>" +
95 " <span title=\"xip/c:NPA\">" +
96 " <span title=\"xip/c:NP\">" +
97 " <span title=\"xip/c:NOUN\">Bridge</span>" +
98 " </span>" +
99 " </span>" +
100 " </span>" +
101 " <span title=\"xip/c:INFC\">" +
102 " <span title=\"xip/c:INS\">" +
103 " <span title=\"xip/c:VERB\">weiterzugeben</span>" +
104 " </span>" +
105 " </span>" +
106 " </span>" +
107 " </span>" +
108 "</span>" +
109 "<span class=\"context-right\"></span>";
110
Akronaa01dca2018-02-05 19:51:28 +0100111
112 var relSnippet =
113 "<span class=\"context-left\"></span>"+
114 "<span class=\"match\">"+
115 " <span xml:id=\"token-WDD17/982/72848-p15836-15839\">"+
116 " <span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15838\">Ein</span>"+
117 " "+
118 " <span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15838\">letztes</span>"+
119 " "+
120 " <span xml:id=\"token-WDD17/982/72848-p15838\">"+
121 // s1464_n2 "ein" -> ":"
122 " <span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15836-15839\">mal</span>"+
123 " </span>"+
124 ": "+
125 " <span xml:id=\"token-WDD17/982/72848-p15839-15840\">"+
126 " <span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15839-15840\">AL</span>"+
127 " </span>"+
128 " </span>"+
129 " <span xlink:show=\"other\" data-action=\"join\" xlink:href=\"#token-WDD17/982/72848-p15839-15840\">"+
130 ":"+
131 " <span xml:id=\"token-WDD17/982/72848-p15840-15846\">"+
132 " <span xml:id=\"token-WDD17/982/72848-p15840\">"+
133 " <span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15840-15846\">halt</span>"+
134 " </span>"+
135 " </span>"+
136 " </span>"+
137 " <span xlink:show=\"other\" data-action=\"join\" xlink:href=\"#token-WDD17/982/72848-p15840-15846\">"+
138 " "+
139 " <span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15842\">den</span>"+
140 " "+
141 " <span xml:id=\"token-WDD17/982/72848-p15842\">"+
142 " <span xlink:title=\"lwc/d:OA\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15843\">Ball</span>"+
143 " </span>"+
144 " "+
145 " <span xml:id=\"token-WDD17/982/72848-p15843\">"+
146 " <span xlink:title=\"lwc/d:PD\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15840\">flach</span>"+
147 " </span>"+
148 ", "+
149 " <mark>"+
150 " <span xlink:title=\"lwc/d:MO\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15845\">ganz</span>"+
151 " "+
152 " <span xml:id=\"token-WDD17/982/72848-p15845\">"+
153 " <span xlink:title=\"lwc/d:CJ\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15843\">flach</span>"+
154 " </span>"+
155 " </mark>"+
156 " </span>"+
157 "</span>"+
158 "<span class=\"context-right\"></span>";
159
Akron0ad7cd22018-02-08 18:03:06 +0100160 var meta = {"messages":[["Response format is temporary"]],"@context":"http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld","meta":{},"document":{"@type":"koral:document","fields":[{"@type":"koral:field","type":"type:store","key":"ref","value":"My reference"},{"@type":"koral:field","type":"type:text","key":"title","value":"Der Name der Rose"},{"@type":"koral:field","type":"type:string","key":"textSigle","value":"a/b/c"},{"@type":"koral:field","type":"type:string","key":"keyword","value":["baum","wald"]},{"@type":"koral:field","type":"type:number","key":"zahl1","value":56},{"@type":"koral:field","type":"type:string","key":"name","value":"Peter"}]}};
161
Akronbf3fc9d2018-03-08 12:36:39 +0100162 meta = {"messages":[["Response format is temporary"]],"@context":"http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld","meta":{},"document":{"@type":"koral:document","fields":[{"@type":"koral:field","type":"type:number","key":"pubDate","value":20170701},{"@type":"koral:field","type":"type:string","key":"textSigle","value":"WDD17/982/72848"},{"@type":"koral:field","type":"type:string","key":"foundries","value":"dereko dereko/structure dereko/structure/base-sentences-paragraphs-pagebreaks lwc lwc/dependency treetagger treetagger/morpho"},{"@type":"koral:field","type":"type:string","key":"corpusSigle","value":"WDD17"},{"@type":"koral:field","type":"type:string","key":"docSigle","value":"WDD17/982"},{"@type":"koral:field","type":"type:store","key":"reference","value":"Diskussion:99 Namen Allahs/Archiv/1, In: Wikipedia - URL:http://de.wikipedia.org/wiki/Diskussion:99_Namen_Allahs/Archiv/1: Wikipedia, 2017"},{"@type":"koral:field","type":"type:text","key":"author","value":"ArchivBot, u.a."},{"@type":"koral:field","type":"type:number","key":"creationDate","value":20140609},{"@type":"koral:field","type":"type:string","key":"textTypeArt","value":"Diskussion"},{"@type":"koral:field","type":"type:store","key":"editor","value":"wikipedia.org"},{"@type":"koral:field","type":"type:text","key":"title","value":"Diskussion:99 Namen Allahs/Archiv/1"},{"@type":"koral:field","type":"type:store","key":"tokenSource","value":"base#tokens"},{"@type":"koral:field","type":"type:store","key":"layerInfos","value":"dereko/s=spans lwc/d=rels tt/l=tokens tt/p=tokens"},{"@type":"koral:field","type":"type:string","key":"textClass","value":"staat-gesellschaft biographien-interviews"},{"@type":"koral:field","type":"type:string","key":"availability","value":"CC-BY-SA"}]}};
Akron0ad7cd22018-02-08 18:03:06 +0100163
Akronbf3fc9d2018-03-08 12:36:39 +0100164 meta = {
165 "@context":"http:\/\/korap.ids-mannheim.de\/ns\/KoralQuery\/v0.3\/context.jsonld",
166 "document":{
167 "@type":"koral:document",
168 "fields":[
169 {
170 "@type":"koral:field",
171 "key":"editor",
172 "type":"type:store",
173 "value":"wikipedia.org"
174 },
175 {
176 "@type":"koral:field",
177 "key":"textSigle",
178 "type":"type:string",
179 "value":"WPD15\/264\/58336"
180 },
181 {
182 "@type":"koral:field",
183 "key":"author",
184 "type":"type:text",
185 "value":"Sprachpfleger, u.a."
186 },
187 {
188 "@type":"koral:field",
189 "key":"docSigle",
190 "type":"type:string",
191 "value":"WPD15\/264"
192 },
193 {
194 "@type":"koral:field",
195 "key":"textTypeArt",
196 "type":"type:string",
197 "value":"Enzyklopädie-Artikel"
198 },
199 {
200 "@type":"koral:field",
201 "key":"language",
202 "type":"type:string",
203 "value":"de"
204 },
205 {
206 "@type":"koral:field",
207 "key":"docTitle",
208 "type":"type:text",
209 "value":"Wikipedia, Artikel mit Anfangszahl 2, Teil 64"
210 },
211 {
212 "@type":"koral:field",
213 "key":"textType",
214 "type":"type:string",
215 "value":"Enzyklopädie"
216 },
217 {
218 "@type":"koral:field",
219 "key":"availability",
220 "type":"type:string",
221 "value":"CC-BY-SA"
222 },
223 {
224 "@type":"koral:field",
225 "key":"foundries",
226 "type":"type:keywords",
227 "value":[
228 "corenlp",
229 "corenlp\/constituency",
230 "corenlp\/morpho",
231 "corenlp\/sentences",
232 "dereko",
233 "dereko\/structure",
234 "dereko\/structure\/base-sentences-paragraphs-pagebreaks",
235 "opennlp",
236 "opennlp\/morpho",
237 "opennlp\/sentences"
238 ]
239 },
240 {
241 "@type":"koral:field",
242 "key":"creationDate",
243 "type":"type:date",
244 "value":"2015-04-17"
245 },
246 {
247 "@type":"koral:field",
248 "key":"title",
249 "type":"type:text",
250 "value":"22:43 – Das Schicksal hat einen Plan"
251 },
252 {
253 "@type":"koral:field",
254 "key":"pubDate",
255 "type":"type:date",
256 "value":"2015-05-01"
257 },
258 {
259 "@type":"koral:field",
260 "key":"reference",
261 "type":"type:store",
262 "value":"22:43 – Das Schicksal hat einen Plan, In: Wikipedia - URL:http:\/\/de.wikipedia.org\/wiki\/22:43_–_Das_Schicksal_hat_einen_Plan: Wikipedia, 2015"
263 },
264 {
265 "@type":"koral:field",
266 "key":"textClass",
267 "type":"type:keywords",
268 "value":["kultur","film"]
269 },
270 {
271 "@type":"koral:field",
272 "key":"tokenSource",
273 "type":"type:store",
274 "value":"base#tokens"
275 },
276 {
277 "@type":"koral:field",
278 "key":"publisher",
279 "type":"type:store",
280 "value":"Wikipedia"
281 },
282 {
283 "@type":"koral:field",
284 "key":"layerInfos",
285 "type":"type:store",
286 "value":"corenlp\/c=spans corenlp\/p=tokens corenlp\/s=spans dereko\/s=spans opennlp\/p=tokens opennlp\/s=spans"
287 },
288 {
289 "@type":"koral:field",
290 "key":"pubPlace",
291 "type":"type:string",
292 "value":"URL:http:\/\/de.wikipedia.org"
293 },
294 {
295 "@type":"koral:field",
296 "key":"corpusTitle",
297 "type":"type:text",
298 "value":"Wikipedia"
299 },
300 {
301 "@type":"koral:field",
302 "key":"corpusEditor",
303 "type":"type:store",
304 "value":"wikipedia.org"
305 },
306 {
307 "@type":"koral:field",
308 "key":"corpusSigle",
309 "type":"type:string",
310 "value":"WPD15"
311 }
312 ]
313 }
314 };
Akron0ad7cd22018-02-08 18:03:06 +0100315
Nils Diewald4347ee92015-05-04 20:32:48 +0000316
Nils Diewald0e6992a2015-04-14 20:13:52 +0000317 KorAP.API.getMatchInfo = function(match, callObj, cb) {
Akron7f613e02016-11-07 02:50:44 +0100318 console.dir(callObj);
Nils Diewald0e6992a2015-04-14 20:13:52 +0000319 if (callObj["spans"] !== undefined && callObj["spans"] === true) {
Akronaa01dca2018-02-05 19:51:28 +0100320 if (callObj["layer"] === "d") {
321 return cb({ "snippet": relSnippet });
322 }
323 else {
324 return cb({ "snippet": treeSnippet });
325 }
Nils Diewald0e6992a2015-04-14 20:13:52 +0000326 }
327 else {
328 return cb({ "snippet": snippet });
329 }
330 };
Akron0ad7cd22018-02-08 18:03:06 +0100331
332 KorAP.API.getTextInfo = function(doc, callObj, cb) {
333 return cb(meta);
334 };
Nils Diewald0e6992a2015-04-14 20:13:52 +0000335});