blob: efde1cd625f30ecb5a7104bcca9e036b2d7c21c5 [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 Kupietz58270662017-12-04 12:10:06 +01009 <script src = "https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
10 <script src = "https://cdn.datatables.net/fixedcolumns/3.2.3/js/dataTables.fixedColumns.min.js"></script>
11 <script src = "https://cdn.datatables.net/plug-ins/1.10.16/sorting/scientific.js"></script>
Marc Kupietza0ffb392018-01-25 08:53:43 +010012 <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 +010013 <link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/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 Kupietza0ffb392018-01-25 08:53:43 +010050 }
51 );
52 });
53
54 //set things up so that we can shove raw html into what is shown in the tooltip;
55 // in this case, we will have already put into the title attribute the html that
56 // contains the MathJax rendered equations (via what we do in the callback).
57 $(function () {
58 $(document).tooltip({
59 content: function () {
60 return $(this).prop('title');
61 }
62 });
63 });
64
Marc Kupietze6a7a732018-01-12 09:21:08 +010065 $("input").bind("keydown", function(event) {
66 // track enter key
67 var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
68 if (keycode == 13) { // keycode for enter key
69 // force the 'Enter Key' to implicitly click the Update button
70 document.getElementById('SEARCH').click();
71 return false;
72 } else {
73 return true;
74 }});
Marc Kupietzdab9f222017-11-29 14:22:59 +010075
Marc Kupietze871abd2018-01-25 16:18:27 +010076 var collocatorTable_activated = false;
Marc Kupietze6a7a732018-01-12 09:21:08 +010077 $( "#tabs" ).on( "tabsactivate", function( event, ui ) {
78 if (localStorage) localStorage['tab'] = ui.newTab.index();
Marc Kupietze871abd2018-01-25 16:18:27 +010079 if(ui.newTab.index() == 2 && !collocatorTable_activated) {
80 classicCollocatorTable.columns.adjust();
81 collocatorTable.columns.adjust();
82 collocatorTable_activated = true;
83 }
Marc Kupietze6a7a732018-01-12 09:21:08 +010084 });
85
86 $(function(){
87 $("#SEARCH").click(function() {
88 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietz58270662017-12-04 12:10:06 +010089 });
Marc Kupietze6a7a732018-01-12 09:21:08 +010090 });
Marc Kupietz0af83e32017-11-27 09:31:37 +010091
Marc Kupietze6a7a732018-01-12 09:21:08 +010092 function changeCharColor(txt, heat, word) {
93 var newText = "";
94 for (var i=0, l=txt.length; i<l; i++) {
95 newText += (i == 5 ? txt.charAt(i) : '<a href="http://korap.ids-mannheim.de/kalamar/?ql=cosmas2&q=' +
96 CIIsearchWords + ' /' + (i > 5? '%2B' : '-') + 'w' +
97 Math.abs(i-5) + ':' + Math.abs(i-5) + ' ' + word +
98 '" target="korap"><span style="background-color:' +
99 getHeatColor(heat[i]/maxHeat)+'">'+txt.charAt(i)+'</span></a>');
Marc Kupietzb6c615d2017-12-02 10:38:20 +0100100 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100101 return newText;
102 }
Marc Kupietzb6c615d2017-12-02 10:38:20 +0100103
Marc Kupietze6a7a732018-01-12 09:21:08 +0100104 function getHeatColor(value) {
105 var hue=((1-value)*120).toString(10);
106 return ["hsl(",hue,",90%,70%)"].join("");
107 }
108
109 function bitvec2window(n, heat, word) {
110 var str = n.toString(2).padStart(10, "0")
111 .replace(/^([0-9]{5})/, '$1x')
112 .replace(/0/g, '·')
113 .replace(/1/g, '+');
114 return changeCharColor(str, heat, word);
115 }
116
117 % use Mojo::ByteStream 'b';
118 var paraResults = <%= b(Mojo::JSON::to_json($lists)) %>;
119 var urlprefix = new URLSearchParams(window.location.search);
120 if (paraResults.length > 0 && paraResults[0] != null) {
121 var nvecs = [],
122 nwords = [],
123 nranks = [],
124 nmarked = [];
125 for(var i = 0; i < paraResults.length; i++) {
126 nwords = nwords.concat(paraResults[i].map(function(a){return a.word;}));
127 nvecs = nvecs.concat(paraResults[i].map(function(a){return a.vector;}));
128 nranks = nranks.concat(paraResults[i].map(function(a){return a.rank;}));
129 nmarked = nmarked.concat(paraResults[i].map(function(a){return a.marked;}));
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100130 }
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100131 showMap({target: " "+urlParams.get('word')+" ", mergedEnd: <%= $mergedEnd %>, words: nwords, vecs: nvecs, ranks: nranks, marked: nmarked} );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100132 var t = $('#firsttable').DataTable({
Marc Kupietzee894d52019-01-09 14:55:14 +0100133 data: [].concat.apply([], paraResults),
Marc Kupietze6a7a732018-01-12 09:21:08 +0100134 "sScrollY": "780px",
135 "bScrollCollapse": true,
136 "bPaginate": false,
137 "bJQueryUI": true,
138 "dom": '<"top">rt<"bottom"flp><"clear">',
Marc Kupietz384c9132018-03-19 16:45:24 +0100139 "initComplete":function(settings, json) {
140 $('td.paradigmator a').on('mousedown', function(e) {
141 return paradigmatorClick(e, paraResults[0][0].word, this.childNodes["0"].textContent);
142 });
143 },
Marc Kupietze6a7a732018-01-12 09:21:08 +0100144 "columns": [
145 { "data": "rank", type: "allnumeric" },
146 { "data": "dist", render: function ( data, type, row ) {return data.toFixed(3) }},
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100147 { "data": "word", class: "paradigmator", render: function ( data, type, row ) {
148 urlprefix.set("word", data); return '<a class="' + getMergedClass(row.rank) + '" href="?' + urlprefix + '">' + data + '</a>'
149 }}
Marc Kupietze6a7a732018-01-12 09:21:08 +0100150 ],
151 "columnDefs": [
152 { className: "dt-right", "targets": [0,1] },
153 { "searchable": false,
154 "orderable": false,
155 "targets": 0
156 },
157 { "orderSequence": [ "desc" ], "targets": [ 1 ] },
158 { "orderSequence": [ "asc", "desc" ], "targets": [ 2 ] },
159 ],
160 "oLanguage": {
161 "sSearch": "Filter: "
162 },
163 "order": [[ 1, 'desc' ]],
164 } );
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100165
Marc Kupietze6a7a732018-01-12 09:21:08 +0100166 t.on( 'order.dt search.dt', function () {
167 t.column(0, {order:'applied'}).nodes().each( function (cell, i) {
168 cell.innerHTML = i+1;
169 } );
170 } ).draw();
171
172 $( "#first" ).clone().prependTo( "#tabs-2" );
173
174 }
175
176
177 var collocatorData = <%= b(Mojo::JSON::to_json($collocators)) %>;
178 var maxHeat; // = Math.max.apply(Math,collocatorData.map(function(o){return o.cprob;}))
179
180 if (collocatorData != null) {
181 maxHeat = Math.max.apply(Math,collocatorData.map(function(o){return Math.max.apply(Math,o.heat);}))
182 collocatorTable = $('#secondtable').DataTable({
183 data: collocatorData,
184 "sScrollY": "780px",
185 "bScrollCollapse": true,
186 "bPaginate": false,
187 "bJQueryUI": true,
188 "dom": '<"top">rt<"bottom"flp><"clear">',
189 "columns": [
190 { "data": "rank", type: "allnumeric" },
191 { "data": "pos", width: "7%", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitvec2window(data, row.heat, row.word) }},
192 { "data": "max", render: function ( data, type, row ) {return data.toFixed(3) }},
193 { "data": "average", render: function ( data, type, row ) {return data.toFixed(3) }},
194 { "data": "prob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
195 { "data": "cprob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
196 { "data": "overall", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
197 { "data": "word", sClass: "collocator" },
198 { "data": "rank", type: "allnumeric" }
199 ],
200 "columnDefs": [
201 { className: "dt-right", "targets": [0,2,3,4,5,6] },
202 { className: "dt-center", "targets": [ 1] },
203 { "searchable": false,
204 "orderable": false,
205 "targets": [0, 8]
206 },
207 { "type": "scientific", targets: [2,3,4,5,6] },
208 { "orderSequence": [ "desc" ], "targets": [ 2, 3, 4, 5, 6 ] },
209 { "orderSequence": [ "asc", "desc" ], "targets": [ 1, 7 ] },
210 { "targets": [8], "visible": false }
211 ],
212 "oLanguage": {
213 "sSearch": "Filter: "
214 },
215 "order": [[ 4, 'desc' ]],
216 } );
217 $.ajaxSetup({
218 type: 'POST',
219 timeout: 30000,
220 error: function(xhr) {
221 $('#display_error')
222 .html('Error: ' + xhr.status + ' ' + xhr.statusText);
223 }
Marc Kupietz78b434a2018-01-12 22:33:32 +0100224 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100225
Marc Kupietz384c9132018-03-19 16:45:24 +0100226
227 if($('#sprofiles').length) {
228 similarProfileTable = $('#sprofiles').DataTable({
229 ajax: {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100230 method: "GET",
Marc Kupietz384c9132018-03-19 16:45:24 +0100231 url: '/derekovecs/getSimilarProfiles',
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100232 dataType: 'json',
233 dataSrc: "",
234 timeout: 30000,
235 data: { w: paraResults[0][0].rank }
Marc Kupietz384c9132018-03-19 16:45:24 +0100236 },
237 "initComplete":function(settings, json){
238 $('td.paradigmator a').on('mousedown', function(e) {
239 if (e.which === 2) {
240 e.preventDefault();
241 queryKorAPalternatives(paraResults[0][0].word, this.childNodes["0"].textContent);
242 return false;
243 }
244 });
245 },
246 "sScrollY": "780px",
247 "bScrollCollapse": true,
248 "bPaginate": false,
249 "bJQueryUI": true,
250 "dom": '<"top">rt<"bottom"flp><"clear">',
251 "columns": [
252 { "data": "v", render: function ( data, type, row ) {return data.toFixed(3) }},
253 { "data": "w", sClass: "paradigmator", render: function ( data, type, row ) {urlprefix.set("word", data); return '<a href="?' + urlprefix + '">' + data + '</a>' } }
254 ],
255 "columnDefs": [
256 { className: "dt-right", "targets": [0] },
257 ],
258 "oLanguage": {
259 "sSearch": "Filter: "
260 },
261 "order": [[ 0, 'desc' ]],
262 });
263 }
264 // var filterQuot = /(^quot?=[A-Z])|(quot$)/g;
265 var filterQuot = /^quot/;
266 classicCollocatorTable = $('#classicoloctable').DataTable({
267 ajax: {
268 method: "GET",
269 url: '/derekovecs/getClassicCollocators',
270 dataType: 'json',
271 dataSrc: "",
272 timeout: 30000,
273 data: { w: paraResults[0][0].rank }
Marc Kupietz78b434a2018-01-12 22:33:32 +0100274 },
Marc Kupietzad783722018-01-13 17:45:21 +0100275 "initComplete":function(settings, json){
276 $("td.collocator").click(function(){
277 queryKorAPCII(this.textContent + " /w5 " + CIIsearchWords);
278 });
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100279 classicCollocatorTable.columns(".detail").visible(false);
280 $("#ccd").css('width', '450px');
281 classicCollocatorTable.columns.adjust().draw();
Marc Kupietzad783722018-01-13 17:45:21 +0100282 },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100283 "sScrollY": "780px",
284 "bScrollCollapse": true,
285 "bPaginate": false,
286 "bJQueryUI": true,
287 "dom": '<"top">rt<"bottom"flp><"clear">',
288 "columns": [
289 // { "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 +0100290 { "data": "llr", render: function ( data, type, row ) {return data.toFixed(0) }},
Marc Kupietz7bd55232019-01-22 15:29:06 +0100291 { "data": "pmi", render: function ( data, type, row ) {return data.toFixed(2) }},
292 { "data": "md", render: function ( data, type, row ) {return data.toFixed(2) }},
293 { "data": "lfmd", render: function ( data, type, row ) {return data.toFixed(2) }},
Marc Kupietz1acb3172018-02-17 09:41:26 +0100294 // { "data": "fpmi", type: "scientific", render: function ( data, type, row ) {return data.toExponential(2) } },
Marc Kupietz7bd55232019-01-22 15:29:06 +0100295 { "data": "npmi", render: function ( data, type, row ) {return data.toFixed(3) }},
296 { "data": "dice", render: function ( data, type, row ) {return data.toExponential(2) }},
297 { "data": "ld", render: function ( data, type, row ) {return data.toFixed(2) }},
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100298 { "data": "llfmd", render: function ( data, type, row ) {return data.toFixed(1) }},
299 { "data": "rlfmd", render: function ( data, type, row ) {return data.toFixed(1) }},
300 { "data": "lnpmi", render: function ( data, type, row ) {return data.toFixed(2) }},
301 { "data": "rnpmi", render: function ( data, type, row ) {return data.toFixed(2) }},
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100302 { "data": "f" },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100303 { "data": "word", sClass: "collocator" }
304 ],
305 "columnDefs": [
Marc Kupietz7bd55232019-01-22 15:29:06 +0100306 { className: "dt-right", "targets": [0,1,2,3,4,5,6,7,8,9,10,11] },
307 { className: "dt-right detail", "targets": [5,7,8,9,10] },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100308 { "searchable": false,
309 "orderable": false,
310 "targets": []
311 },
Marc Kupietz7bd55232019-01-22 15:29:06 +0100312 { "orderSequence": [ "desc" ], "targets": [0,1,2,3,4,5,6,7,8,9,10,11] },
313 { "orderSequence": [ "asc", "desc" ], "targets": [12] },
Marc Kupietz78b434a2018-01-12 22:33:32 +0100314 ],
315 "oLanguage": {
316 "sSearch": "Filter: "
317 },
Marc Kupietz7046b8a2019-01-22 16:18:32 +0100318 "order": [[ 6, 'desc' ]],
Marc Kupietz78b434a2018-01-12 22:33:32 +0100319 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100320
Marc Kupietz1acb3172018-02-17 09:41:26 +0100321
322 $('#show-details').change(function (e) {
323 var columns = classicCollocatorTable.columns(".detail");
324 if(this.checked) {
325 columns.visible(true);
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100326 $("#ccd").css('width', 'auto');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100327 } else {
328 columns.visible(false);
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100329 $("#ccd").css('width', '450px');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100330 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100331 classicCollocatorTable.columns.adjust().draw();
Marc Kupietz1acb3172018-02-17 09:41:26 +0100332 } );
333
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100334 $("td.collocator").click(function(){
335 queryKorAPCII(this.textContent + " /w5 " + CIIsearchWords);
Marc Kupietzad783722018-01-13 17:45:21 +0100336 });
337
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100338 collocatorTable.on( 'order.dt search.dt', function () {
339 collocatorTable.column(0, {order:'applied'}).nodes().each( function (cell, i) {
340 cell.innerHTML = i+1;
341 } );
342 }).draw();
343 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100344
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100345 if (localStorage && !window.location.hash) { // let's not crash if some user has IE7
346 var index = parseInt(localStorage['tab']||'0');
347 $("#tabs").tabs({ active: index });
348 }
349 $("#tabs").css("visibility", "visible"); // now we can show the tabs
350 });
Marc Kupietz58270662017-12-04 12:10:06 +0100351
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100352 $(function(){
353 $("#dropdownoptions").dialog({
354 title: "Options",
355 autoOpen: false,
356 modal: false,
357 draggable: false,
358 height: "auto",
359 width: "auto",
360 resizable: false,
361 buttons: {
362 "Cancel": function() {
363 $( this ).dialog( "close" );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100364 },
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100365 "Apply": function() {
366 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietze6a7a732018-01-12 09:21:08 +0100367 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100368 }
369 });
370 });
371
372 $(function(){
373 $("#showoptions").click(function(){
374 $("#dropdownoptions").dialog("open");
375 var target = $(this);
376 $("#dropdownoptions").dialog("widget").position({
377 my: 'left bottom',
378 at: 'left bottom',
379 of: target
Marc Kupietz58270662017-12-04 12:10:06 +0100380 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100381 });
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100382 });
383
384 $( function() {
385 $( "#no_iterations" ).spinner({
386 spin: function( event, ui ) {
387 if ( ui.value < 1000 ) {
388 $( this ).spinner( "value", 1000 );
389 return false;
390 } else if ( ui.value > 10000 ) {
391 $( this ).spinner( "value", 10000 );
392 return false;
393 }
394 }
395 });
396 } );
397
398 $( function() {
399 $( "#neighbours" ).spinner({
400 spin: function( event, ui ) {
401 if ( ui.value < 0 ) {
402 $( this ).spinner( "value", 0 );
403 return false;
404 } else if ( ui.value > 200 ) {
405 $( this ).spinner( "value", 200 );
406 return false;
407 }
408 }
409 });
410 } );
411
412 $( function() {
413 $( "#cutoff" ).spinner({
414 spin: function( event, ui ) {
415 if ( ui.value < 100000 ) {
416 $( this ).spinner( "value", 100000 );
417 return false;
418 } else if ( ui.value > 2000000 ) {
419 $( this ).spinner( "value", 2000000 );
420 return false;
421 }
422 }
423 });
424 } );
425
426 $( function() {
427 $( "#tabs" ).tabs().addClass('tabs-min');
428 } );
429
430 $( function() {
431 $( ".controlgroup-vertical" ).controlgroup({
432 "direction": "vertical"
433 });
434 } );
435
436 $(function() {
437 $( document ).tooltip({
438 content: function() {
439 return $(this).attr('title');
440 }}
441 )
442 });
443
444 $(function () {
445 $(document).tooltip({
446 content: function () {
447 return $(this).prop('title');
448 },
449 show: null,
450 close: function (event, ui) {
451 ui.tooltip.hover(
452 function () {
453 $(this).stop(true).fadeTo(400, 1);
454 },
455 function () {
456 $(this).fadeOut("400", function () {
457 $(this).remove();
458 })
459 });
460 }
461 });
462 });
Marc Kupietz83305222016-04-28 09:57:22 +0200463 </script>
Marc Kupietz58270662017-12-04 12:10:06 +0100464 <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
465 <script src="/derekovecs/js/tsne.js"></script>
466 <script src="/derekovecs/js/som.js"></script>
467 <script src="/derekovecs/js/labeler.js"></script>
Marc Kupietzcdd51302018-03-19 16:36:54 +0100468 <script src="/derekovecs/js/derekovcs.js"></script>
Marc Kupietz83305222016-04-28 09:57:22 +0200469 <script>
470
471 var opt = {epsilon: <%= $epsilon %>, perplexity: <%= $perplexity %>},
Marc Kupietz58270662017-12-04 12:10:06 +0100472 mapWidth = 800, // width map
473 mapHeight = 800,
474 jitterRadius = 7;
Marc Kupietz83305222016-04-28 09:57:22 +0200475
476 var T = new tsnejs.tSNE(opt); // create a tSNE instance
477
478 var Y;
479
480 var data;
481 var labeler;
482
483 function applyJitter() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100484 svg.selectAll('.tsnet')
485 .data(labels)
486 .transition()
487 .duration(50)
488 .attr("transform", function(d, i) {
489 T.Y[i][0] = (d.x - mapWidth/2 - tx)/ss/20;
490 T.Y[i][1] = (d.y - mapHeight/2 - ty)/ss/20;
491 return "translate(" +
Marc Kupietz384c9132018-03-19 16:45:24 +0100492 (d.x) + "," +
493 (d.y) + ")";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100494 });
Marc Kupietz83305222016-04-28 09:57:22 +0200495 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100496
Marc Kupietz83305222016-04-28 09:57:22 +0200497 function updateEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100498 var Y = T.getSolution();
499 svg.selectAll('.tsnet')
500 .data(data.words)
501 .attr("transform", function(d, i) {
502 return "translate(" +
Marc Kupietz384c9132018-03-19 16:45:24 +0100503 ((Y[i][0]*20*ss + tx) + mapWidth/2) + "," +
504 ((Y[i][1]*20*ss + ty) + mapHeight/2) + ")"; });
Marc Kupietz83305222016-04-28 09:57:22 +0200505 }
506
507 var svg;
508 var labels = [];
509 var anchor_array = [];
510 var text;
511
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100512 function getMergedClass(i) {
513 if(data.mergedEnd && i > data.mergedEnd) {
514 return " merged"
515 } else {
516 return "";
517 }
518 }
519
520 function getRankTooltip(i) {
521 if(data.mergedEnd) {
522 if(data.ranks[i] < data.mergedEnd) {
523 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
524 } else {
525 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]-data.mergedEnd).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " (merged vocab)";
526 }
527 } else {
528 return "rank: "+i +" "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
529 }
530 }
531
Marc Kupietz83305222016-04-28 09:57:22 +0200532 function drawEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100533 var urlprefix = new URLSearchParams(window.location.search);
534 urlprefix.delete("word");
535 urlprefix.append("word","");
Marc Kupietz8f9c86a2017-12-04 17:17:13 +0100536
Marc Kupietze6a7a732018-01-12 09:21:08 +0100537 $("#embed").empty();
538 var div = d3.select("#embed");
Marc Kupietz34c08172017-11-29 17:08:47 +0100539
Marc Kupietze6a7a732018-01-12 09:21:08 +0100540 // get min and max in each column of Y
541 var Y = T.Y;
Marc Kupietz34c08172017-11-29 17:08:47 +0100542
Marc Kupietze6a7a732018-01-12 09:21:08 +0100543 svg = div.append("svg") // svg is global
544 .attr("width", mapWidth)
545 .attr("height", mapHeight);
Marc Kupietz34c08172017-11-29 17:08:47 +0100546
Marc Kupietze6a7a732018-01-12 09:21:08 +0100547 var g = svg.selectAll(".b")
548 .data(data.words)
549 .enter().append("g")
550 .attr("class", "tsnet");
Marc Kupietz34c08172017-11-29 17:08:47 +0100551
Marc Kupietze6a7a732018-01-12 09:21:08 +0100552 g.append("a")
553 .attr("xlink:href", function(word) {
554 return "?"+urlprefix+word; })
555 .attr("class", function(d, i) {
556 var res="";
557 if(data.marked[i]) {
558 res="marked ";
559 }
560 if(data.target.indexOf(" "+d+" ") >= 0) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100561 res += "target";
562 }
563 if(data.mergedEnd && data.ranks[i] >= data.mergedEnd) {
564 return res+" merged";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100565 } else {
566 return res;
567 }
568 })
569 .attr("title", function(d, i) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100570 return getRankTooltip(i);
Marc Kupietze6a7a732018-01-12 09:21:08 +0100571 })
572 .append("text")
573 .attr("text-anchor", "top")
574 .attr("font-size", 12)
575 .text(function(d) { return d; });
Marc Kupietz34c08172017-11-29 17:08:47 +0100576
Marc Kupietz384c9132018-03-19 16:45:24 +0100577 g.append("svg:title")
578 .text(function(d, i) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100579 return getRankTooltip(i);
Marc Kupietz384c9132018-03-19 16:45:24 +0100580 });
581
Marc Kupietze6a7a732018-01-12 09:21:08 +0100582 var zoomListener = d3.behavior.zoom()
583 .scaleExtent([0.1, 10])
584 .center([0,0])
585 .on("zoom", zoomHandler);
586 zoomListener(svg);
Marc Kupietz83305222016-04-28 09:57:22 +0200587 }
588
589 var tx=0, ty=0;
590 var ss=1;
591 var iter_id=-1;
592
593 function zoomHandler() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100594 tx = d3.event.translate[0];
595 ty = d3.event.translate[1];
596 ss = d3.event.scale;
597 updateEmbedding();
Marc Kupietz83305222016-04-28 09:57:22 +0200598 }
599
600 var stepnum = 0;
601
602 function stopStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100603 clearInterval(iter_id);
604 text = svg.selectAll("text");
Marc Kupietz34c08172017-11-29 17:08:47 +0100605
Marc Kupietze6a7a732018-01-12 09:21:08 +0100606 // jitter function needs different data and co-ordinate representation
607 labels = d3.range(data.words.length).map(function(i) {
608 var x = (T.Y[i][0]*20*ss + tx) + mapWidth/2;
609 var y = (T.Y[i][1]*20*ss + ty) + mapHeight/2;
610 anchor_array.push({x: x, y: y, r: jitterRadius});
611 return {
612 x: x,
613 y: y,
614 name: data.words[i]
615 };
616 });
Marc Kupietz34c08172017-11-29 17:08:47 +0100617
Marc Kupietze6a7a732018-01-12 09:21:08 +0100618 // get the actual label bounding boxes for the jitter function
619 var index = 0;
620 text.each(function() {
621 labels[index].width = this.getBBox().width;
622 labels[index].height = this.getBBox().height;
623 index += 1;
624 });
Marc Kupietz83305222016-04-28 09:57:22 +0200625
Marc Kupietz34c08172017-11-29 17:08:47 +0100626
Marc Kupietze6a7a732018-01-12 09:21:08 +0100627 // setTimeout(updateEmbedding, 1);
628 // setTimeout(
629 labeler = d3.labeler()
630 .label(labels)
631 .anchor(anchor_array)
632 .width(mapWidth)
633 .height(mapHeight)
634 .update(applyJitter);
635 // .start(1000);
Marc Kupietz83305222016-04-28 09:57:22 +0200636
Marc Kupietze6a7a732018-01-12 09:21:08 +0100637 iter_id = setInterval(jitterStep, 1);
Marc Kupietz83305222016-04-28 09:57:22 +0200638 }
639
640 var jitter_i=0;
641
642 function jitterStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100643 if(jitter_i++ > 100) {
644 clearInterval(iter_id);
645 } else {
646 labeler.start2(10);
647 applyJitter();
648 }
Marc Kupietz83305222016-04-28 09:57:22 +0200649 }
650
651 var last_cost=1000;
652
653 function step() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100654 var i = T.iter;
Marc Kupietz34c08172017-11-29 17:08:47 +0100655
Marc Kupietze6a7a732018-01-12 09:21:08 +0100656 if(i > <%= $no_iterations %>) {
657 stopStep();
658 } else {
659 var cost = Math.round(T.step() * 100000) / 100000; // do a few steps
660 $("#cost").html("tsne iteration " + i + ", cost: " + cost.toFixed(5));
661 if(i % 250 == 0 && cost >= last_cost) {
662 stopStep();
Marc Kupietz58270662017-12-04 12:10:06 +0100663 } else {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100664 last_cost = cost;
665 updateEmbedding();
Marc Kupietz58270662017-12-04 12:10:06 +0100666 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100667 }
Marc Kupietz83305222016-04-28 09:57:22 +0200668 }
669
670 function showMap(j) {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100671 data=j;
672 T.iter=0;
673 iter_id = -1;
674 last_cost=1000;
675 T.initDataRaw(data.vecs); // init embedding
676 drawEmbedding(); // draw initial embedding
Marc Kupietz78114532017-11-29 17:00:16 +0100677
Marc Kupietze6a7a732018-01-12 09:21:08 +0100678 if(iter_id >= 0) {
679 clearInterval(iter_id);
680 }
681 //T.debugGrad();
682 iter_id = setInterval(step, 1);
683 if(true) { // (<%= $show_som %>) {
684 makeSOM(j, <%= $no_iterations %>);
685 }
Marc Kupietz83305222016-04-28 09:57:22 +0200686 }
Marc Kupietz39179ab2017-07-04 16:28:06 +0200687 var queryword;
688
Marc Kupietz66bfd952017-12-11 09:59:45 +0100689 function showCollocatorSOM() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100690 if (collocatorTable) {
691 var ctableData = collocatorTable.rows().data();
692 var nwords = [],
693 nranks = [];
694 for (var i=0; i < ctableData.length && i < 100; i++) {
695 nranks.push(ctableData[i].rank);
696 nwords.push(ctableData[i].word);
Marc Kupietz66bfd952017-12-11 09:59:45 +0100697 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100698 $.post('/derekovecs/getVecsByRanks',
699 JSON.stringify(nranks),
700 function(data, status){
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100701 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 +0100702 }, 'json');
703 }
Marc Kupietz66bfd952017-12-11 09:59:45 +0100704 }
705
Marc Kupietz39179ab2017-07-04 16:28:06 +0200706 function onload() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100707 queryword = document.getElementById('word');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200708 }
709
710 function queryKorAP() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100711 window.open('http://korap.ids-mannheim.de/kalamar/?q='+queryword.value, 'KorAP');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200712 }
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100713
714 function queryKorAPCII(query) {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100715 window.open('http://korap.ids-mannheim.de/kalamar/?ql=cosmas2&q='+query, 'KorAP');
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100716 }
Marc Kupietz83305222016-04-28 09:57:22 +0200717 </script>
718 </head>
Marc Kupietz39179ab2017-07-04 16:28:06 +0200719 <body onload="onload()">
Marc Kupietz7bd55232019-01-22 15:29:06 +0100720 <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>
721 <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>
722 <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 +0100723 <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 +0100724 <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>
725<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 +0100726 <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 +0100727 <div id="header">
728 <div id="pagetitle">
Marc Kupietzc053d972019-01-10 10:41:51 +0100729 <h1>DeReKoVecs</h1>
730 <h2><%== $title %></h2>
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100731 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100732 <div id="options" class="widget">
733 <form id="queryform">
734 <input id="word" type="text" name="word" placeholder="Word(s) to be searched" value="<%= $word %>"
735 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."/>
736 <input id="SEARCH" type="button" value="SEARCH">
737 <input type="button" id="showoptions" name="showoptions" value="Options" />
738 </form>
739 <div id="dropdownoptions" style="display: none">
740 <form id="optionsform">
741 <div class="controlgroup-vertical">
742 <label for="cutoff">cut-off</label>
743 <input id="cutoff" type="text" name="cutoff" size="10" value="<%= $cutoff %>" title="Only consider the most frequent x word forms.">
744 <label for="dedupe">dedupe</label>
745 <input id="dedupe" type="checkbox" name="dedupe" value="1" <%= ($dedupe ? "checked" : "") %> title="radically filter out any near-duplicates">
746 % if($mergedEnd > 0) {
747 <label for="sbf">backw.</label>
748 <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.">
749 % }
750 <label for="neighbours">max. neighbours:</label>
751 <input id="neighbours" size="4" name="n" value="<%= $no_nbs %>">
752 <label for="no_iterations">max. iterations</label>
753 <input id="no_iterations" name="N" size="4" value="<%= $no_iterations %>">
754 <!-- <label for="dosom">SOM</label>
755 <input id="dosom" type="checkbox" name="som" value="1" <%= ($show_som ? "checked" : "") %>> -->
756 % if($collocators) {
757 <label for="sortby">window/sort</label>
758 <select id="sortby" name="sort">
759 <option value="0" <%= ($sort!=1 && $sort!=2? "selected":"") %>>auto focus</option>
760 <!-- <option value="1" <%= ($sort==1? "selected":"") %>>any single position</option>
761 <option value="2" <%= ($sort==2? "selected":"") %>>whole window</option> -->
762 </select>
763 % }
764 <input type="button" value="→ KorAP" onclick="queryKorAP();" title="query word with KorAP"/>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100765 <input id="show-details" type="checkbox" name="show-details" value="1" >
766 <label for="show-details">
767 Show details
768 </label>
Marc Kupietz58270662017-12-04 12:10:06 +0100769 </div>
770 </form>
771 </div>
772 </div>
773 </div>
774 <div id="topwrapper">
775 <div style="visibility: hidden;" id="tabs">
776 <ul>
777 <li><a href="#tabs-1">Semantics (TSNE-map)</a></li>
778 <li><a href="#tabs-2">Semantics (SOM)</a></li>
Marc Kupietzbb3da6a2019-01-22 15:21:38 +0100779 <li><a href="#tabs-3">Syntagmatic (collocates)</a></li>
Marc Kupietz58270662017-12-04 12:10:06 +0100780 </ul>
Marc Kupietz384c9132018-03-19 16:45:24 +0100781 <div id="tabs-1" style="display: flex; padding: 5px; flex-flow: row wrap;">
Marc Kupietz58270662017-12-04 12:10:06 +0100782 % if($lists && (@$lists) > 0 && (@$lists)[0]) {
783 <div id="wrapper">
Marc Kupietz384c9132018-03-19 16:45:24 +0100784 <div id="first" style="width: 230px; margin-bottom: 15px;">
Marc Kupietz58270662017-12-04 12:10:06 +0100785 <table class="display compact nowrap" id="firsttable">
786 <thead>
787 <tr>
Marc Kupietz384c9132018-03-19 16:45:24 +0100788 <th align="right">#</th><th align="right">cos</th><th align="left">similars by w2v</th>
Marc Kupietz58270662017-12-04 12:10:06 +0100789 </tr>
790 </thead>
791 <tbody>
792 <tr>
793 <td align="right">
794 </td>
795 <td align="right">
796 </td>
797 <td></td>
798 </tr>
799 </tbody>
800 </table>
801 </div>
Marc Kupietza55a09a2018-07-06 13:30:30 +0200802 % if(0 && $haveSProfiles) {
Marc Kupietz384c9132018-03-19 16:45:24 +0100803 <div id="sprofilesdiv" style="width: 200px; padding-right: 10px;">
804 <table class="display compact nowrap" id="sprofiles">
805 <thead>
806 <tr>
807 <th align="right">cos</th><th align="left">similars by coll. profile</th>
808 </tr>
809 </thead>
810 <tbody>
811 <tr>
812 <td align="right">
813 </td>
814 <td></td>
815 </tr>
816 </tbody>
817 </table>
818 </div>
819 %}
820 <div id="second">
Marc Kupietz58270662017-12-04 12:10:06 +0100821 <div id="embed">
822 </div>
823 <div id="cost">
824 </div>
825 </div>
826 </div>
Marc Kupietz384c9132018-03-19 16:45:24 +0100827 % } elsif($word !~ /^\s*$/) {
828 <div id="wrapper">
829 <div id="not-found-dialog" title="Not found">
830 <p>ERROR: "<%= $word %>" not found in vocabluary.</p>
831 <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>
832 </div>
833 <script>
834 $( function() {
835 $( "#not-found-dialog" ).dialog({
836 autoOpen: true,
837 modal: true,
838 draggable: false,
839 height: "auto",
840 width: "auto",
841 resizable: false,
842 buttons: {
843 "OK": function() {
844 $( this ).dialog( "close" );
845 },
846 "Apply": function() {
847 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
848 }
849 }
850 });
851 });
852 </script>
853 </div>
854 % }
Marc Kupietz58270662017-12-04 12:10:06 +0100855 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100856 <div id="tabs-2" style="display: flex; padding: 5px; flex-flow: row wrap;">
Marc Kupietz66bfd952017-12-11 09:59:45 +0100857 <div id="som2" style="width: 800;">
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100858 <div id="sominfo1"><span id="somcolor1"> </span> <span id="somword1"> </span> <span id="somcolor2"> </span> <span id="somword2"> </span> <span id="somcolor3"> </span></div>
859 <div id="sominfo" style="text-align: right">SOM iteration <span id="iterations">0</span></div>
Marc Kupietz58270662017-12-04 12:10:06 +0100860 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100861 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100862 <div id="tabs-3" style="display: flex; padding:5px; flex-flow: row wrap;">
863 <div style="margin-right: 20px; margin-bottom: 10px;" id="secondt">
Marc Kupietze6a7a732018-01-12 09:21:08 +0100864 <table class="display compact nowrap" id="secondtable">
Marc Kupietz58270662017-12-04 12:10:06 +0100865 <thead>
866 <tr>
867 % if($collocators) {
868 <th>#</th>
Marc Kupietz4116b432017-12-06 14:15:32 +0100869 <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>
870 <th align="right" title="Maximum activation of the collocator anywhere in the output layer.">max(a)</th>
871 <th title="Average raw activation of the collocator in the columns selected by auto-focus." align="right">⟨a⟩</th>
872 <th title="Sum of activations over the selected colunns normalized by the total activation sum of the selected columns." align="right">Σa/Σw'</th>
873 <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 +0100874 <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 +0100875 <th align="left">collocate (by w2v)</th>
Marc Kupietz58270662017-12-04 12:10:06 +0100876 % }
877 </tr>
878 </thead>
879 <tbody>
880 <tr>
881 <td align="right">
882 </td>
883 <td align="right">
884 </td>
885 <td align="right">
886 </td>
887 <td align="right">
888 </td>
889 <td align="right">
890 </td>
891 <td align="right">
892 </td>
Marc Kupietz58270662017-12-04 12:10:06 +0100893 </tr>
894 </tbody>
895 </table>
Marc Kupietz66bfd952017-12-11 09:59:45 +0100896 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100897 <div id="ccd" style="">
Marc Kupietze6a7a732018-01-12 09:21:08 +0100898 <table class="display compact nowrap" id="classicoloctable">
899 <thead>
Marc Kupietzcd136e22018-01-29 09:18:12 +0100900 % if($collocators) {
901 <tr>
Marc Kupietzcd136e22018-01-29 09:18:12 +0100902 <th id="npmi_tt">nPMI</th>
Marc Kupietzf19814b2019-01-21 16:50:19 +0100903 <th id="ll_tt">LL</th>
904 <th id="lfmd_tt">MI³</th>
Marc Kupietz5a7f9ac2018-01-30 11:22:44 +0100905 <th title="PMI³ restricted to left neighbour">l-PMI³</th>
906 <th title="PMI³ restricted to right neighbour">r-PMI³</th>
907 <th title="nPMI restricted to left neighbour">l-nPMI</th>
908 <th title="nPMI restricted to right neighbour">r-nPMI</th>
Marc Kupietzbb3da6a2019-01-22 15:21:38 +0100909 <th title="raw frequency sum of collocation within window">raw</th>
910 <th>collocate (by CA)</th>
Marc Kupietzcd136e22018-01-29 09:18:12 +0100911 </tr>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100912 % }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100913 </thead>
914 <tbody>
915 <tr>
916 <td align="right">
917 </td>
918 <td align="right">
919 </td>
920 <td align="right">
921 </td>
922 <td align="right">
923 </td>
Marc Kupietzcfcdcfc2018-01-24 09:51:26 +0100924 <td align="right">
925 </td>
926 <td align="right">
927 </td>
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100928 <td align="right"></td>
929 <td align="right"></td>
930 <td align="left"></td>
Marc Kupietze6a7a732018-01-12 09:21:08 +0100931 </tr>
932 </tbody>
933 </table>
934 </div>
Marc Kupietz384c9132018-03-19 16:45:24 +0100935 <!--
936 <div style="clear:both" ></div>
937 <div style="float: right; overflow: hidden" id="extra"><button onClick="showCollocatorSOM()"> </button></div>
938 -->
Marc Kupietz66bfd952017-12-11 09:59:45 +0100939 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100940 </div>
941 </div> <!-- topwrapper -->
942 <div style="clear: both;"></div>
943 </div>
Marc Kupietzebea4702018-01-12 09:16:09 +0100944 % if($training_args && (@$lists)[0]) {
945 <div class="info">
946 % if($training_args =~ /-type\s*3/) {
947 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 %>
948 % } else {
949 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 %>
950 % }
951 </div>
Marc Kupietz83305222016-04-28 09:57:22 +0200952 % }
Marc Kupietz58270662017-12-04 12:10:06 +0100953 </body>
Marc Kupietz83305222016-04-28 09:57:22 +0200954</html>