blob: 88ff568f1d89047e3bd8622b429b1db30e0d0dc6 [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 Kupietz42e6d092023-04-18 19:29:12 +02008 <script src="https://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>
Marc Kupietz9ae184c2023-11-04 18:21:54 +010013 <script src="https://cdnjs.cloudflare.com/ajax/libs/ical.js/1.5.0/ical.js"
14 integrity="sha512-UxWd2RMDGpYwYuDeU2Fs+nd51gw4ZLQY0D9wWZ3NuanNSk6QQmWCZ6C+rvI0lJ/b/nZtBQ8RVESA9DN9r65dUg=="
15 crossorigin="anonymous" referrerpolicy="no-referrer"></script>
16 <script
17 src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment-with-locales.min.js"
18 integrity="sha512-42PE0rd+wZ2hNXftlM78BSehIGzezNeQuzihiBCvUEB3CVxHvsShF86wBWwQORNxNINlBPuq7rG4WWhNiTVHFg=="
19 crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Marc Kupietz5f532b32019-01-23 10:03:18 +010020 <link rel="stylesheet" href="https://cdn.datatables.net/1.10.18/css/jquery.dataTables.min.css">
Marc Kupietz4949d232018-03-19 16:43:18 +010021 <link rel="stylesheet" href="/derekovecs/css/derekovecs.css">
Marc Kupietz80bd7b92017-07-04 16:25:54 +020022 <script
Marc Kupietz42e6d092023-04-18 19:29:12 +020023 src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
Marc Kupietze6a7a732018-01-12 09:21:08 +010024 integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
25 crossorigin="anonymous"></script>
Marc Kupietz80bd7b92017-07-04 16:25:54 +020026 <script>
Marc Kupietza0ffb392018-01-25 08:53:43 +010027 MathJax.Hub.Config({
28 config: ["MMLorHTML.js"],
29 jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML", "output/PreviewHTML"],
30 extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js", "fast-preview.js", "AssistiveMML.js", "a11y/accessibility-menu.js"],
31 TeX: {
32 extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
33 }
34 });
Marc Kupietz58270662017-12-04 12:10:06 +010035 var urlParams = new URLSearchParams(window.location.search);
Marc Kupietzb3a2e4f2017-12-08 17:25:53 +010036 var currentWords = urlParams.get("word");
Marc Kupietza0ffb392018-01-25 08:53:43 +010037 var CIIsearchWords = (currentWords && currentWords.includes(" ") ? '('+currentWords.replace(/ +/g, " oder ")+')' : currentWords);
Marc Kupietz66bfd952017-12-11 09:59:45 +010038 var collocatorTable = null;
Marc Kupietz86b50292019-02-17 21:03:59 +010039 var plainTitle ="<%= $plain_title %>"
Marc Kupietz78d7c1a2019-02-17 22:31:22 +010040 var korapPath="/";
41 if (plainTitle.match(/-en/)) {
42 korapPath="/instance/english";
43 }
Marc Kupietz78230872019-08-02 15:15:25 +020044 var korapVC="";
45 if (plainTitle.match(/WUDD/i)) {
46 korapVC="&collection=corpusSigle+%3D+%2FW%5BDU%5DD17%2F";
47 korapPath="/instance/test";
48 }
49
Marc Kupietz58270662017-12-04 12:10:06 +010050 $(document).ready(function() {
Marc Kupietz3576c622023-11-05 08:51:58 +010051 insertCalendarEvents(document.getElementById('downtimes'), '/derekovecs/getDowntimeCalendar' );
Marc Kupietz694610d2017-11-25 18:30:03 +010052
Marc Kupietza0ffb392018-01-25 08:53:43 +010053 $('#firstable').hide();
54 //Set up a callback to hear back when MathJax is done rendering the equations
55 // it finds
56 $('#ccd').load(
57 '@Url.Action("ActionResultMethod","ControllerName",{controller parameters})',
58 function () {
59 MathJax.Hub.Queue(
60 ["Typeset",MathJax.Hub,"ccd"],
Marc Kupietz95977002019-02-26 09:09:59 +010061 function () {
Marc Kupietz7bd55232019-01-22 15:29:06 +010062 $("#mi_tt").attr("title",$("#pmi_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010063 $("#lfmd_tt").attr("title",$("#lfmd_ttt").html());
Marc Kupietz7bd55232019-01-22 15:29:06 +010064 $("#md_tt").attr("title",$("#md_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010065 $("#npmi_tt").attr("title",$("#npmi_ttt").html());
Marc Kupietzf19814b2019-01-21 16:50:19 +010066 $("#ll_tt").attr("title",$("#ll_ttt").html());
Marc Kupietz7bd55232019-01-22 15:29:06 +010067 $("#logdice_tt").attr("title",$("#logdice_ttt").html());
Marc Kupietz63b268f2019-01-22 22:34:29 +010068 $("#logdiceaf_tt").attr("title",$("#logdiceaf_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010069 }
70 );
71 });
72
73 //set things up so that we can shove raw html into what is shown in the tooltip;
74 // in this case, we will have already put into the title attribute the html that
75 // contains the MathJax rendered equations (via what we do in the callback).
76 $(function () {
77 $(document).tooltip({
78 content: function () {
79 return $(this).prop('title');
80 }
81 });
82 });
83
Marc Kupietze6a7a732018-01-12 09:21:08 +010084 $("input").bind("keydown", function(event) {
85 // track enter key
86 var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
87 if (keycode == 13) { // keycode for enter key
88 // force the 'Enter Key' to implicitly click the Update button
89 document.getElementById('SEARCH').click();
90 return false;
91 } else {
92 return true;
93 }});
Marc Kupietzdab9f222017-11-29 14:22:59 +010094
Marc Kupietze871abd2018-01-25 16:18:27 +010095 var collocatorTable_activated = false;
Marc Kupietze6a7a732018-01-12 09:21:08 +010096 $( "#tabs" ).on( "tabsactivate", function( event, ui ) {
97 if (localStorage) localStorage['tab'] = ui.newTab.index();
Marc Kupietzd7760b42019-02-21 09:01:44 +010098 if(ui.newTab.index() == 3 && !collocatorTable_activated) {
Marc Kupietze871abd2018-01-25 16:18:27 +010099 classicCollocatorTable.columns.adjust();
100 collocatorTable.columns.adjust();
101 collocatorTable_activated = true;
102 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100103 });
104
105 $(function(){
106 $("#SEARCH").click(function() {
107 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietz58270662017-12-04 12:10:06 +0100108 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100109 });
Marc Kupietz0af83e32017-11-27 09:31:37 +0100110
Marc Kupietze6a7a732018-01-12 09:21:08 +0100111 function changeCharColor(txt, heat, word) {
112 var newText = "";
113 for (var i=0, l=txt.length; i<l; i++) {
Marc Kupietz86b50292019-02-17 21:03:59 +0100114 newText += (i == 5 ? txt.charAt(i) : '<a href="http://korap.ids-mannheim.de' + korapPath + '/?ql=cosmas2&q=' +
Marc Kupietze6a7a732018-01-12 09:21:08 +0100115 CIIsearchWords + ' /' + (i > 5? '%2B' : '-') + 'w' +
Marc Kupietz78230872019-08-02 15:15:25 +0200116 Math.abs(i-5) + ':' + Math.abs(i-5) + ' ' + word + korapVC +
Marc Kupietze6a7a732018-01-12 09:21:08 +0100117 '" target="korap"><span style="background-color:' +
118 getHeatColor(heat[i]/maxHeat)+'">'+txt.charAt(i)+'</span></a>');
Marc Kupietzb6c615d2017-12-02 10:38:20 +0100119 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100120 return newText;
121 }
Marc Kupietzb6c615d2017-12-02 10:38:20 +0100122
Marc Kupietze6a7a732018-01-12 09:21:08 +0100123 function getHeatColor(value) {
124 var hue=((1-value)*120).toString(10);
125 return ["hsl(",hue,",90%,70%)"].join("");
126 }
127
128 function bitvec2window(n, heat, word) {
129 var str = n.toString(2).padStart(10, "0")
130 .replace(/^([0-9]{5})/, '$1x')
131 .replace(/0/g, '·')
132 .replace(/1/g, '+');
133 return changeCharColor(str, heat, word);
134 }
135
136 % use Mojo::ByteStream 'b';
137 var paraResults = <%= b(Mojo::JSON::to_json($lists)) %>;
138 var urlprefix = new URLSearchParams(window.location.search);
139 if (paraResults.length > 0 && paraResults[0] != null) {
140 var nvecs = [],
141 nwords = [],
142 nranks = [],
143 nmarked = [];
144 for(var i = 0; i < paraResults.length; i++) {
145 nwords = nwords.concat(paraResults[i].map(function(a){return a.word;}));
146 nvecs = nvecs.concat(paraResults[i].map(function(a){return a.vector;}));
147 nranks = nranks.concat(paraResults[i].map(function(a){return a.rank;}));
148 nmarked = nmarked.concat(paraResults[i].map(function(a){return a.marked;}));
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100149 }
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100150 showMap({target: " "+urlParams.get('word')+" ", mergedEnd: <%= $mergedEnd %>, words: nwords, vecs: nvecs, ranks: nranks, marked: nmarked} );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100151 var t = $('#firsttable').DataTable({
Marc Kupietzee894d52019-01-09 14:55:14 +0100152 data: [].concat.apply([], paraResults),
Marc Kupietze6a7a732018-01-12 09:21:08 +0100153 "sScrollY": "780px",
154 "bScrollCollapse": true,
155 "bPaginate": false,
156 "bJQueryUI": true,
157 "dom": '<"top">rt<"bottom"flp><"clear">',
Marc Kupietz384c9132018-03-19 16:45:24 +0100158 "initComplete":function(settings, json) {
159 $('td.paradigmator a').on('mousedown', function(e) {
Marc Kupietz86b50292019-02-17 21:03:59 +0100160 return paradigmatorClick(e, paraResults[0][0].word, this.childNodes["0"].textContent);
Marc Kupietz384c9132018-03-19 16:45:24 +0100161 });
162 },
Marc Kupietze6a7a732018-01-12 09:21:08 +0100163 "columns": [
164 { "data": "rank", type: "allnumeric" },
165 { "data": "dist", render: function ( data, type, row ) {return data.toFixed(3) }},
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100166 { "data": "word", class: "paradigmator", render: function ( data, type, row ) {
167 urlprefix.set("word", data); return '<a class="' + getMergedClass(row.rank) + '" href="?' + urlprefix + '">' + data + '</a>'
168 }}
Marc Kupietze6a7a732018-01-12 09:21:08 +0100169 ],
170 "columnDefs": [
171 { className: "dt-right", "targets": [0,1] },
172 { "searchable": false,
173 "orderable": false,
174 "targets": 0
175 },
176 { "orderSequence": [ "desc" ], "targets": [ 1 ] },
177 { "orderSequence": [ "asc", "desc" ], "targets": [ 2 ] },
178 ],
179 "oLanguage": {
180 "sSearch": "Filter: "
181 },
182 "order": [[ 1, 'desc' ]],
183 } );
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100184
Marc Kupietze6a7a732018-01-12 09:21:08 +0100185 t.on( 'order.dt search.dt', function () {
186 t.column(0, {order:'applied'}).nodes().each( function (cell, i) {
187 cell.innerHTML = i+1;
188 } );
189 } ).draw();
190
191 $( "#first" ).clone().prependTo( "#tabs-2" );
192
193 }
194
195
196 var collocatorData = <%= b(Mojo::JSON::to_json($collocators)) %>;
197 var maxHeat; // = Math.max.apply(Math,collocatorData.map(function(o){return o.cprob;}))
198
Marc Kupietzcddc8482019-12-04 08:57:33 +0100199 if(typeof data !== 'undefined' && data.mergedEnd > 0) {
Marc Kupietz78230872019-08-02 15:15:25 +0200200 vocabDistanceTable = makeVocabDistanceTable("#vocabdistt", baseURL);
201 }
Marc Kupietzd7760b42019-02-21 09:01:44 +0100202
Marc Kupietze6a7a732018-01-12 09:21:08 +0100203 if (collocatorData != null) {
204 maxHeat = Math.max.apply(Math,collocatorData.map(function(o){return Math.max.apply(Math,o.heat);}))
205 collocatorTable = $('#secondtable').DataTable({
206 data: collocatorData,
207 "sScrollY": "780px",
208 "bScrollCollapse": true,
209 "bPaginate": false,
210 "bJQueryUI": true,
211 "dom": '<"top">rt<"bottom"flp><"clear">',
212 "columns": [
213 { "data": "rank", type: "allnumeric" },
214 { "data": "pos", width: "7%", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitvec2window(data, row.heat, row.word) }},
215 { "data": "max", render: function ( data, type, row ) {return data.toFixed(3) }},
216 { "data": "average", render: function ( data, type, row ) {return data.toFixed(3) }},
217 { "data": "prob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
218 { "data": "cprob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
219 { "data": "overall", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
220 { "data": "word", sClass: "collocator" },
221 { "data": "rank", type: "allnumeric" }
222 ],
223 "columnDefs": [
224 { className: "dt-right", "targets": [0,2,3,4,5,6] },
225 { className: "dt-center", "targets": [ 1] },
226 { "searchable": false,
227 "orderable": false,
228 "targets": [0, 8]
229 },
230 { "type": "scientific", targets: [2,3,4,5,6] },
231 { "orderSequence": [ "desc" ], "targets": [ 2, 3, 4, 5, 6 ] },
232 { "orderSequence": [ "asc", "desc" ], "targets": [ 1, 7 ] },
233 { "targets": [8], "visible": false }
234 ],
235 "oLanguage": {
236 "sSearch": "Filter: "
237 },
238 "order": [[ 4, 'desc' ]],
239 } );
240 $.ajaxSetup({
241 type: 'POST',
242 timeout: 30000,
243 error: function(xhr) {
244 $('#display_error')
245 .html('Error: ' + xhr.status + ' ' + xhr.statusText);
246 }
Marc Kupietz78b434a2018-01-12 22:33:32 +0100247 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100248
Marc Kupietz384c9132018-03-19 16:45:24 +0100249
250 if($('#sprofiles').length) {
251 similarProfileTable = $('#sprofiles').DataTable({
252 ajax: {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100253 method: "GET",
Marc Kupietz384c9132018-03-19 16:45:24 +0100254 url: '/derekovecs/getSimilarProfiles',
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100255 dataType: 'json',
256 dataSrc: "",
257 timeout: 30000,
258 data: { w: paraResults[0][0].rank }
Marc Kupietz384c9132018-03-19 16:45:24 +0100259 },
260 "initComplete":function(settings, json){
261 $('td.paradigmator a').on('mousedown', function(e) {
262 if (e.which === 2) {
263 e.preventDefault();
264 queryKorAPalternatives(paraResults[0][0].word, this.childNodes["0"].textContent);
265 return false;
266 }
267 });
268 },
269 "sScrollY": "780px",
270 "bScrollCollapse": true,
271 "bPaginate": false,
272 "bJQueryUI": true,
273 "dom": '<"top">rt<"bottom"flp><"clear">',
274 "columns": [
275 { "data": "v", render: function ( data, type, row ) {return data.toFixed(3) }},
276 { "data": "w", sClass: "paradigmator", render: function ( data, type, row ) {urlprefix.set("word", data); return '<a href="?' + urlprefix + '">' + data + '</a>' } }
277 ],
278 "columnDefs": [
279 { className: "dt-right", "targets": [0] },
280 ],
281 "oLanguage": {
282 "sSearch": "Filter: "
283 },
284 "order": [[ 0, 'desc' ]],
285 });
286 }
Marc Kupietzd7760b42019-02-21 09:01:44 +0100287
Marc Kupietz384c9132018-03-19 16:45:24 +0100288 // var filterQuot = /(^quot?=[A-Z])|(quot$)/g;
289 var filterQuot = /^quot/;
Marc Kupietz4784fae2019-02-04 12:32:12 +0100290 var ccResult;
Marc Kupietz86b50292019-02-17 21:03:59 +0100291 var baseURL = window.location.pathname.replace(/[/]$/, '')
Marc Kupietz95977002019-02-26 09:09:59 +0100292 classicCollocatorTable = makeClassicCollocatorTable('#classicoloctable', baseURL, paraResults[0][0].rank)
Marc Kupietze6a7a732018-01-12 09:21:08 +0100293
Marc Kupietz1acb3172018-02-17 09:41:26 +0100294 $('#show-details').change(function (e) {
295 var columns = classicCollocatorTable.columns(".detail");
296 if(this.checked) {
297 columns.visible(true);
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100298 $("#ccd").css('width', 'auto');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100299 } else {
300 columns.visible(false);
Marc Kupietz08bfd402019-01-23 10:05:17 +0100301 $("#ccd").css('width', '680px');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100302 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100303 classicCollocatorTable.columns.adjust().draw();
Marc Kupietz1acb3172018-02-17 09:41:26 +0100304 } );
305
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100306 $("td.collocator").click(function(){
307 queryKorAPCII(this.textContent + " /w5 " + CIIsearchWords);
Marc Kupietzad783722018-01-13 17:45:21 +0100308 });
309
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100310 collocatorTable.on( 'order.dt search.dt', function () {
311 collocatorTable.column(0, {order:'applied'}).nodes().each( function (cell, i) {
312 cell.innerHTML = i+1;
313 } );
314 }).draw();
315 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100316
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100317 if (localStorage && !window.location.hash) { // let's not crash if some user has IE7
318 var index = parseInt(localStorage['tab']||'0');
319 $("#tabs").tabs({ active: index });
320 }
321 $("#tabs").css("visibility", "visible"); // now we can show the tabs
322 });
Marc Kupietz58270662017-12-04 12:10:06 +0100323
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100324 $(function(){
325 $("#dropdownoptions").dialog({
Marc Kupietz95104512019-12-05 10:13:05 +0100326 title: "<%= loc 'Options' %>",
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100327 autoOpen: false,
328 modal: false,
329 draggable: false,
330 height: "auto",
331 width: "auto",
332 resizable: false,
333 buttons: {
Marc Kupietz95104512019-12-05 10:13:05 +0100334 "<%= loc 'Cancel'%>": function() {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100335 $( this ).dialog( "close" );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100336 },
Marc Kupietz95104512019-12-05 10:13:05 +0100337 "<%= loc 'Apply' %>": function() {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100338 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietze6a7a732018-01-12 09:21:08 +0100339 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100340 }
341 });
342 });
343
344 $(function(){
345 $("#showoptions").click(function(){
346 $("#dropdownoptions").dialog("open");
347 var target = $(this);
348 $("#dropdownoptions").dialog("widget").position({
349 my: 'left bottom',
350 at: 'left bottom',
351 of: target
Marc Kupietz58270662017-12-04 12:10:06 +0100352 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100353 });
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100354 });
355
356 $( function() {
357 $( "#no_iterations" ).spinner({
358 spin: function( event, ui ) {
359 if ( ui.value < 1000 ) {
360 $( this ).spinner( "value", 1000 );
361 return false;
362 } else if ( ui.value > 10000 ) {
363 $( this ).spinner( "value", 10000 );
364 return false;
365 }
366 }
367 });
368 } );
369
370 $( function() {
371 $( "#neighbours" ).spinner({
372 spin: function( event, ui ) {
373 if ( ui.value < 0 ) {
374 $( this ).spinner( "value", 0 );
375 return false;
376 } else if ( ui.value > 200 ) {
377 $( this ).spinner( "value", 200 );
378 return false;
379 }
380 }
381 });
382 } );
383
384 $( function() {
385 $( "#cutoff" ).spinner({
386 spin: function( event, ui ) {
387 if ( ui.value < 100000 ) {
388 $( this ).spinner( "value", 100000 );
389 return false;
390 } else if ( ui.value > 2000000 ) {
391 $( this ).spinner( "value", 2000000 );
392 return false;
393 }
394 }
395 });
396 } );
397
398 $( function() {
399 $( "#tabs" ).tabs().addClass('tabs-min');
400 } );
401
402 $( function() {
403 $( ".controlgroup-vertical" ).controlgroup({
404 "direction": "vertical"
405 });
406 } );
407
408 $(function() {
409 $( document ).tooltip({
410 content: function() {
411 return $(this).attr('title');
412 }}
413 )
414 });
415
416 $(function () {
417 $(document).tooltip({
418 content: function () {
419 return $(this).prop('title');
420 },
421 show: null,
422 close: function (event, ui) {
423 ui.tooltip.hover(
424 function () {
425 $(this).stop(true).fadeTo(400, 1);
426 },
427 function () {
428 $(this).fadeOut("400", function () {
429 $(this).remove();
430 })
431 });
432 }
433 });
434 });
Marc Kupietz83305222016-04-28 09:57:22 +0200435 </script>
Marc Kupietz58270662017-12-04 12:10:06 +0100436 <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
Marc Kupietz68e29be2023-11-04 18:37:35 +0100437 <script src="/derekovecs/js/calendar-events.js"></script>
Marc Kupietz58270662017-12-04 12:10:06 +0100438 <script src="/derekovecs/js/tsne.js"></script>
439 <script src="/derekovecs/js/som.js"></script>
440 <script src="/derekovecs/js/labeler.js"></script>
Marc K20476c72021-03-11 12:18:01 +0100441 <script src="/derekovecs/js/derekovecs.js"></script>
Marc Kupietz83305222016-04-28 09:57:22 +0200442 <script>
443
444 var opt = {epsilon: <%= $epsilon %>, perplexity: <%= $perplexity %>},
Marc Kupietz58270662017-12-04 12:10:06 +0100445 mapWidth = 800, // width map
446 mapHeight = 800,
447 jitterRadius = 7;
Marc Kupietz83305222016-04-28 09:57:22 +0200448
449 var T = new tsnejs.tSNE(opt); // create a tSNE instance
450
451 var Y;
452
453 var data;
454 var labeler;
455
456 function applyJitter() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100457 svg.selectAll('.tsnet')
458 .data(labels)
459 .transition()
460 .duration(50)
461 .attr("transform", function(d, i) {
462 T.Y[i][0] = (d.x - mapWidth/2 - tx)/ss/20;
463 T.Y[i][1] = (d.y - mapHeight/2 - ty)/ss/20;
464 return "translate(" +
Marc Kupietz78230872019-08-02 15:15:25 +0200465 (d.x) + "," +
466 (d.y) + ")";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100467 });
Marc Kupietz83305222016-04-28 09:57:22 +0200468 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100469
Marc Kupietz83305222016-04-28 09:57:22 +0200470 function updateEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100471 var Y = T.getSolution();
472 svg.selectAll('.tsnet')
473 .data(data.words)
474 .attr("transform", function(d, i) {
475 return "translate(" +
Marc Kupietz78230872019-08-02 15:15:25 +0200476 ((Y[i][0]*20*ss + tx) + mapWidth/2) + "," +
477 ((Y[i][1]*20*ss + ty) + mapHeight/2) + ")"; });
Marc Kupietz83305222016-04-28 09:57:22 +0200478 }
479
480 var svg;
481 var labels = [];
482 var anchor_array = [];
483 var text;
484
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100485 function getMergedClass(i) {
Marc Kupietzd7760b42019-02-21 09:01:44 +0100486 if(typeof data !== 'undefined' && i > data.mergedEnd) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100487 return " merged"
488 } else {
489 return "";
490 }
491 }
492
493 function getRankTooltip(i) {
494 if(data.mergedEnd) {
495 if(data.ranks[i] < data.mergedEnd) {
496 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
497 } else {
498 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]-data.mergedEnd).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " (merged vocab)";
499 }
500 } else {
501 return "rank: "+i +" "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
502 }
503 }
504
Marc Kupietz83305222016-04-28 09:57:22 +0200505 function drawEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100506 var urlprefix = new URLSearchParams(window.location.search);
507 urlprefix.delete("word");
508 urlprefix.append("word","");
Marc Kupietz8f9c86a2017-12-04 17:17:13 +0100509
Marc Kupietze6a7a732018-01-12 09:21:08 +0100510 $("#embed").empty();
511 var div = d3.select("#embed");
Marc Kupietz34c08172017-11-29 17:08:47 +0100512
Marc Kupietze6a7a732018-01-12 09:21:08 +0100513 // get min and max in each column of Y
514 var Y = T.Y;
Marc Kupietz34c08172017-11-29 17:08:47 +0100515
Marc Kupietze6a7a732018-01-12 09:21:08 +0100516 svg = div.append("svg") // svg is global
517 .attr("width", mapWidth)
518 .attr("height", mapHeight);
Marc Kupietz34c08172017-11-29 17:08:47 +0100519
Marc Kupietze6a7a732018-01-12 09:21:08 +0100520 var g = svg.selectAll(".b")
521 .data(data.words)
522 .enter().append("g")
523 .attr("class", "tsnet");
Marc Kupietz34c08172017-11-29 17:08:47 +0100524
Marc Kupietze6a7a732018-01-12 09:21:08 +0100525 g.append("a")
526 .attr("xlink:href", function(word) {
527 return "?"+urlprefix+word; })
528 .attr("class", function(d, i) {
529 var res="";
530 if(data.marked[i]) {
531 res="marked ";
532 }
533 if(data.target.indexOf(" "+d+" ") >= 0) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100534 res += "target";
535 }
536 if(data.mergedEnd && data.ranks[i] >= data.mergedEnd) {
537 return res+" merged";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100538 } else {
539 return res;
540 }
541 })
542 .attr("title", function(d, i) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100543 return getRankTooltip(i);
Marc Kupietze6a7a732018-01-12 09:21:08 +0100544 })
545 .append("text")
546 .attr("text-anchor", "top")
547 .attr("font-size", 12)
548 .text(function(d) { return d; });
Marc Kupietz34c08172017-11-29 17:08:47 +0100549
Marc Kupietz384c9132018-03-19 16:45:24 +0100550 g.append("svg:title")
551 .text(function(d, i) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100552 return getRankTooltip(i);
Marc Kupietz384c9132018-03-19 16:45:24 +0100553 });
554
Marc Kupietze6a7a732018-01-12 09:21:08 +0100555 var zoomListener = d3.behavior.zoom()
556 .scaleExtent([0.1, 10])
557 .center([0,0])
558 .on("zoom", zoomHandler);
559 zoomListener(svg);
Marc Kupietz83305222016-04-28 09:57:22 +0200560 }
561
562 var tx=0, ty=0;
563 var ss=1;
564 var iter_id=-1;
565
566 function zoomHandler() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100567 tx = d3.event.translate[0];
568 ty = d3.event.translate[1];
569 ss = d3.event.scale;
570 updateEmbedding();
Marc Kupietz83305222016-04-28 09:57:22 +0200571 }
572
573 var stepnum = 0;
574
575 function stopStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100576 clearInterval(iter_id);
577 text = svg.selectAll("text");
Marc Kupietz34c08172017-11-29 17:08:47 +0100578
Marc Kupietze6a7a732018-01-12 09:21:08 +0100579 // jitter function needs different data and co-ordinate representation
580 labels = d3.range(data.words.length).map(function(i) {
581 var x = (T.Y[i][0]*20*ss + tx) + mapWidth/2;
582 var y = (T.Y[i][1]*20*ss + ty) + mapHeight/2;
583 anchor_array.push({x: x, y: y, r: jitterRadius});
584 return {
585 x: x,
586 y: y,
587 name: data.words[i]
588 };
589 });
Marc Kupietz34c08172017-11-29 17:08:47 +0100590
Marc Kupietze6a7a732018-01-12 09:21:08 +0100591 // get the actual label bounding boxes for the jitter function
592 var index = 0;
593 text.each(function() {
594 labels[index].width = this.getBBox().width;
595 labels[index].height = this.getBBox().height;
596 index += 1;
597 });
Marc Kupietz83305222016-04-28 09:57:22 +0200598
Marc Kupietz34c08172017-11-29 17:08:47 +0100599
Marc Kupietze6a7a732018-01-12 09:21:08 +0100600 // setTimeout(updateEmbedding, 1);
601 // setTimeout(
602 labeler = d3.labeler()
603 .label(labels)
604 .anchor(anchor_array)
605 .width(mapWidth)
606 .height(mapHeight)
607 .update(applyJitter);
608 // .start(1000);
Marc Kupietz83305222016-04-28 09:57:22 +0200609
Marc Kupietze6a7a732018-01-12 09:21:08 +0100610 iter_id = setInterval(jitterStep, 1);
Marc Kupietz83305222016-04-28 09:57:22 +0200611 }
612
613 var jitter_i=0;
614
615 function jitterStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100616 if(jitter_i++ > 100) {
617 clearInterval(iter_id);
618 } else {
619 labeler.start2(10);
620 applyJitter();
621 }
Marc Kupietz83305222016-04-28 09:57:22 +0200622 }
623
624 var last_cost=1000;
625
626 function step() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100627 var i = T.iter;
Marc Kupietz34c08172017-11-29 17:08:47 +0100628
Marc Kupietze6a7a732018-01-12 09:21:08 +0100629 if(i > <%= $no_iterations %>) {
630 stopStep();
631 } else {
632 var cost = Math.round(T.step() * 100000) / 100000; // do a few steps
633 $("#cost").html("tsne iteration " + i + ", cost: " + cost.toFixed(5));
634 if(i % 250 == 0 && cost >= last_cost) {
635 stopStep();
Marc Kupietz58270662017-12-04 12:10:06 +0100636 } else {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100637 last_cost = cost;
638 updateEmbedding();
Marc Kupietz58270662017-12-04 12:10:06 +0100639 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100640 }
Marc Kupietz83305222016-04-28 09:57:22 +0200641 }
642
643 function showMap(j) {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100644 data=j;
645 T.iter=0;
646 iter_id = -1;
647 last_cost=1000;
648 T.initDataRaw(data.vecs); // init embedding
649 drawEmbedding(); // draw initial embedding
Marc Kupietz78114532017-11-29 17:00:16 +0100650
Marc Kupietze6a7a732018-01-12 09:21:08 +0100651 if(iter_id >= 0) {
652 clearInterval(iter_id);
653 }
654 //T.debugGrad();
655 iter_id = setInterval(step, 1);
656 if(true) { // (<%= $show_som %>) {
657 makeSOM(j, <%= $no_iterations %>);
658 }
Marc Kupietz83305222016-04-28 09:57:22 +0200659 }
Marc Kupietz39179ab2017-07-04 16:28:06 +0200660 var queryword;
661
Marc Kupietz66bfd952017-12-11 09:59:45 +0100662 function showCollocatorSOM() {
Marc Kupietz86b50292019-02-17 21:03:59 +0100663 var baseURL = window.location.pathname.replace(/[/]$/, '')
Marc Kupietze6a7a732018-01-12 09:21:08 +0100664 if (collocatorTable) {
665 var ctableData = collocatorTable.rows().data();
666 var nwords = [],
667 nranks = [];
668 for (var i=0; i < ctableData.length && i < 100; i++) {
669 nranks.push(ctableData[i].rank);
670 nwords.push(ctableData[i].word);
Marc Kupietz66bfd952017-12-11 09:59:45 +0100671 }
Marc Kupietz86b50292019-02-17 21:03:59 +0100672 $.post(baseURL+'/getVecsByRanks',
Marc Kupietze6a7a732018-01-12 09:21:08 +0100673 JSON.stringify(nranks),
674 function(data, status){
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100675 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 +0100676 }, 'json');
677 }
Marc Kupietz66bfd952017-12-11 09:59:45 +0100678 }
679
Marc Kupietz39179ab2017-07-04 16:28:06 +0200680 function onload() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100681 queryword = document.getElementById('word');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200682 }
683
684 function queryKorAP() {
Marc Kupietz78230872019-08-02 15:15:25 +0200685 window.open('http://korap.ids-mannheim.de' + korapPath + '?q='+queryword.value+korapVC, 'KorAP');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200686 }
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100687
688 function queryKorAPCII(query) {
Marc Kupietz78230872019-08-02 15:15:25 +0200689 window.open('http://korap.ids-mannheim.de' +korapPath + '?ql=cosmas2&q='+query+korapVC, 'KorAP');
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100690 }
Marc Kupietz83305222016-04-28 09:57:22 +0200691 </script>
692 </head>
Marc Kupietz7b0e5de2019-01-31 12:49:32 +0100693 <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>
694 <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>
695 <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>
696 <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>
697 <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>
698 <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>
699 <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>
700 <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 +0100701 <div id="ids_logo">
702 <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>
703 </div>
704 <div id="header">
Marc Kupietz58270662017-12-04 12:10:06 +0100705 <div id="pagetitle">
Marc Kupietzc053d972019-01-10 10:41:51 +0100706 <h1>DeReKoVecs</h1>
707 <h2><%== $title %></h2>
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100708 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100709 <div id="options" class="widget">
710 <form id="queryform">
Marc Kupietz95104512019-12-05 10:13:05 +0100711 <input id="word" type="text" name="word" placeholder="<%= loc 'words_to_be_searched' %>" value="<%= $word %>"
712 title="<%= loc 'search_description' %>"/>
713 <input id="SEARCH" type="button" value="<%= loc 'SEARCH' %>">
714 <input type="button" id="showoptions" name="showoptions" value="<%= loc 'Options' %>" />
Marc Kupietz58270662017-12-04 12:10:06 +0100715 </form>
716 <div id="dropdownoptions" style="display: none">
717 <form id="optionsform">
718 <div class="controlgroup-vertical">
719 <label for="cutoff">cut-off</label>
720 <input id="cutoff" type="text" name="cutoff" size="10" value="<%= $cutoff %>" title="Only consider the most frequent x word forms.">
721 <label for="dedupe">dedupe</label>
722 <input id="dedupe" type="checkbox" name="dedupe" value="1" <%= ($dedupe ? "checked" : "") %> title="radically filter out any near-duplicates">
723 % if($mergedEnd > 0) {
724 <label for="sbf">backw.</label>
725 <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.">
726 % }
727 <label for="neighbours">max. neighbours:</label>
728 <input id="neighbours" size="4" name="n" value="<%= $no_nbs %>">
729 <label for="no_iterations">max. iterations</label>
730 <input id="no_iterations" name="N" size="4" value="<%= $no_iterations %>">
731 <!-- <label for="dosom">SOM</label>
732 <input id="dosom" type="checkbox" name="som" value="1" <%= ($show_som ? "checked" : "") %>> -->
733 % if($collocators) {
734 <label for="sortby">window/sort</label>
735 <select id="sortby" name="sort">
736 <option value="0" <%= ($sort!=1 && $sort!=2? "selected":"") %>>auto focus</option>
737 <!-- <option value="1" <%= ($sort==1? "selected":"") %>>any single position</option>
738 <option value="2" <%= ($sort==2? "selected":"") %>>whole window</option> -->
739 </select>
740 % }
741 <input type="button" value="→ KorAP" onclick="queryKorAP();" title="query word with KorAP"/>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100742 <input id="show-details" type="checkbox" name="show-details" value="1" >
743 <label for="show-details">
744 Show details
745 </label>
Marc Kupietz58270662017-12-04 12:10:06 +0100746 </div>
747 </form>
748 </div>
749 </div>
750 </div>
751 <div id="topwrapper">
752 <div style="visibility: hidden;" id="tabs">
753 <ul>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100754 % if (defined $word && $word ne '') {
755 % if($mergedEnd && $distantWords) {
756 <li><a href="#tabs-0" title="Cos offsets of the words furthest away from their position in the reference corpus."">Offsets</a></li>
757 % }
758 <li><a href="#tabs-1"><%= loc 'paradigmatic_tsne' %></a></li>
759 <li><a href="#tabs-2"><%= loc 'paradigmatic_som' %></a></li>
760 <li><a href="#tabs-3"><%= loc 'syntagmatic' %></a></li>
Marc Kupietzd7760b42019-02-21 09:01:44 +0100761 % }
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100762 <li><a href="#tabs-4">Info</a></li>
Marc Kupietz58270662017-12-04 12:10:06 +0100763 </ul>
Marc Kupietzb6514dc2019-06-26 11:47:56 +0200764 % if($mergedEnd && $distantWords) {
Marc Kupietzd7760b42019-02-21 09:01:44 +0100765 <div id="tabs-0" style="display: flex; padding: 5px; flex-flow: row wrap;">
766 <div id="vocabdist" style="width: 230px; margin-bottom: 15px;">
767 <table class="display compact nowrap" id="vocabdistt">
768 <thead>
769 <tr>
Marc Kupietz95977002019-02-26 09:09:59 +0100770 <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 +0100771 </tr>
772 </thead>
773 <tbody>
774 <tr>
775 <td align="right">
Marc Kupietz95977002019-02-26 09:09:59 +0100776 </td>
Marc Kupietzd7760b42019-02-21 09:01:44 +0100777 <td align="right">
778 </td>
779 <td></td>
780 </tr>
781 </tbody>
782 </table>
783 </div>
784 </div>
Marc Kupietzb6514dc2019-06-26 11:47:56 +0200785 % }
Marc Kupietz384c9132018-03-19 16:45:24 +0100786 <div id="tabs-1" style="display: flex; padding: 5px; flex-flow: row wrap;">
Marc Kupietz58270662017-12-04 12:10:06 +0100787 % if($lists && (@$lists) > 0 && (@$lists)[0]) {
788 <div id="wrapper">
Marc Kupietz384c9132018-03-19 16:45:24 +0100789 <div id="first" style="width: 230px; margin-bottom: 15px;">
Marc Kupietz58270662017-12-04 12:10:06 +0100790 <table class="display compact nowrap" id="firsttable">
791 <thead>
792 <tr>
Marc Kupietz95977002019-02-26 09:09:59 +0100793 <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 +0100794 </tr>
795 </thead>
796 <tbody>
797 <tr>
798 <td align="right">
799 </td>
800 <td align="right">
801 </td>
802 <td></td>
803 </tr>
804 </tbody>
805 </table>
806 </div>
Marc Kupietza55a09a2018-07-06 13:30:30 +0200807 % if(0 && $haveSProfiles) {
Marc Kupietz384c9132018-03-19 16:45:24 +0100808 <div id="sprofilesdiv" style="width: 200px; padding-right: 10px;">
809 <table class="display compact nowrap" id="sprofiles">
810 <thead>
811 <tr>
812 <th align="right">cos</th><th align="left">similars by coll. profile</th>
813 </tr>
814 </thead>
815 <tbody>
816 <tr>
817 <td align="right">
818 </td>
819 <td></td>
820 </tr>
821 </tbody>
822 </table>
823 </div>
824 %}
Marc Kupietz81aeed22019-02-17 21:22:45 +0100825 <div id="second">
Marc Kupietz58270662017-12-04 12:10:06 +0100826 <div id="embed">
827 </div>
828 <div id="cost">
829 </div>
830 </div>
831 </div>
Marc Kupietz81aeed22019-02-17 21:22:45 +0100832 % } elsif($word !~ /^\s*$/) {
833 <div id="wrapper">
Marc Kupietz81aeed22019-02-17 21:22:45 +0100834 <script>
835 $( function() {
Marc Kupietzce6490b2019-12-06 11:05:40 +0100836 $( "<%== loc 'notfounddialog' %>").dialog({
Marc Kupietz81aeed22019-02-17 21:22:45 +0100837 autoOpen: true,
838 modal: true,
839 draggable: false,
840 height: "auto",
841 width: "auto",
842 resizable: false,
843 buttons: {
844 "OK": function() {
845 $( this ).dialog( "close" );
Marc Kupietzce6490b2019-12-06 11:05:40 +0100846 } /* ,
Marc Kupietz81aeed22019-02-17 21:22:45 +0100847 "Apply": function() {
848 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietzce6490b2019-12-06 11:05:40 +0100849 } */
Marc Kupietz81aeed22019-02-17 21:22:45 +0100850 }
851 });
852 });
853 </script>
Marc Kupietzce6490b2019-12-06 11:05:40 +0100854 <div id="not-found-dialog_de" style="display: none" title="Nicht gefunden">
855 <p>FEHLER: Konnte "<%= $word %>" nicht finden.</p>
856 <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>
857 </div>
858 <div id="not-found-dialog_en" style="display: none" title="Not found">
859 <p>ERROR: "<%= $word %>" not found in vocabluary.</p>
860 <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>
861 </div>
Marc Kupietz81aeed22019-02-17 21:22:45 +0100862 </div>
Marc Kupietz384c9132018-03-19 16:45:24 +0100863 % }
Marc Kupietz58270662017-12-04 12:10:06 +0100864 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100865 <div id="tabs-2" style="display: flex; padding: 5px; flex-flow: row wrap;">
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100866 % if(defined $word && $word ne "") {
867 <div id="som2" style="width: 800;">
868 <div id="sominfo1"><span id="somcolor1"> </span> <span id="somword1"> </span> <span id="somcolor2"> </span> <span id="somword2"> </span> <span id="somcolor3"> </span></div>
869 <div id="sominfo" style="text-align: right">SOM iteration <span id="iterations">0</span></div>
870 </div>
871 % }
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 Kupietz95104512019-12-05 10:13:05 +0100886 <th align="left"><%= loc 'collocate_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>
Marc Kupietz001bffd2019-02-21 08:52:41 +0100921 <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 +0100922 <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 +0100923 <th title="PMI³ restricted to left neighbour">l-PMI³</th>
924 <th title="PMI³ restricted to right neighbour">r-PMI³</th>
925 <th title="nPMI restricted to left neighbour">l-nPMI</th>
926 <th title="nPMI restricted to right neighbour">r-nPMI</th>
Marc Kupietz4784fae2019-02-04 12:32:12 +0100927 <th id="rawfreq_tt" title="raw frequency sum of collocation within window">raw</th>
Marc Kupietz95104512019-12-05 10:13:05 +0100928 <th><%= loc 'collocate_ca' %></th>
Marc Kupietzcd136e22018-01-29 09:18:12 +0100929 </tr>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100930 % }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100931 </thead>
932 <tbody>
933 <tr>
Marc Kupietz63b268f2019-01-22 22:34:29 +0100934 <td align="right"></td>
935 <td align="right"></td>
936 <td align="right"></td>
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100937 <td align="right"></td>
Marc Kupietz78d7c1a2019-02-17 22:31:22 +0100938 <td align="right"></td>
939 <td align="right"></td>
940 <td align="right"></td>
941 <td align="right"></td>
942 <td align="right"></td>
943 <td align="left"> </td>
944 <td align="right"></td>
945 <td align="right"></td>
946 <td align="right"></td>
947 <td align="right"></td>
948 <td align="left"> </td>
Marc Kupietze6a7a732018-01-12 09:21:08 +0100949 </tr>
950 </tbody>
951 </table>
952 </div>
Marc Kupietz384c9132018-03-19 16:45:24 +0100953 <!--
954 <div style="clear:both" ></div>
955 <div style="float: right; overflow: hidden" id="extra"><button onClick="showCollocatorSOM()"> </button></div>
956 -->
Marc Kupietz66bfd952017-12-11 09:59:45 +0100957 </div>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100958 <div id="tabs-4" style="display: flex; padding:5px; flex-flow: row wrap;">
959 <div id="info">
960 <h3><%== loc 'about' %></h3>
961 %= include(loc('abouttext'))
962 % if($training_args && (@$lists)[0]) {
963 <h3><%= loc 'training_parameters' %></h3>
964 % if($training_args =~ /-type\s*3/) {
965 <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>
966 <div class="mono"><%= $training_args %></div>
967 % } else {
968 <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>
969 <div class="mono"><%= $training_args %></div>
970 % }
Marc Kupietz2133bd12022-05-19 09:24:42 +0200971 % }
972 <h3>Source Code</h3>
973 <ul>
974 <li><a href="https://korap.ids-mannheim.de/gerrit/plugins/gitiles/ids-kl/dereko2vec">dereko2vec</a></li>
975 <li><a href="https://korap.ids-mannheim.de/gerrit/plugins/gitiles/ids-kl/derekovecs">derekovecs</a></li>
976 </ul>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100977 <h3><%== loc 'references' %></h3>
978 %= include 'references'
979 </div>
980 </div>
981 </div> <!-- tabs -->
Marc Kupietz58270662017-12-04 12:10:06 +0100982 </div> <!-- topwrapper -->
983 <div style="clear: both;"></div>
984 </div>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100985 <div class="footer">
986 <span class="footertext">
987 %= include(loc('footer'))
988 </span>
Marc Kupietzebea4702018-01-12 09:16:09 +0100989 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100990 </body>
Marc Kupietz83305222016-04-28 09:57:22 +0200991</html>