blob: 6d1827f24e19f8254c0930a2d87961f74c1d7747 [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 Kupietz898e5482024-02-20 15:03:07 +01009 <script src = "https://cdn.datatables.net/1.13.10/js/jquery.dataTables.min.js"></script>
Marc Kupietz5f532b32019-01-23 10:03:18 +010010 <script src = "https://cdn.datatables.net/fixedcolumns/3.2.5/js/dataTables.fixedColumns.min.js"></script>
Marc Kupietz898e5482024-02-20 15:03:07 +010011 <script src = "https://cdn.datatables.net/plug-ins/1.13.10/sorting/scientific.js"></script>
Marc Kupietz5f532b32019-01-23 10:03:18 +010012 <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 +010013 <script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script>
14 <script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script>
15 <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
16 <script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script>
17
Marc Kupietz9ae184c2023-11-04 18:21:54 +010018 <script src="https://cdnjs.cloudflare.com/ajax/libs/ical.js/1.5.0/ical.js"
19 integrity="sha512-UxWd2RMDGpYwYuDeU2Fs+nd51gw4ZLQY0D9wWZ3NuanNSk6QQmWCZ6C+rvI0lJ/b/nZtBQ8RVESA9DN9r65dUg=="
20 crossorigin="anonymous" referrerpolicy="no-referrer"></script>
21 <script
22 src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment-with-locales.min.js"
23 integrity="sha512-42PE0rd+wZ2hNXftlM78BSehIGzezNeQuzihiBCvUEB3CVxHvsShF86wBWwQORNxNINlBPuq7rG4WWhNiTVHFg=="
24 crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Marc Kupietz898e5482024-02-20 15:03:07 +010025 <link rel="stylesheet" href="https://cdn.datatables.net/1.13.10/css/jquery.dataTables.min.css">
Marc Kupietz4949d232018-03-19 16:43:18 +010026 <link rel="stylesheet" href="/derekovecs/css/derekovecs.css">
Marc Kupietz80bd7b92017-07-04 16:25:54 +020027 <script
Marc Kupietz42e6d092023-04-18 19:29:12 +020028 src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
Marc Kupietze6a7a732018-01-12 09:21:08 +010029 integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
30 crossorigin="anonymous"></script>
Marc Kupietz80bd7b92017-07-04 16:25:54 +020031 <script>
Marc Kupietza0ffb392018-01-25 08:53:43 +010032 MathJax.Hub.Config({
33 config: ["MMLorHTML.js"],
34 jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML", "output/PreviewHTML"],
35 extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js", "fast-preview.js", "AssistiveMML.js", "a11y/accessibility-menu.js"],
36 TeX: {
37 extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
38 }
39 });
Marc Kupietz58270662017-12-04 12:10:06 +010040 var urlParams = new URLSearchParams(window.location.search);
Marc Kupietzb3a2e4f2017-12-08 17:25:53 +010041 var currentWords = urlParams.get("word");
Rainer Perkuhn06578a12024-07-31 16:12:40 +020042 var CIIsearchWords = (currentWords && (currentWords.includes(" ") || currentWords.includes("|")) ? '('+currentWords.replace(/[ |]+/g, " oder ")+')' : currentWords);
Marc Kupietz66bfd952017-12-11 09:59:45 +010043 var collocatorTable = null;
Marc Kupietz86b50292019-02-17 21:03:59 +010044 var plainTitle ="<%= $plain_title %>"
Marc Kupietz78d7c1a2019-02-17 22:31:22 +010045 var korapPath="/";
46 if (plainTitle.match(/-en/)) {
47 korapPath="/instance/english";
48 }
Marc Kupietz78230872019-08-02 15:15:25 +020049 var korapVC="";
50 if (plainTitle.match(/WUDD/i)) {
51 korapVC="&collection=corpusSigle+%3D+%2FW%5BDU%5DD17%2F";
52 korapPath="/instance/test";
53 }
54
Marc Kupietz58270662017-12-04 12:10:06 +010055 $(document).ready(function() {
Marc Kupietz3576c622023-11-05 08:51:58 +010056 insertCalendarEvents(document.getElementById('downtimes'), '/derekovecs/getDowntimeCalendar' );
Marc Kupietz694610d2017-11-25 18:30:03 +010057
Marc Kupietza0ffb392018-01-25 08:53:43 +010058 $('#firstable').hide();
59 //Set up a callback to hear back when MathJax is done rendering the equations
60 // it finds
61 $('#ccd').load(
62 '@Url.Action("ActionResultMethod","ControllerName",{controller parameters})',
63 function () {
64 MathJax.Hub.Queue(
65 ["Typeset",MathJax.Hub,"ccd"],
Marc Kupietz95977002019-02-26 09:09:59 +010066 function () {
Marc Kupietz7bd55232019-01-22 15:29:06 +010067 $("#mi_tt").attr("title",$("#pmi_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010068 $("#lfmd_tt").attr("title",$("#lfmd_ttt").html());
Marc Kupietz7bd55232019-01-22 15:29:06 +010069 $("#md_tt").attr("title",$("#md_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010070 $("#npmi_tt").attr("title",$("#npmi_ttt").html());
Marc Kupietzf19814b2019-01-21 16:50:19 +010071 $("#ll_tt").attr("title",$("#ll_ttt").html());
Marc Kupietz7bd55232019-01-22 15:29:06 +010072 $("#logdice_tt").attr("title",$("#logdice_ttt").html());
Marc Kupietz63b268f2019-01-22 22:34:29 +010073 $("#logdiceaf_tt").attr("title",$("#logdiceaf_ttt").html());
Marc Kupietza0ffb392018-01-25 08:53:43 +010074 }
75 );
76 });
77
78 //set things up so that we can shove raw html into what is shown in the tooltip;
79 // in this case, we will have already put into the title attribute the html that
80 // contains the MathJax rendered equations (via what we do in the callback).
81 $(function () {
82 $(document).tooltip({
83 content: function () {
84 return $(this).prop('title');
85 }
86 });
87 });
88
Marc Kupietze6a7a732018-01-12 09:21:08 +010089 $("input").bind("keydown", function(event) {
90 // track enter key
91 var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
92 if (keycode == 13) { // keycode for enter key
93 // force the 'Enter Key' to implicitly click the Update button
94 document.getElementById('SEARCH').click();
95 return false;
96 } else {
97 return true;
98 }});
Marc Kupietzdab9f222017-11-29 14:22:59 +010099
Marc Kupietze871abd2018-01-25 16:18:27 +0100100 var collocatorTable_activated = false;
Marc Kupietze6a7a732018-01-12 09:21:08 +0100101 $( "#tabs" ).on( "tabsactivate", function( event, ui ) {
102 if (localStorage) localStorage['tab'] = ui.newTab.index();
Marc Kupietzd7760b42019-02-21 09:01:44 +0100103 if(ui.newTab.index() == 3 && !collocatorTable_activated) {
Marc Kupietze871abd2018-01-25 16:18:27 +0100104 classicCollocatorTable.columns.adjust();
105 collocatorTable.columns.adjust();
106 collocatorTable_activated = true;
107 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100108 });
109
110 $(function(){
111 $("#SEARCH").click(function() {
112 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietz58270662017-12-04 12:10:06 +0100113 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100114 });
Marc Kupietz0af83e32017-11-27 09:31:37 +0100115
Marc Kupietze6a7a732018-01-12 09:21:08 +0100116 function changeCharColor(txt, heat, word) {
117 var newText = "";
118 for (var i=0, l=txt.length; i<l; i++) {
Marc Kupietz86b50292019-02-17 21:03:59 +0100119 newText += (i == 5 ? txt.charAt(i) : '<a href="http://korap.ids-mannheim.de' + korapPath + '/?ql=cosmas2&q=' +
Marc Kupietze6a7a732018-01-12 09:21:08 +0100120 CIIsearchWords + ' /' + (i > 5? '%2B' : '-') + 'w' +
Rainer Perkuhne58a7492024-07-30 15:17:52 +0200121 Math.abs(i-5) + ':' + Math.abs(i-5) + ',s0 ' + word + korapVC +
Marc Kupietze6a7a732018-01-12 09:21:08 +0100122 '" target="korap"><span style="background-color:' +
123 getHeatColor(heat[i]/maxHeat)+'">'+txt.charAt(i)+'</span></a>');
Marc Kupietzb6c615d2017-12-02 10:38:20 +0100124 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100125 return newText;
126 }
Marc Kupietzb6c615d2017-12-02 10:38:20 +0100127
Marc Kupietze6a7a732018-01-12 09:21:08 +0100128 function getHeatColor(value) {
129 var hue=((1-value)*120).toString(10);
130 return ["hsl(",hue,",90%,70%)"].join("");
131 }
132
133 function bitvec2window(n, heat, word) {
134 var str = n.toString(2).padStart(10, "0")
135 .replace(/^([0-9]{5})/, '$1x')
136 .replace(/0/g, '·')
137 .replace(/1/g, '+');
138 return changeCharColor(str, heat, word);
139 }
140
141 % use Mojo::ByteStream 'b';
142 var paraResults = <%= b(Mojo::JSON::to_json($lists)) %>;
143 var urlprefix = new URLSearchParams(window.location.search);
144 if (paraResults.length > 0 && paraResults[0] != null) {
145 var nvecs = [],
146 nwords = [],
147 nranks = [],
148 nmarked = [];
149 for(var i = 0; i < paraResults.length; i++) {
150 nwords = nwords.concat(paraResults[i].map(function(a){return a.word;}));
151 nvecs = nvecs.concat(paraResults[i].map(function(a){return a.vector;}));
152 nranks = nranks.concat(paraResults[i].map(function(a){return a.rank;}));
153 nmarked = nmarked.concat(paraResults[i].map(function(a){return a.marked;}));
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100154 }
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100155 showMap({target: " "+urlParams.get('word')+" ", mergedEnd: <%= $mergedEnd %>, words: nwords, vecs: nvecs, ranks: nranks, marked: nmarked} );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100156 var t = $('#firsttable').DataTable({
Marc Kupietzee894d52019-01-09 14:55:14 +0100157 data: [].concat.apply([], paraResults),
Marc Kupietze6a7a732018-01-12 09:21:08 +0100158 "sScrollY": "780px",
159 "bScrollCollapse": true,
160 "bPaginate": false,
161 "bJQueryUI": true,
Marc Kupietz898e5482024-02-20 15:03:07 +0100162 "dom": '<"top">rt<"bottom"flpB><"clear">',
163 buttons: [
164 { extend: 'copyHtml5', text: '<i class="fa fa-files-o"></i>', titleAttr: 'Copy' },
165 { extend: 'csvHtml5', text: '<i class="fa fa-file-text-o"></i>', titleAttr: 'CSV', filename: currentWords+'_para_neighbours' },
166 { extend: 'excelHtml5', text: '<i class="fa fa-file-excel-o"></i>', titleAttr: 'Excel', filename: currentWords+'_para_neighbours', exportOptions: { columns: ':visible' } ,
167 }
168 ],
Marc Kupietz384c9132018-03-19 16:45:24 +0100169 "initComplete":function(settings, json) {
170 $('td.paradigmator a').on('mousedown', function(e) {
Marc Kupietz86b50292019-02-17 21:03:59 +0100171 return paradigmatorClick(e, paraResults[0][0].word, this.childNodes["0"].textContent);
Marc Kupietz384c9132018-03-19 16:45:24 +0100172 });
173 },
Marc Kupietze6a7a732018-01-12 09:21:08 +0100174 "columns": [
175 { "data": "rank", type: "allnumeric" },
176 { "data": "dist", render: function ( data, type, row ) {return data.toFixed(3) }},
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100177 { "data": "word", class: "paradigmator", render: function ( data, type, row ) {
178 urlprefix.set("word", data); return '<a class="' + getMergedClass(row.rank) + '" href="?' + urlprefix + '">' + data + '</a>'
179 }}
Marc Kupietze6a7a732018-01-12 09:21:08 +0100180 ],
181 "columnDefs": [
182 { className: "dt-right", "targets": [0,1] },
183 { "searchable": false,
184 "orderable": false,
185 "targets": 0
186 },
187 { "orderSequence": [ "desc" ], "targets": [ 1 ] },
188 { "orderSequence": [ "asc", "desc" ], "targets": [ 2 ] },
189 ],
190 "oLanguage": {
191 "sSearch": "Filter: "
192 },
193 "order": [[ 1, 'desc' ]],
194 } );
Marc Kupietz0d4c0ca2017-12-04 09:18:56 +0100195
Marc Kupietze6a7a732018-01-12 09:21:08 +0100196 t.on( 'order.dt search.dt', function () {
197 t.column(0, {order:'applied'}).nodes().each( function (cell, i) {
198 cell.innerHTML = i+1;
199 } );
200 } ).draw();
201
202 $( "#first" ).clone().prependTo( "#tabs-2" );
203
204 }
205
206
207 var collocatorData = <%= b(Mojo::JSON::to_json($collocators)) %>;
208 var maxHeat; // = Math.max.apply(Math,collocatorData.map(function(o){return o.cprob;}))
209
Marc Kupietzcddc8482019-12-04 08:57:33 +0100210 if(typeof data !== 'undefined' && data.mergedEnd > 0) {
Marc Kupietz78230872019-08-02 15:15:25 +0200211 vocabDistanceTable = makeVocabDistanceTable("#vocabdistt", baseURL);
212 }
Marc Kupietzd7760b42019-02-21 09:01:44 +0100213
Marc Kupietze6a7a732018-01-12 09:21:08 +0100214 if (collocatorData != null) {
215 maxHeat = Math.max.apply(Math,collocatorData.map(function(o){return Math.max.apply(Math,o.heat);}))
216 collocatorTable = $('#secondtable').DataTable({
217 data: collocatorData,
218 "sScrollY": "780px",
219 "bScrollCollapse": true,
220 "bPaginate": false,
221 "bJQueryUI": true,
Marc Kupietz898e5482024-02-20 15:03:07 +0100222 "dom": '<"top">rt<"bottom"flpB><"clear">',
223 buttons: [
224 { extend: 'copyHtml5', text: '<i class="fa fa-files-o"></i>', titleAttr: 'Copy' },
225 { extend: 'csvHtml5', text: '<i class="fa fa-file-text-o"></i>', titleAttr: 'CSV', filename: currentWords+'_syn_neighbours' },
226 { extend: 'excelHtml5', text: '<i class="fa fa-file-excel-o"></i>', titleAttr: 'Excel', filename: currentWords+'_syn_neighbours', exportOptions: { columns: ':visible' } ,
227 }
228 ],
229 "columns": [
Marc Kupietze6a7a732018-01-12 09:21:08 +0100230 { "data": "rank", type: "allnumeric" },
231 { "data": "pos", width: "7%", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitvec2window(data, row.heat, row.word) }},
232 { "data": "max", render: function ( data, type, row ) {return data.toFixed(3) }},
233 { "data": "average", render: function ( data, type, row ) {return data.toFixed(3) }},
234 { "data": "prob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
235 { "data": "cprob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
236 { "data": "overall", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
237 { "data": "word", sClass: "collocator" },
238 { "data": "rank", type: "allnumeric" }
239 ],
240 "columnDefs": [
241 { className: "dt-right", "targets": [0,2,3,4,5,6] },
242 { className: "dt-center", "targets": [ 1] },
243 { "searchable": false,
244 "orderable": false,
245 "targets": [0, 8]
246 },
247 { "type": "scientific", targets: [2,3,4,5,6] },
248 { "orderSequence": [ "desc" ], "targets": [ 2, 3, 4, 5, 6 ] },
249 { "orderSequence": [ "asc", "desc" ], "targets": [ 1, 7 ] },
250 { "targets": [8], "visible": false }
251 ],
252 "oLanguage": {
253 "sSearch": "Filter: "
254 },
255 "order": [[ 4, 'desc' ]],
256 } );
257 $.ajaxSetup({
258 type: 'POST',
259 timeout: 30000,
260 error: function(xhr) {
261 $('#display_error')
262 .html('Error: ' + xhr.status + ' ' + xhr.statusText);
263 }
Marc Kupietz78b434a2018-01-12 22:33:32 +0100264 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100265
Marc Kupietz384c9132018-03-19 16:45:24 +0100266
267 if($('#sprofiles').length) {
268 similarProfileTable = $('#sprofiles').DataTable({
269 ajax: {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100270 method: "GET",
Marc Kupietz384c9132018-03-19 16:45:24 +0100271 url: '/derekovecs/getSimilarProfiles',
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100272 dataType: 'json',
273 dataSrc: "",
274 timeout: 30000,
275 data: { w: paraResults[0][0].rank }
Marc Kupietz384c9132018-03-19 16:45:24 +0100276 },
277 "initComplete":function(settings, json){
278 $('td.paradigmator a').on('mousedown', function(e) {
279 if (e.which === 2) {
280 e.preventDefault();
281 queryKorAPalternatives(paraResults[0][0].word, this.childNodes["0"].textContent);
282 return false;
283 }
284 });
285 },
286 "sScrollY": "780px",
287 "bScrollCollapse": true,
288 "bPaginate": false,
289 "bJQueryUI": true,
290 "dom": '<"top">rt<"bottom"flp><"clear">',
Marc Kupietz898e5482024-02-20 15:03:07 +0100291 "columns": [
Marc Kupietz384c9132018-03-19 16:45:24 +0100292 { "data": "v", render: function ( data, type, row ) {return data.toFixed(3) }},
293 { "data": "w", sClass: "paradigmator", render: function ( data, type, row ) {urlprefix.set("word", data); return '<a href="?' + urlprefix + '">' + data + '</a>' } }
294 ],
295 "columnDefs": [
296 { className: "dt-right", "targets": [0] },
297 ],
298 "oLanguage": {
299 "sSearch": "Filter: "
300 },
301 "order": [[ 0, 'desc' ]],
302 });
303 }
Marc Kupietzd7760b42019-02-21 09:01:44 +0100304
Marc Kupietz384c9132018-03-19 16:45:24 +0100305 // var filterQuot = /(^quot?=[A-Z])|(quot$)/g;
306 var filterQuot = /^quot/;
Marc Kupietz4784fae2019-02-04 12:32:12 +0100307 var ccResult;
Marc Kupietz86b50292019-02-17 21:03:59 +0100308 var baseURL = window.location.pathname.replace(/[/]$/, '')
Marc Kupietz95977002019-02-26 09:09:59 +0100309 classicCollocatorTable = makeClassicCollocatorTable('#classicoloctable', baseURL, paraResults[0][0].rank)
Marc Kupietze6a7a732018-01-12 09:21:08 +0100310
Marc Kupietz1acb3172018-02-17 09:41:26 +0100311 $('#show-details').change(function (e) {
312 var columns = classicCollocatorTable.columns(".detail");
313 if(this.checked) {
314 columns.visible(true);
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100315 $("#ccd").css('width', 'auto');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100316 } else {
317 columns.visible(false);
Marc Kupietz08bfd402019-01-23 10:05:17 +0100318 $("#ccd").css('width', '680px');
Marc Kupietz1acb3172018-02-17 09:41:26 +0100319 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100320 classicCollocatorTable.columns.adjust().draw();
Marc Kupietz1acb3172018-02-17 09:41:26 +0100321 } );
322
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100323 $("td.collocator").click(function(){
Rainer Perkuhnd5010ec2024-07-30 14:38:25 +0200324 queryKorAPCII(this.textContent + " /w1:5,s0 " + CIIsearchWords);
Marc Kupietzad783722018-01-13 17:45:21 +0100325 });
326
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100327 collocatorTable.on( 'order.dt search.dt', function () {
328 collocatorTable.column(0, {order:'applied'}).nodes().each( function (cell, i) {
329 cell.innerHTML = i+1;
330 } );
331 }).draw();
332 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100333
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100334 if (localStorage && !window.location.hash) { // let's not crash if some user has IE7
335 var index = parseInt(localStorage['tab']||'0');
336 $("#tabs").tabs({ active: index });
337 }
338 $("#tabs").css("visibility", "visible"); // now we can show the tabs
339 });
Marc Kupietz58270662017-12-04 12:10:06 +0100340
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100341 $(function(){
342 $("#dropdownoptions").dialog({
Marc Kupietz95104512019-12-05 10:13:05 +0100343 title: "<%= loc 'Options' %>",
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100344 autoOpen: false,
345 modal: false,
346 draggable: false,
347 height: "auto",
348 width: "auto",
349 resizable: false,
350 buttons: {
Marc Kupietz95104512019-12-05 10:13:05 +0100351 "<%= loc 'Cancel'%>": function() {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100352 $( this ).dialog( "close" );
Marc Kupietze6a7a732018-01-12 09:21:08 +0100353 },
Marc Kupietz95104512019-12-05 10:13:05 +0100354 "<%= loc 'Apply' %>": function() {
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100355 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietze6a7a732018-01-12 09:21:08 +0100356 }
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100357 }
358 });
359 });
360
361 $(function(){
362 $("#showoptions").click(function(){
363 $("#dropdownoptions").dialog("open");
364 var target = $(this);
365 $("#dropdownoptions").dialog("widget").position({
366 my: 'left bottom',
367 at: 'left bottom',
368 of: target
Marc Kupietz58270662017-12-04 12:10:06 +0100369 });
Marc Kupietze6a7a732018-01-12 09:21:08 +0100370 });
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100371 });
372
373 $( function() {
374 $( "#no_iterations" ).spinner({
375 spin: function( event, ui ) {
376 if ( ui.value < 1000 ) {
377 $( this ).spinner( "value", 1000 );
378 return false;
379 } else if ( ui.value > 10000 ) {
380 $( this ).spinner( "value", 10000 );
381 return false;
382 }
383 }
384 });
385 } );
386
387 $( function() {
388 $( "#neighbours" ).spinner({
389 spin: function( event, ui ) {
390 if ( ui.value < 0 ) {
391 $( this ).spinner( "value", 0 );
392 return false;
393 } else if ( ui.value > 200 ) {
394 $( this ).spinner( "value", 200 );
395 return false;
396 }
397 }
398 });
399 } );
400
401 $( function() {
402 $( "#cutoff" ).spinner({
403 spin: function( event, ui ) {
404 if ( ui.value < 100000 ) {
405 $( this ).spinner( "value", 100000 );
406 return false;
407 } else if ( ui.value > 2000000 ) {
408 $( this ).spinner( "value", 2000000 );
409 return false;
410 }
411 }
412 });
413 } );
414
415 $( function() {
416 $( "#tabs" ).tabs().addClass('tabs-min');
417 } );
418
419 $( function() {
420 $( ".controlgroup-vertical" ).controlgroup({
421 "direction": "vertical"
422 });
423 } );
424
425 $(function() {
426 $( document ).tooltip({
427 content: function() {
428 return $(this).attr('title');
429 }}
430 )
431 });
432
433 $(function () {
434 $(document).tooltip({
435 content: function () {
436 return $(this).prop('title');
437 },
438 show: null,
439 close: function (event, ui) {
440 ui.tooltip.hover(
441 function () {
442 $(this).stop(true).fadeTo(400, 1);
443 },
444 function () {
445 $(this).fadeOut("400", function () {
446 $(this).remove();
447 })
448 });
449 }
450 });
451 });
Marc Kupietz83305222016-04-28 09:57:22 +0200452 </script>
Marc Kupietz58270662017-12-04 12:10:06 +0100453 <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
Marc Kupietz68e29be2023-11-04 18:37:35 +0100454 <script src="/derekovecs/js/calendar-events.js"></script>
Marc Kupietz58270662017-12-04 12:10:06 +0100455 <script src="/derekovecs/js/tsne.js"></script>
456 <script src="/derekovecs/js/som.js"></script>
457 <script src="/derekovecs/js/labeler.js"></script>
Marc K20476c72021-03-11 12:18:01 +0100458 <script src="/derekovecs/js/derekovecs.js"></script>
Marc Kupietz83305222016-04-28 09:57:22 +0200459 <script>
460
461 var opt = {epsilon: <%= $epsilon %>, perplexity: <%= $perplexity %>},
Marc Kupietz58270662017-12-04 12:10:06 +0100462 mapWidth = 800, // width map
463 mapHeight = 800,
464 jitterRadius = 7;
Marc Kupietz83305222016-04-28 09:57:22 +0200465
466 var T = new tsnejs.tSNE(opt); // create a tSNE instance
467
468 var Y;
469
470 var data;
471 var labeler;
472
473 function applyJitter() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100474 svg.selectAll('.tsnet')
475 .data(labels)
476 .transition()
477 .duration(50)
478 .attr("transform", function(d, i) {
479 T.Y[i][0] = (d.x - mapWidth/2 - tx)/ss/20;
480 T.Y[i][1] = (d.y - mapHeight/2 - ty)/ss/20;
481 return "translate(" +
Marc Kupietz78230872019-08-02 15:15:25 +0200482 (d.x) + "," +
483 (d.y) + ")";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100484 });
Marc Kupietz83305222016-04-28 09:57:22 +0200485 }
Marc Kupietz34c08172017-11-29 17:08:47 +0100486
Marc Kupietz83305222016-04-28 09:57:22 +0200487 function updateEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100488 var Y = T.getSolution();
489 svg.selectAll('.tsnet')
490 .data(data.words)
491 .attr("transform", function(d, i) {
492 return "translate(" +
Marc Kupietz78230872019-08-02 15:15:25 +0200493 ((Y[i][0]*20*ss + tx) + mapWidth/2) + "," +
494 ((Y[i][1]*20*ss + ty) + mapHeight/2) + ")"; });
Marc Kupietz83305222016-04-28 09:57:22 +0200495 }
496
497 var svg;
498 var labels = [];
499 var anchor_array = [];
500 var text;
501
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100502 function getMergedClass(i) {
Marc Kupietzd7760b42019-02-21 09:01:44 +0100503 if(typeof data !== 'undefined' && i > data.mergedEnd) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100504 return " merged"
505 } else {
506 return "";
507 }
508 }
509
510 function getRankTooltip(i) {
511 if(data.mergedEnd) {
512 if(data.ranks[i] < data.mergedEnd) {
513 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
514 } else {
515 return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]-data.mergedEnd).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " (merged vocab)";
516 }
517 } else {
518 return "rank: "+i +" "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
519 }
520 }
521
Marc Kupietz83305222016-04-28 09:57:22 +0200522 function drawEmbedding() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100523 var urlprefix = new URLSearchParams(window.location.search);
524 urlprefix.delete("word");
525 urlprefix.append("word","");
Marc Kupietz8f9c86a2017-12-04 17:17:13 +0100526
Marc Kupietze6a7a732018-01-12 09:21:08 +0100527 $("#embed").empty();
528 var div = d3.select("#embed");
Marc Kupietz34c08172017-11-29 17:08:47 +0100529
Marc Kupietze6a7a732018-01-12 09:21:08 +0100530 // get min and max in each column of Y
531 var Y = T.Y;
Marc Kupietz34c08172017-11-29 17:08:47 +0100532
Marc Kupietze6a7a732018-01-12 09:21:08 +0100533 svg = div.append("svg") // svg is global
534 .attr("width", mapWidth)
535 .attr("height", mapHeight);
Marc Kupietz34c08172017-11-29 17:08:47 +0100536
Marc Kupietze6a7a732018-01-12 09:21:08 +0100537 var g = svg.selectAll(".b")
538 .data(data.words)
539 .enter().append("g")
540 .attr("class", "tsnet");
Marc Kupietz34c08172017-11-29 17:08:47 +0100541
Marc Kupietze6a7a732018-01-12 09:21:08 +0100542 g.append("a")
543 .attr("xlink:href", function(word) {
544 return "?"+urlprefix+word; })
545 .attr("class", function(d, i) {
546 var res="";
547 if(data.marked[i]) {
548 res="marked ";
549 }
550 if(data.target.indexOf(" "+d+" ") >= 0) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100551 res += "target";
552 }
553 if(data.mergedEnd && data.ranks[i] >= data.mergedEnd) {
554 return res+" merged";
Marc Kupietze6a7a732018-01-12 09:21:08 +0100555 } else {
556 return res;
557 }
558 })
559 .attr("title", function(d, i) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100560 return getRankTooltip(i);
Marc Kupietze6a7a732018-01-12 09:21:08 +0100561 })
562 .append("text")
563 .attr("text-anchor", "top")
564 .attr("font-size", 12)
565 .text(function(d) { return d; });
Marc Kupietz34c08172017-11-29 17:08:47 +0100566
Marc Kupietz384c9132018-03-19 16:45:24 +0100567 g.append("svg:title")
568 .text(function(d, i) {
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100569 return getRankTooltip(i);
Marc Kupietz384c9132018-03-19 16:45:24 +0100570 });
571
Marc Kupietze6a7a732018-01-12 09:21:08 +0100572 var zoomListener = d3.behavior.zoom()
573 .scaleExtent([0.1, 10])
574 .center([0,0])
575 .on("zoom", zoomHandler);
576 zoomListener(svg);
Marc Kupietz83305222016-04-28 09:57:22 +0200577 }
578
579 var tx=0, ty=0;
580 var ss=1;
581 var iter_id=-1;
582
583 function zoomHandler() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100584 tx = d3.event.translate[0];
585 ty = d3.event.translate[1];
586 ss = d3.event.scale;
587 updateEmbedding();
Marc Kupietz83305222016-04-28 09:57:22 +0200588 }
589
590 var stepnum = 0;
591
592 function stopStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100593 clearInterval(iter_id);
594 text = svg.selectAll("text");
Marc Kupietz34c08172017-11-29 17:08:47 +0100595
Marc Kupietze6a7a732018-01-12 09:21:08 +0100596 // jitter function needs different data and co-ordinate representation
597 labels = d3.range(data.words.length).map(function(i) {
598 var x = (T.Y[i][0]*20*ss + tx) + mapWidth/2;
599 var y = (T.Y[i][1]*20*ss + ty) + mapHeight/2;
600 anchor_array.push({x: x, y: y, r: jitterRadius});
601 return {
602 x: x,
603 y: y,
604 name: data.words[i]
605 };
606 });
Marc Kupietz34c08172017-11-29 17:08:47 +0100607
Marc Kupietze6a7a732018-01-12 09:21:08 +0100608 // get the actual label bounding boxes for the jitter function
609 var index = 0;
610 text.each(function() {
611 labels[index].width = this.getBBox().width;
612 labels[index].height = this.getBBox().height;
613 index += 1;
614 });
Marc Kupietz83305222016-04-28 09:57:22 +0200615
Marc Kupietz34c08172017-11-29 17:08:47 +0100616
Marc Kupietze6a7a732018-01-12 09:21:08 +0100617 // setTimeout(updateEmbedding, 1);
618 // setTimeout(
619 labeler = d3.labeler()
620 .label(labels)
621 .anchor(anchor_array)
622 .width(mapWidth)
623 .height(mapHeight)
624 .update(applyJitter);
625 // .start(1000);
Marc Kupietz83305222016-04-28 09:57:22 +0200626
Marc Kupietze6a7a732018-01-12 09:21:08 +0100627 iter_id = setInterval(jitterStep, 1);
Marc Kupietz83305222016-04-28 09:57:22 +0200628 }
629
630 var jitter_i=0;
631
632 function jitterStep() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100633 if(jitter_i++ > 100) {
634 clearInterval(iter_id);
635 } else {
636 labeler.start2(10);
637 applyJitter();
638 }
Marc Kupietz83305222016-04-28 09:57:22 +0200639 }
640
641 var last_cost=1000;
642
643 function step() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100644 var i = T.iter;
Marc Kupietz34c08172017-11-29 17:08:47 +0100645
Marc Kupietze6a7a732018-01-12 09:21:08 +0100646 if(i > <%= $no_iterations %>) {
647 stopStep();
648 } else {
649 var cost = Math.round(T.step() * 100000) / 100000; // do a few steps
650 $("#cost").html("tsne iteration " + i + ", cost: " + cost.toFixed(5));
651 if(i % 250 == 0 && cost >= last_cost) {
652 stopStep();
Marc Kupietz58270662017-12-04 12:10:06 +0100653 } else {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100654 last_cost = cost;
655 updateEmbedding();
Marc Kupietz58270662017-12-04 12:10:06 +0100656 }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100657 }
Marc Kupietz83305222016-04-28 09:57:22 +0200658 }
659
660 function showMap(j) {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100661 data=j;
662 T.iter=0;
663 iter_id = -1;
664 last_cost=1000;
665 T.initDataRaw(data.vecs); // init embedding
666 drawEmbedding(); // draw initial embedding
Marc Kupietz78114532017-11-29 17:00:16 +0100667
Marc Kupietze6a7a732018-01-12 09:21:08 +0100668 if(iter_id >= 0) {
669 clearInterval(iter_id);
670 }
671 //T.debugGrad();
672 iter_id = setInterval(step, 1);
673 if(true) { // (<%= $show_som %>) {
674 makeSOM(j, <%= $no_iterations %>);
675 }
Marc Kupietz83305222016-04-28 09:57:22 +0200676 }
Marc Kupietz39179ab2017-07-04 16:28:06 +0200677 var queryword;
678
Marc Kupietz66bfd952017-12-11 09:59:45 +0100679 function showCollocatorSOM() {
Marc Kupietz86b50292019-02-17 21:03:59 +0100680 var baseURL = window.location.pathname.replace(/[/]$/, '')
Marc Kupietze6a7a732018-01-12 09:21:08 +0100681 if (collocatorTable) {
682 var ctableData = collocatorTable.rows().data();
683 var nwords = [],
684 nranks = [];
685 for (var i=0; i < ctableData.length && i < 100; i++) {
686 nranks.push(ctableData[i].rank);
687 nwords.push(ctableData[i].word);
Marc Kupietz66bfd952017-12-11 09:59:45 +0100688 }
Marc Kupietz86b50292019-02-17 21:03:59 +0100689 $.post(baseURL+'/getVecsByRanks',
Marc Kupietze6a7a732018-01-12 09:21:08 +0100690 JSON.stringify(nranks),
691 function(data, status){
Marc Kupietz2e2e4db2018-12-21 15:07:37 +0100692 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 +0100693 }, 'json');
694 }
Marc Kupietz66bfd952017-12-11 09:59:45 +0100695 }
696
Marc Kupietz39179ab2017-07-04 16:28:06 +0200697 function onload() {
Marc Kupietze6a7a732018-01-12 09:21:08 +0100698 queryword = document.getElementById('word');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200699 }
700
701 function queryKorAP() {
Marc Kupietz78230872019-08-02 15:15:25 +0200702 window.open('http://korap.ids-mannheim.de' + korapPath + '?q='+queryword.value+korapVC, 'KorAP');
Marc Kupietz39179ab2017-07-04 16:28:06 +0200703 }
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100704
705 function queryKorAPCII(query) {
Marc Kupietz78230872019-08-02 15:15:25 +0200706 window.open('http://korap.ids-mannheim.de' +korapPath + '?ql=cosmas2&q='+query+korapVC, 'KorAP');
Marc Kupietz4dc270c2017-11-24 10:17:12 +0100707 }
Marc Kupietz83305222016-04-28 09:57:22 +0200708 </script>
709 </head>
Marc Kupietz7b0e5de2019-01-31 12:49:32 +0100710 <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>
711 <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>
712 <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>
713 <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>
714 <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>
715 <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>
716 <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>
717 <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 +0100718 <div id="ids_logo">
719 <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>
720 </div>
721 <div id="header">
Marc Kupietz58270662017-12-04 12:10:06 +0100722 <div id="pagetitle">
Marc Kupietzc053d972019-01-10 10:41:51 +0100723 <h1>DeReKoVecs</h1>
724 <h2><%== $title %></h2>
Marc Kupietz4fcda0c2017-11-29 09:00:31 +0100725 </div>
Marc Kupietz58270662017-12-04 12:10:06 +0100726 <div id="options" class="widget">
727 <form id="queryform">
Marc Kupietz95104512019-12-05 10:13:05 +0100728 <input id="word" type="text" name="word" placeholder="<%= loc 'words_to_be_searched' %>" value="<%= $word %>"
729 title="<%= loc 'search_description' %>"/>
730 <input id="SEARCH" type="button" value="<%= loc 'SEARCH' %>">
731 <input type="button" id="showoptions" name="showoptions" value="<%= loc 'Options' %>" />
Marc Kupietz58270662017-12-04 12:10:06 +0100732 </form>
733 <div id="dropdownoptions" style="display: none">
734 <form id="optionsform">
735 <div class="controlgroup-vertical">
736 <label for="cutoff">cut-off</label>
737 <input id="cutoff" type="text" name="cutoff" size="10" value="<%= $cutoff %>" title="Only consider the most frequent x word forms.">
738 <label for="dedupe">dedupe</label>
739 <input id="dedupe" type="checkbox" name="dedupe" value="1" <%= ($dedupe ? "checked" : "") %> title="radically filter out any near-duplicates">
740 % if($mergedEnd > 0) {
741 <label for="sbf">backw.</label>
742 <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.">
743 % }
744 <label for="neighbours">max. neighbours:</label>
745 <input id="neighbours" size="4" name="n" value="<%= $no_nbs %>">
746 <label for="no_iterations">max. iterations</label>
747 <input id="no_iterations" name="N" size="4" value="<%= $no_iterations %>">
748 <!-- <label for="dosom">SOM</label>
749 <input id="dosom" type="checkbox" name="som" value="1" <%= ($show_som ? "checked" : "") %>> -->
750 % if($collocators) {
751 <label for="sortby">window/sort</label>
752 <select id="sortby" name="sort">
753 <option value="0" <%= ($sort!=1 && $sort!=2? "selected":"") %>>auto focus</option>
754 <!-- <option value="1" <%= ($sort==1? "selected":"") %>>any single position</option>
755 <option value="2" <%= ($sort==2? "selected":"") %>>whole window</option> -->
756 </select>
757 % }
758 <input type="button" value="→ KorAP" onclick="queryKorAP();" title="query word with KorAP"/>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100759 <input id="show-details" type="checkbox" name="show-details" value="1" >
760 <label for="show-details">
761 Show details
762 </label>
Marc Kupietz58270662017-12-04 12:10:06 +0100763 </div>
764 </form>
765 </div>
766 </div>
767 </div>
768 <div id="topwrapper">
769 <div style="visibility: hidden;" id="tabs">
770 <ul>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100771 % if (defined $word && $word ne '') {
772 % if($mergedEnd && $distantWords) {
773 <li><a href="#tabs-0" title="Cos offsets of the words furthest away from their position in the reference corpus."">Offsets</a></li>
774 % }
775 <li><a href="#tabs-1"><%= loc 'paradigmatic_tsne' %></a></li>
776 <li><a href="#tabs-2"><%= loc 'paradigmatic_som' %></a></li>
777 <li><a href="#tabs-3"><%= loc 'syntagmatic' %></a></li>
Marc Kupietzd7760b42019-02-21 09:01:44 +0100778 % }
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100779 <li><a href="#tabs-4">Info</a></li>
Marc Kupietz58270662017-12-04 12:10:06 +0100780 </ul>
Marc Kupietzb6514dc2019-06-26 11:47:56 +0200781 % if($mergedEnd && $distantWords) {
Marc Kupietzd7760b42019-02-21 09:01:44 +0100782 <div id="tabs-0" style="display: flex; padding: 5px; flex-flow: row wrap;">
783 <div id="vocabdist" style="width: 230px; margin-bottom: 15px;">
784 <table class="display compact nowrap" id="vocabdistt">
785 <thead>
786 <tr>
Marc Kupietz95977002019-02-26 09:09:59 +0100787 <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 +0100788 </tr>
789 </thead>
790 <tbody>
791 <tr>
792 <td align="right">
Marc Kupietz95977002019-02-26 09:09:59 +0100793 </td>
Marc Kupietzd7760b42019-02-21 09:01:44 +0100794 <td align="right">
795 </td>
796 <td></td>
797 </tr>
798 </tbody>
799 </table>
800 </div>
801 </div>
Marc Kupietzb6514dc2019-06-26 11:47:56 +0200802 % }
Marc Kupietz384c9132018-03-19 16:45:24 +0100803 <div id="tabs-1" style="display: flex; padding: 5px; flex-flow: row wrap;">
Marc Kupietz58270662017-12-04 12:10:06 +0100804 % if($lists && (@$lists) > 0 && (@$lists)[0]) {
805 <div id="wrapper">
Marc Kupietz384c9132018-03-19 16:45:24 +0100806 <div id="first" style="width: 230px; margin-bottom: 15px;">
Marc Kupietz58270662017-12-04 12:10:06 +0100807 <table class="display compact nowrap" id="firsttable">
808 <thead>
809 <tr>
Marc Kupietz95977002019-02-26 09:09:59 +0100810 <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 +0100811 </tr>
812 </thead>
813 <tbody>
814 <tr>
815 <td align="right">
816 </td>
817 <td align="right">
818 </td>
819 <td></td>
820 </tr>
821 </tbody>
822 </table>
823 </div>
Marc Kupietza55a09a2018-07-06 13:30:30 +0200824 % if(0 && $haveSProfiles) {
Marc Kupietz384c9132018-03-19 16:45:24 +0100825 <div id="sprofilesdiv" style="width: 200px; padding-right: 10px;">
826 <table class="display compact nowrap" id="sprofiles">
827 <thead>
828 <tr>
829 <th align="right">cos</th><th align="left">similars by coll. profile</th>
830 </tr>
831 </thead>
832 <tbody>
833 <tr>
834 <td align="right">
835 </td>
836 <td></td>
837 </tr>
838 </tbody>
839 </table>
840 </div>
841 %}
Marc Kupietz81aeed22019-02-17 21:22:45 +0100842 <div id="second">
Marc Kupietz58270662017-12-04 12:10:06 +0100843 <div id="embed">
844 </div>
845 <div id="cost">
846 </div>
847 </div>
848 </div>
Marc Kupietz81aeed22019-02-17 21:22:45 +0100849 % } elsif($word !~ /^\s*$/) {
850 <div id="wrapper">
Marc Kupietz81aeed22019-02-17 21:22:45 +0100851 <script>
852 $( function() {
Marc Kupietzce6490b2019-12-06 11:05:40 +0100853 $( "<%== loc 'notfounddialog' %>").dialog({
Marc Kupietz81aeed22019-02-17 21:22:45 +0100854 autoOpen: true,
855 modal: true,
856 draggable: false,
857 height: "auto",
858 width: "auto",
859 resizable: false,
860 buttons: {
861 "OK": function() {
862 $( this ).dialog( "close" );
Marc Kupietzce6490b2019-12-06 11:05:40 +0100863 } /* ,
Marc Kupietz81aeed22019-02-17 21:22:45 +0100864 "Apply": function() {
865 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
Marc Kupietzce6490b2019-12-06 11:05:40 +0100866 } */
Marc Kupietz81aeed22019-02-17 21:22:45 +0100867 }
868 });
869 });
870 </script>
Marc Kupietzce6490b2019-12-06 11:05:40 +0100871 <div id="not-found-dialog_de" style="display: none" title="Nicht gefunden">
872 <p>FEHLER: Konnte "<%= $word %>" nicht finden.</p>
873 <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>
874 </div>
875 <div id="not-found-dialog_en" style="display: none" title="Not found">
876 <p>ERROR: "<%= $word %>" not found in vocabluary.</p>
877 <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>
878 </div>
Marc Kupietz81aeed22019-02-17 21:22:45 +0100879 </div>
Marc Kupietz384c9132018-03-19 16:45:24 +0100880 % }
Marc Kupietz58270662017-12-04 12:10:06 +0100881 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100882 <div id="tabs-2" style="display: flex; padding: 5px; flex-flow: row wrap;">
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100883 % if(defined $word && $word ne "") {
884 <div id="som2" style="width: 800;">
885 <div id="sominfo1"><span id="somcolor1"> </span> <span id="somword1"> </span> <span id="somcolor2"> </span> <span id="somword2"> </span> <span id="somcolor3"> </span></div>
886 <div id="sominfo" style="text-align: right">SOM iteration <span id="iterations">0</span></div>
887 </div>
888 % }
Marc Kupietz58270662017-12-04 12:10:06 +0100889 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100890 <div id="tabs-3" style="display: flex; padding:5px; flex-flow: row wrap;">
891 <div style="margin-right: 20px; margin-bottom: 10px;" id="secondt">
Marc Kupietze6a7a732018-01-12 09:21:08 +0100892 <table class="display compact nowrap" id="secondtable">
Marc Kupietz58270662017-12-04 12:10:06 +0100893 <thead>
894 <tr>
895 % if($collocators) {
896 <th>#</th>
Marc Kupietz4116b432017-12-06 14:15:32 +0100897 <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>
898 <th align="right" title="Maximum activation of the collocator anywhere in the output layer.">max(a)</th>
899 <th title="Average raw activation of the collocator in the columns selected by auto-focus." align="right">⟨a⟩</th>
900 <th title="Sum of activations over the selected colunns normalized by the total activation sum of the selected columns." align="right">Σa/Σw'</th>
901 <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 +0100902 <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 +0100903 <th align="left"><%= loc 'collocate_w2v' %></th>
Marc Kupietz58270662017-12-04 12:10:06 +0100904 % }
905 </tr>
906 </thead>
907 <tbody>
908 <tr>
909 <td align="right">
910 </td>
911 <td align="right">
912 </td>
913 <td align="right">
914 </td>
915 <td align="right">
916 </td>
917 <td align="right">
918 </td>
919 <td align="right">
920 </td>
Marc Kupietz58270662017-12-04 12:10:06 +0100921 </tr>
922 </tbody>
923 </table>
Marc Kupietz66bfd952017-12-11 09:59:45 +0100924 </div>
Marc Kupietzdeb8f622018-03-12 09:41:00 +0100925 <div id="ccd" style="">
Marc Kupietze6a7a732018-01-12 09:21:08 +0100926 <table class="display compact nowrap" id="classicoloctable">
927 <thead>
Marc Kupietzcd136e22018-01-29 09:18:12 +0100928 % if($collocators) {
929 <tr>
Marc Kupietzf19814b2019-01-21 16:50:19 +0100930 <th id="ll_tt">LL</th>
Marc Kupietzfab14a72019-01-22 16:20:29 +0100931 <th id="mi_tt">MI</th>
932 <th id="md_tt">MI²</th>
Marc Kupietzf19814b2019-01-21 16:50:19 +0100933 <th id="lfmd_tt">MI³</th>
Marc Kupietzfab14a72019-01-22 16:20:29 +0100934 <th id="npmi_tt">nPMI</th>
935 <th id="dice_tt">dice</th>
Marc Kupietz63b268f2019-01-22 22:34:29 +0100936 <th id="logdice_tt">LD</th>
937 <th id="logdiceaf_tt">LDaf</th>
Marc Kupietz001bffd2019-02-21 08:52:41 +0100938 <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 +0100939 <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 +0100940 <th title="PMI³ restricted to left neighbour">l-PMI³</th>
941 <th title="PMI³ restricted to right neighbour">r-PMI³</th>
942 <th title="nPMI restricted to left neighbour">l-nPMI</th>
943 <th title="nPMI restricted to right neighbour">r-nPMI</th>
Marc Kupietz4784fae2019-02-04 12:32:12 +0100944 <th id="rawfreq_tt" title="raw frequency sum of collocation within window">raw</th>
Marc Kupietz95104512019-12-05 10:13:05 +0100945 <th><%= loc 'collocate_ca' %></th>
Marc Kupietzcd136e22018-01-29 09:18:12 +0100946 </tr>
Marc Kupietz1acb3172018-02-17 09:41:26 +0100947 % }
Marc Kupietze6a7a732018-01-12 09:21:08 +0100948 </thead>
949 <tbody>
950 <tr>
Marc Kupietz63b268f2019-01-22 22:34:29 +0100951 <td align="right"></td>
952 <td align="right"></td>
953 <td align="right"></td>
Marc Kupietzb4b53ca2018-01-25 08:57:11 +0100954 <td align="right"></td>
Marc Kupietz78d7c1a2019-02-17 22:31:22 +0100955 <td align="right"></td>
956 <td align="right"></td>
957 <td align="right"></td>
958 <td align="right"></td>
959 <td align="right"></td>
960 <td align="left"> </td>
961 <td align="right"></td>
962 <td align="right"></td>
963 <td align="right"></td>
964 <td align="right"></td>
965 <td align="left"> </td>
Marc Kupietze6a7a732018-01-12 09:21:08 +0100966 </tr>
967 </tbody>
968 </table>
969 </div>
Marc Kupietz384c9132018-03-19 16:45:24 +0100970 <!--
971 <div style="clear:both" ></div>
972 <div style="float: right; overflow: hidden" id="extra"><button onClick="showCollocatorSOM()"> </button></div>
973 -->
Marc Kupietz66bfd952017-12-11 09:59:45 +0100974 </div>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100975 <div id="tabs-4" style="display: flex; padding:5px; flex-flow: row wrap;">
976 <div id="info">
977 <h3><%== loc 'about' %></h3>
978 %= include(loc('abouttext'))
979 % if($training_args && (@$lists)[0]) {
980 <h3><%= loc 'training_parameters' %></h3>
981 % if($training_args =~ /-type\s*3/) {
982 <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>
983 <div class="mono"><%= $training_args %></div>
984 % } else {
985 <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>
986 <div class="mono"><%= $training_args %></div>
987 % }
Marc Kupietz2133bd12022-05-19 09:24:42 +0200988 % }
989 <h3>Source Code</h3>
990 <ul>
991 <li><a href="https://korap.ids-mannheim.de/gerrit/plugins/gitiles/ids-kl/dereko2vec">dereko2vec</a></li>
992 <li><a href="https://korap.ids-mannheim.de/gerrit/plugins/gitiles/ids-kl/derekovecs">derekovecs</a></li>
993 </ul>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +0100994 <h3><%== loc 'references' %></h3>
995 %= include 'references'
996 </div>
997 </div>
998 </div> <!-- tabs -->
Marc Kupietz58270662017-12-04 12:10:06 +0100999 </div> <!-- topwrapper -->
1000 <div style="clear: both;"></div>
1001 </div>
Marc Kupietzd6dfdf02019-12-06 09:53:34 +01001002 <div class="footer">
1003 <span class="footertext">
1004 %= include(loc('footer'))
1005 </span>
Marc Kupietzebea4702018-01-12 09:16:09 +01001006 </div>
Marc Kupietz58270662017-12-04 12:10:06 +01001007 </body>
Marc Kupietz83305222016-04-28 09:57:22 +02001008</html>