blob: 13a56a1aaefbc4df892d42ba0054757e83d3e4dd [file] [log] [blame]
Marc Kupietz83305222016-04-28 09:57:22 +02001<!DOCTYPE html>
2<html>
3 <head>
Marc Kupietzc053d972019-01-10 10:41:51 +01004 <% my $plain_title = $title; $plain_title=~s/<[^>]+>//g; %>
5 <title><%= $plain_title %>:<%= $word %> DeReKo-Word-Vector-Distances</title>
Marc Kupietz80bd7b92017-07-04 16:25:54 +02006 <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
Marc Kupietz58270662017-12-04 12:10:06 +01007 <link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Condensed" rel="stylesheet">
Marc Kupietz80bd7b92017-07-04 16:25:54 +02008 <script src="http://code.jquery.com/jquery-latest.min.js"></script>
Marc Kupietz5f532b32019-01-23 10:03:18 +01009 <script src = "https://cdn.datatables.net/1.10.18/js/jquery.dataTables.min.js"></script>
10 <script src = "https://cdn.datatables.net/fixedcolumns/3.2.5/js/dataTables.fixedColumns.min.js"></script>
11 <script src = "https://cdn.datatables.net/plug-ins/1.10.18/sorting/scientific.js"></script>
12 <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML'></script>
13 <link rel="stylesheet" href="https://cdn.datatables.net/1.10.18/css/jquery.dataTables.min.css">
Marc Kupietz4949d232018-03-19 16:43:18 +010014 <link rel="stylesheet" href="/derekovecs/css/derekovecs.css">
Marc Kupietz80bd7b92017-07-04 16:25:54 +020015 <script
Marc Kupietze6a7a732018-01-12 09:21:08 +010016 src="http://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
17 integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
18 crossorigin="anonymous"></script>
Marc Kupietz80bd7b92017-07-04 16:25:54 +020019 <script>
Marc Kupietza0ffb392018-01-25 08:53:43 +010020 MathJax.Hub.Config({
21 config: ["MMLorHTML.js"],
22 jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML", "output/PreviewHTML"],
23 extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js", "fast-preview.js", "AssistiveMML.js", "a11y/accessibility-menu.js"],
24 TeX: {
25 extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
26 }
27 });
Marc Kupietz58270662017-12-04 12:10:06 +010028 var urlParams = new URLSearchParams(window.location.search);
Marc Kupietzb3a2e4f2017-12-08 17:25:53 +010029 var currentWords = urlParams.get("word");
Marc Kupietza0ffb392018-01-25 08:53:43 +010030 var CIIsearchWords = (currentWords && currentWords.includes(" ") ? '('+currentWords.replace(/ +/g, " oder ")+')' : currentWords);
Marc Kupietz66bfd952017-12-11 09:59:45 +010031 var collocatorTable = null;
Marc Kupietza6e08f02017-12-01 22:06:21 +010032
Marc Kupietz58270662017-12-04 12:10:06 +010033 $(document).ready(function() {
Marc Kupietz694610d2017-11-25 18:30:03 +010034
Marc Kupietza0ffb392018-01-25 08:53:43 +010035 $('#firstable').hide();
36 //Set up a callback to hear back when MathJax is done rendering the equations
37 // it finds
38 $('#ccd').load(
39 '@Url.Action("ActionResultMethod","ControllerName",{controller parameters})',
40 function () {
41 MathJax.Hub.Queue(
42 ["Typeset",MathJax.Hub,"ccd"],
43 function () {
Marc Kupietz7bd55232019-01-22 15:29:06 +010044 $("#mi_tt").attr("title",$("#pmi_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010045 $("#lfmd_tt").attr("title",$("#lfmd_ttt").html());
Marc Kupietz7bd55232019-01-22 15:29:06 +010046 $("#md_tt").attr("title",$("#md_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010047 $("#npmi_tt").attr("title",$("#npmi_ttt").html());
Marc Kupietzf19814b2019-01-21 16:50:19 +010048 $("#ll_tt").attr("title",$("#ll_ttt").html());
Marc Kupietz7bd55232019-01-22 15:29:06 +010049 $("#logdice_tt").attr("title",$("#logdice_ttt").html());
Marc Kupietz63b268f2019-01-22 22:34:29 +010050 $("#logdiceaf_tt").attr("title",$("#logdiceaf_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010051 }
52 );
53 });
54
55 //set things up so that we can shove raw html into what is shown in the tooltip;
56 // in this case, we will have already put into the title attribute the html that
57 // contains the MathJax rendered equations (via what we do in the callback).
58 $(function () {
59 $(document).tooltip({
60 content: function () {
61 return $(this).prop('title');
62 }
63 });
64 });
65
Marc Kupietze6a7a732018-01-12 09:21:08 +010066 $("input").bind("keydown", function(event) {
67 // track enter key
68 var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
69 if (keycode == 13) { // keycode for enter key
70 // force the 'Enter Key' to implicitly click the Update button
71 document.getElementById('SEARCH').click();
72 return false;
73 } else {
74 return true;
75 }});
Marc Kupietzdab9f222017-11-29 14:22:59 +010076
Marc Kupietze871abd2018-01-25 16:18:27 +010077 var collocatorTable_activated = false;
Marc Kupietze6a7a732018-01-12 09:21:08 +010078 $( "#tabs" ).on( "tabsactivate", function( event, ui ) {
79 if (localStorage) localStorage['tab'] = ui.newTab.index();
Marc Kupietze871abd2018-01-25 16:18:27 +010080 if(ui.newTab.index() == 2 && !collocatorTable_activated) {
81 classicCollocatorTable.columns.adjust();
82 collocatorTable.columns.adjust();
83 collocatorTable_activated = true;
84 }
Marc Kupietze6a7a732018-01-12 09:21:08 +010085 });
86
87 $(function(){
88 $("#SEARCH").click(function() {
89 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietz58270662017-12-04 12:10:06 +010090 });
Marc Kupietze6a7a732018-01-12 09:21:08 +010091 });
Marc Kupietz0af83e32017-11-27 09:31:37 +010092
Marc Kupietze6a7a732018-01-12 09:21:08 +010093 function changeCharColor(txt, heat, word) {
94 var newText = "";
95 for (var i=0, l=txt.length; i<l; i++) {
96 newText += (i == 5 ? txt.charAt(i) : '<a href="http://korap.ids-mannheim.de/kalamar/?ql=cosmas2&q=' +
97 CIIsearchWords + ' /' + (i > 5? '%2B' : '-') + 'w' +
98 Math.abs(i-5) + ':' + Math.abs(i-5) + ' ' + word +
99 '" target="korap"><span style="background-color:' +
100 getHeatColor(heat[i]/maxHeat)+'">'+txt.charAt(i)+'</span></a>');
Marc Kupietzb6c615d2017-12-02 10:38:20 +0100101 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100102 return newText;
103 }
Marc Kupietzb6c615d2017-12-02 10:38:20 +0100104
Marc Kupietze6a7a732018-01-12 09:21:08 +0100105 function getHeatColor(value) {
106 var hue=((1-value)*120).toString(10);
107 return ["hsl(",hue,",90%,70%)"].join("");
108 }
109
Marc Kupietz63b268f2019-01-22 22:34:29 +0100110 function bitmask2window(n) {
111 var str = n.toString(2).padStart(10, "0")
112 .replace(/^([0-9]{5})/, '$1 ')
113 .replace(/0/g, '·')
114 .replace(/1/g, '+');
115 return str;
116 }
117
Marc Kupietze6a7a732018-01-12 09:21:08 +0100118 function bitvec2window(n, heat, word) {
119 var str = n.toString(2).padStart(10, "0")
120 .replace(/^([0-9]{5})/, '$1x')
121 .replace(/0/g, '·')
122 .replace(/1/g, '+');
123 return changeCharColor(str, heat, word);
124 }
125
126 % use Mojo::ByteStream 'b';
127 var paraResults = <%= b(Mojo::JSON::to_json($lists)) %>;
128 var urlprefix = new URLSearchParams(window.location.search);
129 if (paraResults.length > 0 && paraResults[0] != null) {
130 var nvecs = [],
131 nwords = [],
132 nranks = [],
133 nmarked = [];
134 for(var i = 0; i < paraResults.length; i++) {
135 nwords = nwords.concat(paraResults[i].map(function(a){return a.word;}));
136 nvecs = nvecs.concat(paraResults[i].map(function(a){return a.vector;}));
137 nranks = nranks.concat(paraResults[i].map(function(a){return a.rank;}));
138 nmarked = nmarked.concat(paraResults[i].map(function(a){return a.marked;}));
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100139 }
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100140 showMap({target: " "+urlParams.get('word')+" ", mergedEnd: <%= $mergedEnd %>, words: nwords, vecs: nvecs, ranks: nranks, marked: nmarked} );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100141 var t = $('#firsttable').DataTable({
Marc Kupietzee894d52019-01-09 14:55:14 +0100142 data: [].concat.apply([], paraResults),
Marc Kupietze6a7a732018-01-12 09:21:08 +0100143 "sScrollY": "780px",
144 "bScrollCollapse": true,
145 "bPaginate": false,
146 "bJQueryUI": true,
147 "dom": '<"top">rt<"bottom"flp><"clear">',
Marc Kupietz384c9132018-03-19 16:45:24 +0100148 "initComplete":function(settings, json) {
149 $('td.paradigmator a').on('mousedown', function(e) {
150 return paradigmatorClick(e, paraResults[0][0].word, this.childNodes["0"].textContent);
151 });
152 },
Marc Kupietze6a7a732018-01-12 09:21:08 +0100153 "columns": [
154 { "data": "rank", type: "allnumeric" },
155 { "data": "dist", render: function ( data, type, row ) {return data.toFixed(3) }},
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100156 { "data": "word", class: "paradigmator", render: function ( data, type, row ) {
157 urlprefix.set("word", data); return '<a class="' + getMergedClass(row.rank) + '" href="?' + urlprefix + '">' + data + '</a>'
158 }}
Marc Kupietze6a7a732018-01-12 09:21:08 +0100159 ],
160 "columnDefs": [
161 { className: "dt-right", "targets": [0,1] },
162 { "searchable": false,
163 "orderable": false,
164 "targets": 0
165 },
166 { "orderSequence": [ "desc" ], "targets": [ 1 ] },
167 { "orderSequence": [ "asc", "desc" ], "targets": [ 2 ] },
168 ],
169 "oLanguage": {
170 "sSearch": "Filter: "
171 },
172 "order": [[ 1, 'desc' ]],
173 } );
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100174
Marc Kupietze6a7a732018-01-12 09:21:08 +0100175 t.on( 'order.dt search.dt', function () {
176 t.column(0, {order:'applied'}).nodes().each( function (cell, i) {
177 cell.innerHTML = i+1;
178 } );
179 } ).draw();
180
181 $( "#first" ).clone().prependTo( "#tabs-2" );
182
183 }
184
185
186 var collocatorData = <%= b(Mojo::JSON::to_json($collocators)) %>;
187 var maxHeat; // = Math.max.apply(Math,collocatorData.map(function(o){return o.cprob;}))
188
189 if (collocatorData != null) {
190 maxHeat = Math.max.apply(Math,collocatorData.map(function(o){return Math.max.apply(Math,o.heat);}))
191 collocatorTable = $('#secondtable').DataTable({
192 data: collocatorData,
193 "sScrollY": "780px",
194 "bScrollCollapse": true,
195 "bPaginate": false,
196 "bJQueryUI": true,
197 "dom": '<"top">rt<"bottom"flp><"clear">',
198 "columns": [
199 { "data": "rank", type: "allnumeric" },
200 { "data": "pos", width: "7%", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitvec2window(data, row.heat, row.word) }},
201 { "data": "max", render: function ( data, type, row ) {return data.toFixed(3) }},
202 { "data": "average", render: function ( data, type, row ) {return data.toFixed(3) }},
203 { "data": "prob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
204 { "data": "cprob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
205 { "data": "overall", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
206 { "data": "word", sClass: "collocator" },
207 { "data": "rank", type: "allnumeric" }
208 ],
209 "columnDefs": [
210 { className: "dt-right", "targets": [0,2,3,4,5,6] },
211 { className: "dt-center", "targets": [ 1] },
212 { "searchable": false,
213 "orderable": false,
214 "targets": [0, 8]
215 },
216 { "type": "scientific", targets: [2,3,4,5,6] },
217 { "orderSequence": [ "desc" ], "targets": [ 2, 3, 4, 5, 6 ] },
218 { "orderSequence": [ "asc", "desc" ], "targets": [ 1, 7 ] },
219 { "targets": [8], "visible": false }
220 ],
221 "oLanguage": {
222 "sSearch": "Filter: "
223 },
224 "order": [[ 4, 'desc' ]],
225 } );
226 $.ajaxSetup({
227 type: 'POST',
228 timeout: 30000,
229 error: function(xhr) {
230 $('#display_error')
231 .html('Error: ' + xhr.status + ' ' + xhr.statusText);
232 }
Marc Kupietz78b434a2018-01-12 22:33:32 +0100233 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100234
Marc Kupietz384c9132018-03-19 16:45:24 +0100235
236 if($('#sprofiles').length) {
237 similarProfileTable = $('#sprofiles').DataTable({
238 ajax: {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100239 method: "GET",
Marc Kupietz384c9132018-03-19 16:45:24 +0100240 url: '/derekovecs/getSimilarProfiles',
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100241 dataType: 'json',
242 dataSrc: "",
243 timeout: 30000,
244 data: { w: paraResults[0][0].rank }
Marc Kupietz384c9132018-03-19 16:45:24 +0100245 },
246 "initComplete":function(settings, json){
247 $('td.paradigmator a').on('mousedown', function(e) {
248 if (e.which === 2) {
249 e.preventDefault();
250 queryKorAPalternatives(paraResults[0][0].word, this.childNodes["0"].textContent);
251 return false;
252 }
253 });
254 },
255 "sScrollY": "780px",
256 "bScrollCollapse": true,
257 "bPaginate": false,
258 "bJQueryUI": true,
259 "dom": '<"top">rt<"bottom"flp><"clear">',
260 "columns": [
261 { "data": "v", render: function ( data, type, row ) {return data.toFixed(3) }},
262 { "data": "w", sClass: "paradigmator", render: function ( data, type, row ) {urlprefix.set("word", data); return '<a href="?' + urlprefix + '">' + data + '</a>' } }
263 ],
264 "columnDefs": [
265 { className: "dt-right", "targets": [0] },
266 ],
267 "oLanguage": {
268 "sSearch": "Filter: "
269 },
270 "order": [[ 0, 'desc' ]],
271 });
272 }
273 // var filterQuot = /(^quot?=[A-Z])|(quot$)/g;
274 var filterQuot = /^quot/;
275 classicCollocatorTable = $('#classicoloctable').DataTable({
276 ajax: {
277 method: "GET",
278 url: '/derekovecs/getClassicCollocators',
279 dataType: 'json',
280 dataSrc: "",
281 timeout: 30000,
282 data: { w: paraResults[0][0].rank }
Marc Kupietz78b434a2018-01-12 22:33:32 +0100283 },
Marc Kupietzad783722018-01-13 17:45:21 +0100284 "initComplete":function(settings, json){
285 $("td.collocator").click(function(){
286 queryKorAPCII(this.textContent + " /w5 " + CIIsearchWords);
287 });
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100288 classicCollocatorTable.columns(".detail").visible(false);
Marc Kupietz63b268f2019-01-22 22:34:29 +0100289 $("#ccd").css('width', '680px');
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100290 classicCollocatorTable.columns.adjust().draw();
Marc Kupietzad783722018-01-13 17:45:21 +0100291 },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100292 "sScrollY": "780px",
293 "bScrollCollapse": true,
294 "bPaginate": false,
295 "bJQueryUI": true,
296 "dom": '<"top">rt<"bottom"flp><"clear">',
297 "columns": [
298 // { "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 +0100299 { "data": "llr", render: function ( data, type, row ) {return data.toFixed(0) }},
Marc Kupietz7bd55232019-01-22 15:29:06 +0100300 { "data": "pmi", render: function ( data, type, row ) {return data.toFixed(2) }},
301 { "data": "md", render: function ( data, type, row ) {return data.toFixed(2) }},
302 { "data": "lfmd", render: function ( data, type, row ) {return data.toFixed(2) }},
Marc Kupietz1acb3172018-02-17 09:41:26 +0100303 // { "data": "fpmi", type: "scientific", render: function ( data, type, row ) {return data.toExponential(2) } },
Marc Kupietz7bd55232019-01-22 15:29:06 +0100304 { "data": "npmi", render: function ( data, type, row ) {return data.toFixed(3) }},
305 { "data": "dice", render: function ( data, type, row ) {return data.toExponential(2) }},
306 { "data": "ld", render: function ( data, type, row ) {return data.toFixed(2) }},
Marc Kupietz63b268f2019-01-22 22:34:29 +0100307 { "data": "af", render: function ( data, type, row ) {return data.toFixed(2) }},
308 { "data": "win", width: "auto", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitmask2window(data) }},
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100309 { "data": "llfmd", render: function ( data, type, row ) {return data.toFixed(1) }},
310 { "data": "rlfmd", render: function ( data, type, row ) {return data.toFixed(1) }},
311 { "data": "lnpmi", render: function ( data, type, row ) {return data.toFixed(2) }},
312 { "data": "rnpmi", render: function ( data, type, row ) {return data.toFixed(2) }},
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100313 { "data": "f" },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100314 { "data": "word", sClass: "collocator" }
315 ],
316 "columnDefs": [
Marc Kupietz63b268f2019-01-22 22:34:29 +0100317 { className: "dt-right", "targets": [0,1,2,3,4,5,6,7,9,10,11,12,13] },
318 { className: "dt-right detail", "targets": [5,9,10,11,12] },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100319 { "searchable": false,
320 "orderable": false,
321 "targets": []
322 },
Marc Kupietz63b268f2019-01-22 22:34:29 +0100323 { "orderSequence": [ "desc" ], "targets": [0,1,2,3,4,5,6,7,9,10,11,12,13] },
324 { "orderSequence": [ "asc", "desc" ], "targets": [8,14] },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100325 ],
326 "oLanguage": {
327 "sSearch": "Filter: "
328 },
Marc Kupietz63b268f2019-01-22 22:34:29 +0100329 "order": [[ 7, 'desc' ]],
Marc Kupietz78b434a2018-01-12 22:33:32 +0100330 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100331
Marc Kupietz1acb3172018-02-17 09:41:26 +0100332
333 $('#show-details').change(function (e) {
334 var columns = classicCollocatorTable.columns(".detail");
335 if(this.checked) {
336 columns.visible(true);
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100337 $("#ccd").css('width', 'auto');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100338 } else {
339 columns.visible(false);
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100340 $("#ccd").css('width', '450px');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100341 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100342 classicCollocatorTable.columns.adjust().draw();
Marc Kupietz1acb3172018-02-17 09:41:26 +0100343 } );
344
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100345 $("td.collocator").click(function(){
346 queryKorAPCII(this.textContent + " /w5 " + CIIsearchWords);
Marc Kupietzad783722018-01-13 17:45:21 +0100347 });
348
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100349 collocatorTable.on( 'order.dt search.dt', function () {
350 collocatorTable.column(0, {order:'applied'}).nodes().each( function (cell, i) {
351 cell.innerHTML = i+1;
352 } );
353 }).draw();
354 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100355
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100356 if (localStorage && !window.location.hash) { // let's not crash if some user has IE7
357 var index = parseInt(localStorage['tab']||'0');
358 $("#tabs").tabs({ active: index });
359 }
360 $("#tabs").css("visibility", "visible"); // now we can show the tabs
361 });
Marc Kupietz58270662017-12-04 12:10:06 +0100362
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100363 $(function(){
364 $("#dropdownoptions").dialog({
365 title: "Options",
366 autoOpen: false,
367 modal: false,
368 draggable: false,
369 height: "auto",
370 width: "auto",
371 resizable: false,
372 buttons: {
373 "Cancel": function() {
374 $( this ).dialog( "close" );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100375 },
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100376 "Apply": function() {
377 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietze6a7a732018-01-12 09:21:08 +0100378 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100379 }
380 });
381 });
382
383 $(function(){
384 $("#showoptions").click(function(){
385 $("#dropdownoptions").dialog("open");
386 var target = $(this);
387 $("#dropdownoptions").dialog("widget").position({
388 my: 'left bottom',
389 at: 'left bottom',
390 of: target
Marc Kupietz58270662017-12-04 12:10:06 +0100391 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100392 });
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100393 });
394
395 $( function() {
396 $( "#no_iterations" ).spinner({
397 spin: function( event, ui ) {
398 if ( ui.value < 1000 ) {
399 $( this ).spinner( "value", 1000 );
400 return false;
401 } else if ( ui.value > 10000 ) {
402 $( this ).spinner( "value", 10000 );
403 return false;
404 }
405 }
406 });
407 } );
408
409 $( function() {
410 $( "#neighbours" ).spinner({
411 spin: function( event, ui ) {
412 if ( ui.value < 0 ) {
413 $( this ).spinner( "value", 0 );
414 return false;
415 } else if ( ui.value > 200 ) {
416 $( this ).spinner( "value", 200 );
417 return false;
418 }
419 }
420 });
421 } );
422
423 $( function() {
424 $( "#cutoff" ).spinner({
425 spin: function( event, ui ) {
426 if ( ui.value < 100000 ) {
427 $( this ).spinner( "value", 100000 );
428 return false;
429 } else if ( ui.value > 2000000 ) {
430 $( this ).spinner( "value", 2000000 );
431 return false;
432 }
433 }
434 });
435 } );
436
437 $( function() {
438 $( "#tabs" ).tabs().addClass('tabs-min');
439 } );
440
441 $( function() {
442 $( ".controlgroup-vertical" ).controlgroup({
443 "direction": "vertical"
444 });
445 } );
446
447 $(function() {
448 $( document ).tooltip({
449 content: function() {
450 return $(this).attr('title');
451 }}
452 )
453 });
454
455 $(function () {
456 $(document).tooltip({
457 content: function () {
458 return $(this).prop('title');
459 },
460 show: null,
461 close: function (event, ui) {
462 ui.tooltip.hover(
463 function () {
464 $(this).stop(true).fadeTo(400, 1);
465 },
466 function () {
467 $(this).fadeOut("400", function () {
468 $(this).remove();
469 })
470 });
471 }
472 });
473 });
Marc Kupietz83305222016-04-28 09:57:22 +0200474 </script>
Marc Kupietz58270662017-12-04 12:10:06 +0100475 <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
476 <script src="/derekovecs/js/tsne.js"></script>
477 <script src="/derekovecs/js/som.js"></script>
478 <script src="/derekovecs/js/labeler.js"></script>
Marc Kupietzcdd51302018-03-19 16:36:54 +0100479 <script src="/derekovecs/js/derekovcs.js"></script>
Marc Kupietz83305222016-04-28 09:57:22 +0200480 <script>
481
482 var opt = {epsilon: <%= $epsilon %>, perplexity: <%= $perplexity %>},
Marc Kupietz58270662017-12-04 12:10:06 +0100483 mapWidth = 800, // width map
484 mapHeight = 800,
485 jitterRadius = 7;
Marc Kupietz83305222016-04-28 09:57:22 +0200486
487 var T = new tsnejs.tSNE(opt); // create a tSNE instance
488
489 var Y;
490
491 var data;
492 var labeler;
493
494 function applyJitter() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100495 svg.selectAll('.tsnet')
496 .data(labels)
497 .transition()
498 .duration(50)
499 .attr("transform", function(d, i) {
500 T.Y[i][0] = (d.x - mapWidth/2 - tx)/ss/20;
501 T.Y[i][1] = (d.y - mapHeight/2 - ty)/ss/20;
502 return "translate(" +
Marc Kupietz384c9132018-03-19 16:45:24 +0100503 (d.x) + "," +
504 (d.y) + ")";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100505 });
Marc Kupietz83305222016-04-28 09:57:22 +0200506 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100507
Marc Kupietz83305222016-04-28 09:57:22 +0200508 function updateEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100509 var Y = T.getSolution();
510 svg.selectAll('.tsnet')
511 .data(data.words)
512 .attr("transform", function(d, i) {
513 return "translate(" +
Marc Kupietz384c9132018-03-19 16:45:24 +0100514 ((Y[i][0]*20*ss + tx) + mapWidth/2) + "," +
515 ((Y[i][1]*20*ss + ty) + mapHeight/2) + ")"; });
Marc Kupietz83305222016-04-28 09:57:22 +0200516 }
517
518 var svg;
519 var labels = [];
520 var anchor_array = [];
521 var text;
522
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100523 function getMergedClass(i) {
524 if(data.mergedEnd && i > data.mergedEnd) {
525 return " merged"
526 } else {
527 return "";
528 }
529 }
530
531 function getRankTooltip(i) {
532 if(data.mergedEnd) {
533 if(data.ranks[i] < data.mergedEnd) {
534 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
535 } else {
536 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]-data.mergedEnd).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " (merged vocab)";
537 }
538 } else {
539 return "rank: "+i +" "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
540 }
541 }
542
Marc Kupietz83305222016-04-28 09:57:22 +0200543 function drawEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100544 var urlprefix = new URLSearchParams(window.location.search);
545 urlprefix.delete("word");
546 urlprefix.append("word","");
Marc Kupietz8f9c86a2017-12-04 17:17:13 +0100547
Marc Kupietze6a7a732018-01-12 09:21:08 +0100548 $("#embed").empty();
549 var div = d3.select("#embed");
Marc Kupietz34c08172017-11-29 17:08:47 +0100550
Marc Kupietze6a7a732018-01-12 09:21:08 +0100551 // get min and max in each column of Y
552 var Y = T.Y;
Marc Kupietz34c08172017-11-29 17:08:47 +0100553
Marc Kupietze6a7a732018-01-12 09:21:08 +0100554 svg = div.append("svg") // svg is global
555 .attr("width", mapWidth)
556 .attr("height", mapHeight);
Marc Kupietz34c08172017-11-29 17:08:47 +0100557
Marc Kupietze6a7a732018-01-12 09:21:08 +0100558 var g = svg.selectAll(".b")
559 .data(data.words)
560 .enter().append("g")
561 .attr("class", "tsnet");
Marc Kupietz34c08172017-11-29 17:08:47 +0100562
Marc Kupietze6a7a732018-01-12 09:21:08 +0100563 g.append("a")
564 .attr("xlink:href", function(word) {
565 return "?"+urlprefix+word; })
566 .attr("class", function(d, i) {
567 var res="";
568 if(data.marked[i]) {
569 res="marked ";
570 }
571 if(data.target.indexOf(" "+d+" ") >= 0) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100572 res += "target";
573 }
574 if(data.mergedEnd && data.ranks[i] >= data.mergedEnd) {
575 return res+" merged";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100576 } else {
577 return res;
578 }
579 })
580 .attr("title", function(d, i) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100581 return getRankTooltip(i);
Marc Kupietze6a7a732018-01-12 09:21:08 +0100582 })
583 .append("text")
584 .attr("text-anchor", "top")
585 .attr("font-size", 12)
586 .text(function(d) { return d; });
Marc Kupietz34c08172017-11-29 17:08:47 +0100587
Marc Kupietz384c9132018-03-19 16:45:24 +0100588 g.append("svg:title")
589 .text(function(d, i) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100590 return getRankTooltip(i);
Marc Kupietz384c9132018-03-19 16:45:24 +0100591 });
592
Marc Kupietze6a7a732018-01-12 09:21:08 +0100593 var zoomListener = d3.behavior.zoom()
594 .scaleExtent([0.1, 10])
595 .center([0,0])
596 .on("zoom", zoomHandler);
597 zoomListener(svg);
Marc Kupietz83305222016-04-28 09:57:22 +0200598 }
599
600 var tx=0, ty=0;
601 var ss=1;
602 var iter_id=-1;
603
604 function zoomHandler() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100605 tx = d3.event.translate[0];
606 ty = d3.event.translate[1];
607 ss = d3.event.scale;
608 updateEmbedding();
Marc Kupietz83305222016-04-28 09:57:22 +0200609 }
610
611 var stepnum = 0;
612
613 function stopStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100614 clearInterval(iter_id);
615 text = svg.selectAll("text");
Marc Kupietz34c08172017-11-29 17:08:47 +0100616
Marc Kupietze6a7a732018-01-12 09:21:08 +0100617 // jitter function needs different data and co-ordinate representation
618 labels = d3.range(data.words.length).map(function(i) {
619 var x = (T.Y[i][0]*20*ss + tx) + mapWidth/2;
620 var y = (T.Y[i][1]*20*ss + ty) + mapHeight/2;
621 anchor_array.push({x: x, y: y, r: jitterRadius});
622 return {
623 x: x,
624 y: y,
625 name: data.words[i]
626 };
627 });
Marc Kupietz34c08172017-11-29 17:08:47 +0100628
Marc Kupietze6a7a732018-01-12 09:21:08 +0100629 // get the actual label bounding boxes for the jitter function
630 var index = 0;
631 text.each(function() {
632 labels[index].width = this.getBBox().width;
633 labels[index].height = this.getBBox().height;
634 index += 1;
635 });
Marc Kupietz83305222016-04-28 09:57:22 +0200636
Marc Kupietz34c08172017-11-29 17:08:47 +0100637
Marc Kupietze6a7a732018-01-12 09:21:08 +0100638 // setTimeout(updateEmbedding, 1);
639 // setTimeout(
640 labeler = d3.labeler()
641 .label(labels)
642 .anchor(anchor_array)
643 .width(mapWidth)
644 .height(mapHeight)
645 .update(applyJitter);
646 // .start(1000);
Marc Kupietz83305222016-04-28 09:57:22 +0200647
Marc Kupietze6a7a732018-01-12 09:21:08 +0100648 iter_id = setInterval(jitterStep, 1);
Marc Kupietz83305222016-04-28 09:57:22 +0200649 }
650
651 var jitter_i=0;
652
653 function jitterStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100654 if(jitter_i++ > 100) {
655 clearInterval(iter_id);
656 } else {
657 labeler.start2(10);
658 applyJitter();
659 }
Marc Kupietz83305222016-04-28 09:57:22 +0200660 }
661
662 var last_cost=1000;
663
664 function step() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100665 var i = T.iter;
Marc Kupietz34c08172017-11-29 17:08:47 +0100666
Marc Kupietze6a7a732018-01-12 09:21:08 +0100667 if(i > <%= $no_iterations %>) {
668 stopStep();
669 } else {
670 var cost = Math.round(T.step() * 100000) / 100000; // do a few steps
671 $("#cost").html("tsne iteration " + i + ", cost: " + cost.toFixed(5));
672 if(i % 250 == 0 && cost >= last_cost) {
673 stopStep();
Marc Kupietz58270662017-12-04 12:10:06 +0100674 } else {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100675 last_cost = cost;
676 updateEmbedding();
Marc Kupietz58270662017-12-04 12:10:06 +0100677 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100678 }
Marc Kupietz83305222016-04-28 09:57:22 +0200679 }
680
681 function showMap(j) {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100682 data=j;
683 T.iter=0;
684 iter_id = -1;
685 last_cost=1000;
686 T.initDataRaw(data.vecs); // init embedding
687 drawEmbedding(); // draw initial embedding
Marc Kupietz78114532017-11-29 17:00:16 +0100688
Marc Kupietze6a7a732018-01-12 09:21:08 +0100689 if(iter_id >= 0) {
690 clearInterval(iter_id);
691 }
692 //T.debugGrad();
693 iter_id = setInterval(step, 1);
694 if(true) { // (<%= $show_som %>) {
695 makeSOM(j, <%= $no_iterations %>);
696 }
Marc Kupietz83305222016-04-28 09:57:22 +0200697 }
Marc Kupietz39179ab2017-07-04 16:28:06 +0200698 var queryword;
699
Marc Kupietz66bfd952017-12-11 09:59:45 +0100700 function showCollocatorSOM() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100701 if (collocatorTable) {
702 var ctableData = collocatorTable.rows().data();
703 var nwords = [],
704 nranks = [];
705 for (var i=0; i < ctableData.length && i < 100; i++) {
706 nranks.push(ctableData[i].rank);
707 nwords.push(ctableData[i].word);
Marc Kupietz66bfd952017-12-11 09:59:45 +0100708 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100709 $.post('/derekovecs/getVecsByRanks',
710 JSON.stringify(nranks),
711 function(data, status){
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100712 showMap({target: " "+urlParams.get('word')+" ", mergedEnd: <%= $mergedEnd %>, words: nwords, vecs: data, ranks: nranks, marked: Array(100).fill(false)} );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100713 }, 'json');
714 }
Marc Kupietz66bfd952017-12-11 09:59:45 +0100715 }
716
Marc Kupietz39179ab2017-07-04 16:28:06 +0200717 function onload() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100718 queryword = document.getElementById('word');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200719 }
720
721 function queryKorAP() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100722 window.open('http://korap.ids-mannheim.de/kalamar/?q='+queryword.value, 'KorAP');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200723 }
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100724
725 function queryKorAPCII(query) {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100726 window.open('http://korap.ids-mannheim.de/kalamar/?ql=cosmas2&q='+query, 'KorAP');
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100727 }
Marc Kupietz83305222016-04-28 09:57:22 +0200728 </script>
729 </head>
Marc Kupietz39179ab2017-07-04 16:28:06 +0200730 <body onload="onload()">
Marc Kupietz7bd55232019-01-22 15:29:06 +0100731 <div style="display:none;" id="pmi_ttt">Pointwise mutual information: $$\text{MI}=\text{MI}=log_2\frac{p(w_1,w_2)}{p(w_1) p(w_2)}$$<p class="citation">Church, K. W. and Hanks, P. (1990): Word association norms, mutual information, and lexicography. Comput. Linguist. 16, 1 (March 1990), 22-29.</p></div>
732 <div style="display:none;" id="md_ttt">Pointwise mutual information squared [1], also called mutual dependency [2]: $$\text{MI}^2=\text{MD}=log_2\frac{p^2(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>
733 <div style="display:none;" id="lfmd_ttt">Pointwise mutual information cubed [1], also called log-frequency biased mutual dependency [2]: $$\text{MI}^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 +0100734 <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 Kupietz9f732f02019-01-22 16:19:51 +0100735 <div style="display:none;" id="ll_ttt">Log-likelihood: $$2*\sum_{ij}O_{ij}*log\frac{O_{ij}}{E_{ij}}$$<p class="citation">Dunning, T. (1993): Accurate methods for the statistics of surprise and coincidence. Comput. Linguist. 19, 1 (March 1993), 61-74.</p>
736<p class="citation">Evert, Stefan (2004): <a href="http://purl.org/stefan.evert/PUB/Evert2004phd.pdf">The Statistics of Word Cooccurrences: Word Pairs and Collocations.</a> PhD dissertation, IMS, University of Stuttgart. Published in 2005, URN urn:nbn:de:bsz:93-opus-23714.</p></div>
Marc Kupietz7bd55232019-01-22 15:29:06 +0100737 <div style="display:none;" id="logdice_ttt">Log-Dice: $$14 + log_2 \frac{2*(f_{12}+ε)}{(f_1+ε) + (f_2+ε)}$$<p class="citation">Rychlý, Pavel (2008): <a href="http://www.fi.muni.cz/usr/sojka/download/raslan2008/13.pdf">A lexicographer-friendly association score.</a> In Proceedings of Recent Advances in Slavonic Natural Language Processing, RASLAN, 6–9, 2008</p></div>
Marc Kupietz58270662017-12-04 12:10:06 +0100738 <div id="header">
739 <div id="pagetitle">
Marc Kupietzc053d972019-01-10 10:41:51 +0100740 <h1>DeReKoVecs</h1>
741 <h2><%== $title %></h2>
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100742 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100743 <div id="options" class="widget">
744 <form id="queryform">
745 <input id="word" type="text" name="word" placeholder="Word(s) to be searched" value="<%= $word %>"
746 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."/>
747 <input id="SEARCH" type="button" value="SEARCH">
748 <input type="button" id="showoptions" name="showoptions" value="Options" />
749 </form>
750 <div id="dropdownoptions" style="display: none">
751 <form id="optionsform">
752 <div class="controlgroup-vertical">
753 <label for="cutoff">cut-off</label>
754 <input id="cutoff" type="text" name="cutoff" size="10" value="<%= $cutoff %>" title="Only consider the most frequent x word forms.">
755 <label for="dedupe">dedupe</label>
756 <input id="dedupe" type="checkbox" name="dedupe" value="1" <%= ($dedupe ? "checked" : "") %> title="radically filter out any near-duplicates">
757 % if($mergedEnd > 0) {
758 <label for="sbf">backw.</label>
759 <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.">
760 % }
761 <label for="neighbours">max. neighbours:</label>
762 <input id="neighbours" size="4" name="n" value="<%= $no_nbs %>">
763 <label for="no_iterations">max. iterations</label>
764 <input id="no_iterations" name="N" size="4" value="<%= $no_iterations %>">
765 <!-- <label for="dosom">SOM</label>
766 <input id="dosom" type="checkbox" name="som" value="1" <%= ($show_som ? "checked" : "") %>> -->
767 % if($collocators) {
768 <label for="sortby">window/sort</label>
769 <select id="sortby" name="sort">
770 <option value="0" <%= ($sort!=1 && $sort!=2? "selected":"") %>>auto focus</option>
771 <!-- <option value="1" <%= ($sort==1? "selected":"") %>>any single position</option>
772 <option value="2" <%= ($sort==2? "selected":"") %>>whole window</option> -->
773 </select>
774 % }
775 <input type="button" value="→ KorAP" onclick="queryKorAP();" title="query word with KorAP"/>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100776 <input id="show-details" type="checkbox" name="show-details" value="1" >
777 <label for="show-details">
778 Show details
779 </label>
Marc Kupietz58270662017-12-04 12:10:06 +0100780 </div>
781 </form>
782 </div>
783 </div>
784 </div>
785 <div id="topwrapper">
786 <div style="visibility: hidden;" id="tabs">
787 <ul>
788 <li><a href="#tabs-1">Semantics (TSNE-map)</a></li>
789 <li><a href="#tabs-2">Semantics (SOM)</a></li>
Marc Kupietzbb3da6a2019-01-22 15:21:38 +0100790 <li><a href="#tabs-3">Syntagmatic (collocates)</a></li>
Marc Kupietz58270662017-12-04 12:10:06 +0100791 </ul>
Marc Kupietz384c9132018-03-19 16:45:24 +0100792 <div id="tabs-1" style="display: flex; padding: 5px; flex-flow: row wrap;">
Marc Kupietz58270662017-12-04 12:10:06 +0100793 % if($lists && (@$lists) > 0 && (@$lists)[0]) {
794 <div id="wrapper">
Marc Kupietz384c9132018-03-19 16:45:24 +0100795 <div id="first" style="width: 230px; margin-bottom: 15px;">
Marc Kupietz58270662017-12-04 12:10:06 +0100796 <table class="display compact nowrap" id="firsttable">
797 <thead>
798 <tr>
Marc Kupietz384c9132018-03-19 16:45:24 +0100799 <th align="right">#</th><th align="right">cos</th><th align="left">similars by w2v</th>
Marc Kupietz58270662017-12-04 12:10:06 +0100800 </tr>
801 </thead>
802 <tbody>
803 <tr>
804 <td align="right">
805 </td>
806 <td align="right">
807 </td>
808 <td></td>
809 </tr>
810 </tbody>
811 </table>
812 </div>
Marc Kupietza55a09a2018-07-06 13:30:30 +0200813 % if(0 && $haveSProfiles) {
Marc Kupietz384c9132018-03-19 16:45:24 +0100814 <div id="sprofilesdiv" style="width: 200px; padding-right: 10px;">
815 <table class="display compact nowrap" id="sprofiles">
816 <thead>
817 <tr>
818 <th align="right">cos</th><th align="left">similars by coll. profile</th>
819 </tr>
820 </thead>
821 <tbody>
822 <tr>
823 <td align="right">
824 </td>
825 <td></td>
826 </tr>
827 </tbody>
828 </table>
829 </div>
830 %}
831 <div id="second">
Marc Kupietz58270662017-12-04 12:10:06 +0100832 <div id="embed">
833 </div>
834 <div id="cost">
835 </div>
836 </div>
837 </div>
Marc Kupietz384c9132018-03-19 16:45:24 +0100838 % } elsif($word !~ /^\s*$/) {
839 <div id="wrapper">
840 <div id="not-found-dialog" title="Not found">
841 <p>ERROR: "<%= $word %>" not found in vocabluary.</p>
842 <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>
843 </div>
844 <script>
845 $( function() {
846 $( "#not-found-dialog" ).dialog({
847 autoOpen: true,
848 modal: true,
849 draggable: false,
850 height: "auto",
851 width: "auto",
852 resizable: false,
853 buttons: {
854 "OK": function() {
855 $( this ).dialog( "close" );
856 },
857 "Apply": function() {
858 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
859 }
860 }
861 });
862 });
863 </script>
864 </div>
865 % }
Marc Kupietz58270662017-12-04 12:10:06 +0100866 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100867 <div id="tabs-2" style="display: flex; padding: 5px; flex-flow: row wrap;">
Marc Kupietz66bfd952017-12-11 09:59:45 +0100868 <div id="som2" style="width: 800;">
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100869 <div id="sominfo1"><span id="somcolor1"> </span> <span id="somword1"> </span> <span id="somcolor2"> </span> <span id="somword2"> </span> <span id="somcolor3"> </span></div>
870 <div id="sominfo" style="text-align: right">SOM iteration <span id="iterations">0</span></div>
Marc Kupietz58270662017-12-04 12:10:06 +0100871 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100872 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100873 <div id="tabs-3" style="display: flex; padding:5px; flex-flow: row wrap;">
874 <div style="margin-right: 20px; margin-bottom: 10px;" id="secondt">
Marc Kupietze6a7a732018-01-12 09:21:08 +0100875 <table class="display compact nowrap" id="secondtable">
Marc Kupietz58270662017-12-04 12:10:06 +0100876 <thead>
877 <tr>
878 % if($collocators) {
879 <th>#</th>
Marc Kupietz4116b432017-12-06 14:15:32 +0100880 <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>
881 <th align="right" title="Maximum activation of the collocator anywhere in the output layer.">max(a)</th>
882 <th title="Average raw activation of the collocator in the columns selected by auto-focus." align="right">⟨a⟩</th>
883 <th title="Sum of activations over the selected colunns normalized by the total activation sum of the selected columns." align="right">Σa/Σw'</th>
884 <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 +0100885 <th title="Sum of the activations over the whole window normalized by the total window sum (no auto-focus)." align="right">Σa/Σw</th>
Marc Kupietzbb3da6a2019-01-22 15:21:38 +0100886 <th align="left">collocate (by w2v)</th>
Marc Kupietz58270662017-12-04 12:10:06 +0100887 % }
888 </tr>
889 </thead>
890 <tbody>
891 <tr>
892 <td align="right">
893 </td>
894 <td align="right">
895 </td>
896 <td align="right">
897 </td>
898 <td align="right">
899 </td>
900 <td align="right">
901 </td>
902 <td align="right">
903 </td>
Marc Kupietz58270662017-12-04 12:10:06 +0100904 </tr>
905 </tbody>
906 </table>
Marc Kupietz66bfd952017-12-11 09:59:45 +0100907 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100908 <div id="ccd" style="">
Marc Kupietze6a7a732018-01-12 09:21:08 +0100909 <table class="display compact nowrap" id="classicoloctable">
910 <thead>
Marc Kupietzcd136e22018-01-29 09:18:12 +0100911 % if($collocators) {
912 <tr>
Marc Kupietzf19814b2019-01-21 16:50:19 +0100913 <th id="ll_tt">LL</th>
Marc Kupietzfab14a72019-01-22 16:20:29 +0100914 <th id="mi_tt">MI</th>
915 <th id="md_tt">MI²</th>
Marc Kupietzf19814b2019-01-21 16:50:19 +0100916 <th id="lfmd_tt">MI³</th>
Marc Kupietzfab14a72019-01-22 16:20:29 +0100917 <th id="npmi_tt">nPMI</th>
918 <th id="dice_tt">dice</th>
Marc Kupietz63b268f2019-01-22 22:34:29 +0100919 <th id="logdice_tt">LD</th>
920 <th id="logdiceaf_tt">LDaf</th>
921 <th id="af_win">af-window</th>
Marc Kupietz5a7f9ac2018-01-30 11:22:44 +0100922 <th title="PMI³ restricted to left neighbour">l-PMI³</th>
923 <th title="PMI³ restricted to right neighbour">r-PMI³</th>
924 <th title="nPMI restricted to left neighbour">l-nPMI</th>
925 <th title="nPMI restricted to right neighbour">r-nPMI</th>
Marc Kupietzbb3da6a2019-01-22 15:21:38 +0100926 <th title="raw frequency sum of collocation within window">raw</th>
927 <th>collocate (by CA)</th>
Marc Kupietzcd136e22018-01-29 09:18:12 +0100928 </tr>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100929 % }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100930 </thead>
931 <tbody>
932 <tr>
933 <td align="right">
934 </td>
935 <td align="right">
936 </td>
937 <td align="right">
938 </td>
939 <td align="right">
940 </td>
Marc Kupietzcfcdcfc2018-01-24 09:51:26 +0100941 <td align="right">
942 </td>
943 <td align="right">
944 </td>
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100945 <td align="right"></td>
Marc Kupietz63b268f2019-01-22 22:34:29 +0100946 <td align="left"></td>
947 <td align="right"></td>
948 <td align="right"></td>
949 <td align="right"></td>
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100950 <td align="right"></td>
951 <td align="left"></td>
Marc Kupietze6a7a732018-01-12 09:21:08 +0100952 </tr>
953 </tbody>
954 </table>
955 </div>
Marc Kupietz384c9132018-03-19 16:45:24 +0100956 <!--
957 <div style="clear:both" ></div>
958 <div style="float: right; overflow: hidden" id="extra"><button onClick="showCollocatorSOM()"> </button></div>
959 -->
Marc Kupietz66bfd952017-12-11 09:59:45 +0100960 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100961 </div>
962 </div> <!-- topwrapper -->
963 <div style="clear: both;"></div>
964 </div>
Marc Kupietzebea4702018-01-12 09:16:09 +0100965 % if($training_args && (@$lists)[0]) {
966 <div class="info">
967 % if($training_args =~ /-type\s*3/) {
968 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 %>
969 % } else {
970 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 %>
971 % }
972 </div>
Marc Kupietz83305222016-04-28 09:57:22 +0200973 % }
Marc Kupietz58270662017-12-04 12:10:06 +0100974 </body>
Marc Kupietz83305222016-04-28 09:57:22 +0200975</html>