blob: a9575f310ae1f669cc32a56be100b4f947ed1549 [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; %>
Marc Kupietz86b50292019-02-17 21:03:59 +01005 <title><%= $plain_title %>:<%= $word %> · IDS word vector analysis</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 Kupietz86b50292019-02-17 21:03:59 +010032 var plainTitle ="<%= $plain_title %>"
Marc Kupietz78d7c1a2019-02-17 22:31:22 +010033 var korapPath="/";
34 if (plainTitle.match(/-en/)) {
35 korapPath="/instance/english";
36 }
Marc Kupietz78230872019-08-02 15:15:25 +020037 var korapVC="";
38 if (plainTitle.match(/WUDD/i)) {
39 korapVC="&collection=corpusSigle+%3D+%2FW%5BDU%5DD17%2F";
40 korapPath="/instance/test";
41 }
42
Marc Kupietz58270662017-12-04 12:10:06 +010043 $(document).ready(function() {
Marc Kupietz694610d2017-11-25 18:30:03 +010044
Marc Kupietza0ffb392018-01-25 08:53:43 +010045 $('#firstable').hide();
46 //Set up a callback to hear back when MathJax is done rendering the equations
47 // it finds
48 $('#ccd').load(
49 '@Url.Action("ActionResultMethod","ControllerName",{controller parameters})',
50 function () {
51 MathJax.Hub.Queue(
52 ["Typeset",MathJax.Hub,"ccd"],
Marc Kupietz95977002019-02-26 09:09:59 +010053 function () {
Marc Kupietz7bd55232019-01-22 15:29:06 +010054 $("#mi_tt").attr("title",$("#pmi_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010055 $("#lfmd_tt").attr("title",$("#lfmd_ttt").html());
Marc Kupietz7bd55232019-01-22 15:29:06 +010056 $("#md_tt").attr("title",$("#md_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010057 $("#npmi_tt").attr("title",$("#npmi_ttt").html());
Marc Kupietzf19814b2019-01-21 16:50:19 +010058 $("#ll_tt").attr("title",$("#ll_ttt").html());
Marc Kupietz7bd55232019-01-22 15:29:06 +010059 $("#logdice_tt").attr("title",$("#logdice_ttt").html());
Marc Kupietz63b268f2019-01-22 22:34:29 +010060 $("#logdiceaf_tt").attr("title",$("#logdiceaf_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010061 }
62 );
63 });
64
65 //set things up so that we can shove raw html into what is shown in the tooltip;
66 // in this case, we will have already put into the title attribute the html that
67 // contains the MathJax rendered equations (via what we do in the callback).
68 $(function () {
69 $(document).tooltip({
70 content: function () {
71 return $(this).prop('title');
72 }
73 });
74 });
75
Marc Kupietze6a7a732018-01-12 09:21:08 +010076 $("input").bind("keydown", function(event) {
77 // track enter key
78 var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
79 if (keycode == 13) { // keycode for enter key
80 // force the 'Enter Key' to implicitly click the Update button
81 document.getElementById('SEARCH').click();
82 return false;
83 } else {
84 return true;
85 }});
Marc Kupietzdab9f222017-11-29 14:22:59 +010086
Marc Kupietze871abd2018-01-25 16:18:27 +010087 var collocatorTable_activated = false;
Marc Kupietze6a7a732018-01-12 09:21:08 +010088 $( "#tabs" ).on( "tabsactivate", function( event, ui ) {
89 if (localStorage) localStorage['tab'] = ui.newTab.index();
Marc Kupietzd7760b42019-02-21 09:01:44 +010090 if(ui.newTab.index() == 3 && !collocatorTable_activated) {
Marc Kupietze871abd2018-01-25 16:18:27 +010091 classicCollocatorTable.columns.adjust();
92 collocatorTable.columns.adjust();
93 collocatorTable_activated = true;
94 }
Marc Kupietze6a7a732018-01-12 09:21:08 +010095 });
96
97 $(function(){
98 $("#SEARCH").click(function() {
99 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietz58270662017-12-04 12:10:06 +0100100 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100101 });
Marc Kupietz0af83e32017-11-27 09:31:37 +0100102
Marc Kupietze6a7a732018-01-12 09:21:08 +0100103 function changeCharColor(txt, heat, word) {
104 var newText = "";
105 for (var i=0, l=txt.length; i<l; i++) {
Marc Kupietz86b50292019-02-17 21:03:59 +0100106 newText += (i == 5 ? txt.charAt(i) : '<a href="http://korap.ids-mannheim.de' + korapPath + '/?ql=cosmas2&q=' +
Marc Kupietze6a7a732018-01-12 09:21:08 +0100107 CIIsearchWords + ' /' + (i > 5? '%2B' : '-') + 'w' +
Marc Kupietz78230872019-08-02 15:15:25 +0200108 Math.abs(i-5) + ':' + Math.abs(i-5) + ' ' + word + korapVC +
Marc Kupietze6a7a732018-01-12 09:21:08 +0100109 '" target="korap"><span style="background-color:' +
110 getHeatColor(heat[i]/maxHeat)+'">'+txt.charAt(i)+'</span></a>');
Marc Kupietzb6c615d2017-12-02 10:38:20 +0100111 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100112 return newText;
113 }
Marc Kupietzb6c615d2017-12-02 10:38:20 +0100114
Marc Kupietze6a7a732018-01-12 09:21:08 +0100115 function getHeatColor(value) {
116 var hue=((1-value)*120).toString(10);
117 return ["hsl(",hue,",90%,70%)"].join("");
118 }
119
120 function bitvec2window(n, heat, word) {
121 var str = n.toString(2).padStart(10, "0")
122 .replace(/^([0-9]{5})/, '$1x')
123 .replace(/0/g, '·')
124 .replace(/1/g, '+');
125 return changeCharColor(str, heat, word);
126 }
127
128 % use Mojo::ByteStream 'b';
129 var paraResults = <%= b(Mojo::JSON::to_json($lists)) %>;
130 var urlprefix = new URLSearchParams(window.location.search);
131 if (paraResults.length > 0 && paraResults[0] != null) {
132 var nvecs = [],
133 nwords = [],
134 nranks = [],
135 nmarked = [];
136 for(var i = 0; i < paraResults.length; i++) {
137 nwords = nwords.concat(paraResults[i].map(function(a){return a.word;}));
138 nvecs = nvecs.concat(paraResults[i].map(function(a){return a.vector;}));
139 nranks = nranks.concat(paraResults[i].map(function(a){return a.rank;}));
140 nmarked = nmarked.concat(paraResults[i].map(function(a){return a.marked;}));
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100141 }
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100142 showMap({target: " "+urlParams.get('word')+" ", mergedEnd: <%= $mergedEnd %>, words: nwords, vecs: nvecs, ranks: nranks, marked: nmarked} );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100143 var t = $('#firsttable').DataTable({
Marc Kupietzee894d52019-01-09 14:55:14 +0100144 data: [].concat.apply([], paraResults),
Marc Kupietze6a7a732018-01-12 09:21:08 +0100145 "sScrollY": "780px",
146 "bScrollCollapse": true,
147 "bPaginate": false,
148 "bJQueryUI": true,
149 "dom": '<"top">rt<"bottom"flp><"clear">',
Marc Kupietz384c9132018-03-19 16:45:24 +0100150 "initComplete":function(settings, json) {
151 $('td.paradigmator a').on('mousedown', function(e) {
Marc Kupietz86b50292019-02-17 21:03:59 +0100152 return paradigmatorClick(e, paraResults[0][0].word, this.childNodes["0"].textContent);
Marc Kupietz384c9132018-03-19 16:45:24 +0100153 });
154 },
Marc Kupietze6a7a732018-01-12 09:21:08 +0100155 "columns": [
156 { "data": "rank", type: "allnumeric" },
157 { "data": "dist", render: function ( data, type, row ) {return data.toFixed(3) }},
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100158 { "data": "word", class: "paradigmator", render: function ( data, type, row ) {
159 urlprefix.set("word", data); return '<a class="' + getMergedClass(row.rank) + '" href="?' + urlprefix + '">' + data + '</a>'
160 }}
Marc Kupietze6a7a732018-01-12 09:21:08 +0100161 ],
162 "columnDefs": [
163 { className: "dt-right", "targets": [0,1] },
164 { "searchable": false,
165 "orderable": false,
166 "targets": 0
167 },
168 { "orderSequence": [ "desc" ], "targets": [ 1 ] },
169 { "orderSequence": [ "asc", "desc" ], "targets": [ 2 ] },
170 ],
171 "oLanguage": {
172 "sSearch": "Filter: "
173 },
174 "order": [[ 1, 'desc' ]],
175 } );
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100176
Marc Kupietze6a7a732018-01-12 09:21:08 +0100177 t.on( 'order.dt search.dt', function () {
178 t.column(0, {order:'applied'}).nodes().each( function (cell, i) {
179 cell.innerHTML = i+1;
180 } );
181 } ).draw();
182
183 $( "#first" ).clone().prependTo( "#tabs-2" );
184
185 }
186
187
188 var collocatorData = <%= b(Mojo::JSON::to_json($collocators)) %>;
189 var maxHeat; // = Math.max.apply(Math,collocatorData.map(function(o){return o.cprob;}))
190
Marc Kupietzcddc8482019-12-04 08:57:33 +0100191 if(typeof data !== 'undefined' && data.mergedEnd > 0) {
Marc Kupietz78230872019-08-02 15:15:25 +0200192 vocabDistanceTable = makeVocabDistanceTable("#vocabdistt", baseURL);
193 }
Marc Kupietzd7760b42019-02-21 09:01:44 +0100194
Marc Kupietze6a7a732018-01-12 09:21:08 +0100195 if (collocatorData != null) {
196 maxHeat = Math.max.apply(Math,collocatorData.map(function(o){return Math.max.apply(Math,o.heat);}))
197 collocatorTable = $('#secondtable').DataTable({
198 data: collocatorData,
199 "sScrollY": "780px",
200 "bScrollCollapse": true,
201 "bPaginate": false,
202 "bJQueryUI": true,
203 "dom": '<"top">rt<"bottom"flp><"clear">',
204 "columns": [
205 { "data": "rank", type: "allnumeric" },
206 { "data": "pos", width: "7%", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitvec2window(data, row.heat, row.word) }},
207 { "data": "max", render: function ( data, type, row ) {return data.toFixed(3) }},
208 { "data": "average", render: function ( data, type, row ) {return data.toFixed(3) }},
209 { "data": "prob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
210 { "data": "cprob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
211 { "data": "overall", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
212 { "data": "word", sClass: "collocator" },
213 { "data": "rank", type: "allnumeric" }
214 ],
215 "columnDefs": [
216 { className: "dt-right", "targets": [0,2,3,4,5,6] },
217 { className: "dt-center", "targets": [ 1] },
218 { "searchable": false,
219 "orderable": false,
220 "targets": [0, 8]
221 },
222 { "type": "scientific", targets: [2,3,4,5,6] },
223 { "orderSequence": [ "desc" ], "targets": [ 2, 3, 4, 5, 6 ] },
224 { "orderSequence": [ "asc", "desc" ], "targets": [ 1, 7 ] },
225 { "targets": [8], "visible": false }
226 ],
227 "oLanguage": {
228 "sSearch": "Filter: "
229 },
230 "order": [[ 4, 'desc' ]],
231 } );
232 $.ajaxSetup({
233 type: 'POST',
234 timeout: 30000,
235 error: function(xhr) {
236 $('#display_error')
237 .html('Error: ' + xhr.status + ' ' + xhr.statusText);
238 }
Marc Kupietz78b434a2018-01-12 22:33:32 +0100239 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100240
Marc Kupietz384c9132018-03-19 16:45:24 +0100241
242 if($('#sprofiles').length) {
243 similarProfileTable = $('#sprofiles').DataTable({
244 ajax: {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100245 method: "GET",
Marc Kupietz384c9132018-03-19 16:45:24 +0100246 url: '/derekovecs/getSimilarProfiles',
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100247 dataType: 'json',
248 dataSrc: "",
249 timeout: 30000,
250 data: { w: paraResults[0][0].rank }
Marc Kupietz384c9132018-03-19 16:45:24 +0100251 },
252 "initComplete":function(settings, json){
253 $('td.paradigmator a').on('mousedown', function(e) {
254 if (e.which === 2) {
255 e.preventDefault();
256 queryKorAPalternatives(paraResults[0][0].word, this.childNodes["0"].textContent);
257 return false;
258 }
259 });
260 },
261 "sScrollY": "780px",
262 "bScrollCollapse": true,
263 "bPaginate": false,
264 "bJQueryUI": true,
265 "dom": '<"top">rt<"bottom"flp><"clear">',
266 "columns": [
267 { "data": "v", render: function ( data, type, row ) {return data.toFixed(3) }},
268 { "data": "w", sClass: "paradigmator", render: function ( data, type, row ) {urlprefix.set("word", data); return '<a href="?' + urlprefix + '">' + data + '</a>' } }
269 ],
270 "columnDefs": [
271 { className: "dt-right", "targets": [0] },
272 ],
273 "oLanguage": {
274 "sSearch": "Filter: "
275 },
276 "order": [[ 0, 'desc' ]],
277 });
278 }
Marc Kupietzd7760b42019-02-21 09:01:44 +0100279
Marc Kupietz384c9132018-03-19 16:45:24 +0100280 // var filterQuot = /(^quot?=[A-Z])|(quot$)/g;
281 var filterQuot = /^quot/;
Marc Kupietz4784fae2019-02-04 12:32:12 +0100282 var ccResult;
Marc Kupietz86b50292019-02-17 21:03:59 +0100283 var baseURL = window.location.pathname.replace(/[/]$/, '')
Marc Kupietz95977002019-02-26 09:09:59 +0100284 classicCollocatorTable = makeClassicCollocatorTable('#classicoloctable', baseURL, paraResults[0][0].rank)
Marc Kupietze6a7a732018-01-12 09:21:08 +0100285
Marc Kupietz1acb3172018-02-17 09:41:26 +0100286 $('#show-details').change(function (e) {
287 var columns = classicCollocatorTable.columns(".detail");
288 if(this.checked) {
289 columns.visible(true);
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100290 $("#ccd").css('width', 'auto');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100291 } else {
292 columns.visible(false);
Marc Kupietz08bfd402019-01-23 10:05:17 +0100293 $("#ccd").css('width', '680px');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100294 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100295 classicCollocatorTable.columns.adjust().draw();
Marc Kupietz1acb3172018-02-17 09:41:26 +0100296 } );
297
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100298 $("td.collocator").click(function(){
299 queryKorAPCII(this.textContent + " /w5 " + CIIsearchWords);
Marc Kupietzad783722018-01-13 17:45:21 +0100300 });
301
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100302 collocatorTable.on( 'order.dt search.dt', function () {
303 collocatorTable.column(0, {order:'applied'}).nodes().each( function (cell, i) {
304 cell.innerHTML = i+1;
305 } );
306 }).draw();
307 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100308
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100309 if (localStorage && !window.location.hash) { // let's not crash if some user has IE7
310 var index = parseInt(localStorage['tab']||'0');
311 $("#tabs").tabs({ active: index });
312 }
313 $("#tabs").css("visibility", "visible"); // now we can show the tabs
314 });
Marc Kupietz58270662017-12-04 12:10:06 +0100315
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100316 $(function(){
317 $("#dropdownoptions").dialog({
Marc Kupietz95104512019-12-05 10:13:05 +0100318 title: "<%= loc 'Options' %>",
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100319 autoOpen: false,
320 modal: false,
321 draggable: false,
322 height: "auto",
323 width: "auto",
324 resizable: false,
325 buttons: {
Marc Kupietz95104512019-12-05 10:13:05 +0100326 "<%= loc 'Cancel'%>": function() {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100327 $( this ).dialog( "close" );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100328 },
Marc Kupietz95104512019-12-05 10:13:05 +0100329 "<%= loc 'Apply' %>": function() {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100330 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietze6a7a732018-01-12 09:21:08 +0100331 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100332 }
333 });
334 });
335
336 $(function(){
337 $("#showoptions").click(function(){
338 $("#dropdownoptions").dialog("open");
339 var target = $(this);
340 $("#dropdownoptions").dialog("widget").position({
341 my: 'left bottom',
342 at: 'left bottom',
343 of: target
Marc Kupietz58270662017-12-04 12:10:06 +0100344 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100345 });
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100346 });
347
348 $( function() {
349 $( "#no_iterations" ).spinner({
350 spin: function( event, ui ) {
351 if ( ui.value < 1000 ) {
352 $( this ).spinner( "value", 1000 );
353 return false;
354 } else if ( ui.value > 10000 ) {
355 $( this ).spinner( "value", 10000 );
356 return false;
357 }
358 }
359 });
360 } );
361
362 $( function() {
363 $( "#neighbours" ).spinner({
364 spin: function( event, ui ) {
365 if ( ui.value < 0 ) {
366 $( this ).spinner( "value", 0 );
367 return false;
368 } else if ( ui.value > 200 ) {
369 $( this ).spinner( "value", 200 );
370 return false;
371 }
372 }
373 });
374 } );
375
376 $( function() {
377 $( "#cutoff" ).spinner({
378 spin: function( event, ui ) {
379 if ( ui.value < 100000 ) {
380 $( this ).spinner( "value", 100000 );
381 return false;
382 } else if ( ui.value > 2000000 ) {
383 $( this ).spinner( "value", 2000000 );
384 return false;
385 }
386 }
387 });
388 } );
389
390 $( function() {
391 $( "#tabs" ).tabs().addClass('tabs-min');
392 } );
393
394 $( function() {
395 $( ".controlgroup-vertical" ).controlgroup({
396 "direction": "vertical"
397 });
398 } );
399
400 $(function() {
401 $( document ).tooltip({
402 content: function() {
403 return $(this).attr('title');
404 }}
405 )
406 });
407
408 $(function () {
409 $(document).tooltip({
410 content: function () {
411 return $(this).prop('title');
412 },
413 show: null,
414 close: function (event, ui) {
415 ui.tooltip.hover(
416 function () {
417 $(this).stop(true).fadeTo(400, 1);
418 },
419 function () {
420 $(this).fadeOut("400", function () {
421 $(this).remove();
422 })
423 });
424 }
425 });
426 });
Marc Kupietz83305222016-04-28 09:57:22 +0200427 </script>
Marc Kupietz58270662017-12-04 12:10:06 +0100428 <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
429 <script src="/derekovecs/js/tsne.js"></script>
430 <script src="/derekovecs/js/som.js"></script>
431 <script src="/derekovecs/js/labeler.js"></script>
Marc K20476c72021-03-11 12:18:01 +0100432 <script src="/derekovecs/js/derekovecs.js"></script>
Marc Kupietz83305222016-04-28 09:57:22 +0200433 <script>
434
435 var opt = {epsilon: <%= $epsilon %>, perplexity: <%= $perplexity %>},
Marc Kupietz58270662017-12-04 12:10:06 +0100436 mapWidth = 800, // width map
437 mapHeight = 800,
438 jitterRadius = 7;
Marc Kupietz83305222016-04-28 09:57:22 +0200439
440 var T = new tsnejs.tSNE(opt); // create a tSNE instance
441
442 var Y;
443
444 var data;
445 var labeler;
446
447 function applyJitter() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100448 svg.selectAll('.tsnet')
449 .data(labels)
450 .transition()
451 .duration(50)
452 .attr("transform", function(d, i) {
453 T.Y[i][0] = (d.x - mapWidth/2 - tx)/ss/20;
454 T.Y[i][1] = (d.y - mapHeight/2 - ty)/ss/20;
455 return "translate(" +
Marc Kupietz78230872019-08-02 15:15:25 +0200456 (d.x) + "," +
457 (d.y) + ")";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100458 });
Marc Kupietz83305222016-04-28 09:57:22 +0200459 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100460
Marc Kupietz83305222016-04-28 09:57:22 +0200461 function updateEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100462 var Y = T.getSolution();
463 svg.selectAll('.tsnet')
464 .data(data.words)
465 .attr("transform", function(d, i) {
466 return "translate(" +
Marc Kupietz78230872019-08-02 15:15:25 +0200467 ((Y[i][0]*20*ss + tx) + mapWidth/2) + "," +
468 ((Y[i][1]*20*ss + ty) + mapHeight/2) + ")"; });
Marc Kupietz83305222016-04-28 09:57:22 +0200469 }
470
471 var svg;
472 var labels = [];
473 var anchor_array = [];
474 var text;
475
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100476 function getMergedClass(i) {
Marc Kupietzd7760b42019-02-21 09:01:44 +0100477 if(typeof data !== 'undefined' && i > data.mergedEnd) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100478 return " merged"
479 } else {
480 return "";
481 }
482 }
483
484 function getRankTooltip(i) {
485 if(data.mergedEnd) {
486 if(data.ranks[i] < data.mergedEnd) {
487 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
488 } else {
489 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]-data.mergedEnd).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " (merged vocab)";
490 }
491 } else {
492 return "rank: "+i +" "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
493 }
494 }
495
Marc Kupietz83305222016-04-28 09:57:22 +0200496 function drawEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100497 var urlprefix = new URLSearchParams(window.location.search);
498 urlprefix.delete("word");
499 urlprefix.append("word","");
Marc Kupietz8f9c86a2017-12-04 17:17:13 +0100500
Marc Kupietze6a7a732018-01-12 09:21:08 +0100501 $("#embed").empty();
502 var div = d3.select("#embed");
Marc Kupietz34c08172017-11-29 17:08:47 +0100503
Marc Kupietze6a7a732018-01-12 09:21:08 +0100504 // get min and max in each column of Y
505 var Y = T.Y;
Marc Kupietz34c08172017-11-29 17:08:47 +0100506
Marc Kupietze6a7a732018-01-12 09:21:08 +0100507 svg = div.append("svg") // svg is global
508 .attr("width", mapWidth)
509 .attr("height", mapHeight);
Marc Kupietz34c08172017-11-29 17:08:47 +0100510
Marc Kupietze6a7a732018-01-12 09:21:08 +0100511 var g = svg.selectAll(".b")
512 .data(data.words)
513 .enter().append("g")
514 .attr("class", "tsnet");
Marc Kupietz34c08172017-11-29 17:08:47 +0100515
Marc Kupietze6a7a732018-01-12 09:21:08 +0100516 g.append("a")
517 .attr("xlink:href", function(word) {
518 return "?"+urlprefix+word; })
519 .attr("class", function(d, i) {
520 var res="";
521 if(data.marked[i]) {
522 res="marked ";
523 }
524 if(data.target.indexOf(" "+d+" ") >= 0) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100525 res += "target";
526 }
527 if(data.mergedEnd && data.ranks[i] >= data.mergedEnd) {
528 return res+" merged";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100529 } else {
530 return res;
531 }
532 })
533 .attr("title", function(d, i) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100534 return getRankTooltip(i);
Marc Kupietze6a7a732018-01-12 09:21:08 +0100535 })
536 .append("text")
537 .attr("text-anchor", "top")
538 .attr("font-size", 12)
539 .text(function(d) { return d; });
Marc Kupietz34c08172017-11-29 17:08:47 +0100540
Marc Kupietz384c9132018-03-19 16:45:24 +0100541 g.append("svg:title")
542 .text(function(d, i) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100543 return getRankTooltip(i);
Marc Kupietz384c9132018-03-19 16:45:24 +0100544 });
545
Marc Kupietze6a7a732018-01-12 09:21:08 +0100546 var zoomListener = d3.behavior.zoom()
547 .scaleExtent([0.1, 10])
548 .center([0,0])
549 .on("zoom", zoomHandler);
550 zoomListener(svg);
Marc Kupietz83305222016-04-28 09:57:22 +0200551 }
552
553 var tx=0, ty=0;
554 var ss=1;
555 var iter_id=-1;
556
557 function zoomHandler() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100558 tx = d3.event.translate[0];
559 ty = d3.event.translate[1];
560 ss = d3.event.scale;
561 updateEmbedding();
Marc Kupietz83305222016-04-28 09:57:22 +0200562 }
563
564 var stepnum = 0;
565
566 function stopStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100567 clearInterval(iter_id);
568 text = svg.selectAll("text");
Marc Kupietz34c08172017-11-29 17:08:47 +0100569
Marc Kupietze6a7a732018-01-12 09:21:08 +0100570 // jitter function needs different data and co-ordinate representation
571 labels = d3.range(data.words.length).map(function(i) {
572 var x = (T.Y[i][0]*20*ss + tx) + mapWidth/2;
573 var y = (T.Y[i][1]*20*ss + ty) + mapHeight/2;
574 anchor_array.push({x: x, y: y, r: jitterRadius});
575 return {
576 x: x,
577 y: y,
578 name: data.words[i]
579 };
580 });
Marc Kupietz34c08172017-11-29 17:08:47 +0100581
Marc Kupietze6a7a732018-01-12 09:21:08 +0100582 // get the actual label bounding boxes for the jitter function
583 var index = 0;
584 text.each(function() {
585 labels[index].width = this.getBBox().width;
586 labels[index].height = this.getBBox().height;
587 index += 1;
588 });
Marc Kupietz83305222016-04-28 09:57:22 +0200589
Marc Kupietz34c08172017-11-29 17:08:47 +0100590
Marc Kupietze6a7a732018-01-12 09:21:08 +0100591 // setTimeout(updateEmbedding, 1);
592 // setTimeout(
593 labeler = d3.labeler()
594 .label(labels)
595 .anchor(anchor_array)
596 .width(mapWidth)
597 .height(mapHeight)
598 .update(applyJitter);
599 // .start(1000);
Marc Kupietz83305222016-04-28 09:57:22 +0200600
Marc Kupietze6a7a732018-01-12 09:21:08 +0100601 iter_id = setInterval(jitterStep, 1);
Marc Kupietz83305222016-04-28 09:57:22 +0200602 }
603
604 var jitter_i=0;
605
606 function jitterStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100607 if(jitter_i++ > 100) {
608 clearInterval(iter_id);
609 } else {
610 labeler.start2(10);
611 applyJitter();
612 }
Marc Kupietz83305222016-04-28 09:57:22 +0200613 }
614
615 var last_cost=1000;
616
617 function step() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100618 var i = T.iter;
Marc Kupietz34c08172017-11-29 17:08:47 +0100619
Marc Kupietze6a7a732018-01-12 09:21:08 +0100620 if(i > <%= $no_iterations %>) {
621 stopStep();
622 } else {
623 var cost = Math.round(T.step() * 100000) / 100000; // do a few steps
624 $("#cost").html("tsne iteration " + i + ", cost: " + cost.toFixed(5));
625 if(i % 250 == 0 && cost >= last_cost) {
626 stopStep();
Marc Kupietz58270662017-12-04 12:10:06 +0100627 } else {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100628 last_cost = cost;
629 updateEmbedding();
Marc Kupietz58270662017-12-04 12:10:06 +0100630 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100631 }
Marc Kupietz83305222016-04-28 09:57:22 +0200632 }
633
634 function showMap(j) {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100635 data=j;
636 T.iter=0;
637 iter_id = -1;
638 last_cost=1000;
639 T.initDataRaw(data.vecs); // init embedding
640 drawEmbedding(); // draw initial embedding
Marc Kupietz78114532017-11-29 17:00:16 +0100641
Marc Kupietze6a7a732018-01-12 09:21:08 +0100642 if(iter_id >= 0) {
643 clearInterval(iter_id);
644 }
645 //T.debugGrad();
646 iter_id = setInterval(step, 1);
647 if(true) { // (<%= $show_som %>) {
648 makeSOM(j, <%= $no_iterations %>);
649 }
Marc Kupietz83305222016-04-28 09:57:22 +0200650 }
Marc Kupietz39179ab2017-07-04 16:28:06 +0200651 var queryword;
652
Marc Kupietz66bfd952017-12-11 09:59:45 +0100653 function showCollocatorSOM() {
Marc Kupietz86b50292019-02-17 21:03:59 +0100654 var baseURL = window.location.pathname.replace(/[/]$/, '')
Marc Kupietze6a7a732018-01-12 09:21:08 +0100655 if (collocatorTable) {
656 var ctableData = collocatorTable.rows().data();
657 var nwords = [],
658 nranks = [];
659 for (var i=0; i < ctableData.length && i < 100; i++) {
660 nranks.push(ctableData[i].rank);
661 nwords.push(ctableData[i].word);
Marc Kupietz66bfd952017-12-11 09:59:45 +0100662 }
Marc Kupietz86b50292019-02-17 21:03:59 +0100663 $.post(baseURL+'/getVecsByRanks',
Marc Kupietze6a7a732018-01-12 09:21:08 +0100664 JSON.stringify(nranks),
665 function(data, status){
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100666 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 +0100667 }, 'json');
668 }
Marc Kupietz66bfd952017-12-11 09:59:45 +0100669 }
670
Marc Kupietz39179ab2017-07-04 16:28:06 +0200671 function onload() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100672 queryword = document.getElementById('word');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200673 }
674
675 function queryKorAP() {
Marc Kupietz78230872019-08-02 15:15:25 +0200676 window.open('http://korap.ids-mannheim.de' + korapPath + '?q='+queryword.value+korapVC, 'KorAP');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200677 }
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100678
679 function queryKorAPCII(query) {
Marc Kupietz78230872019-08-02 15:15:25 +0200680 window.open('http://korap.ids-mannheim.de' +korapPath + '?ql=cosmas2&q='+query+korapVC, 'KorAP');
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100681 }
Marc Kupietz83305222016-04-28 09:57:22 +0200682 </script>
683 </head>
Marc Kupietz7b0e5de2019-01-31 12:49:32 +0100684 <body onload="onload()"> <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>
685 <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>
686 <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>
687 <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>
688 <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>
689 <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>
690 <div style="display:none;" id="logdice_ttt">Log-Dice: $$14 + \log_2 \frac{2f_{1,2}}{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>
691 <div style="display:none;" id="logdiceaf_ttt">Log-Dice using "auto-focus", i.e. the window that yields the highest score.</div>
Marc Kupietz6d7462c2019-12-05 10:16:38 +0100692 <div id="ids_logo">
693 <a href="http://www.ids-mannheim.de/" target="_blank"><img src="/derekovecs/img/IDS-neu_farbig.svg" alt="Leibniz-Institut für Deutsche Sprache"/></a>
694 </div>
695 <div id="header">
Marc Kupietz58270662017-12-04 12:10:06 +0100696 <div id="pagetitle">
Marc Kupietzc053d972019-01-10 10:41:51 +0100697 <h1>DeReKoVecs</h1>
698 <h2><%== $title %></h2>
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100699 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100700 <div id="options" class="widget">
701 <form id="queryform">
Marc Kupietz95104512019-12-05 10:13:05 +0100702 <input id="word" type="text" name="word" placeholder="<%= loc 'words_to_be_searched' %>" value="<%= $word %>"
703 title="<%= loc 'search_description' %>"/>
704 <input id="SEARCH" type="button" value="<%= loc 'SEARCH' %>">
705 <input type="button" id="showoptions" name="showoptions" value="<%= loc 'Options' %>" />
Marc Kupietz58270662017-12-04 12:10:06 +0100706 </form>
707 <div id="dropdownoptions" style="display: none">
708 <form id="optionsform">
709 <div class="controlgroup-vertical">
710 <label for="cutoff">cut-off</label>
711 <input id="cutoff" type="text" name="cutoff" size="10" value="<%= $cutoff %>" title="Only consider the most frequent x word forms.">
712 <label for="dedupe">dedupe</label>
713 <input id="dedupe" type="checkbox" name="dedupe" value="1" <%= ($dedupe ? "checked" : "") %> title="radically filter out any near-duplicates">
714 % if($mergedEnd > 0) {
715 <label for="sbf">backw.</label>
716 <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.">
717 % }
718 <label for="neighbours">max. neighbours:</label>
719 <input id="neighbours" size="4" name="n" value="<%= $no_nbs %>">
720 <label for="no_iterations">max. iterations</label>
721 <input id="no_iterations" name="N" size="4" value="<%= $no_iterations %>">
722 <!-- <label for="dosom">SOM</label>
723 <input id="dosom" type="checkbox" name="som" value="1" <%= ($show_som ? "checked" : "") %>> -->
724 % if($collocators) {
725 <label for="sortby">window/sort</label>
726 <select id="sortby" name="sort">
727 <option value="0" <%= ($sort!=1 && $sort!=2? "selected":"") %>>auto focus</option>
728 <!-- <option value="1" <%= ($sort==1? "selected":"") %>>any single position</option>
729 <option value="2" <%= ($sort==2? "selected":"") %>>whole window</option> -->
730 </select>
731 % }
732 <input type="button" value="→ KorAP" onclick="queryKorAP();" title="query word with KorAP"/>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100733 <input id="show-details" type="checkbox" name="show-details" value="1" >
734 <label for="show-details">
735 Show details
736 </label>
Marc Kupietz58270662017-12-04 12:10:06 +0100737 </div>
738 </form>
739 </div>
740 </div>
741 </div>
742 <div id="topwrapper">
743 <div style="visibility: hidden;" id="tabs">
744 <ul>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100745 % if (defined $word && $word ne '') {
746 % if($mergedEnd && $distantWords) {
747 <li><a href="#tabs-0" title="Cos offsets of the words furthest away from their position in the reference corpus."">Offsets</a></li>
748 % }
749 <li><a href="#tabs-1"><%= loc 'paradigmatic_tsne' %></a></li>
750 <li><a href="#tabs-2"><%= loc 'paradigmatic_som' %></a></li>
751 <li><a href="#tabs-3"><%= loc 'syntagmatic' %></a></li>
Marc Kupietzd7760b42019-02-21 09:01:44 +0100752 % }
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100753 <li><a href="#tabs-4">Info</a></li>
Marc Kupietz58270662017-12-04 12:10:06 +0100754 </ul>
Marc Kupietzb6514dc2019-06-26 11:47:56 +0200755 % if($mergedEnd && $distantWords) {
Marc Kupietzd7760b42019-02-21 09:01:44 +0100756 <div id="tabs-0" style="display: flex; padding: 5px; flex-flow: row wrap;">
757 <div id="vocabdist" style="width: 230px; margin-bottom: 15px;">
758 <table class="display compact nowrap" id="vocabdistt">
759 <thead>
760 <tr>
Marc Kupietz95977002019-02-26 09:09:59 +0100761 <th align="right">#</th><th id="cosD" align="right">D<sub>cos</sub></th><th align="left">word</th>
Marc Kupietzd7760b42019-02-21 09:01:44 +0100762 </tr>
763 </thead>
764 <tbody>
765 <tr>
766 <td align="right">
Marc Kupietz95977002019-02-26 09:09:59 +0100767 </td>
Marc Kupietzd7760b42019-02-21 09:01:44 +0100768 <td align="right">
769 </td>
770 <td></td>
771 </tr>
772 </tbody>
773 </table>
774 </div>
775 </div>
Marc Kupietzb6514dc2019-06-26 11:47:56 +0200776 % }
Marc Kupietz384c9132018-03-19 16:45:24 +0100777 <div id="tabs-1" style="display: flex; padding: 5px; flex-flow: row wrap;">
Marc Kupietz58270662017-12-04 12:10:06 +0100778 % if($lists && (@$lists) > 0 && (@$lists)[0]) {
779 <div id="wrapper">
Marc Kupietz384c9132018-03-19 16:45:24 +0100780 <div id="first" style="width: 230px; margin-bottom: 15px;">
Marc Kupietz58270662017-12-04 12:10:06 +0100781 <table class="display compact nowrap" id="firsttable">
782 <thead>
783 <tr>
Marc Kupietz95977002019-02-26 09:09:59 +0100784 <th align="right">#</th><th align="right">S<sub>cos</sub></th><th align="left">similars by w2v</th>
Marc Kupietz58270662017-12-04 12:10:06 +0100785 </tr>
786 </thead>
787 <tbody>
788 <tr>
789 <td align="right">
790 </td>
791 <td align="right">
792 </td>
793 <td></td>
794 </tr>
795 </tbody>
796 </table>
797 </div>
Marc Kupietza55a09a2018-07-06 13:30:30 +0200798 % if(0 && $haveSProfiles) {
Marc Kupietz384c9132018-03-19 16:45:24 +0100799 <div id="sprofilesdiv" style="width: 200px; padding-right: 10px;">
800 <table class="display compact nowrap" id="sprofiles">
801 <thead>
802 <tr>
803 <th align="right">cos</th><th align="left">similars by coll. profile</th>
804 </tr>
805 </thead>
806 <tbody>
807 <tr>
808 <td align="right">
809 </td>
810 <td></td>
811 </tr>
812 </tbody>
813 </table>
814 </div>
815 %}
Marc Kupietz81aeed22019-02-17 21:22:45 +0100816 <div id="second">
Marc Kupietz58270662017-12-04 12:10:06 +0100817 <div id="embed">
818 </div>
819 <div id="cost">
820 </div>
821 </div>
822 </div>
Marc Kupietz81aeed22019-02-17 21:22:45 +0100823 % } elsif($word !~ /^\s*$/) {
824 <div id="wrapper">
Marc Kupietz81aeed22019-02-17 21:22:45 +0100825 <script>
826 $( function() {
Marc Kupietzce6490b2019-12-06 11:05:40 +0100827 $( "<%== loc 'notfounddialog' %>").dialog({
Marc Kupietz81aeed22019-02-17 21:22:45 +0100828 autoOpen: true,
829 modal: true,
830 draggable: false,
831 height: "auto",
832 width: "auto",
833 resizable: false,
834 buttons: {
835 "OK": function() {
836 $( this ).dialog( "close" );
Marc Kupietzce6490b2019-12-06 11:05:40 +0100837 } /* ,
Marc Kupietz81aeed22019-02-17 21:22:45 +0100838 "Apply": function() {
839 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietzce6490b2019-12-06 11:05:40 +0100840 } */
Marc Kupietz81aeed22019-02-17 21:22:45 +0100841 }
842 });
843 });
844 </script>
Marc Kupietzce6490b2019-12-06 11:05:40 +0100845 <div id="not-found-dialog_de" style="display: none" title="Nicht gefunden">
846 <p>FEHLER: Konnte "<%= $word %>" nicht finden.</p>
847 <p>Wenn Sie der Meinung sind, dass es Vokabluar enthalten sein sollte, können Sie versuchen den Cut-Off-Parameter in den Optionen zu erhöhen.</p>
848 </div>
849 <div id="not-found-dialog_en" style="display: none" title="Not found">
850 <p>ERROR: "<%= $word %>" not found in vocabluary.</p>
851 <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>
852 </div>
Marc Kupietz81aeed22019-02-17 21:22:45 +0100853 </div>
Marc Kupietz384c9132018-03-19 16:45:24 +0100854 % }
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 Kupietzd6dfdf02019-12-06 09:53:34 +0100857 % if(defined $word && $word ne "") {
858 <div id="som2" style="width: 800;">
859 <div id="sominfo1"><span id="somcolor1"> </span> <span id="somword1"> </span> <span id="somcolor2"> </span> <span id="somword2"> </span> <span id="somcolor3"> </span></div>
860 <div id="sominfo" style="text-align: right">SOM iteration <span id="iterations">0</span></div>
861 </div>
862 % }
Marc Kupietz58270662017-12-04 12:10:06 +0100863 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100864 <div id="tabs-3" style="display: flex; padding:5px; flex-flow: row wrap;">
865 <div style="margin-right: 20px; margin-bottom: 10px;" id="secondt">
Marc Kupietze6a7a732018-01-12 09:21:08 +0100866 <table class="display compact nowrap" id="secondtable">
Marc Kupietz58270662017-12-04 12:10:06 +0100867 <thead>
868 <tr>
869 % if($collocators) {
870 <th>#</th>
Marc Kupietz4116b432017-12-06 14:15:32 +0100871 <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>
872 <th align="right" title="Maximum activation of the collocator anywhere in the output layer.">max(a)</th>
873 <th title="Average raw activation of the collocator in the columns selected by auto-focus." align="right">⟨a⟩</th>
874 <th title="Sum of activations over the selected colunns normalized by the total activation sum of the selected columns." align="right">Σa/Σw'</th>
875 <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 +0100876 <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 Kupietz95104512019-12-05 10:13:05 +0100877 <th align="left"><%= loc 'collocate_w2v' %></th>
Marc Kupietz58270662017-12-04 12:10:06 +0100878 % }
879 </tr>
880 </thead>
881 <tbody>
882 <tr>
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>
893 <td align="right">
894 </td>
Marc Kupietz58270662017-12-04 12:10:06 +0100895 </tr>
896 </tbody>
897 </table>
Marc Kupietz66bfd952017-12-11 09:59:45 +0100898 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100899 <div id="ccd" style="">
Marc Kupietze6a7a732018-01-12 09:21:08 +0100900 <table class="display compact nowrap" id="classicoloctable">
901 <thead>
Marc Kupietzcd136e22018-01-29 09:18:12 +0100902 % if($collocators) {
903 <tr>
Marc Kupietzf19814b2019-01-21 16:50:19 +0100904 <th id="ll_tt">LL</th>
Marc Kupietzfab14a72019-01-22 16:20:29 +0100905 <th id="mi_tt">MI</th>
906 <th id="md_tt">MI²</th>
Marc Kupietzf19814b2019-01-21 16:50:19 +0100907 <th id="lfmd_tt">MI³</th>
Marc Kupietzfab14a72019-01-22 16:20:29 +0100908 <th id="npmi_tt">nPMI</th>
909 <th id="dice_tt">dice</th>
Marc Kupietz63b268f2019-01-22 22:34:29 +0100910 <th id="logdice_tt">LD</th>
911 <th id="logdiceaf_tt">LDaf</th>
Marc Kupietz001bffd2019-02-21 08:52:41 +0100912 <th id="delta_tt" title="Delta to log-Dice score in reference corpus. ⚠: If the collocate is not within the top 200 of the reference corpus, a reference value of min(lD)-0.1 is assumed.">Δ</th>
Marc Kupietz95104512019-12-05 10:13:05 +0100913 <th id="af_win" title="Positions around the target word that are selected by the auto-focus function are marked with ◾. Positions at which the collocate appears at least once are marked with ◽."><span class="regular"><%= loc 'af_window' %></span></th>
Marc Kupietz5a7f9ac2018-01-30 11:22:44 +0100914 <th title="PMI³ restricted to left neighbour">l-PMI³</th>
915 <th title="PMI³ restricted to right neighbour">r-PMI³</th>
916 <th title="nPMI restricted to left neighbour">l-nPMI</th>
917 <th title="nPMI restricted to right neighbour">r-nPMI</th>
Marc Kupietz4784fae2019-02-04 12:32:12 +0100918 <th id="rawfreq_tt" title="raw frequency sum of collocation within window">raw</th>
Marc Kupietz95104512019-12-05 10:13:05 +0100919 <th><%= loc 'collocate_ca' %></th>
Marc Kupietzcd136e22018-01-29 09:18:12 +0100920 </tr>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100921 % }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100922 </thead>
923 <tbody>
924 <tr>
Marc Kupietz63b268f2019-01-22 22:34:29 +0100925 <td align="right"></td>
926 <td align="right"></td>
927 <td align="right"></td>
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100928 <td align="right"></td>
Marc Kupietz78d7c1a2019-02-17 22:31:22 +0100929 <td align="right"></td>
930 <td align="right"></td>
931 <td align="right"></td>
932 <td align="right"></td>
933 <td align="right"></td>
934 <td align="left"> </td>
935 <td align="right"></td>
936 <td align="right"></td>
937 <td align="right"></td>
938 <td align="right"></td>
939 <td align="left"> </td>
Marc Kupietze6a7a732018-01-12 09:21:08 +0100940 </tr>
941 </tbody>
942 </table>
943 </div>
Marc Kupietz384c9132018-03-19 16:45:24 +0100944 <!--
945 <div style="clear:both" ></div>
946 <div style="float: right; overflow: hidden" id="extra"><button onClick="showCollocatorSOM()"> </button></div>
947 -->
Marc Kupietz66bfd952017-12-11 09:59:45 +0100948 </div>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100949 <div id="tabs-4" style="display: flex; padding:5px; flex-flow: row wrap;">
950 <div id="info">
951 <h3><%== loc 'about' %></h3>
952 %= include(loc('abouttext'))
953 % if($training_args && (@$lists)[0]) {
954 <h3><%= loc 'training_parameters' %></h3>
955 % if($training_args =~ /-type\s*3/) {
956 <p>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:</p>
957 <div class="mono"><%= $training_args %></div>
958 % } else {
959 <p>Calculations are based on a word embedding model trained with <a href="https://code.google.com/p/word2vec/">word2vec</a> using the following parameters:</p>
960 <div class="mono"><%= $training_args %></div>
961 % }
962 % }
963 <h3><%== loc 'references' %></h3>
964 %= include 'references'
965 </div>
966 </div>
967 </div> <!-- tabs -->
Marc Kupietz58270662017-12-04 12:10:06 +0100968 </div> <!-- topwrapper -->
969 <div style="clear: both;"></div>
970 </div>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100971 <div class="footer">
972 <span class="footertext">
973 %= include(loc('footer'))
974 </span>
Marc Kupietzebea4702018-01-12 09:16:09 +0100975 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100976 </body>
Marc Kupietz83305222016-04-28 09:57:22 +0200977</html>