blob: 1d16c4cc0eb143a25d90cb7036fd2df7c04b0935 [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 Kupietzb3cd59f2026-08-21 10:47:45 +02006%# Result pages are computed for one word each and there is one for every
7%# word of the vocabulary, so they are not something to index or to follow.
8% if (stash 'noindex') {
9 <meta name="robots" content="noindex, nofollow">
10% }
Marc Kupietz80bd7b92017-07-04 16:25:54 +020011 <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
Marc Kupietz58270662017-12-04 12:10:06 +010012 <link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Condensed" rel="stylesheet">
Marc Kupietz42e6d092023-04-18 19:29:12 +020013 <script src="https://code.jquery.com/jquery-latest.min.js"></script>
Marc Kupietz898e5482024-02-20 15:03:07 +010014 <script src = "https://cdn.datatables.net/1.13.10/js/jquery.dataTables.min.js"></script>
Marc Kupietz5f532b32019-01-23 10:03:18 +010015 <script src = "https://cdn.datatables.net/fixedcolumns/3.2.5/js/dataTables.fixedColumns.min.js"></script>
Marc Kupietz898e5482024-02-20 15:03:07 +010016 <script src = "https://cdn.datatables.net/plug-ins/1.13.10/sorting/scientific.js"></script>
Marc Kupietz5f532b32019-01-23 10:03:18 +010017 <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML'></script>
Marc Kupietz898e5482024-02-20 15:03:07 +010018 <script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script>
19 <script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script>
20 <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
21 <script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script>
22
Marc Kupietz9ae184c2023-11-04 18:21:54 +010023 <script src="https://cdnjs.cloudflare.com/ajax/libs/ical.js/1.5.0/ical.js"
24 integrity="sha512-UxWd2RMDGpYwYuDeU2Fs+nd51gw4ZLQY0D9wWZ3NuanNSk6QQmWCZ6C+rvI0lJ/b/nZtBQ8RVESA9DN9r65dUg=="
25 crossorigin="anonymous" referrerpolicy="no-referrer"></script>
26 <script
27 src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment-with-locales.min.js"
28 integrity="sha512-42PE0rd+wZ2hNXftlM78BSehIGzezNeQuzihiBCvUEB3CVxHvsShF86wBWwQORNxNINlBPuq7rG4WWhNiTVHFg=="
29 crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Marc Kupietz898e5482024-02-20 15:03:07 +010030 <link rel="stylesheet" href="https://cdn.datatables.net/1.13.10/css/jquery.dataTables.min.css">
Marc Kupietz4949d232018-03-19 16:43:18 +010031 <link rel="stylesheet" href="/derekovecs/css/derekovecs.css">
Marc Kupietz80bd7b92017-07-04 16:25:54 +020032 <script
Marc Kupietz42e6d092023-04-18 19:29:12 +020033 src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
Marc Kupietze6a7a732018-01-12 09:21:08 +010034 integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
35 crossorigin="anonymous"></script>
Marc Kupietz80bd7b92017-07-04 16:25:54 +020036 <script>
Marc Kupietza0ffb392018-01-25 08:53:43 +010037 MathJax.Hub.Config({
38 config: ["MMLorHTML.js"],
39 jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML", "output/PreviewHTML"],
40 extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js", "fast-preview.js", "AssistiveMML.js", "a11y/accessibility-menu.js"],
41 TeX: {
42 extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
43 }
44 });
Marc Kupietz58270662017-12-04 12:10:06 +010045 var urlParams = new URLSearchParams(window.location.search);
Marc Kupietzb3a2e4f2017-12-08 17:25:53 +010046 var currentWords = urlParams.get("word");
Rainer Perkuhn06578a12024-07-31 16:12:40 +020047 var CIIsearchWords = (currentWords && (currentWords.includes(" ") || currentWords.includes("|")) ? '('+currentWords.replace(/[ |]+/g, " oder ")+')' : currentWords);
Marc Kupietz66bfd952017-12-11 09:59:45 +010048 var collocatorTable = null;
Marc Kupietz86b50292019-02-17 21:03:59 +010049 var plainTitle ="<%= $plain_title %>"
Marc Kupietz78d7c1a2019-02-17 22:31:22 +010050 var korapPath="/";
51 if (plainTitle.match(/-en/)) {
52 korapPath="/instance/english";
53 }
Marc Kupietz78230872019-08-02 15:15:25 +020054 var korapVC="";
55 if (plainTitle.match(/WUDD/i)) {
56 korapVC="&collection=corpusSigle+%3D+%2FW%5BDU%5DD17%2F";
57 korapPath="/instance/test";
58 }
59
Marc Kupietz58270662017-12-04 12:10:06 +010060 $(document).ready(function() {
Marc Kupietz3576c622023-11-05 08:51:58 +010061 insertCalendarEvents(document.getElementById('downtimes'), '/derekovecs/getDowntimeCalendar' );
Marc Kupietz694610d2017-11-25 18:30:03 +010062
Marc Kupietza0ffb392018-01-25 08:53:43 +010063 $('#firstable').hide();
64 //Set up a callback to hear back when MathJax is done rendering the equations
65 // it finds
66 $('#ccd').load(
67 '@Url.Action("ActionResultMethod","ControllerName",{controller parameters})',
68 function () {
69 MathJax.Hub.Queue(
70 ["Typeset",MathJax.Hub,"ccd"],
Marc Kupietz95977002019-02-26 09:09:59 +010071 function () {
Marc Kupietz7bd55232019-01-22 15:29:06 +010072 $("#mi_tt").attr("title",$("#pmi_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010073 $("#lfmd_tt").attr("title",$("#lfmd_ttt").html());
Marc Kupietz7bd55232019-01-22 15:29:06 +010074 $("#md_tt").attr("title",$("#md_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010075 $("#npmi_tt").attr("title",$("#npmi_ttt").html());
Marc Kupietzf19814b2019-01-21 16:50:19 +010076 $("#ll_tt").attr("title",$("#ll_ttt").html());
Marc Kupietz7bd55232019-01-22 15:29:06 +010077 $("#logdice_tt").attr("title",$("#logdice_ttt").html());
Marc Kupietz63b268f2019-01-22 22:34:29 +010078 $("#logdiceaf_tt").attr("title",$("#logdiceaf_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010079 }
80 );
81 });
82
83 //set things up so that we can shove raw html into what is shown in the tooltip;
84 // in this case, we will have already put into the title attribute the html that
85 // contains the MathJax rendered equations (via what we do in the callback).
86 $(function () {
87 $(document).tooltip({
88 content: function () {
89 return $(this).prop('title');
90 }
91 });
92 });
93
Marc Kupietze6a7a732018-01-12 09:21:08 +010094 $("input").bind("keydown", function(event) {
95 // track enter key
96 var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
97 if (keycode == 13) { // keycode for enter key
98 // force the 'Enter Key' to implicitly click the Update button
99 document.getElementById('SEARCH').click();
100 return false;
101 } else {
102 return true;
103 }});
Marc Kupietzdab9f222017-11-29 14:22:59 +0100104
Marc Kupietze871abd2018-01-25 16:18:27 +0100105 var collocatorTable_activated = false;
Marc Kupietze6a7a732018-01-12 09:21:08 +0100106 $( "#tabs" ).on( "tabsactivate", function( event, ui ) {
107 if (localStorage) localStorage['tab'] = ui.newTab.index();
Marc Kupietzd7760b42019-02-21 09:01:44 +0100108 if(ui.newTab.index() == 3 && !collocatorTable_activated) {
Marc Kupietze871abd2018-01-25 16:18:27 +0100109 classicCollocatorTable.columns.adjust();
110 collocatorTable.columns.adjust();
111 collocatorTable_activated = true;
112 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100113 });
114
115 $(function(){
116 $("#SEARCH").click(function() {
117 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietz58270662017-12-04 12:10:06 +0100118 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100119 });
Marc Kupietz0af83e32017-11-27 09:31:37 +0100120
Marc Kupietze6a7a732018-01-12 09:21:08 +0100121 function changeCharColor(txt, heat, word) {
122 var newText = "";
123 for (var i=0, l=txt.length; i<l; i++) {
Marc Kupietz49c5cf02024-08-06 10:30:44 +0200124 newText += (i == 5 ? txt.charAt(i) : "<a href=\"<%= $korap_url %>" + korapPath + '/?ql=cosmas2&q=' +
Marc Kupietze6a7a732018-01-12 09:21:08 +0100125 CIIsearchWords + ' /' + (i > 5? '%2B' : '-') + 'w' +
Rainer Perkuhne58a7492024-07-30 15:17:52 +0200126 Math.abs(i-5) + ':' + Math.abs(i-5) + ',s0 ' + word + korapVC +
Marc Kupietze6a7a732018-01-12 09:21:08 +0100127 '" target="korap"><span style="background-color:' +
128 getHeatColor(heat[i]/maxHeat)+'">'+txt.charAt(i)+'</span></a>');
Marc Kupietzb6c615d2017-12-02 10:38:20 +0100129 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100130 return newText;
131 }
Marc Kupietzb6c615d2017-12-02 10:38:20 +0100132
Marc Kupietze6a7a732018-01-12 09:21:08 +0100133 function getHeatColor(value) {
134 var hue=((1-value)*120).toString(10);
135 return ["hsl(",hue,",90%,70%)"].join("");
136 }
137
138 function bitvec2window(n, heat, word) {
139 var str = n.toString(2).padStart(10, "0")
140 .replace(/^([0-9]{5})/, '$1x')
141 .replace(/0/g, '·')
142 .replace(/1/g, '+');
143 return changeCharColor(str, heat, word);
144 }
145
146 % use Mojo::ByteStream 'b';
147 var paraResults = <%= b(Mojo::JSON::to_json($lists)) %>;
148 var urlprefix = new URLSearchParams(window.location.search);
149 if (paraResults.length > 0 && paraResults[0] != null) {
150 var nvecs = [],
151 nwords = [],
152 nranks = [],
153 nmarked = [];
154 for(var i = 0; i < paraResults.length; i++) {
155 nwords = nwords.concat(paraResults[i].map(function(a){return a.word;}));
156 nvecs = nvecs.concat(paraResults[i].map(function(a){return a.vector;}));
157 nranks = nranks.concat(paraResults[i].map(function(a){return a.rank;}));
158 nmarked = nmarked.concat(paraResults[i].map(function(a){return a.marked;}));
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100159 }
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100160 showMap({target: " "+urlParams.get('word')+" ", mergedEnd: <%= $mergedEnd %>, words: nwords, vecs: nvecs, ranks: nranks, marked: nmarked} );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100161 var t = $('#firsttable').DataTable({
Marc Kupietzee894d52019-01-09 14:55:14 +0100162 data: [].concat.apply([], paraResults),
Marc Kupietze6a7a732018-01-12 09:21:08 +0100163 "sScrollY": "780px",
164 "bScrollCollapse": true,
165 "bPaginate": false,
166 "bJQueryUI": true,
Marc Kupietz898e5482024-02-20 15:03:07 +0100167 "dom": '<"top">rt<"bottom"flpB><"clear">',
168 buttons: [
169 { extend: 'copyHtml5', text: '<i class="fa fa-files-o"></i>', titleAttr: 'Copy' },
170 { extend: 'csvHtml5', text: '<i class="fa fa-file-text-o"></i>', titleAttr: 'CSV', filename: currentWords+'_para_neighbours' },
171 { extend: 'excelHtml5', text: '<i class="fa fa-file-excel-o"></i>', titleAttr: 'Excel', filename: currentWords+'_para_neighbours', exportOptions: { columns: ':visible' } ,
172 }
173 ],
Marc Kupietz384c9132018-03-19 16:45:24 +0100174 "initComplete":function(settings, json) {
175 $('td.paradigmator a').on('mousedown', function(e) {
Marc Kupietz86b50292019-02-17 21:03:59 +0100176 return paradigmatorClick(e, paraResults[0][0].word, this.childNodes["0"].textContent);
Marc Kupietz384c9132018-03-19 16:45:24 +0100177 });
178 },
Marc Kupietze6a7a732018-01-12 09:21:08 +0100179 "columns": [
180 { "data": "rank", type: "allnumeric" },
181 { "data": "dist", render: function ( data, type, row ) {return data.toFixed(3) }},
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100182 { "data": "word", class: "paradigmator", render: function ( data, type, row ) {
183 urlprefix.set("word", data); return '<a class="' + getMergedClass(row.rank) + '" href="?' + urlprefix + '">' + data + '</a>'
184 }}
Marc Kupietze6a7a732018-01-12 09:21:08 +0100185 ],
186 "columnDefs": [
187 { className: "dt-right", "targets": [0,1] },
188 { "searchable": false,
189 "orderable": false,
190 "targets": 0
191 },
192 { "orderSequence": [ "desc" ], "targets": [ 1 ] },
193 { "orderSequence": [ "asc", "desc" ], "targets": [ 2 ] },
194 ],
195 "oLanguage": {
196 "sSearch": "Filter: "
197 },
198 "order": [[ 1, 'desc' ]],
199 } );
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100200
Marc Kupietze6a7a732018-01-12 09:21:08 +0100201 t.on( 'order.dt search.dt', function () {
202 t.column(0, {order:'applied'}).nodes().each( function (cell, i) {
203 cell.innerHTML = i+1;
204 } );
205 } ).draw();
206
207 $( "#first" ).clone().prependTo( "#tabs-2" );
208
209 }
210
211
212 var collocatorData = <%= b(Mojo::JSON::to_json($collocators)) %>;
213 var maxHeat; // = Math.max.apply(Math,collocatorData.map(function(o){return o.cprob;}))
214
Marc Kupietzcddc8482019-12-04 08:57:33 +0100215 if(typeof data !== 'undefined' && data.mergedEnd > 0) {
Marc Kupietz78230872019-08-02 15:15:25 +0200216 vocabDistanceTable = makeVocabDistanceTable("#vocabdistt", baseURL);
217 }
Marc Kupietzd7760b42019-02-21 09:01:44 +0100218
Marc Kupietze6a7a732018-01-12 09:21:08 +0100219 if (collocatorData != null) {
220 maxHeat = Math.max.apply(Math,collocatorData.map(function(o){return Math.max.apply(Math,o.heat);}))
221 collocatorTable = $('#secondtable').DataTable({
222 data: collocatorData,
223 "sScrollY": "780px",
224 "bScrollCollapse": true,
225 "bPaginate": false,
226 "bJQueryUI": true,
Marc Kupietz898e5482024-02-20 15:03:07 +0100227 "dom": '<"top">rt<"bottom"flpB><"clear">',
228 buttons: [
229 { extend: 'copyHtml5', text: '<i class="fa fa-files-o"></i>', titleAttr: 'Copy' },
230 { extend: 'csvHtml5', text: '<i class="fa fa-file-text-o"></i>', titleAttr: 'CSV', filename: currentWords+'_syn_neighbours' },
231 { extend: 'excelHtml5', text: '<i class="fa fa-file-excel-o"></i>', titleAttr: 'Excel', filename: currentWords+'_syn_neighbours', exportOptions: { columns: ':visible' } ,
232 }
233 ],
234 "columns": [
Marc Kupietze6a7a732018-01-12 09:21:08 +0100235 { "data": "rank", type: "allnumeric" },
236 { "data": "pos", width: "7%", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitvec2window(data, row.heat, row.word) }},
237 { "data": "max", render: function ( data, type, row ) {return data.toFixed(3) }},
238 { "data": "average", render: function ( data, type, row ) {return data.toFixed(3) }},
239 { "data": "prob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
240 { "data": "cprob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
241 { "data": "overall", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
242 { "data": "word", sClass: "collocator" },
243 { "data": "rank", type: "allnumeric" }
244 ],
245 "columnDefs": [
246 { className: "dt-right", "targets": [0,2,3,4,5,6] },
247 { className: "dt-center", "targets": [ 1] },
248 { "searchable": false,
249 "orderable": false,
250 "targets": [0, 8]
251 },
252 { "type": "scientific", targets: [2,3,4,5,6] },
253 { "orderSequence": [ "desc" ], "targets": [ 2, 3, 4, 5, 6 ] },
254 { "orderSequence": [ "asc", "desc" ], "targets": [ 1, 7 ] },
255 { "targets": [8], "visible": false }
256 ],
257 "oLanguage": {
258 "sSearch": "Filter: "
259 },
260 "order": [[ 4, 'desc' ]],
261 } );
262 $.ajaxSetup({
263 type: 'POST',
264 timeout: 30000,
265 error: function(xhr) {
266 $('#display_error')
267 .html('Error: ' + xhr.status + ' ' + xhr.statusText);
268 }
Marc Kupietz78b434a2018-01-12 22:33:32 +0100269 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100270
Marc Kupietz384c9132018-03-19 16:45:24 +0100271
272 if($('#sprofiles').length) {
273 similarProfileTable = $('#sprofiles').DataTable({
274 ajax: {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100275 method: "GET",
Marc Kupietz384c9132018-03-19 16:45:24 +0100276 url: '/derekovecs/getSimilarProfiles',
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100277 dataType: 'json',
278 dataSrc: "",
279 timeout: 30000,
280 data: { w: paraResults[0][0].rank }
Marc Kupietz384c9132018-03-19 16:45:24 +0100281 },
282 "initComplete":function(settings, json){
283 $('td.paradigmator a').on('mousedown', function(e) {
284 if (e.which === 2) {
285 e.preventDefault();
286 queryKorAPalternatives(paraResults[0][0].word, this.childNodes["0"].textContent);
287 return false;
288 }
289 });
290 },
291 "sScrollY": "780px",
292 "bScrollCollapse": true,
293 "bPaginate": false,
294 "bJQueryUI": true,
295 "dom": '<"top">rt<"bottom"flp><"clear">',
Marc Kupietz898e5482024-02-20 15:03:07 +0100296 "columns": [
Marc Kupietz384c9132018-03-19 16:45:24 +0100297 { "data": "v", render: function ( data, type, row ) {return data.toFixed(3) }},
298 { "data": "w", sClass: "paradigmator", render: function ( data, type, row ) {urlprefix.set("word", data); return '<a href="?' + urlprefix + '">' + data + '</a>' } }
299 ],
300 "columnDefs": [
301 { className: "dt-right", "targets": [0] },
302 ],
303 "oLanguage": {
304 "sSearch": "Filter: "
305 },
306 "order": [[ 0, 'desc' ]],
307 });
308 }
Marc Kupietzd7760b42019-02-21 09:01:44 +0100309
Marc Kupietz384c9132018-03-19 16:45:24 +0100310 // var filterQuot = /(^quot?=[A-Z])|(quot$)/g;
311 var filterQuot = /^quot/;
Marc Kupietz4784fae2019-02-04 12:32:12 +0100312 var ccResult;
Marc Kupietz86b50292019-02-17 21:03:59 +0100313 var baseURL = window.location.pathname.replace(/[/]$/, '')
Marc Kupietz95977002019-02-26 09:09:59 +0100314 classicCollocatorTable = makeClassicCollocatorTable('#classicoloctable', baseURL, paraResults[0][0].rank)
Marc Kupietze6a7a732018-01-12 09:21:08 +0100315
Marc Kupietz1acb3172018-02-17 09:41:26 +0100316 $('#show-details').change(function (e) {
317 var columns = classicCollocatorTable.columns(".detail");
318 if(this.checked) {
319 columns.visible(true);
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100320 $("#ccd").css('width', 'auto');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100321 } else {
322 columns.visible(false);
Marc Kupietz08bfd402019-01-23 10:05:17 +0100323 $("#ccd").css('width', '680px');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100324 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100325 classicCollocatorTable.columns.adjust().draw();
Marc Kupietz1acb3172018-02-17 09:41:26 +0100326 } );
327
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100328 $("td.collocator").click(function(){
Rainer Perkuhnd5010ec2024-07-30 14:38:25 +0200329 queryKorAPCII(this.textContent + " /w1:5,s0 " + CIIsearchWords);
Marc Kupietzad783722018-01-13 17:45:21 +0100330 });
331
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100332 collocatorTable.on( 'order.dt search.dt', function () {
333 collocatorTable.column(0, {order:'applied'}).nodes().each( function (cell, i) {
334 cell.innerHTML = i+1;
335 } );
336 }).draw();
337 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100338
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100339 if (localStorage && !window.location.hash) { // let's not crash if some user has IE7
340 var index = parseInt(localStorage['tab']||'0');
341 $("#tabs").tabs({ active: index });
342 }
343 $("#tabs").css("visibility", "visible"); // now we can show the tabs
344 });
Marc Kupietz58270662017-12-04 12:10:06 +0100345
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100346 $(function(){
347 $("#dropdownoptions").dialog({
Marc Kupietz95104512019-12-05 10:13:05 +0100348 title: "<%= loc 'Options' %>",
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100349 autoOpen: false,
350 modal: false,
351 draggable: false,
352 height: "auto",
353 width: "auto",
354 resizable: false,
355 buttons: {
Marc Kupietz95104512019-12-05 10:13:05 +0100356 "<%= loc 'Cancel'%>": function() {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100357 $( this ).dialog( "close" );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100358 },
Marc Kupietz95104512019-12-05 10:13:05 +0100359 "<%= loc 'Apply' %>": function() {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100360 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietze6a7a732018-01-12 09:21:08 +0100361 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100362 }
363 });
364 });
365
366 $(function(){
367 $("#showoptions").click(function(){
368 $("#dropdownoptions").dialog("open");
369 var target = $(this);
370 $("#dropdownoptions").dialog("widget").position({
371 my: 'left bottom',
372 at: 'left bottom',
373 of: target
Marc Kupietz58270662017-12-04 12:10:06 +0100374 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100375 });
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100376 });
377
378 $( function() {
379 $( "#no_iterations" ).spinner({
380 spin: function( event, ui ) {
381 if ( ui.value < 1000 ) {
382 $( this ).spinner( "value", 1000 );
383 return false;
384 } else if ( ui.value > 10000 ) {
385 $( this ).spinner( "value", 10000 );
386 return false;
387 }
388 }
389 });
390 } );
391
392 $( function() {
393 $( "#neighbours" ).spinner({
394 spin: function( event, ui ) {
395 if ( ui.value < 0 ) {
396 $( this ).spinner( "value", 0 );
397 return false;
398 } else if ( ui.value > 200 ) {
399 $( this ).spinner( "value", 200 );
400 return false;
401 }
402 }
403 });
404 } );
405
406 $( function() {
407 $( "#cutoff" ).spinner({
408 spin: function( event, ui ) {
409 if ( ui.value < 100000 ) {
410 $( this ).spinner( "value", 100000 );
411 return false;
412 } else if ( ui.value > 2000000 ) {
413 $( this ).spinner( "value", 2000000 );
414 return false;
415 }
416 }
417 });
418 } );
419
420 $( function() {
421 $( "#tabs" ).tabs().addClass('tabs-min');
422 } );
423
424 $( function() {
425 $( ".controlgroup-vertical" ).controlgroup({
426 "direction": "vertical"
427 });
428 } );
429
430 $(function() {
431 $( document ).tooltip({
432 content: function() {
433 return $(this).attr('title');
434 }}
435 )
436 });
437
438 $(function () {
439 $(document).tooltip({
440 content: function () {
441 return $(this).prop('title');
442 },
443 show: null,
444 close: function (event, ui) {
445 ui.tooltip.hover(
446 function () {
447 $(this).stop(true).fadeTo(400, 1);
448 },
449 function () {
450 $(this).fadeOut("400", function () {
451 $(this).remove();
452 })
453 });
454 }
455 });
456 });
Marc Kupietz83305222016-04-28 09:57:22 +0200457 </script>
Marc Kupietz58270662017-12-04 12:10:06 +0100458 <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
Marc Kupietz68e29be2023-11-04 18:37:35 +0100459 <script src="/derekovecs/js/calendar-events.js"></script>
Marc Kupietz58270662017-12-04 12:10:06 +0100460 <script src="/derekovecs/js/tsne.js"></script>
461 <script src="/derekovecs/js/som.js"></script>
462 <script src="/derekovecs/js/labeler.js"></script>
Marc K20476c72021-03-11 12:18:01 +0100463 <script src="/derekovecs/js/derekovecs.js"></script>
Marc Kupietz83305222016-04-28 09:57:22 +0200464 <script>
465
466 var opt = {epsilon: <%= $epsilon %>, perplexity: <%= $perplexity %>},
Marc Kupietz58270662017-12-04 12:10:06 +0100467 mapWidth = 800, // width map
468 mapHeight = 800,
469 jitterRadius = 7;
Marc Kupietz83305222016-04-28 09:57:22 +0200470
471 var T = new tsnejs.tSNE(opt); // create a tSNE instance
472
473 var Y;
474
475 var data;
476 var labeler;
477
478 function applyJitter() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100479 svg.selectAll('.tsnet')
480 .data(labels)
481 .transition()
482 .duration(50)
483 .attr("transform", function(d, i) {
484 T.Y[i][0] = (d.x - mapWidth/2 - tx)/ss/20;
485 T.Y[i][1] = (d.y - mapHeight/2 - ty)/ss/20;
486 return "translate(" +
Marc Kupietz78230872019-08-02 15:15:25 +0200487 (d.x) + "," +
488 (d.y) + ")";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100489 });
Marc Kupietz83305222016-04-28 09:57:22 +0200490 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100491
Marc Kupietz83305222016-04-28 09:57:22 +0200492 function updateEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100493 var Y = T.getSolution();
494 svg.selectAll('.tsnet')
495 .data(data.words)
496 .attr("transform", function(d, i) {
497 return "translate(" +
Marc Kupietz78230872019-08-02 15:15:25 +0200498 ((Y[i][0]*20*ss + tx) + mapWidth/2) + "," +
499 ((Y[i][1]*20*ss + ty) + mapHeight/2) + ")"; });
Marc Kupietz83305222016-04-28 09:57:22 +0200500 }
501
502 var svg;
503 var labels = [];
504 var anchor_array = [];
505 var text;
506
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100507 function getMergedClass(i) {
Marc Kupietzd7760b42019-02-21 09:01:44 +0100508 if(typeof data !== 'undefined' && i > data.mergedEnd) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100509 return " merged"
510 } else {
511 return "";
512 }
513 }
514
515 function getRankTooltip(i) {
516 if(data.mergedEnd) {
517 if(data.ranks[i] < data.mergedEnd) {
518 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
519 } else {
520 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]-data.mergedEnd).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " (merged vocab)";
521 }
522 } else {
523 return "rank: "+i +" "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
524 }
525 }
526
Marc Kupietz83305222016-04-28 09:57:22 +0200527 function drawEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100528 var urlprefix = new URLSearchParams(window.location.search);
529 urlprefix.delete("word");
530 urlprefix.append("word","");
Marc Kupietz8f9c86a2017-12-04 17:17:13 +0100531
Marc Kupietze6a7a732018-01-12 09:21:08 +0100532 $("#embed").empty();
533 var div = d3.select("#embed");
Marc Kupietz34c08172017-11-29 17:08:47 +0100534
Marc Kupietze6a7a732018-01-12 09:21:08 +0100535 // get min and max in each column of Y
536 var Y = T.Y;
Marc Kupietz34c08172017-11-29 17:08:47 +0100537
Marc Kupietze6a7a732018-01-12 09:21:08 +0100538 svg = div.append("svg") // svg is global
539 .attr("width", mapWidth)
540 .attr("height", mapHeight);
Marc Kupietz34c08172017-11-29 17:08:47 +0100541
Marc Kupietze6a7a732018-01-12 09:21:08 +0100542 var g = svg.selectAll(".b")
543 .data(data.words)
544 .enter().append("g")
545 .attr("class", "tsnet");
Marc Kupietz34c08172017-11-29 17:08:47 +0100546
Marc Kupietze6a7a732018-01-12 09:21:08 +0100547 g.append("a")
548 .attr("xlink:href", function(word) {
549 return "?"+urlprefix+word; })
550 .attr("class", function(d, i) {
551 var res="";
552 if(data.marked[i]) {
553 res="marked ";
554 }
555 if(data.target.indexOf(" "+d+" ") >= 0) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100556 res += "target";
557 }
558 if(data.mergedEnd && data.ranks[i] >= data.mergedEnd) {
559 return res+" merged";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100560 } else {
561 return res;
562 }
563 })
564 .attr("title", function(d, i) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100565 return getRankTooltip(i);
Marc Kupietze6a7a732018-01-12 09:21:08 +0100566 })
567 .append("text")
568 .attr("text-anchor", "top")
569 .attr("font-size", 12)
570 .text(function(d) { return d; });
Marc Kupietz34c08172017-11-29 17:08:47 +0100571
Marc Kupietz384c9132018-03-19 16:45:24 +0100572 g.append("svg:title")
573 .text(function(d, i) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100574 return getRankTooltip(i);
Marc Kupietz384c9132018-03-19 16:45:24 +0100575 });
576
Marc Kupietze6a7a732018-01-12 09:21:08 +0100577 var zoomListener = d3.behavior.zoom()
578 .scaleExtent([0.1, 10])
579 .center([0,0])
580 .on("zoom", zoomHandler);
581 zoomListener(svg);
Marc Kupietz83305222016-04-28 09:57:22 +0200582 }
583
584 var tx=0, ty=0;
585 var ss=1;
586 var iter_id=-1;
587
588 function zoomHandler() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100589 tx = d3.event.translate[0];
590 ty = d3.event.translate[1];
591 ss = d3.event.scale;
592 updateEmbedding();
Marc Kupietz83305222016-04-28 09:57:22 +0200593 }
594
595 var stepnum = 0;
596
597 function stopStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100598 clearInterval(iter_id);
599 text = svg.selectAll("text");
Marc Kupietz34c08172017-11-29 17:08:47 +0100600
Marc Kupietze6a7a732018-01-12 09:21:08 +0100601 // jitter function needs different data and co-ordinate representation
602 labels = d3.range(data.words.length).map(function(i) {
603 var x = (T.Y[i][0]*20*ss + tx) + mapWidth/2;
604 var y = (T.Y[i][1]*20*ss + ty) + mapHeight/2;
605 anchor_array.push({x: x, y: y, r: jitterRadius});
606 return {
607 x: x,
608 y: y,
609 name: data.words[i]
610 };
611 });
Marc Kupietz34c08172017-11-29 17:08:47 +0100612
Marc Kupietze6a7a732018-01-12 09:21:08 +0100613 // get the actual label bounding boxes for the jitter function
614 var index = 0;
615 text.each(function() {
616 labels[index].width = this.getBBox().width;
617 labels[index].height = this.getBBox().height;
618 index += 1;
619 });
Marc Kupietz83305222016-04-28 09:57:22 +0200620
Marc Kupietz34c08172017-11-29 17:08:47 +0100621
Marc Kupietze6a7a732018-01-12 09:21:08 +0100622 // setTimeout(updateEmbedding, 1);
623 // setTimeout(
624 labeler = d3.labeler()
625 .label(labels)
626 .anchor(anchor_array)
627 .width(mapWidth)
628 .height(mapHeight)
629 .update(applyJitter);
630 // .start(1000);
Marc Kupietz83305222016-04-28 09:57:22 +0200631
Marc Kupietze6a7a732018-01-12 09:21:08 +0100632 iter_id = setInterval(jitterStep, 1);
Marc Kupietz83305222016-04-28 09:57:22 +0200633 }
634
635 var jitter_i=0;
636
637 function jitterStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100638 if(jitter_i++ > 100) {
639 clearInterval(iter_id);
640 } else {
641 labeler.start2(10);
642 applyJitter();
643 }
Marc Kupietz83305222016-04-28 09:57:22 +0200644 }
645
646 var last_cost=1000;
647
648 function step() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100649 var i = T.iter;
Marc Kupietz34c08172017-11-29 17:08:47 +0100650
Marc Kupietze6a7a732018-01-12 09:21:08 +0100651 if(i > <%= $no_iterations %>) {
652 stopStep();
653 } else {
654 var cost = Math.round(T.step() * 100000) / 100000; // do a few steps
655 $("#cost").html("tsne iteration " + i + ", cost: " + cost.toFixed(5));
656 if(i % 250 == 0 && cost >= last_cost) {
657 stopStep();
Marc Kupietz58270662017-12-04 12:10:06 +0100658 } else {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100659 last_cost = cost;
660 updateEmbedding();
Marc Kupietz58270662017-12-04 12:10:06 +0100661 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100662 }
Marc Kupietz83305222016-04-28 09:57:22 +0200663 }
664
665 function showMap(j) {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100666 data=j;
667 T.iter=0;
668 iter_id = -1;
669 last_cost=1000;
670 T.initDataRaw(data.vecs); // init embedding
671 drawEmbedding(); // draw initial embedding
Marc Kupietz78114532017-11-29 17:00:16 +0100672
Marc Kupietze6a7a732018-01-12 09:21:08 +0100673 if(iter_id >= 0) {
674 clearInterval(iter_id);
675 }
676 //T.debugGrad();
677 iter_id = setInterval(step, 1);
678 if(true) { // (<%= $show_som %>) {
679 makeSOM(j, <%= $no_iterations %>);
680 }
Marc Kupietz83305222016-04-28 09:57:22 +0200681 }
Marc Kupietz39179ab2017-07-04 16:28:06 +0200682 var queryword;
683
Marc Kupietz66bfd952017-12-11 09:59:45 +0100684 function showCollocatorSOM() {
Marc Kupietz86b50292019-02-17 21:03:59 +0100685 var baseURL = window.location.pathname.replace(/[/]$/, '')
Marc Kupietze6a7a732018-01-12 09:21:08 +0100686 if (collocatorTable) {
687 var ctableData = collocatorTable.rows().data();
688 var nwords = [],
689 nranks = [];
690 for (var i=0; i < ctableData.length && i < 100; i++) {
691 nranks.push(ctableData[i].rank);
692 nwords.push(ctableData[i].word);
Marc Kupietz66bfd952017-12-11 09:59:45 +0100693 }
Marc Kupietz86b50292019-02-17 21:03:59 +0100694 $.post(baseURL+'/getVecsByRanks',
Marc Kupietze6a7a732018-01-12 09:21:08 +0100695 JSON.stringify(nranks),
696 function(data, status){
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100697 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 +0100698 }, 'json');
699 }
Marc Kupietz66bfd952017-12-11 09:59:45 +0100700 }
701
Marc Kupietz39179ab2017-07-04 16:28:06 +0200702 function onload() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100703 queryword = document.getElementById('word');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200704 }
705
706 function queryKorAP() {
Marc Kupietz49c5cf02024-08-06 10:30:44 +0200707 window.open("<%= $korap_url %>" + korapPath + '?q='+queryword.value+korapVC, 'KorAP');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200708 }
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100709
710 function queryKorAPCII(query) {
Marc Kupietz49c5cf02024-08-06 10:30:44 +0200711 window.open("<%= $korap_url %>" +korapPath + '?ql=cosmas2&q='+query+korapVC, 'KorAP');
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100712 }
Marc Kupietz49c5cf02024-08-06 10:30:44 +0200713
Marc Kupietz83305222016-04-28 09:57:22 +0200714 </script>
715 </head>
Marc Kupietz7b0e5de2019-01-31 12:49:32 +0100716 <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>
717 <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>
718 <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>
719 <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>
720 <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>
721 <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>
722 <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>
Marc Kupietz1e00eb82026-09-04 16:38:30 +0200723 <div style="display:none;" id="logdiceaf_ttt">Log-Dice using "auto-focus", i.e. the highest value reached by any – not necessarily contiguous – selection \(S\) of positions: $$\max_S \left(14 + \log_2 \frac{2f_{1,2}(S)}{f_2 + f_1|S|}\right)$$ Dividing by the width of the selection makes the measure sensitive to how concentrated a pair is, which is what distinguishes actual collocations from words that merely occur in the same contexts. Note that LDaf is therefore not on the same scale as LD and can be higher or lower than it.</div>
Marc Kupietz6d7462c2019-12-05 10:16:38 +0100724 <div id="ids_logo">
725 <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>
726 </div>
727 <div id="header">
Marc Kupietz58270662017-12-04 12:10:06 +0100728 <div id="pagetitle">
Marc Kupietzc053d972019-01-10 10:41:51 +0100729 <h1>DeReKoVecs</h1>
730 <h2><%== $title %></h2>
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100731 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100732 <div id="options" class="widget">
733 <form id="queryform">
Marc Kupietz95104512019-12-05 10:13:05 +0100734 <input id="word" type="text" name="word" placeholder="<%= loc 'words_to_be_searched' %>" value="<%= $word %>"
735 title="<%= loc 'search_description' %>"/>
736 <input id="SEARCH" type="button" value="<%= loc 'SEARCH' %>">
737 <input type="button" id="showoptions" name="showoptions" value="<%= loc 'Options' %>" />
Marc Kupietz58270662017-12-04 12:10:06 +0100738 </form>
739 <div id="dropdownoptions" style="display: none">
740 <form id="optionsform">
741 <div class="controlgroup-vertical">
742 <label for="cutoff">cut-off</label>
743 <input id="cutoff" type="text" name="cutoff" size="10" value="<%= $cutoff %>" title="Only consider the most frequent x word forms.">
744 <label for="dedupe">dedupe</label>
745 <input id="dedupe" type="checkbox" name="dedupe" value="1" <%= ($dedupe ? "checked" : "") %> title="radically filter out any near-duplicates">
746 % if($mergedEnd > 0) {
747 <label for="sbf">backw.</label>
748 <input id="sbf" type="checkbox" name="sbf" value="1" <%= ($searchBaseVocabFirst ? "checked" : "") %> title="If checkecked base vocabulary will be searched first. Otherwise merged vocabulray will be searched first.">
749 % }
750 <label for="neighbours">max. neighbours:</label>
751 <input id="neighbours" size="4" name="n" value="<%= $no_nbs %>">
752 <label for="no_iterations">max. iterations</label>
753 <input id="no_iterations" name="N" size="4" value="<%= $no_iterations %>">
754 <!-- <label for="dosom">SOM</label>
755 <input id="dosom" type="checkbox" name="som" value="1" <%= ($show_som ? "checked" : "") %>> -->
756 % if($collocators) {
757 <label for="sortby">window/sort</label>
758 <select id="sortby" name="sort">
759 <option value="0" <%= ($sort!=1 && $sort!=2? "selected":"") %>>auto focus</option>
760 <!-- <option value="1" <%= ($sort==1? "selected":"") %>>any single position</option>
761 <option value="2" <%= ($sort==2? "selected":"") %>>whole window</option> -->
762 </select>
763 % }
764 <input type="button" value="→ KorAP" onclick="queryKorAP();" title="query word with KorAP"/>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100765 <input id="show-details" type="checkbox" name="show-details" value="1" >
766 <label for="show-details">
767 Show details
768 </label>
Marc Kupietz58270662017-12-04 12:10:06 +0100769 </div>
770 </form>
771 </div>
772 </div>
773 </div>
774 <div id="topwrapper">
775 <div style="visibility: hidden;" id="tabs">
776 <ul>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100777 % if (defined $word && $word ne '') {
778 % if($mergedEnd && $distantWords) {
779 <li><a href="#tabs-0" title="Cos offsets of the words furthest away from their position in the reference corpus."">Offsets</a></li>
780 % }
781 <li><a href="#tabs-1"><%= loc 'paradigmatic_tsne' %></a></li>
782 <li><a href="#tabs-2"><%= loc 'paradigmatic_som' %></a></li>
783 <li><a href="#tabs-3"><%= loc 'syntagmatic' %></a></li>
Marc Kupietzd7760b42019-02-21 09:01:44 +0100784 % }
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100785 <li><a href="#tabs-4">Info</a></li>
Marc Kupietz58270662017-12-04 12:10:06 +0100786 </ul>
Marc Kupietzb6514dc2019-06-26 11:47:56 +0200787 % if($mergedEnd && $distantWords) {
Marc Kupietzd7760b42019-02-21 09:01:44 +0100788 <div id="tabs-0" style="display: flex; padding: 5px; flex-flow: row wrap;">
789 <div id="vocabdist" style="width: 230px; margin-bottom: 15px;">
790 <table class="display compact nowrap" id="vocabdistt">
791 <thead>
792 <tr>
Marc Kupietz95977002019-02-26 09:09:59 +0100793 <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 +0100794 </tr>
795 </thead>
796 <tbody>
797 <tr>
798 <td align="right">
Marc Kupietz95977002019-02-26 09:09:59 +0100799 </td>
Marc Kupietzd7760b42019-02-21 09:01:44 +0100800 <td align="right">
801 </td>
802 <td></td>
803 </tr>
804 </tbody>
805 </table>
806 </div>
807 </div>
Marc Kupietzb6514dc2019-06-26 11:47:56 +0200808 % }
Marc Kupietz384c9132018-03-19 16:45:24 +0100809 <div id="tabs-1" style="display: flex; padding: 5px; flex-flow: row wrap;">
Marc Kupietz58270662017-12-04 12:10:06 +0100810 % if($lists && (@$lists) > 0 && (@$lists)[0]) {
811 <div id="wrapper">
Marc Kupietz384c9132018-03-19 16:45:24 +0100812 <div id="first" style="width: 230px; margin-bottom: 15px;">
Marc Kupietz58270662017-12-04 12:10:06 +0100813 <table class="display compact nowrap" id="firsttable">
814 <thead>
815 <tr>
Marc Kupietz95977002019-02-26 09:09:59 +0100816 <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 +0100817 </tr>
818 </thead>
819 <tbody>
820 <tr>
821 <td align="right">
822 </td>
823 <td align="right">
824 </td>
825 <td></td>
826 </tr>
827 </tbody>
828 </table>
829 </div>
Marc Kupietza55a09a2018-07-06 13:30:30 +0200830 % if(0 && $haveSProfiles) {
Marc Kupietz384c9132018-03-19 16:45:24 +0100831 <div id="sprofilesdiv" style="width: 200px; padding-right: 10px;">
832 <table class="display compact nowrap" id="sprofiles">
833 <thead>
834 <tr>
835 <th align="right">cos</th><th align="left">similars by coll. profile</th>
836 </tr>
837 </thead>
838 <tbody>
839 <tr>
840 <td align="right">
841 </td>
842 <td></td>
843 </tr>
844 </tbody>
845 </table>
846 </div>
847 %}
Marc Kupietz81aeed22019-02-17 21:22:45 +0100848 <div id="second">
Marc Kupietz58270662017-12-04 12:10:06 +0100849 <div id="embed">
850 </div>
851 <div id="cost">
852 </div>
853 </div>
854 </div>
Marc Kupietz81aeed22019-02-17 21:22:45 +0100855 % } elsif($word !~ /^\s*$/) {
856 <div id="wrapper">
Marc Kupietz81aeed22019-02-17 21:22:45 +0100857 <script>
858 $( function() {
Marc Kupietzce6490b2019-12-06 11:05:40 +0100859 $( "<%== loc 'notfounddialog' %>").dialog({
Marc Kupietz81aeed22019-02-17 21:22:45 +0100860 autoOpen: true,
861 modal: true,
862 draggable: false,
863 height: "auto",
864 width: "auto",
865 resizable: false,
866 buttons: {
867 "OK": function() {
868 $( this ).dialog( "close" );
Marc Kupietzce6490b2019-12-06 11:05:40 +0100869 } /* ,
Marc Kupietz81aeed22019-02-17 21:22:45 +0100870 "Apply": function() {
871 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietzce6490b2019-12-06 11:05:40 +0100872 } */
Marc Kupietz81aeed22019-02-17 21:22:45 +0100873 }
874 });
875 });
876 </script>
Marc Kupietzce6490b2019-12-06 11:05:40 +0100877 <div id="not-found-dialog_de" style="display: none" title="Nicht gefunden">
878 <p>FEHLER: Konnte "<%= $word %>" nicht finden.</p>
879 <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>
880 </div>
881 <div id="not-found-dialog_en" style="display: none" title="Not found">
882 <p>ERROR: "<%= $word %>" not found in vocabluary.</p>
883 <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>
884 </div>
Marc Kupietz81aeed22019-02-17 21:22:45 +0100885 </div>
Marc Kupietz384c9132018-03-19 16:45:24 +0100886 % }
Marc Kupietz58270662017-12-04 12:10:06 +0100887 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100888 <div id="tabs-2" style="display: flex; padding: 5px; flex-flow: row wrap;">
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100889 % if(defined $word && $word ne "") {
890 <div id="som2" style="width: 800;">
891 <div id="sominfo1"><span id="somcolor1"> </span> <span id="somword1"> </span> <span id="somcolor2"> </span> <span id="somword2"> </span> <span id="somcolor3"> </span></div>
892 <div id="sominfo" style="text-align: right">SOM iteration <span id="iterations">0</span></div>
893 </div>
894 % }
Marc Kupietz58270662017-12-04 12:10:06 +0100895 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100896 <div id="tabs-3" style="display: flex; padding:5px; flex-flow: row wrap;">
897 <div style="margin-right: 20px; margin-bottom: 10px;" id="secondt">
Marc Kupietze6a7a732018-01-12 09:21:08 +0100898 <table class="display compact nowrap" id="secondtable">
Marc Kupietz58270662017-12-04 12:10:06 +0100899 <thead>
900 <tr>
901 % if($collocators) {
902 <th>#</th>
Marc Kupietz4116b432017-12-06 14:15:32 +0100903 <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>
904 <th align="right" title="Maximum activation of the collocator anywhere in the output layer.">max(a)</th>
905 <th title="Average raw activation of the collocator in the columns selected by auto-focus." align="right">⟨a⟩</th>
906 <th title="Sum of activations over the selected colunns normalized by the total activation sum of the selected columns." align="right">Σa/Σw'</th>
907 <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 +0100908 <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 +0100909 <th align="left"><%= loc 'collocate_w2v' %></th>
Marc Kupietz58270662017-12-04 12:10:06 +0100910 % }
911 </tr>
912 </thead>
913 <tbody>
914 <tr>
915 <td align="right">
916 </td>
917 <td align="right">
918 </td>
919 <td align="right">
920 </td>
921 <td align="right">
922 </td>
923 <td align="right">
924 </td>
925 <td align="right">
926 </td>
Marc Kupietz58270662017-12-04 12:10:06 +0100927 </tr>
928 </tbody>
929 </table>
Marc Kupietz66bfd952017-12-11 09:59:45 +0100930 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100931 <div id="ccd" style="">
Marc Kupietze6a7a732018-01-12 09:21:08 +0100932 <table class="display compact nowrap" id="classicoloctable">
933 <thead>
Marc Kupietzcd136e22018-01-29 09:18:12 +0100934 % if($collocators) {
935 <tr>
Marc Kupietzf19814b2019-01-21 16:50:19 +0100936 <th id="ll_tt">LL</th>
Marc Kupietzfab14a72019-01-22 16:20:29 +0100937 <th id="mi_tt">MI</th>
938 <th id="md_tt">MI²</th>
Marc Kupietzf19814b2019-01-21 16:50:19 +0100939 <th id="lfmd_tt">MI³</th>
Marc Kupietzfab14a72019-01-22 16:20:29 +0100940 <th id="npmi_tt">nPMI</th>
941 <th id="dice_tt">dice</th>
Marc Kupietz63b268f2019-01-22 22:34:29 +0100942 <th id="logdice_tt">LD</th>
943 <th id="logdiceaf_tt">LDaf</th>
Marc Kupietz001bffd2019-02-21 08:52:41 +0100944 <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 Kupietz1e00eb82026-09-04 16:38:30 +0200945 <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 ◽. LL, MI, MI², MI³ and nPMI are computed over all positions marked here, the attested ones, rather than over the whole context window, so that a collocate occurring in few positions is rated higher than one spread over many. LD does not depend on any window; LDaf is the auto-focus score of the ◾ positions and is not on the same scale as LD."><span class="regular"><%= loc 'af_window' %></span></th>
Marc Kupietz5a7f9ac2018-01-30 11:22:44 +0100946 <th title="PMI³ restricted to left neighbour">l-PMI³</th>
947 <th title="PMI³ restricted to right neighbour">r-PMI³</th>
948 <th title="nPMI restricted to left neighbour">l-nPMI</th>
949 <th title="nPMI restricted to right neighbour">r-nPMI</th>
Marc Kupietz4784fae2019-02-04 12:32:12 +0100950 <th id="rawfreq_tt" title="raw frequency sum of collocation within window">raw</th>
Marc Kupietz95104512019-12-05 10:13:05 +0100951 <th><%= loc 'collocate_ca' %></th>
Marc Kupietzcd136e22018-01-29 09:18:12 +0100952 </tr>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100953 % }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100954 </thead>
955 <tbody>
956 <tr>
Marc Kupietz63b268f2019-01-22 22:34:29 +0100957 <td align="right"></td>
958 <td align="right"></td>
959 <td align="right"></td>
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100960 <td align="right"></td>
Marc Kupietz78d7c1a2019-02-17 22:31:22 +0100961 <td align="right"></td>
962 <td align="right"></td>
963 <td align="right"></td>
964 <td align="right"></td>
965 <td align="right"></td>
966 <td align="left"> </td>
967 <td align="right"></td>
968 <td align="right"></td>
969 <td align="right"></td>
970 <td align="right"></td>
971 <td align="left"> </td>
Marc Kupietze6a7a732018-01-12 09:21:08 +0100972 </tr>
973 </tbody>
974 </table>
975 </div>
Marc Kupietz384c9132018-03-19 16:45:24 +0100976 <!--
977 <div style="clear:both" ></div>
978 <div style="float: right; overflow: hidden" id="extra"><button onClick="showCollocatorSOM()"> </button></div>
979 -->
Marc Kupietz66bfd952017-12-11 09:59:45 +0100980 </div>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100981 <div id="tabs-4" style="display: flex; padding:5px; flex-flow: row wrap;">
982 <div id="info">
983 <h3><%== loc 'about' %></h3>
984 %= include(loc('abouttext'))
985 % if($training_args && (@$lists)[0]) {
986 <h3><%= loc 'training_parameters' %></h3>
987 % if($training_args =~ /-type\s*3/) {
988 <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>
989 <div class="mono"><%= $training_args %></div>
990 % } else {
991 <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>
992 <div class="mono"><%= $training_args %></div>
993 % }
Marc Kupietz2133bd12022-05-19 09:24:42 +0200994 % }
995 <h3>Source Code</h3>
996 <ul>
997 <li><a href="https://korap.ids-mannheim.de/gerrit/plugins/gitiles/ids-kl/dereko2vec">dereko2vec</a></li>
998 <li><a href="https://korap.ids-mannheim.de/gerrit/plugins/gitiles/ids-kl/derekovecs">derekovecs</a></li>
999 </ul>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +01001000 <h3><%== loc 'references' %></h3>
1001 %= include 'references'
1002 </div>
1003 </div>
1004 </div> <!-- tabs -->
Marc Kupietz58270662017-12-04 12:10:06 +01001005 </div> <!-- topwrapper -->
1006 <div style="clear: both;"></div>
1007 </div>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +01001008 <div class="footer">
1009 <span class="footertext">
1010 %= include(loc('footer'))
1011 </span>
Marc Kupietzebea4702018-01-12 09:16:09 +01001012 </div>
Marc Kupietz58270662017-12-04 12:10:06 +01001013 </body>
Marc Kupietz83305222016-04-28 09:57:22 +02001014</html>