blob: d818149255bfadebe26f41ed69d0093dfee469a0 [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 Kupietz78b434a2018-01-12 22:33:32 +0100213 classicCollocatorTable = $('#classicoloctable').DataTable({
214 ajax: {
Marc Kupietz8893dec2018-01-24 09:52:02 +0100215 method: "GET",
Marc Kupietz78b434a2018-01-12 22:33:32 +0100216 url: '/derekovecs/getClassicCollocators',
217 dataType: 'json',
218 dataSrc: "",
219 timeout: 30000,
Marc Kupietz8893dec2018-01-24 09:52:02 +0100220 data: { w: paraResults[0][0].rank }
Marc Kupietz78b434a2018-01-12 22:33:32 +0100221 },
Marc Kupietzad783722018-01-13 17:45:21 +0100222 "initComplete":function(settings, json){
223 $("td.collocator").click(function(){
224 queryKorAPCII(this.textContent + " /w5 " + CIIsearchWords);
225 });
226 },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100227 "sScrollY": "780px",
228 "bScrollCollapse": true,
229 "bPaginate": false,
230 "bJQueryUI": true,
231 "dom": '<"top">rt<"bottom"flp><"clear">',
232 "columns": [
233 // { "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 +0100234 { "data": "llr", render: function ( data, type, row ) {return data.toFixed(0) }},
235 { "data": "lfmd", render: function ( data, type, row ) {return data.toFixed(1) }},
Marc Kupietz1acb3172018-02-17 09:41:26 +0100236 // { "data": "fpmi", type: "scientific", render: function ( data, type, row ) {return data.toExponential(2) } },
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100237 { "data": "npmi", render: function ( data, type, row ) {return data.toFixed(2) }},
Marc Kupietz1acb3172018-02-17 09:41:26 +0100238 { "data": "llfmd", class: "detail", render: function ( data, type, row ) {return data.toFixed(1) }},
239 { "data": "rlfmd", class: "detail", render: function ( data, type, row ) {return data.toFixed(1) }},
240 { "data": "lnpmi", class: "detail", render: function ( data, type, row ) {return data.toFixed(2) }},
241 { "data": "rnpmi", class: "detail", render: function ( data, type, row ) {return data.toFixed(2) }},
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100242 { "data": "f" },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100243 { "data": "word", sClass: "collocator" }
244 ],
245 "columnDefs": [
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100246 { className: "dt-right", "targets": [0,1,2,3,4,5,6,7] },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100247 { "searchable": false,
248 "orderable": false,
249 "targets": []
250 },
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100251 { "orderSequence": [ "desc" ], "targets": [ 0, 1, 2,3,4,5,6,7 ] },
252 { "orderSequence": [ "asc", "desc" ], "targets": [ 8 ] },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100253 ],
254 "oLanguage": {
255 "sSearch": "Filter: "
256 },
257 "order": [[ 1, 'desc' ]],
258 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100259
Marc Kupietz1acb3172018-02-17 09:41:26 +0100260
261 $('#show-details').change(function (e) {
262 var columns = classicCollocatorTable.columns(".detail");
263 if(this.checked) {
264 columns.visible(true);
265 } else {
266 columns.visible(false);
267 }
268 } );
269
270 $("td.collocator").click(function(){
271 queryKorAPCII(this.textContent + " /w5 " + CIIsearchWords);
272 });
273
274 collocatorTable.on( 'order.dt search.dt', function () {
275 collocatorTable.column(0, {order:'applied'}).nodes().each( function (cell, i) {
276 cell.innerHTML = i+1;
277 } );
278 }).draw();
279 }
280
281 if (localStorage && !window.location.hash) { // let's not crash if some user has IE7
282 var index = parseInt(localStorage['tab']||'0');
283 $("#tabs").tabs({ active: index });
284 }
285 $("#tabs").css("visibility", "visible"); // now we can show the tabs
286 });
287
288 $(function(){
289 $("#dropdownoptions").dialog({
290 title: "Options",
291 autoOpen: false,
292 modal: false,
293 draggable: false,
294 height: "auto",
295 width: "auto",
296 resizable: false,
297 buttons: {
298 "Cancel": function() {
299 $( this ).dialog( "close" );
300 },
301 "Apply": function() {
302 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
303 }
304 }
Marc Kupietzad783722018-01-13 17:45:21 +0100305 });
Marc Kupietz1acb3172018-02-17 09:41:26 +0100306 });
Marc Kupietzad783722018-01-13 17:45:21 +0100307
Marc Kupietz1acb3172018-02-17 09:41:26 +0100308 $(function(){
309 $("#showoptions").click(function(){
310 $("#dropdownoptions").dialog("open");
311 var target = $(this);
312 $("#dropdownoptions").dialog("widget").position({
313 my: 'left bottom',
314 at: 'left bottom',
315 of: target
316 });
317 });
318 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100319
Marc Kupietz1acb3172018-02-17 09:41:26 +0100320 $( function() {
321 $( "#no_iterations" ).spinner({
322 spin: function( event, ui ) {
323 if ( ui.value < 1000 ) {
324 $( this ).spinner( "value", 1000 );
325 return false;
326 } else if ( ui.value > 10000 ) {
327 $( this ).spinner( "value", 10000 );
328 return false;
329 }
330 }
331 });
332 } );
Marc Kupietz58270662017-12-04 12:10:06 +0100333
Marc Kupietz1acb3172018-02-17 09:41:26 +0100334 $( function() {
335 $( "#neighbours" ).spinner({
336 spin: function( event, ui ) {
337 if ( ui.value < 0 ) {
338 $( this ).spinner( "value", 0 );
339 return false;
340 } else if ( ui.value > 200 ) {
341 $( this ).spinner( "value", 200 );
342 return false;
343 }
344 }
345 });
346 } );
347
348 $( function() {
349 $( "#cutoff" ).spinner({
350 spin: function( event, ui ) {
351 if ( ui.value < 100000 ) {
352 $( this ).spinner( "value", 100000 );
353 return false;
354 } else if ( ui.value > 2000000 ) {
355 $( this ).spinner( "value", 2000000 );
356 return false;
357 }
358 }
359 });
360 } );
361
362 $( function() {
363 $( "#tabs" ).tabs().addClass('tabs-min');
364 } );
365
366 $( function() {
367 $( ".controlgroup-vertical" ).controlgroup({
368 "direction": "vertical"
369 });
370 } );
371
372 $(function() {
373 $( document ).tooltip({
374 content: function() {
375 return $(this).attr('title');
376 }}
377 )
378 });
379
380 $(function () {
381 $(document).tooltip({
382 content: function () {
383 return $(this).prop('title');
Marc Kupietze6a7a732018-01-12 09:21:08 +0100384 },
Marc Kupietz1acb3172018-02-17 09:41:26 +0100385 show: null,
386 close: function (event, ui) {
387 ui.tooltip.hover(
388 function () {
389 $(this).stop(true).fadeTo(400, 1);
390 },
391 function () {
392 $(this).fadeOut("400", function () {
393 $(this).remove();
394 })
395 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100396 }
Marc Kupietz58270662017-12-04 12:10:06 +0100397 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100398 });
Marc Kupietz83305222016-04-28 09:57:22 +0200399 </script>
Marc Kupietz58270662017-12-04 12:10:06 +0100400 <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
401 <script src="/derekovecs/js/tsne.js"></script>
402 <script src="/derekovecs/js/som.js"></script>
403 <script src="/derekovecs/js/labeler.js"></script>
Marc Kupietz83305222016-04-28 09:57:22 +0200404 <style>
405 body, input {
Marc Kupietz58270662017-12-04 12:10:06 +0100406 font-family: Lato, sans-serif;
407 font-size: 11pt;
Marc Kupietz83305222016-04-28 09:57:22 +0200408 }
Marc Kupietz30ca4342017-11-22 21:21:20 +0100409
Marc Kupietze6a7a732018-01-12 09:21:08 +0100410 .info {
411 font-size: 8pt;
412 margin-top: 4px;
413 /* position: absolute;
414 bottom: 0;
415 left: 0;
416 right: 0; */
417 }
418
Marc Kupietz58270662017-12-04 12:10:06 +0100419 h1, h2, h3 {
420 margin: 5px 10px 0 0;
421 color: rgb(246,168,0);
422 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;
423 font-weight: bold;
424 line-height: 1.35;
425 letter-spacing: normal;
426 text-transform: uppercase;
427 text-shadow: none;
428 word-wrap: break-word;
429 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100430
431
Marc Kupietz58270662017-12-04 12:10:06 +0100432 showoptions, #SEARCH {
433 margin-left: 10px;
434 margin-right: 10px;
435 }
Marc Kupietz6dbadd12017-11-29 16:43:33 +0100436
Marc Kupietz58270662017-12-04 12:10:06 +0100437 .tabs-left-vertical .ui-tabs-nav {
438 position: absolute;
439 width: 21em;
440 transform: translate(-100%,0%) rotate(-90deg);
441 transform-origin: 100% 0%;
442 }
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100443
Marc Kupietz58270662017-12-04 12:10:06 +0100444 .tabs-left-vertical .ui-tabs-nav li {
445 float: right;
446 }
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100447
Marc Kupietz58270662017-12-04 12:10:06 +0100448 .tabs-left-vertical .ui-tabs-panel {
449 padding-left: 3.5em;
450 }
Marc Kupietzdab9f222017-11-29 14:22:59 +0100451
Marc Kupietz58270662017-12-04 12:10:06 +0100452 .tabs-left-vertical .ui-tabs-panel {
453 height: 20em;
454 }
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100455
Marc Kupietz58270662017-12-04 12:10:06 +0100456 .mono {
Marc Kupietzc8221182017-12-08 17:26:19 +0100457 font-family: "DejaVu Sans Mono", Inconsolata, SourceCodePro, "Courier New", Courier, monospace;
Marc Kupietz58270662017-12-04 12:10:06 +0100458 }
Marc Kupietz30ca4342017-11-22 21:21:20 +0100459
Marc Kupietz58270662017-12-04 12:10:06 +0100460 .ui-tooltip-content {
Marc Kupietz4116b432017-12-06 14:15:32 +0100461 font-size: 10pt;
Marc Kupietz58270662017-12-04 12:10:06 +0100462 color: #222222;
463 }
Marc Kupietzf4b49392016-04-28 10:49:56 +0200464
Marc Kupietz58270662017-12-04 12:10:06 +0100465 svg > .ui-tooltip-content {
466 font-size: 8pt;
467 color: #222222;
468 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100469
Marc Kupietz58270662017-12-04 12:10:06 +0100470 a.merged {
471 color: green;
472 fill: green;
473 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100474
Marc Kupietz58270662017-12-04 12:10:06 +0100475 #first a {
476 text-decoration: none;
477 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100478
Marc Kupietz58270662017-12-04 12:10:06 +0100479 a.marked, #first a.marked {
480 text-decoration: underline;
481 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100482
Marc Kupietz58270662017-12-04 12:10:06 +0100483 a.target {
484 color: red;
485 fill: red;
486 }
Marc Kupietz694610d2017-11-25 18:30:03 +0100487
Marc Kupietz58270662017-12-04 12:10:06 +0100488 table.display {
489 width: 40% important!;
490 margin: 1; /* <- works for me this way ****/
491 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100492
Marc Kupietz58270662017-12-04 12:10:06 +0100493 table.dataTable thead th, table.dataTable thead td, table.dataTable tbody td {
494 padding: 2px 2px;
495 // border-bottom: 1px solid #111;
496 }
Marc Kupietz4abcd682017-11-28 20:51:08 +0100497
Marc Kupietz8f75b1f2017-12-06 09:42:13 +0100498 td.collocator {
499 cursor: pointer;
500 }
501
Marc Kupietz58270662017-12-04 12:10:06 +0100502 #collocators {
503 margin-bottom: 15px;
504 }
Marc Kupietz4abcd682017-11-28 20:51:08 +0100505
Marc Kupietz58270662017-12-04 12:10:06 +0100506 #header {
507 width: 100%;
508 // border: 1px solid red;
509 overflow: hidden; /* will contain if #first is longer than #second */
510 }
Marc Kupietz81bf39c2017-11-29 17:04:35 +0100511
Marc Kupietz58270662017-12-04 12:10:06 +0100512 #topwrapper {
513 width: 100%;
514 // border: 1px solid red;
515 overflow: hidden; /* will contain if #first is longer than #second */
516 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100517
Marc Kupietz58270662017-12-04 12:10:06 +0100518 #wrapper {
519 // border: 1px solid red;
520 overflow: hidden; /* will contain if #first is longer than #second */
521 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100522
Marc Kupietz58270662017-12-04 12:10:06 +0100523 #pagetitle {
524 max-width: 460px;
525 margin-right: 20px;
526 float: left;
527 overflow: hidden; /* if you don't want #second to wrap below #first */
528 // border: 1px solid green;
529 }
Marc Kupietz4abcd682017-11-28 20:51:08 +0100530
Marc Kupietz58270662017-12-04 12:10:06 +0100531 #options {
532 float: left;
533 width: 800px;
534 margin: 10px;
535 overflow: hidden; /* if you don't want #second to wrap below #first */
536 }
Marc Kupietz81bf39c2017-11-29 17:04:35 +0100537
Marc Kupietz58270662017-12-04 12:10:06 +0100538 #word {
539 width: 50%;
540 }
Marc Kupietz81bf39c2017-11-29 17:04:35 +0100541
Marc Kupietz58270662017-12-04 12:10:06 +0100542 #first {
543 margin-right: 20px;
544 float: left;
545 overflow: hidden; /* if you don't want #second to wrap below #first */
546 // border: 1px solid green;
547 }
548 #tabs {
549 margin-right: 20px;
550 overflow: hidden; /* if you don't want #second to wrap below #first */
551 }
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100552
Marc Kupietz58270662017-12-04 12:10:06 +0100553 .tabs-min {
554 background: transparent;
555 border: none;
556 }
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100557
Marc Kupietz58270662017-12-04 12:10:06 +0100558 .tabs-min .ui-widget-header {
559 background: transparent;
560 border: none;
561 border-bottom: 1px solid #c0c0c0;
562 -moz-border-radius: 0px;
563 -webkit-border-radius: 0px;
564 border-radius: 0px;
565 }
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100566
Marc Kupietz58270662017-12-04 12:10:06 +0100567 .tabs-min .ui-tabs-nav .ui-state-default {
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-tabs-nav .ui-state-active {
573 background: transparent url(derekovecs/img/uiTabsArrow.png) no-repeat bottom center;
574 border: none;
575 }
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100576
Marc Kupietz58270662017-12-04 12:10:06 +0100577 .tabs-min .ui-tabs-nav .ui-state-default a {
578 color: #c0c0c0;
579 }
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100580
Marc Kupietz58270662017-12-04 12:10:06 +0100581 .tabs-min .ui-tabs-nav .ui-state-active a {
582 color: rgb(246,168,0);
583 }
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100584
Marc Kupietz58270662017-12-04 12:10:06 +0100585 #embed {
586 max-width: 802px;
587 border: 1px solid #333;
588 }
Marc Kupietz4abcd682017-11-28 20:51:08 +0100589
Marc Kupietz58270662017-12-04 12:10:06 +0100590 #second {
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100591 min-width: 700px;
Marc Kupietz58270662017-12-04 12:10:06 +0100592 // border: 1px solid #333;
593 overflow: hidden; /* if you don't want #second to wrap below #first */
594 }
595 #som2 svg {
596 border: 1px solid #333;
597 }
Marc Kupietz83305222016-04-28 09:57:22 +0200598
Marc Kupietz58270662017-12-04 12:10:06 +0100599 #cost {
600 font-size: 8pt;
601 color: #222222;
602 margin-top: 4px;
603 margin-bottom: 12px;
604 }
Marc Kupietz83305222016-04-28 09:57:22 +0200605
Marc Kupietz58270662017-12-04 12:10:06 +0100606 #sominfo1, #sominfo {
607 font-size: 8pt;
608 color: #222222;
609 margin-top: 0px;
610 }
Marc Kupietz83305222016-04-28 09:57:22 +0200611
Marc Kupietz58270662017-12-04 12:10:06 +0100612 #somcolor1, #somcolor2, #somcolor3 {
613 display: inline-block;
614 height: 10px;
615 width: 10px;
616 }
Marc Kupietz83305222016-04-28 09:57:22 +0200617
Marc Kupietz58270662017-12-04 12:10:06 +0100618 #third {
619 border: 1px solid #333;
620 }
Marc Kupietz83305222016-04-28 09:57:22 +0200621
Marc Kupietza0ffb392018-01-25 08:53:43 +0100622 th {
623 color: rgb(246,168,0);
624 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;
625 }
626
627 p.citation {
628 font-size: 8pt;
629 color: #999999;
630 }
Marc Kupietz83305222016-04-28 09:57:22 +0200631 </style>
632 <script>
633
634 var opt = {epsilon: <%= $epsilon %>, perplexity: <%= $perplexity %>},
Marc Kupietz58270662017-12-04 12:10:06 +0100635 mapWidth = 800, // width map
636 mapHeight = 800,
637 jitterRadius = 7;
Marc Kupietz83305222016-04-28 09:57:22 +0200638
639 var T = new tsnejs.tSNE(opt); // create a tSNE instance
640
641 var Y;
642
643 var data;
644 var labeler;
645
646 function applyJitter() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100647 svg.selectAll('.tsnet')
648 .data(labels)
649 .transition()
650 .duration(50)
651 .attr("transform", function(d, i) {
652 T.Y[i][0] = (d.x - mapWidth/2 - tx)/ss/20;
653 T.Y[i][1] = (d.y - mapHeight/2 - ty)/ss/20;
654 return "translate(" +
Marc Kupietz1acb3172018-02-17 09:41:26 +0100655 (d.x) + "," +
656 (d.y) + ")";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100657 });
Marc Kupietz83305222016-04-28 09:57:22 +0200658 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100659
Marc Kupietz83305222016-04-28 09:57:22 +0200660 function updateEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100661 var Y = T.getSolution();
662 svg.selectAll('.tsnet')
663 .data(data.words)
664 .attr("transform", function(d, i) {
665 return "translate(" +
Marc Kupietz1acb3172018-02-17 09:41:26 +0100666 ((Y[i][0]*20*ss + tx) + mapWidth/2) + "," +
667 ((Y[i][1]*20*ss + ty) + mapHeight/2) + ")"; });
Marc Kupietz83305222016-04-28 09:57:22 +0200668 }
669
670 var svg;
671 var labels = [];
672 var anchor_array = [];
673 var text;
674
675 function drawEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100676 var urlprefix = new URLSearchParams(window.location.search);
677 urlprefix.delete("word");
678 urlprefix.append("word","");
Marc Kupietz8f9c86a2017-12-04 17:17:13 +0100679
Marc Kupietze6a7a732018-01-12 09:21:08 +0100680 $("#embed").empty();
681 var div = d3.select("#embed");
Marc Kupietz34c08172017-11-29 17:08:47 +0100682
Marc Kupietze6a7a732018-01-12 09:21:08 +0100683 // get min and max in each column of Y
684 var Y = T.Y;
Marc Kupietz34c08172017-11-29 17:08:47 +0100685
Marc Kupietze6a7a732018-01-12 09:21:08 +0100686 svg = div.append("svg") // svg is global
687 .attr("width", mapWidth)
688 .attr("height", mapHeight);
Marc Kupietz34c08172017-11-29 17:08:47 +0100689
Marc Kupietze6a7a732018-01-12 09:21:08 +0100690 var g = svg.selectAll(".b")
691 .data(data.words)
692 .enter().append("g")
693 .attr("class", "tsnet");
Marc Kupietz34c08172017-11-29 17:08:47 +0100694
Marc Kupietze6a7a732018-01-12 09:21:08 +0100695 g.append("a")
696 .attr("xlink:href", function(word) {
697 return "?"+urlprefix+word; })
698 .attr("class", function(d, i) {
699 var res="";
700 if(data.marked[i]) {
701 res="marked ";
702 }
703 if(data.target.indexOf(" "+d+" ") >= 0) {
704 return res+"target";
705 } else if(data.ranks[i] < data.mergedEnd) {
706 return res+"merged";
707 } else {
708 return res;
709 }
710 })
711 .attr("title", function(d, i) {
712 if(data.mergedEnd > 0) {
713 if(data.ranks[i] >= data.mergedEnd) {
714 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
715 } else {
716 return "rank: "+i +" "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " (merged vocab)";
717 }
718 } else {
719 return "rank: "+i +" "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
720 }
721 })
722 .append("text")
723 .attr("text-anchor", "top")
724 .attr("font-size", 12)
725 .text(function(d) { return d; });
Marc Kupietz34c08172017-11-29 17:08:47 +0100726
Marc Kupietze6a7a732018-01-12 09:21:08 +0100727 var zoomListener = d3.behavior.zoom()
728 .scaleExtent([0.1, 10])
729 .center([0,0])
730 .on("zoom", zoomHandler);
731 zoomListener(svg);
Marc Kupietz83305222016-04-28 09:57:22 +0200732 }
733
734 var tx=0, ty=0;
735 var ss=1;
736 var iter_id=-1;
737
738 function zoomHandler() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100739 tx = d3.event.translate[0];
740 ty = d3.event.translate[1];
741 ss = d3.event.scale;
742 updateEmbedding();
Marc Kupietz83305222016-04-28 09:57:22 +0200743 }
744
745 var stepnum = 0;
746
747 function stopStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100748 clearInterval(iter_id);
749 text = svg.selectAll("text");
Marc Kupietz34c08172017-11-29 17:08:47 +0100750
Marc Kupietze6a7a732018-01-12 09:21:08 +0100751 // jitter function needs different data and co-ordinate representation
752 labels = d3.range(data.words.length).map(function(i) {
753 var x = (T.Y[i][0]*20*ss + tx) + mapWidth/2;
754 var y = (T.Y[i][1]*20*ss + ty) + mapHeight/2;
755 anchor_array.push({x: x, y: y, r: jitterRadius});
756 return {
757 x: x,
758 y: y,
759 name: data.words[i]
760 };
761 });
Marc Kupietz34c08172017-11-29 17:08:47 +0100762
Marc Kupietze6a7a732018-01-12 09:21:08 +0100763 // get the actual label bounding boxes for the jitter function
764 var index = 0;
765 text.each(function() {
766 labels[index].width = this.getBBox().width;
767 labels[index].height = this.getBBox().height;
768 index += 1;
769 });
Marc Kupietz83305222016-04-28 09:57:22 +0200770
Marc Kupietz34c08172017-11-29 17:08:47 +0100771
Marc Kupietze6a7a732018-01-12 09:21:08 +0100772 // setTimeout(updateEmbedding, 1);
773 // setTimeout(
774 labeler = d3.labeler()
775 .label(labels)
776 .anchor(anchor_array)
777 .width(mapWidth)
778 .height(mapHeight)
779 .update(applyJitter);
780 // .start(1000);
Marc Kupietz83305222016-04-28 09:57:22 +0200781
Marc Kupietze6a7a732018-01-12 09:21:08 +0100782 iter_id = setInterval(jitterStep, 1);
Marc Kupietz83305222016-04-28 09:57:22 +0200783 }
784
785 var jitter_i=0;
786
787 function jitterStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100788 if(jitter_i++ > 100) {
789 clearInterval(iter_id);
790 } else {
791 labeler.start2(10);
792 applyJitter();
793 }
Marc Kupietz83305222016-04-28 09:57:22 +0200794 }
795
796 var last_cost=1000;
797
798 function step() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100799 var i = T.iter;
Marc Kupietz34c08172017-11-29 17:08:47 +0100800
Marc Kupietze6a7a732018-01-12 09:21:08 +0100801 if(i > <%= $no_iterations %>) {
802 stopStep();
803 } else {
804 var cost = Math.round(T.step() * 100000) / 100000; // do a few steps
805 $("#cost").html("tsne iteration " + i + ", cost: " + cost.toFixed(5));
806 if(i % 250 == 0 && cost >= last_cost) {
807 stopStep();
Marc Kupietz58270662017-12-04 12:10:06 +0100808 } else {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100809 last_cost = cost;
810 updateEmbedding();
Marc Kupietz58270662017-12-04 12:10:06 +0100811 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100812 }
Marc Kupietz83305222016-04-28 09:57:22 +0200813 }
814
815 function showMap(j) {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100816 data=j;
817 T.iter=0;
818 iter_id = -1;
819 last_cost=1000;
820 T.initDataRaw(data.vecs); // init embedding
821 drawEmbedding(); // draw initial embedding
Marc Kupietz78114532017-11-29 17:00:16 +0100822
Marc Kupietze6a7a732018-01-12 09:21:08 +0100823 if(iter_id >= 0) {
824 clearInterval(iter_id);
825 }
826 //T.debugGrad();
827 iter_id = setInterval(step, 1);
828 if(true) { // (<%= $show_som %>) {
829 makeSOM(j, <%= $no_iterations %>);
830 }
Marc Kupietz83305222016-04-28 09:57:22 +0200831 }
Marc Kupietz39179ab2017-07-04 16:28:06 +0200832 var queryword;
833
Marc Kupietz66bfd952017-12-11 09:59:45 +0100834 function showCollocatorSOM() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100835 if (collocatorTable) {
836 var ctableData = collocatorTable.rows().data();
837 var nwords = [],
838 nranks = [];
839 for (var i=0; i < ctableData.length && i < 100; i++) {
840 nranks.push(ctableData[i].rank);
841 nwords.push(ctableData[i].word);
Marc Kupietz66bfd952017-12-11 09:59:45 +0100842 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100843 $.post('/derekovecs/getVecsByRanks',
844 JSON.stringify(nranks),
845 function(data, status){
846 showMap({target: " "+urlParams.get('word')+" ", mergedEnd: 0, words: nwords, vecs: data, ranks: nranks, marked: Array(100).fill(false)} );
847 }, 'json');
848 }
Marc Kupietz66bfd952017-12-11 09:59:45 +0100849 }
850
Marc Kupietz39179ab2017-07-04 16:28:06 +0200851 function onload() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100852 queryword = document.getElementById('word');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200853 }
854
855 function queryKorAP() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100856 window.open('http://korap.ids-mannheim.de/kalamar/?q='+queryword.value, 'KorAP');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200857 }
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100858
859 function queryKorAPCII(query) {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100860 window.open('http://korap.ids-mannheim.de/kalamar/?ql=cosmas2&q='+query, 'KorAP');
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100861 }
Marc Kupietz83305222016-04-28 09:57:22 +0200862 </script>
863 </head>
Marc Kupietz39179ab2017-07-04 16:28:06 +0200864 <body onload="onload()">
Marc Kupietz5a7f9ac2018-01-30 11:22:44 +0100865 <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 +0100866 <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 +0100867 <div id="header">
868 <div id="pagetitle">
869 <h1>DeReKo-Vectors</h1>
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100870 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100871 <div id="options" class="widget">
872 <form id="queryform">
873 <input id="word" type="text" name="word" placeholder="Word(s) to be searched" value="<%= $word %>"
874 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."/>
875 <input id="SEARCH" type="button" value="SEARCH">
876 <input type="button" id="showoptions" name="showoptions" value="Options" />
877 </form>
878 <div id="dropdownoptions" style="display: none">
879 <form id="optionsform">
880 <div class="controlgroup-vertical">
881 <label for="cutoff">cut-off</label>
882 <input id="cutoff" type="text" name="cutoff" size="10" value="<%= $cutoff %>" title="Only consider the most frequent x word forms.">
883 <label for="dedupe">dedupe</label>
884 <input id="dedupe" type="checkbox" name="dedupe" value="1" <%= ($dedupe ? "checked" : "") %> title="radically filter out any near-duplicates">
885 % if($mergedEnd > 0) {
886 <label for="sbf">backw.</label>
887 <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.">
888 % }
889 <label for="neighbours">max. neighbours:</label>
890 <input id="neighbours" size="4" name="n" value="<%= $no_nbs %>">
891 <label for="no_iterations">max. iterations</label>
892 <input id="no_iterations" name="N" size="4" value="<%= $no_iterations %>">
893 <!-- <label for="dosom">SOM</label>
894 <input id="dosom" type="checkbox" name="som" value="1" <%= ($show_som ? "checked" : "") %>> -->
895 % if($collocators) {
896 <label for="sortby">window/sort</label>
897 <select id="sortby" name="sort">
898 <option value="0" <%= ($sort!=1 && $sort!=2? "selected":"") %>>auto focus</option>
899 <!-- <option value="1" <%= ($sort==1? "selected":"") %>>any single position</option>
900 <option value="2" <%= ($sort==2? "selected":"") %>>whole window</option> -->
901 </select>
902 % }
903 <input type="button" value="→ KorAP" onclick="queryKorAP();" title="query word with KorAP"/>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100904 <input id="show-details" type="checkbox" name="show-details" value="1" >
905 <label for="show-details">
906 Show details
907 </label>
Marc Kupietz58270662017-12-04 12:10:06 +0100908 </div>
909 </form>
910 </div>
911 </div>
912 </div>
913 <div id="topwrapper">
914 <div style="visibility: hidden;" id="tabs">
915 <ul>
916 <li><a href="#tabs-1">Semantics (TSNE-map)</a></li>
917 <li><a href="#tabs-2">Semantics (SOM)</a></li>
918 <li><a href="#tabs-3">Syntagmatic (collocators)</a></li>
919 </ul>
920 <div id="tabs-1">
921 % if($lists && (@$lists) > 0 && (@$lists)[0]) {
922 <div id="wrapper">
923 <div id="first" style="width: 320px">
924 <table class="display compact nowrap" id="firsttable">
925 <thead>
926 <tr>
927 <th align="right">#</th><th align="right">cos</th><th align="left">similars</th>
928 </tr>
929 </thead>
930 <tbody>
931 <tr>
932 <td align="right">
933 </td>
934 <td align="right">
935 </td>
936 <td></td>
937 </tr>
938 </tbody>
939 </table>
940 </div>
941 <script>
942 </script>
943 <div id="second">
944 <div id="embed">
945 </div>
946 <div id="cost">
947 </div>
948 </div>
949 </div>
950 % } elsif($word !~ /^\s*$/) {
951 <div id="wrapper">
952 <div id="not-found-dialog" title="Not found">
953 <p>ERROR: "<%= $word %>" not found in vocabluary.</p>
954 <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>
955 </div>
956 <script>
957 $( function() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100958 $( "#not-found-dialog" ).dialog({
959 autoOpen: true,
960 modal: true,
961 draggable: false,
962 height: "auto",
963 width: "auto",
964 resizable: false,
965 buttons: {
966 "OK": function() {
967 $( this ).dialog( "close" );
968 },
969 "Apply": function() {
970 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
971 }
972 }
973 });
Marc Kupietz58270662017-12-04 12:10:06 +0100974 });
975 </script>
976 </div>
Marc Kupietze6a7a732018-01-12 09:21:08 +0100977 % }
Marc Kupietz58270662017-12-04 12:10:06 +0100978 </div>
979 <div id="tabs-2">
Marc Kupietz66bfd952017-12-11 09:59:45 +0100980 <div id="som2" style="width: 800;">
Marc Kupietz58270662017-12-04 12:10:06 +0100981 </div>
982 <div id="sominfo1"><span id="somcolor1"> </span> <span id="somword1"> </span> <span id="somcolor2"> </span> <span id="somword2"> </span> <span id="somcolor3"> </span></div>
983 <div id="sominfo">SOM iteration <span id="iterations">0</span></div>
984 </div>
Marc Kupietzcfcdcfc2018-01-24 09:51:26 +0100985 <div id="tabs-3" style="width:1500px">
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100986 <div style="width: 45%; float: left;" id="secondt">
Marc Kupietze6a7a732018-01-12 09:21:08 +0100987 <table class="display compact nowrap" id="secondtable">
Marc Kupietz58270662017-12-04 12:10:06 +0100988 <thead>
989 <tr>
990 % if($collocators) {
991 <th>#</th>
Marc Kupietz4116b432017-12-06 14:15:32 +0100992 <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>
993 <th align="right" title="Maximum activation of the collocator anywhere in the output layer.">max(a)</th>
994 <th title="Average raw activation of the collocator in the columns selected by auto-focus." align="right">⟨a⟩</th>
995 <th title="Sum of activations over the selected colunns normalized by the total activation sum of the selected columns." align="right">Σa/Σw'</th>
996 <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 +0100997 <th title="Sum of the activations over the whole window normalized by the total window sum (no auto-focus)." align="right">Σa/Σw</th>
998 <th align="left">collocator</th>
999 % }
1000 </tr>
1001 </thead>
1002 <tbody>
1003 <tr>
1004 <td align="right">
1005 </td>
1006 <td align="right">
1007 </td>
1008 <td align="right">
1009 </td>
1010 <td align="right">
1011 </td>
1012 <td align="right">
1013 </td>
1014 <td align="right">
1015 </td>
Marc Kupietz58270662017-12-04 12:10:06 +01001016 </tr>
1017 </tbody>
1018 </table>
Marc Kupietz66bfd952017-12-11 09:59:45 +01001019 </div>
Marc Kupietza0ffb392018-01-25 08:53:43 +01001020 <div id="ccd" style="margin-left:0px; float:right; width:800px;">
Marc Kupietze6a7a732018-01-12 09:21:08 +01001021 <table class="display compact nowrap" id="classicoloctable">
1022 <thead>
Marc Kupietzcd136e22018-01-29 09:18:12 +01001023 % if($collocators) {
1024 <tr>
1025 <th>LLR</th>
Marc Kupietz5a7f9ac2018-01-30 11:22:44 +01001026 <th id="lfmd_tt">PMI³</th>
Marc Kupietzcd136e22018-01-29 09:18:12 +01001027 <th id="npmi_tt">nPMI</th>
Marc Kupietz5a7f9ac2018-01-30 11:22:44 +01001028 <th title="PMI³ restricted to left neighbour">l-PMI³</th>
1029 <th title="PMI³ restricted to right neighbour">r-PMI³</th>
1030 <th title="nPMI restricted to left neighbour">l-nPMI</th>
1031 <th title="nPMI restricted to right neighbour">r-nPMI</th>
Marc Kupietzcd136e22018-01-29 09:18:12 +01001032 <th title="raw max frequency of collocation within window">raw</th>
1033 <th>collocator</th>
1034 </tr>
Marc Kupietz1acb3172018-02-17 09:41:26 +01001035 % }
Marc Kupietze6a7a732018-01-12 09:21:08 +01001036 </thead>
1037 <tbody>
1038 <tr>
1039 <td align="right">
1040 </td>
1041 <td align="right">
1042 </td>
1043 <td align="right">
1044 </td>
1045 <td align="right">
1046 </td>
Marc Kupietzcfcdcfc2018-01-24 09:51:26 +01001047 <td align="right">
1048 </td>
1049 <td align="right">
1050 </td>
Marc Kupietzb4b53ca2018-01-25 08:57:11 +01001051 <td align="right"></td>
1052 <td align="right"></td>
1053 <td align="left"></td>
Marc Kupietze6a7a732018-01-12 09:21:08 +01001054 </tr>
1055 </tbody>
1056 </table>
1057 </div>
1058 <div style="clear:both" ></div>
Marc Kupietz66bfd952017-12-11 09:59:45 +01001059 <div style="float: right; overflow: hidden" id="extra"><button onClick="showCollocatorSOM()"> </button></div>
Marc Kupietz66bfd952017-12-11 09:59:45 +01001060 </div>
Marc Kupietz58270662017-12-04 12:10:06 +01001061 </div>
1062 </div> <!-- topwrapper -->
1063 <div style="clear: both;"></div>
1064 </div>
Marc Kupietzebea4702018-01-12 09:16:09 +01001065 % if($training_args && (@$lists)[0]) {
1066 <div class="info">
1067 % if($training_args =~ /-type\s*3/) {
1068 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 %>
1069 % } else {
1070 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 %>
1071 % }
1072 </div>
Marc Kupietz83305222016-04-28 09:57:22 +02001073 % }
Marc Kupietz58270662017-12-04 12:10:06 +01001074 </body>
Marc Kupietz83305222016-04-28 09:57:22 +02001075</html>