blob: 9acc7a1c1311ca7af5a4e010440321e9626f30e0 [file] [log] [blame]
Marc Kupietz83305222016-04-28 09:57:22 +02001<!DOCTYPE html>
2<html>
3 <head>
Marc Kupietz58270662017-12-04 12:10:06 +01004 <title>DeReKo-Word-Vector-Distances: <%= $word %></title>
Marc Kupietz80bd7b92017-07-04 16:25:54 +02005 <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
Marc Kupietz58270662017-12-04 12:10:06 +01006 <link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Condensed" rel="stylesheet">
Marc Kupietz80bd7b92017-07-04 16:25:54 +02007 <script src="http://code.jquery.com/jquery-latest.min.js"></script>
Marc Kupietz58270662017-12-04 12:10:06 +01008 <script src = "https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
9 <script src = "https://cdn.datatables.net/fixedcolumns/3.2.3/js/dataTables.fixedColumns.min.js"></script>
10 <script src = "https://cdn.datatables.net/plug-ins/1.10.16/sorting/scientific.js"></script>
Marc Kupietza0ffb392018-01-25 08:53:43 +010011 <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML'></script>
Marc Kupietz58270662017-12-04 12:10:06 +010012 <link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
Marc Kupietz80bd7b92017-07-04 16:25:54 +020013 <script
Marc Kupietze6a7a732018-01-12 09:21:08 +010014 src="http://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
15 integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
16 crossorigin="anonymous"></script>
Marc Kupietz80bd7b92017-07-04 16:25:54 +020017 <script>
Marc Kupietza0ffb392018-01-25 08:53:43 +010018 MathJax.Hub.Config({
19 config: ["MMLorHTML.js"],
20 jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML", "output/PreviewHTML"],
21 extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js", "fast-preview.js", "AssistiveMML.js", "a11y/accessibility-menu.js"],
22 TeX: {
23 extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
24 }
25 });
Marc Kupietz58270662017-12-04 12:10:06 +010026 var urlParams = new URLSearchParams(window.location.search);
Marc Kupietzb3a2e4f2017-12-08 17:25:53 +010027 var currentWords = urlParams.get("word");
Marc Kupietza0ffb392018-01-25 08:53:43 +010028 var CIIsearchWords = (currentWords && currentWords.includes(" ") ? '('+currentWords.replace(/ +/g, " oder ")+')' : currentWords);
Marc Kupietz66bfd952017-12-11 09:59:45 +010029 var collocatorTable = null;
Marc Kupietza6e08f02017-12-01 22:06:21 +010030
Marc Kupietz58270662017-12-04 12:10:06 +010031 $(document).ready(function() {
Marc Kupietz694610d2017-11-25 18:30:03 +010032
Marc Kupietza0ffb392018-01-25 08:53:43 +010033 $('#firstable').hide();
34 //Set up a callback to hear back when MathJax is done rendering the equations
35 // it finds
36 $('#ccd').load(
37 '@Url.Action("ActionResultMethod","ControllerName",{controller parameters})',
38 function () {
39 MathJax.Hub.Queue(
40 ["Typeset",MathJax.Hub,"ccd"],
41 function () {
42 $("#lfmd_tt").attr("title",$("#lfmd_ttt").html());
43 $("#npmi_tt").attr("title",$("#npmi_ttt").html());
44 }
45 );
46 });
47
48 //set things up so that we can shove raw html into what is shown in the tooltip;
49 // in this case, we will have already put into the title attribute the html that
50 // contains the MathJax rendered equations (via what we do in the callback).
51 $(function () {
52 $(document).tooltip({
53 content: function () {
54 return $(this).prop('title');
55 }
56 });
57 });
58
Marc Kupietze6a7a732018-01-12 09:21:08 +010059 $("input").bind("keydown", function(event) {
60 // track enter key
61 var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
62 if (keycode == 13) { // keycode for enter key
63 // force the 'Enter Key' to implicitly click the Update button
64 document.getElementById('SEARCH').click();
65 return false;
66 } else {
67 return true;
68 }});
Marc Kupietzdab9f222017-11-29 14:22:59 +010069
Marc Kupietze871abd2018-01-25 16:18:27 +010070 var collocatorTable_activated = false;
Marc Kupietze6a7a732018-01-12 09:21:08 +010071 $( "#tabs" ).on( "tabsactivate", function( event, ui ) {
72 if (localStorage) localStorage['tab'] = ui.newTab.index();
Marc Kupietze871abd2018-01-25 16:18:27 +010073 if(ui.newTab.index() == 2 && !collocatorTable_activated) {
74 classicCollocatorTable.columns.adjust();
75 collocatorTable.columns.adjust();
76 collocatorTable_activated = true;
77 }
Marc Kupietze6a7a732018-01-12 09:21:08 +010078 });
79
80 $(function(){
81 $("#SEARCH").click(function() {
82 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietz58270662017-12-04 12:10:06 +010083 });
Marc Kupietze6a7a732018-01-12 09:21:08 +010084 });
Marc Kupietz0af83e32017-11-27 09:31:37 +010085
Marc Kupietze6a7a732018-01-12 09:21:08 +010086 function changeCharColor(txt, heat, word) {
87 var newText = "";
88 for (var i=0, l=txt.length; i<l; i++) {
89 newText += (i == 5 ? txt.charAt(i) : '<a href="http://korap.ids-mannheim.de/kalamar/?ql=cosmas2&q=' +
90 CIIsearchWords + ' /' + (i > 5? '%2B' : '-') + 'w' +
91 Math.abs(i-5) + ':' + Math.abs(i-5) + ' ' + word +
92 '" target="korap"><span style="background-color:' +
93 getHeatColor(heat[i]/maxHeat)+'">'+txt.charAt(i)+'</span></a>');
Marc Kupietzb6c615d2017-12-02 10:38:20 +010094 }
Marc Kupietze6a7a732018-01-12 09:21:08 +010095 return newText;
96 }
Marc Kupietzb6c615d2017-12-02 10:38:20 +010097
Marc Kupietze6a7a732018-01-12 09:21:08 +010098 function getHeatColor(value) {
99 var hue=((1-value)*120).toString(10);
100 return ["hsl(",hue,",90%,70%)"].join("");
101 }
102
103 function bitvec2window(n, heat, word) {
104 var str = n.toString(2).padStart(10, "0")
105 .replace(/^([0-9]{5})/, '$1x')
106 .replace(/0/g, '·')
107 .replace(/1/g, '+');
108 return changeCharColor(str, heat, word);
109 }
110
111 % use Mojo::ByteStream 'b';
112 var paraResults = <%= b(Mojo::JSON::to_json($lists)) %>;
113 var urlprefix = new URLSearchParams(window.location.search);
114 if (paraResults.length > 0 && paraResults[0] != null) {
115 var nvecs = [],
116 nwords = [],
117 nranks = [],
118 nmarked = [];
119 for(var i = 0; i < paraResults.length; i++) {
120 nwords = nwords.concat(paraResults[i].map(function(a){return a.word;}));
121 nvecs = nvecs.concat(paraResults[i].map(function(a){return a.vector;}));
122 nranks = nranks.concat(paraResults[i].map(function(a){return a.rank;}));
123 nmarked = nmarked.concat(paraResults[i].map(function(a){return a.marked;}));
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100124 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100125 showMap({target: " "+urlParams.get('word')+" ", mergedEnd: 0, words: nwords, vecs: nvecs, ranks: nranks, marked: nmarked} );
126 var t = $('#firsttable').DataTable({
127 data: paraResults[0],
128 "sScrollY": "780px",
129 "bScrollCollapse": true,
130 "bPaginate": false,
131 "bJQueryUI": true,
132 "dom": '<"top">rt<"bottom"flp><"clear">',
133 "columns": [
134 { "data": "rank", type: "allnumeric" },
135 { "data": "dist", render: function ( data, type, row ) {return data.toFixed(3) }},
136 { "data": "word", render: function ( data, type, row ) {urlprefix.set("word", data); return '<a href="?' + urlprefix + '">' + data + '</a>' }}
137 ],
138 "columnDefs": [
139 { className: "dt-right", "targets": [0,1] },
140 { "searchable": false,
141 "orderable": false,
142 "targets": 0
143 },
144 { "orderSequence": [ "desc" ], "targets": [ 1 ] },
145 { "orderSequence": [ "asc", "desc" ], "targets": [ 2 ] },
146 ],
147 "oLanguage": {
148 "sSearch": "Filter: "
149 },
150 "order": [[ 1, 'desc' ]],
151 } );
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100152
Marc Kupietze6a7a732018-01-12 09:21:08 +0100153 t.on( 'order.dt search.dt', function () {
154 t.column(0, {order:'applied'}).nodes().each( function (cell, i) {
155 cell.innerHTML = i+1;
156 } );
157 } ).draw();
158
159 $( "#first" ).clone().prependTo( "#tabs-2" );
160
161 }
162
163
164 var collocatorData = <%= b(Mojo::JSON::to_json($collocators)) %>;
165 var maxHeat; // = Math.max.apply(Math,collocatorData.map(function(o){return o.cprob;}))
166
167 if (collocatorData != null) {
168 maxHeat = Math.max.apply(Math,collocatorData.map(function(o){return Math.max.apply(Math,o.heat);}))
169 collocatorTable = $('#secondtable').DataTable({
170 data: collocatorData,
171 "sScrollY": "780px",
172 "bScrollCollapse": true,
173 "bPaginate": false,
174 "bJQueryUI": true,
175 "dom": '<"top">rt<"bottom"flp><"clear">',
176 "columns": [
177 { "data": "rank", type: "allnumeric" },
178 { "data": "pos", width: "7%", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitvec2window(data, row.heat, row.word) }},
179 { "data": "max", render: function ( data, type, row ) {return data.toFixed(3) }},
180 { "data": "average", render: function ( data, type, row ) {return data.toFixed(3) }},
181 { "data": "prob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
182 { "data": "cprob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
183 { "data": "overall", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
184 { "data": "word", sClass: "collocator" },
185 { "data": "rank", type: "allnumeric" }
186 ],
187 "columnDefs": [
188 { className: "dt-right", "targets": [0,2,3,4,5,6] },
189 { className: "dt-center", "targets": [ 1] },
190 { "searchable": false,
191 "orderable": false,
192 "targets": [0, 8]
193 },
194 { "type": "scientific", targets: [2,3,4,5,6] },
195 { "orderSequence": [ "desc" ], "targets": [ 2, 3, 4, 5, 6 ] },
196 { "orderSequence": [ "asc", "desc" ], "targets": [ 1, 7 ] },
197 { "targets": [8], "visible": false }
198 ],
199 "oLanguage": {
200 "sSearch": "Filter: "
201 },
202 "order": [[ 4, 'desc' ]],
203 } );
204 $.ajaxSetup({
205 type: 'POST',
206 timeout: 30000,
207 error: function(xhr) {
208 $('#display_error')
209 .html('Error: ' + xhr.status + ' ' + xhr.statusText);
210 }
Marc Kupietz78b434a2018-01-12 22:33:32 +0100211 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100212
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100213 // var filterQuot = /(^quot?=[A-Z])|(quot$)/g;
214 var filterQuot = /^quot/;
Marc Kupietz78b434a2018-01-12 22:33:32 +0100215 classicCollocatorTable = $('#classicoloctable').DataTable({
216 ajax: {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100217 method: "GET",
218 url: '/derekovecs/getClassicCollocators',
219 dataType: 'json',
220 dataSrc: "",
221 timeout: 30000,
222 data: { w: paraResults[0][0].rank }
Marc Kupietz78b434a2018-01-12 22:33:32 +0100223 },
Marc Kupietzad783722018-01-13 17:45:21 +0100224 "initComplete":function(settings, json){
225 $("td.collocator").click(function(){
226 queryKorAPCII(this.textContent + " /w5 " + CIIsearchWords);
227 });
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100228 classicCollocatorTable.columns(".detail").visible(false);
229 $("#ccd").css('width', '450px');
230 classicCollocatorTable.columns.adjust().draw();
Marc Kupietzad783722018-01-13 17:45:21 +0100231 },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100232 "sScrollY": "780px",
233 "bScrollCollapse": true,
234 "bPaginate": false,
235 "bJQueryUI": true,
236 "dom": '<"top">rt<"bottom"flp><"clear">',
237 "columns": [
238 // { "data": "pos", width: "7%", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitvec2window(data, row.heat, row.word) }},
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100239 { "data": "llr", render: function ( data, type, row ) {return data.toFixed(0) }},
240 { "data": "lfmd", render: function ( data, type, row ) {return data.toFixed(1) }},
Marc Kupietz1acb3172018-02-17 09:41:26 +0100241 // { "data": "fpmi", type: "scientific", render: function ( data, type, row ) {return data.toExponential(2) } },
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100242 { "data": "npmi", render: function ( data, type, row ) {return data.toFixed(2) }},
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100243 { "data": "llfmd", render: function ( data, type, row ) {return data.toFixed(1) }},
244 { "data": "rlfmd", render: function ( data, type, row ) {return data.toFixed(1) }},
245 { "data": "lnpmi", render: function ( data, type, row ) {return data.toFixed(2) }},
246 { "data": "rnpmi", render: function ( data, type, row ) {return data.toFixed(2) }},
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100247 { "data": "f" },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100248 { "data": "word", sClass: "collocator" }
249 ],
250 "columnDefs": [
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100251 { className: "dt-right", "targets": [0,1,2,3,4,5,6,7] },
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100252 { className: "dt-right detail", "targets": [3,4,5,6] },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100253 { "searchable": false,
254 "orderable": false,
255 "targets": []
256 },
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100257 { "orderSequence": [ "desc" ], "targets": [ 0, 1, 2,3,4,5,6,7 ] },
258 { "orderSequence": [ "asc", "desc" ], "targets": [ 8 ] },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100259 ],
260 "oLanguage": {
261 "sSearch": "Filter: "
262 },
263 "order": [[ 1, 'desc' ]],
264 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100265
Marc Kupietz1acb3172018-02-17 09:41:26 +0100266
267 $('#show-details').change(function (e) {
268 var columns = classicCollocatorTable.columns(".detail");
269 if(this.checked) {
270 columns.visible(true);
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100271 $("#ccd").css('width', 'auto');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100272 } else {
273 columns.visible(false);
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100274 $("#ccd").css('width', '450px');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100275 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100276 classicCollocatorTable.columns.adjust().draw();
Marc Kupietz1acb3172018-02-17 09:41:26 +0100277 } );
278
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100279 $("td.collocator").click(function(){
280 queryKorAPCII(this.textContent + " /w5 " + CIIsearchWords);
Marc Kupietzad783722018-01-13 17:45:21 +0100281 });
282
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100283 collocatorTable.on( 'order.dt search.dt', function () {
284 collocatorTable.column(0, {order:'applied'}).nodes().each( function (cell, i) {
285 cell.innerHTML = i+1;
286 } );
287 }).draw();
288 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100289
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100290 if (localStorage && !window.location.hash) { // let's not crash if some user has IE7
291 var index = parseInt(localStorage['tab']||'0');
292 $("#tabs").tabs({ active: index });
293 }
294 $("#tabs").css("visibility", "visible"); // now we can show the tabs
295 });
Marc Kupietz58270662017-12-04 12:10:06 +0100296
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100297 $(function(){
298 $("#dropdownoptions").dialog({
299 title: "Options",
300 autoOpen: false,
301 modal: false,
302 draggable: false,
303 height: "auto",
304 width: "auto",
305 resizable: false,
306 buttons: {
307 "Cancel": function() {
308 $( this ).dialog( "close" );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100309 },
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100310 "Apply": function() {
311 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietze6a7a732018-01-12 09:21:08 +0100312 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100313 }
314 });
315 });
316
317 $(function(){
318 $("#showoptions").click(function(){
319 $("#dropdownoptions").dialog("open");
320 var target = $(this);
321 $("#dropdownoptions").dialog("widget").position({
322 my: 'left bottom',
323 at: 'left bottom',
324 of: target
Marc Kupietz58270662017-12-04 12:10:06 +0100325 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100326 });
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100327 });
328
329 $( function() {
330 $( "#no_iterations" ).spinner({
331 spin: function( event, ui ) {
332 if ( ui.value < 1000 ) {
333 $( this ).spinner( "value", 1000 );
334 return false;
335 } else if ( ui.value > 10000 ) {
336 $( this ).spinner( "value", 10000 );
337 return false;
338 }
339 }
340 });
341 } );
342
343 $( function() {
344 $( "#neighbours" ).spinner({
345 spin: function( event, ui ) {
346 if ( ui.value < 0 ) {
347 $( this ).spinner( "value", 0 );
348 return false;
349 } else if ( ui.value > 200 ) {
350 $( this ).spinner( "value", 200 );
351 return false;
352 }
353 }
354 });
355 } );
356
357 $( function() {
358 $( "#cutoff" ).spinner({
359 spin: function( event, ui ) {
360 if ( ui.value < 100000 ) {
361 $( this ).spinner( "value", 100000 );
362 return false;
363 } else if ( ui.value > 2000000 ) {
364 $( this ).spinner( "value", 2000000 );
365 return false;
366 }
367 }
368 });
369 } );
370
371 $( function() {
372 $( "#tabs" ).tabs().addClass('tabs-min');
373 } );
374
375 $( function() {
376 $( ".controlgroup-vertical" ).controlgroup({
377 "direction": "vertical"
378 });
379 } );
380
381 $(function() {
382 $( document ).tooltip({
383 content: function() {
384 return $(this).attr('title');
385 }}
386 )
387 });
388
389 $(function () {
390 $(document).tooltip({
391 content: function () {
392 return $(this).prop('title');
393 },
394 show: null,
395 close: function (event, ui) {
396 ui.tooltip.hover(
397 function () {
398 $(this).stop(true).fadeTo(400, 1);
399 },
400 function () {
401 $(this).fadeOut("400", function () {
402 $(this).remove();
403 })
404 });
405 }
406 });
407 });
Marc Kupietz83305222016-04-28 09:57:22 +0200408 </script>
Marc Kupietz58270662017-12-04 12:10:06 +0100409 <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
410 <script src="/derekovecs/js/tsne.js"></script>
411 <script src="/derekovecs/js/som.js"></script>
412 <script src="/derekovecs/js/labeler.js"></script>
Marc Kupietz83305222016-04-28 09:57:22 +0200413 <style>
414 body, input {
Marc Kupietz58270662017-12-04 12:10:06 +0100415 font-family: Lato, sans-serif;
416 font-size: 11pt;
Marc Kupietz83305222016-04-28 09:57:22 +0200417 }
Marc Kupietz30ca4342017-11-22 21:21:20 +0100418
Marc Kupietze6a7a732018-01-12 09:21:08 +0100419 .info {
420 font-size: 8pt;
421 margin-top: 4px;
422 /* position: absolute;
423 bottom: 0;
424 left: 0;
425 right: 0; */
426 }
427
Marc Kupietz58270662017-12-04 12:10:06 +0100428 h1, h2, h3 {
429 margin: 5px 10px 0 0;
430 color: rgb(246,168,0);
431 font-family: "Univers LT Std 47 Cn Lt", "Univers LT Std 67 Cn Lt", "Roboto Condensed", "Univers LT Std 67 Cn Bold", "UniversLTStd-BoldCn", "Times", 'League Gothic', Impact, sans-serif;
432 font-weight: bold;
433 line-height: 1.35;
434 letter-spacing: normal;
435 text-transform: uppercase;
436 text-shadow: none;
437 word-wrap: break-word;
438 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100439
440
Marc Kupietz58270662017-12-04 12:10:06 +0100441 showoptions, #SEARCH {
442 margin-left: 10px;
443 margin-right: 10px;
444 }
Marc Kupietz6dbadd12017-11-29 16:43:33 +0100445
Marc Kupietz58270662017-12-04 12:10:06 +0100446 .tabs-left-vertical .ui-tabs-nav {
447 position: absolute;
448 width: 21em;
449 transform: translate(-100%,0%) rotate(-90deg);
450 transform-origin: 100% 0%;
451 }
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100452
Marc Kupietz58270662017-12-04 12:10:06 +0100453 .tabs-left-vertical .ui-tabs-nav li {
454 float: right;
455 }
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100456
Marc Kupietz58270662017-12-04 12:10:06 +0100457 .tabs-left-vertical .ui-tabs-panel {
458 padding-left: 3.5em;
459 }
Marc Kupietzdab9f222017-11-29 14:22:59 +0100460
Marc Kupietz58270662017-12-04 12:10:06 +0100461 .tabs-left-vertical .ui-tabs-panel {
462 height: 20em;
463 }
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100464
Marc Kupietz58270662017-12-04 12:10:06 +0100465 .mono {
Marc Kupietzc8221182017-12-08 17:26:19 +0100466 font-family: "DejaVu Sans Mono", Inconsolata, SourceCodePro, "Courier New", Courier, monospace;
Marc Kupietz58270662017-12-04 12:10:06 +0100467 }
Marc Kupietz30ca4342017-11-22 21:21:20 +0100468
Marc Kupietz58270662017-12-04 12:10:06 +0100469 .ui-tooltip-content {
Marc Kupietz4116b432017-12-06 14:15:32 +0100470 font-size: 10pt;
Marc Kupietz58270662017-12-04 12:10:06 +0100471 color: #222222;
472 }
Marc Kupietzf4b49392016-04-28 10:49:56 +0200473
Marc Kupietz58270662017-12-04 12:10:06 +0100474 svg > .ui-tooltip-content {
475 font-size: 8pt;
476 color: #222222;
477 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100478
Marc Kupietz58270662017-12-04 12:10:06 +0100479 a.merged {
480 color: green;
481 fill: green;
482 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100483
Marc Kupietz58270662017-12-04 12:10:06 +0100484 #first a {
485 text-decoration: none;
486 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100487
Marc Kupietz58270662017-12-04 12:10:06 +0100488 a.marked, #first a.marked {
489 text-decoration: underline;
490 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100491
Marc Kupietz58270662017-12-04 12:10:06 +0100492 a.target {
493 color: red;
494 fill: red;
495 }
Marc Kupietz694610d2017-11-25 18:30:03 +0100496
Marc Kupietz58270662017-12-04 12:10:06 +0100497 table.display {
498 width: 40% important!;
499 margin: 1; /* <- works for me this way ****/
500 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100501
Marc Kupietz58270662017-12-04 12:10:06 +0100502 table.dataTable thead th, table.dataTable thead td, table.dataTable tbody td {
503 padding: 2px 2px;
504 // border-bottom: 1px solid #111;
505 }
Marc Kupietz4abcd682017-11-28 20:51:08 +0100506
Marc Kupietz8f75b1f2017-12-06 09:42:13 +0100507 td.collocator {
508 cursor: pointer;
509 }
510
Marc Kupietz58270662017-12-04 12:10:06 +0100511 #collocators {
512 margin-bottom: 15px;
513 }
Marc Kupietz4abcd682017-11-28 20:51:08 +0100514
Marc Kupietz58270662017-12-04 12:10:06 +0100515 #header {
516 width: 100%;
517 // border: 1px solid red;
518 overflow: hidden; /* will contain if #first is longer than #second */
519 }
Marc Kupietz81bf39c2017-11-29 17:04:35 +0100520
Marc Kupietz58270662017-12-04 12:10:06 +0100521 #topwrapper {
522 width: 100%;
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100523 display: flex;
524// border: 1px solid red;
Marc Kupietz58270662017-12-04 12:10:06 +0100525 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100526
Marc Kupietz58270662017-12-04 12:10:06 +0100527 #wrapper {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100528 width: 100%;
529 display: flex;
530 flex-wrap: wrap;
531 padding:5px;
532// border: 1px solid green;
Marc Kupietz58270662017-12-04 12:10:06 +0100533 // border: 1px solid red;
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100534 // overflow: hidden; /* will contain if #first is longer than #second */
Marc Kupietz58270662017-12-04 12:10:06 +0100535 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100536
Marc Kupietz58270662017-12-04 12:10:06 +0100537 #pagetitle {
538 max-width: 460px;
539 margin-right: 20px;
540 float: left;
541 overflow: hidden; /* if you don't want #second to wrap below #first */
542 // border: 1px solid green;
543 }
Marc Kupietz4abcd682017-11-28 20:51:08 +0100544
Marc Kupietz58270662017-12-04 12:10:06 +0100545 #options {
546 float: left;
547 width: 800px;
548 margin: 10px;
549 overflow: hidden; /* if you don't want #second to wrap below #first */
550 }
Marc Kupietz81bf39c2017-11-29 17:04:35 +0100551
Marc Kupietz58270662017-12-04 12:10:06 +0100552 #word {
553 width: 50%;
554 }
Marc Kupietz81bf39c2017-11-29 17:04:35 +0100555
Marc Kupietz58270662017-12-04 12:10:06 +0100556 #first {
557 margin-right: 20px;
558 float: left;
559 overflow: hidden; /* if you don't want #second to wrap below #first */
560 // border: 1px solid green;
561 }
562 #tabs {
563 margin-right: 20px;
564 overflow: hidden; /* if you don't want #second to wrap below #first */
565 }
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100566
Marc Kupietz58270662017-12-04 12:10:06 +0100567 .tabs-min {
568 background: transparent;
569 border: none;
570 }
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100571
Marc Kupietz58270662017-12-04 12:10:06 +0100572 .tabs-min .ui-widget-header {
573 background: transparent;
574 border: none;
575 border-bottom: 1px solid #c0c0c0;
576 -moz-border-radius: 0px;
577 -webkit-border-radius: 0px;
578 border-radius: 0px;
579 }
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100580
Marc Kupietz58270662017-12-04 12:10:06 +0100581 .tabs-min .ui-tabs-nav .ui-state-default {
582 background: transparent;
583 border: none;
584 }
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100585
Marc Kupietz58270662017-12-04 12:10:06 +0100586 .tabs-min .ui-tabs-nav .ui-state-active {
587 background: transparent url(derekovecs/img/uiTabsArrow.png) no-repeat bottom center;
588 border: none;
589 }
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100590
Marc Kupietz58270662017-12-04 12:10:06 +0100591 .tabs-min .ui-tabs-nav .ui-state-default a {
592 color: #c0c0c0;
593 }
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100594
Marc Kupietz58270662017-12-04 12:10:06 +0100595 .tabs-min .ui-tabs-nav .ui-state-active a {
596 color: rgb(246,168,0);
597 }
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100598
Marc Kupietz58270662017-12-04 12:10:06 +0100599 #embed {
600 max-width: 802px;
601 border: 1px solid #333;
602 }
Marc Kupietz4abcd682017-11-28 20:51:08 +0100603
Marc Kupietz58270662017-12-04 12:10:06 +0100604 #second {
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100605 min-width: 700px;
Marc Kupietz58270662017-12-04 12:10:06 +0100606 // border: 1px solid #333;
607 overflow: hidden; /* if you don't want #second to wrap below #first */
608 }
609 #som2 svg {
610 border: 1px solid #333;
611 }
Marc Kupietz83305222016-04-28 09:57:22 +0200612
Marc Kupietz58270662017-12-04 12:10:06 +0100613 #cost {
614 font-size: 8pt;
615 color: #222222;
616 margin-top: 4px;
617 margin-bottom: 12px;
618 }
Marc Kupietz83305222016-04-28 09:57:22 +0200619
Marc Kupietz58270662017-12-04 12:10:06 +0100620 #sominfo1, #sominfo {
621 font-size: 8pt;
622 color: #222222;
623 margin-top: 0px;
624 }
Marc Kupietz83305222016-04-28 09:57:22 +0200625
Marc Kupietz58270662017-12-04 12:10:06 +0100626 #somcolor1, #somcolor2, #somcolor3 {
627 display: inline-block;
628 height: 10px;
629 width: 10px;
630 }
Marc Kupietz83305222016-04-28 09:57:22 +0200631
Marc Kupietz58270662017-12-04 12:10:06 +0100632 #third {
633 border: 1px solid #333;
634 }
Marc Kupietz83305222016-04-28 09:57:22 +0200635
Marc Kupietza0ffb392018-01-25 08:53:43 +0100636 th {
637 color: rgb(246,168,0);
638 font-family: "Univers LT Std 47 Cn Lt", "Univers LT Std 67 Cn Lt", "Roboto Condensed", "Univers LT Std 67 Cn Bold", "UniversLTStd-BoldCn", "Times", 'League Gothic', Impact, sans-serif;
639 }
640
641 p.citation {
642 font-size: 8pt;
643 color: #999999;
644 }
Marc Kupietz83305222016-04-28 09:57:22 +0200645 </style>
Marc Kupietzcdd51302018-03-19 16:36:54 +0100646 <script src="/derekovecs/js/derekovcs.js"></script>
Marc Kupietz83305222016-04-28 09:57:22 +0200647 <script>
648
649 var opt = {epsilon: <%= $epsilon %>, perplexity: <%= $perplexity %>},
Marc Kupietz58270662017-12-04 12:10:06 +0100650 mapWidth = 800, // width map
651 mapHeight = 800,
652 jitterRadius = 7;
Marc Kupietz83305222016-04-28 09:57:22 +0200653
654 var T = new tsnejs.tSNE(opt); // create a tSNE instance
655
656 var Y;
657
658 var data;
659 var labeler;
660
661 function applyJitter() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100662 svg.selectAll('.tsnet')
663 .data(labels)
664 .transition()
665 .duration(50)
666 .attr("transform", function(d, i) {
667 T.Y[i][0] = (d.x - mapWidth/2 - tx)/ss/20;
668 T.Y[i][1] = (d.y - mapHeight/2 - ty)/ss/20;
669 return "translate(" +
Marc Kupietz1acb3172018-02-17 09:41:26 +0100670 (d.x) + "," +
671 (d.y) + ")";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100672 });
Marc Kupietz83305222016-04-28 09:57:22 +0200673 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100674
Marc Kupietz83305222016-04-28 09:57:22 +0200675 function updateEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100676 var Y = T.getSolution();
677 svg.selectAll('.tsnet')
678 .data(data.words)
679 .attr("transform", function(d, i) {
680 return "translate(" +
Marc Kupietz1acb3172018-02-17 09:41:26 +0100681 ((Y[i][0]*20*ss + tx) + mapWidth/2) + "," +
682 ((Y[i][1]*20*ss + ty) + mapHeight/2) + ")"; });
Marc Kupietz83305222016-04-28 09:57:22 +0200683 }
684
685 var svg;
686 var labels = [];
687 var anchor_array = [];
688 var text;
689
690 function drawEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100691 var urlprefix = new URLSearchParams(window.location.search);
692 urlprefix.delete("word");
693 urlprefix.append("word","");
Marc Kupietz8f9c86a2017-12-04 17:17:13 +0100694
Marc Kupietze6a7a732018-01-12 09:21:08 +0100695 $("#embed").empty();
696 var div = d3.select("#embed");
Marc Kupietz34c08172017-11-29 17:08:47 +0100697
Marc Kupietze6a7a732018-01-12 09:21:08 +0100698 // get min and max in each column of Y
699 var Y = T.Y;
Marc Kupietz34c08172017-11-29 17:08:47 +0100700
Marc Kupietze6a7a732018-01-12 09:21:08 +0100701 svg = div.append("svg") // svg is global
702 .attr("width", mapWidth)
703 .attr("height", mapHeight);
Marc Kupietz34c08172017-11-29 17:08:47 +0100704
Marc Kupietze6a7a732018-01-12 09:21:08 +0100705 var g = svg.selectAll(".b")
706 .data(data.words)
707 .enter().append("g")
708 .attr("class", "tsnet");
Marc Kupietz34c08172017-11-29 17:08:47 +0100709
Marc Kupietze6a7a732018-01-12 09:21:08 +0100710 g.append("a")
711 .attr("xlink:href", function(word) {
712 return "?"+urlprefix+word; })
713 .attr("class", function(d, i) {
714 var res="";
715 if(data.marked[i]) {
716 res="marked ";
717 }
718 if(data.target.indexOf(" "+d+" ") >= 0) {
719 return res+"target";
720 } else if(data.ranks[i] < data.mergedEnd) {
721 return res+"merged";
722 } else {
723 return res;
724 }
725 })
726 .attr("title", function(d, i) {
727 if(data.mergedEnd > 0) {
728 if(data.ranks[i] >= data.mergedEnd) {
729 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
730 } else {
731 return "rank: "+i +" "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " (merged vocab)";
732 }
733 } else {
734 return "rank: "+i +" "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
735 }
736 })
737 .append("text")
738 .attr("text-anchor", "top")
739 .attr("font-size", 12)
740 .text(function(d) { return d; });
Marc Kupietz34c08172017-11-29 17:08:47 +0100741
Marc Kupietze6a7a732018-01-12 09:21:08 +0100742 var zoomListener = d3.behavior.zoom()
743 .scaleExtent([0.1, 10])
744 .center([0,0])
745 .on("zoom", zoomHandler);
746 zoomListener(svg);
Marc Kupietz83305222016-04-28 09:57:22 +0200747 }
748
749 var tx=0, ty=0;
750 var ss=1;
751 var iter_id=-1;
752
753 function zoomHandler() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100754 tx = d3.event.translate[0];
755 ty = d3.event.translate[1];
756 ss = d3.event.scale;
757 updateEmbedding();
Marc Kupietz83305222016-04-28 09:57:22 +0200758 }
759
760 var stepnum = 0;
761
762 function stopStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100763 clearInterval(iter_id);
764 text = svg.selectAll("text");
Marc Kupietz34c08172017-11-29 17:08:47 +0100765
Marc Kupietze6a7a732018-01-12 09:21:08 +0100766 // jitter function needs different data and co-ordinate representation
767 labels = d3.range(data.words.length).map(function(i) {
768 var x = (T.Y[i][0]*20*ss + tx) + mapWidth/2;
769 var y = (T.Y[i][1]*20*ss + ty) + mapHeight/2;
770 anchor_array.push({x: x, y: y, r: jitterRadius});
771 return {
772 x: x,
773 y: y,
774 name: data.words[i]
775 };
776 });
Marc Kupietz34c08172017-11-29 17:08:47 +0100777
Marc Kupietze6a7a732018-01-12 09:21:08 +0100778 // get the actual label bounding boxes for the jitter function
779 var index = 0;
780 text.each(function() {
781 labels[index].width = this.getBBox().width;
782 labels[index].height = this.getBBox().height;
783 index += 1;
784 });
Marc Kupietz83305222016-04-28 09:57:22 +0200785
Marc Kupietz34c08172017-11-29 17:08:47 +0100786
Marc Kupietze6a7a732018-01-12 09:21:08 +0100787 // setTimeout(updateEmbedding, 1);
788 // setTimeout(
789 labeler = d3.labeler()
790 .label(labels)
791 .anchor(anchor_array)
792 .width(mapWidth)
793 .height(mapHeight)
794 .update(applyJitter);
795 // .start(1000);
Marc Kupietz83305222016-04-28 09:57:22 +0200796
Marc Kupietze6a7a732018-01-12 09:21:08 +0100797 iter_id = setInterval(jitterStep, 1);
Marc Kupietz83305222016-04-28 09:57:22 +0200798 }
799
800 var jitter_i=0;
801
802 function jitterStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100803 if(jitter_i++ > 100) {
804 clearInterval(iter_id);
805 } else {
806 labeler.start2(10);
807 applyJitter();
808 }
Marc Kupietz83305222016-04-28 09:57:22 +0200809 }
810
811 var last_cost=1000;
812
813 function step() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100814 var i = T.iter;
Marc Kupietz34c08172017-11-29 17:08:47 +0100815
Marc Kupietze6a7a732018-01-12 09:21:08 +0100816 if(i > <%= $no_iterations %>) {
817 stopStep();
818 } else {
819 var cost = Math.round(T.step() * 100000) / 100000; // do a few steps
820 $("#cost").html("tsne iteration " + i + ", cost: " + cost.toFixed(5));
821 if(i % 250 == 0 && cost >= last_cost) {
822 stopStep();
Marc Kupietz58270662017-12-04 12:10:06 +0100823 } else {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100824 last_cost = cost;
825 updateEmbedding();
Marc Kupietz58270662017-12-04 12:10:06 +0100826 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100827 }
Marc Kupietz83305222016-04-28 09:57:22 +0200828 }
829
830 function showMap(j) {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100831 data=j;
832 T.iter=0;
833 iter_id = -1;
834 last_cost=1000;
835 T.initDataRaw(data.vecs); // init embedding
836 drawEmbedding(); // draw initial embedding
Marc Kupietz78114532017-11-29 17:00:16 +0100837
Marc Kupietze6a7a732018-01-12 09:21:08 +0100838 if(iter_id >= 0) {
839 clearInterval(iter_id);
840 }
841 //T.debugGrad();
842 iter_id = setInterval(step, 1);
843 if(true) { // (<%= $show_som %>) {
844 makeSOM(j, <%= $no_iterations %>);
845 }
Marc Kupietz83305222016-04-28 09:57:22 +0200846 }
Marc Kupietz39179ab2017-07-04 16:28:06 +0200847 var queryword;
848
Marc Kupietz66bfd952017-12-11 09:59:45 +0100849 function showCollocatorSOM() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100850 if (collocatorTable) {
851 var ctableData = collocatorTable.rows().data();
852 var nwords = [],
853 nranks = [];
854 for (var i=0; i < ctableData.length && i < 100; i++) {
855 nranks.push(ctableData[i].rank);
856 nwords.push(ctableData[i].word);
Marc Kupietz66bfd952017-12-11 09:59:45 +0100857 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100858 $.post('/derekovecs/getVecsByRanks',
859 JSON.stringify(nranks),
860 function(data, status){
861 showMap({target: " "+urlParams.get('word')+" ", mergedEnd: 0, words: nwords, vecs: data, ranks: nranks, marked: Array(100).fill(false)} );
862 }, 'json');
863 }
Marc Kupietz66bfd952017-12-11 09:59:45 +0100864 }
865
Marc Kupietz39179ab2017-07-04 16:28:06 +0200866 function onload() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100867 queryword = document.getElementById('word');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200868 }
869
870 function queryKorAP() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100871 window.open('http://korap.ids-mannheim.de/kalamar/?q='+queryword.value, 'KorAP');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200872 }
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100873
874 function queryKorAPCII(query) {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100875 window.open('http://korap.ids-mannheim.de/kalamar/?ql=cosmas2&q='+query, 'KorAP');
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100876 }
Marc Kupietz83305222016-04-28 09:57:22 +0200877 </script>
878 </head>
Marc Kupietz39179ab2017-07-04 16:28:06 +0200879 <body onload="onload()">
Marc Kupietz5a7f9ac2018-01-30 11:22:44 +0100880 <div style="display:none;" id="lfmd_ttt">PMI cubed [1], also called log-frequency biased mutual dependency [2]: $$\text{PMI}^3=\text{LFMD}=log_2\frac{p^3(w_1,w_2)}{p(w_1) p(w_2)}$$<p class="citation">[1] Daille, B. (1994): <a href="http://www.bdaille.com/index.php?option=com_docman&task=doc_download&gid=8&Itemid=">Approche mixte pour l’extraction automatique de terminologie: statistiques lexicales et filtres linguistiques</a>. PhD thesis, Université Paris 7.</p><p class="citation">[2] Thanopoulos, A., Fakotakis, N., Kokkinakis, G. (2002): <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.11.8101&rep=rep1&type=pdf">Comparative evaluation of collocation extraction metrics</a>. In: Proc. of LREC 2002: 620–625.</p></div>
Marc Kupietza0ffb392018-01-25 08:53:43 +0100881 <div style="display:none;" id="npmi_ttt">Normalized pointwise mutual information: $$\frac{log_2\frac{p(w_1,w_2)}{p(w_1)p(w_2)}}{-log_2(p(w_1,w_2))}$$<p class="citation">Bouma, Gerlof (2009): <a href="https://svn.spraakdata.gu.se/repos/gerlof/pub/www/Docs/npmi-pfd.pdf">Normalized (pointwise) mutual information in collocation extraction</a>. In Proceedings of GSCL.</p></div>
Marc Kupietz58270662017-12-04 12:10:06 +0100882 <div id="header">
883 <div id="pagetitle">
884 <h1>DeReKo-Vectors</h1>
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100885 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100886 <div id="options" class="widget">
887 <form id="queryform">
888 <input id="word" type="text" name="word" placeholder="Word(s) to be searched" value="<%= $word %>"
889 title="When looking for multiple words use spaces as separators to search around the average vector and | as separator to get the neighbours for each word."/>
890 <input id="SEARCH" type="button" value="SEARCH">
891 <input type="button" id="showoptions" name="showoptions" value="Options" />
892 </form>
893 <div id="dropdownoptions" style="display: none">
894 <form id="optionsform">
895 <div class="controlgroup-vertical">
896 <label for="cutoff">cut-off</label>
897 <input id="cutoff" type="text" name="cutoff" size="10" value="<%= $cutoff %>" title="Only consider the most frequent x word forms.">
898 <label for="dedupe">dedupe</label>
899 <input id="dedupe" type="checkbox" name="dedupe" value="1" <%= ($dedupe ? "checked" : "") %> title="radically filter out any near-duplicates">
900 % if($mergedEnd > 0) {
901 <label for="sbf">backw.</label>
902 <input id="sbf" type="checkbox" name="sbf" value="1" <%= ($searchBaseVocabFirst ? "checked" : "") %> title="If checkecked base vocabulary will be searched first. Otherwise merged vocabulray will be searched first.">
903 % }
904 <label for="neighbours">max. neighbours:</label>
905 <input id="neighbours" size="4" name="n" value="<%= $no_nbs %>">
906 <label for="no_iterations">max. iterations</label>
907 <input id="no_iterations" name="N" size="4" value="<%= $no_iterations %>">
908 <!-- <label for="dosom">SOM</label>
909 <input id="dosom" type="checkbox" name="som" value="1" <%= ($show_som ? "checked" : "") %>> -->
910 % if($collocators) {
911 <label for="sortby">window/sort</label>
912 <select id="sortby" name="sort">
913 <option value="0" <%= ($sort!=1 && $sort!=2? "selected":"") %>>auto focus</option>
914 <!-- <option value="1" <%= ($sort==1? "selected":"") %>>any single position</option>
915 <option value="2" <%= ($sort==2? "selected":"") %>>whole window</option> -->
916 </select>
917 % }
918 <input type="button" value="→ KorAP" onclick="queryKorAP();" title="query word with KorAP"/>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100919 <input id="show-details" type="checkbox" name="show-details" value="1" >
920 <label for="show-details">
921 Show details
922 </label>
Marc Kupietz58270662017-12-04 12:10:06 +0100923 </div>
924 </form>
925 </div>
926 </div>
927 </div>
928 <div id="topwrapper">
929 <div style="visibility: hidden;" id="tabs">
930 <ul>
931 <li><a href="#tabs-1">Semantics (TSNE-map)</a></li>
932 <li><a href="#tabs-2">Semantics (SOM)</a></li>
933 <li><a href="#tabs-3">Syntagmatic (collocators)</a></li>
934 </ul>
935 <div id="tabs-1">
936 % if($lists && (@$lists) > 0 && (@$lists)[0]) {
937 <div id="wrapper">
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100938 <div id="first" style="min-width: 320px; margin-bottom: 15px;">
Marc Kupietz58270662017-12-04 12:10:06 +0100939 <table class="display compact nowrap" id="firsttable">
940 <thead>
941 <tr>
942 <th align="right">#</th><th align="right">cos</th><th align="left">similars</th>
943 </tr>
944 </thead>
945 <tbody>
946 <tr>
947 <td align="right">
948 </td>
949 <td align="right">
950 </td>
951 <td></td>
952 </tr>
953 </tbody>
954 </table>
955 </div>
956 <script>
957 </script>
958 <div id="second">
959 <div id="embed">
960 </div>
961 <div id="cost">
962 </div>
963 </div>
964 </div>
965 % } elsif($word !~ /^\s*$/) {
966 <div id="wrapper">
967 <div id="not-found-dialog" title="Not found">
968 <p>ERROR: "<%= $word %>" not found in vocabluary.</p>
969 <p>If you are sure you have spelled the word as intended, you can try to increase the cutoff parameter in the options menu.</p>
970 </div>
971 <script>
972 $( function() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100973 $( "#not-found-dialog" ).dialog({
974 autoOpen: true,
975 modal: true,
976 draggable: false,
977 height: "auto",
978 width: "auto",
979 resizable: false,
980 buttons: {
981 "OK": function() {
982 $( this ).dialog( "close" );
983 },
984 "Apply": function() {
985 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
986 }
987 }
988 });
Marc Kupietz58270662017-12-04 12:10:06 +0100989 });
990 </script>
991 </div>
Marc Kupietze6a7a732018-01-12 09:21:08 +0100992 % }
Marc Kupietz58270662017-12-04 12:10:06 +0100993 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100994 <div id="tabs-2" style="display: flex; padding: 5px; flex-flow: row wrap;">
Marc Kupietz66bfd952017-12-11 09:59:45 +0100995 <div id="som2" style="width: 800;">
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100996 <div id="sominfo1"><span id="somcolor1"> </span> <span id="somword1"> </span> <span id="somcolor2"> </span> <span id="somword2"> </span> <span id="somcolor3"> </span></div>
997 <div id="sominfo" style="text-align: right">SOM iteration <span id="iterations">0</span></div>
Marc Kupietz58270662017-12-04 12:10:06 +0100998 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100999 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +01001000 <div id="tabs-3" style="display: flex; padding:5px; flex-flow: row wrap;">
1001 <div style="margin-right: 20px; margin-bottom: 10px;" id="secondt">
Marc Kupietze6a7a732018-01-12 09:21:08 +01001002 <table class="display compact nowrap" id="secondtable">
Marc Kupietz58270662017-12-04 12:10:06 +01001003 <thead>
1004 <tr>
1005 % if($collocators) {
1006 <th>#</th>
Marc Kupietz4116b432017-12-06 14:15:32 +01001007 <th align="center" title="Activation of the respective collocator in the columns around the target normalized by its maximum (red). Columns selected by the auto-focus funtion (which window of all possible column-combinations maximizes ⊥(a/c)?) are marked with +. Click on the column postions to lauch a KorAP query with target word and collocator in the respective position.">w'</th>
1008 <th align="right" title="Maximum activation of the collocator anywhere in the output layer.">max(a)</th>
1009 <th title="Average raw activation of the collocator in the columns selected by auto-focus." align="right">⟨a⟩</th>
1010 <th title="Sum of activations over the selected colunns normalized by the total activation sum of the selected columns." align="right">Σa/Σw'</th>
1011 <th title="Co-norm of the column-normalized activations over the colunns selected by the auto-focus." align="right">⊥(a/c)</th>
Marc Kupietz58270662017-12-04 12:10:06 +01001012 <th title="Sum of the activations over the whole window normalized by the total window sum (no auto-focus)." align="right">Σa/Σw</th>
1013 <th align="left">collocator</th>
1014 % }
1015 </tr>
1016 </thead>
1017 <tbody>
1018 <tr>
1019 <td align="right">
1020 </td>
1021 <td align="right">
1022 </td>
1023 <td align="right">
1024 </td>
1025 <td align="right">
1026 </td>
1027 <td align="right">
1028 </td>
1029 <td align="right">
1030 </td>
Marc Kupietz58270662017-12-04 12:10:06 +01001031 </tr>
1032 </tbody>
1033 </table>
Marc Kupietz66bfd952017-12-11 09:59:45 +01001034 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +01001035 <div id="ccd" style="">
Marc Kupietze6a7a732018-01-12 09:21:08 +01001036 <table class="display compact nowrap" id="classicoloctable">
1037 <thead>
Marc Kupietzcd136e22018-01-29 09:18:12 +01001038 % if($collocators) {
1039 <tr>
1040 <th>LLR</th>
Marc Kupietz5a7f9ac2018-01-30 11:22:44 +01001041 <th id="lfmd_tt">PMI³</th>
Marc Kupietzcd136e22018-01-29 09:18:12 +01001042 <th id="npmi_tt">nPMI</th>
Marc Kupietz5a7f9ac2018-01-30 11:22:44 +01001043 <th title="PMI³ restricted to left neighbour">l-PMI³</th>
1044 <th title="PMI³ restricted to right neighbour">r-PMI³</th>
1045 <th title="nPMI restricted to left neighbour">l-nPMI</th>
1046 <th title="nPMI restricted to right neighbour">r-nPMI</th>
Marc Kupietzcd136e22018-01-29 09:18:12 +01001047 <th title="raw max frequency of collocation within window">raw</th>
1048 <th>collocator</th>
1049 </tr>
Marc Kupietz1acb3172018-02-17 09:41:26 +01001050 % }
Marc Kupietze6a7a732018-01-12 09:21:08 +01001051 </thead>
1052 <tbody>
1053 <tr>
1054 <td align="right">
1055 </td>
1056 <td align="right">
1057 </td>
1058 <td align="right">
1059 </td>
1060 <td align="right">
1061 </td>
Marc Kupietzcfcdcfc2018-01-24 09:51:26 +01001062 <td align="right">
1063 </td>
1064 <td align="right">
1065 </td>
Marc Kupietzb4b53ca2018-01-25 08:57:11 +01001066 <td align="right"></td>
1067 <td align="right"></td>
1068 <td align="left"></td>
Marc Kupietze6a7a732018-01-12 09:21:08 +01001069 </tr>
1070 </tbody>
1071 </table>
1072 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +01001073<!--
Marc Kupietze6a7a732018-01-12 09:21:08 +01001074 <div style="clear:both" ></div>
Marc Kupietz66bfd952017-12-11 09:59:45 +01001075 <div style="float: right; overflow: hidden" id="extra"><button onClick="showCollocatorSOM()"> </button></div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +01001076-->
Marc Kupietz66bfd952017-12-11 09:59:45 +01001077 </div>
Marc Kupietz58270662017-12-04 12:10:06 +01001078 </div>
1079 </div> <!-- topwrapper -->
1080 <div style="clear: both;"></div>
1081 </div>
Marc Kupietzebea4702018-01-12 09:16:09 +01001082 % if($training_args && (@$lists)[0]) {
1083 <div class="info">
1084 % if($training_args =~ /-type\s*3/) {
1085 Calculations are based on a word embedding model trained with an extension of <a href="https://github.com/wlin12/wang2vec/">wang2vec</a> using the following parameters: <%= $training_args %>
1086 % } else {
1087 Calculations are based on a word embedding model trained with <a href="https://code.google.com/p/word2vec/">word2vec</a> using the following parameters: <%= $training_args %>
1088 % }
1089 </div>
Marc Kupietz83305222016-04-28 09:57:22 +02001090 % }
Marc Kupietz58270662017-12-04 12:10:06 +01001091 </body>
Marc Kupietz83305222016-04-28 09:57:22 +02001092</html>