Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
Marc Kupietz | c053d97 | 2019-01-10 10:41:51 +0100 | [diff] [blame] | 4 | <% my $plain_title = $title; $plain_title=~s/<[^>]+>//g; %> |
Marc Kupietz | 86b5029 | 2019-02-17 21:03:59 +0100 | [diff] [blame] | 5 | <title><%= $plain_title %>:<%= $word %> · IDS word vector analysis</title> |
Marc Kupietz | 80bd7b9 | 2017-07-04 16:25:54 +0200 | [diff] [blame] | 6 | <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 7 | <link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Condensed" rel="stylesheet"> |
Marc Kupietz | 42e6d09 | 2023-04-18 19:29:12 +0200 | [diff] [blame] | 8 | <script src="https://code.jquery.com/jquery-latest.min.js"></script> |
Marc Kupietz | 898e548 | 2024-02-20 15:03:07 +0100 | [diff] [blame] | 9 | <script src = "https://cdn.datatables.net/1.13.10/js/jquery.dataTables.min.js"></script> |
Marc Kupietz | 5f532b3 | 2019-01-23 10:03:18 +0100 | [diff] [blame] | 10 | <script src = "https://cdn.datatables.net/fixedcolumns/3.2.5/js/dataTables.fixedColumns.min.js"></script> |
Marc Kupietz | 898e548 | 2024-02-20 15:03:07 +0100 | [diff] [blame] | 11 | <script src = "https://cdn.datatables.net/plug-ins/1.13.10/sorting/scientific.js"></script> |
Marc Kupietz | 5f532b3 | 2019-01-23 10:03:18 +0100 | [diff] [blame] | 12 | <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML'></script> |
Marc Kupietz | 898e548 | 2024-02-20 15:03:07 +0100 | [diff] [blame] | 13 | <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 Kupietz | 9ae184c | 2023-11-04 18:21:54 +0100 | [diff] [blame] | 18 | <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 Kupietz | 898e548 | 2024-02-20 15:03:07 +0100 | [diff] [blame] | 25 | <link rel="stylesheet" href="https://cdn.datatables.net/1.13.10/css/jquery.dataTables.min.css"> |
Marc Kupietz | 4949d23 | 2018-03-19 16:43:18 +0100 | [diff] [blame] | 26 | <link rel="stylesheet" href="/derekovecs/css/derekovecs.css"> |
Marc Kupietz | 80bd7b9 | 2017-07-04 16:25:54 +0200 | [diff] [blame] | 27 | <script |
Marc Kupietz | 42e6d09 | 2023-04-18 19:29:12 +0200 | [diff] [blame] | 28 | src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 29 | integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" |
| 30 | crossorigin="anonymous"></script> |
Marc Kupietz | 80bd7b9 | 2017-07-04 16:25:54 +0200 | [diff] [blame] | 31 | <script> |
Marc Kupietz | a0ffb39 | 2018-01-25 08:53:43 +0100 | [diff] [blame] | 32 | 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 Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 40 | var urlParams = new URLSearchParams(window.location.search); |
Marc Kupietz | b3a2e4f | 2017-12-08 17:25:53 +0100 | [diff] [blame] | 41 | var currentWords = urlParams.get("word"); |
Rainer Perkuhn | d5010ec | 2024-07-30 14:38:25 +0200 | [diff] [blame] | 42 | var CIIsearchWords = (currentWords && (currentWords.includes(" ") || currentWords.includes("|")) ? '('+currentWords.replace(/[ |] +/g, " oder ")+')' : currentWords); |
Marc Kupietz | 66bfd95 | 2017-12-11 09:59:45 +0100 | [diff] [blame] | 43 | var collocatorTable = null; |
Marc Kupietz | 86b5029 | 2019-02-17 21:03:59 +0100 | [diff] [blame] | 44 | var plainTitle ="<%= $plain_title %>" |
Marc Kupietz | 78d7c1a | 2019-02-17 22:31:22 +0100 | [diff] [blame] | 45 | var korapPath="/"; |
| 46 | if (plainTitle.match(/-en/)) { |
| 47 | korapPath="/instance/english"; |
| 48 | } |
Marc Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 49 | var korapVC=""; |
| 50 | if (plainTitle.match(/WUDD/i)) { |
| 51 | korapVC="&collection=corpusSigle+%3D+%2FW%5BDU%5DD17%2F"; |
| 52 | korapPath="/instance/test"; |
| 53 | } |
| 54 | |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 55 | $(document).ready(function() { |
Marc Kupietz | 3576c62 | 2023-11-05 08:51:58 +0100 | [diff] [blame] | 56 | insertCalendarEvents(document.getElementById('downtimes'), '/derekovecs/getDowntimeCalendar' ); |
Marc Kupietz | 694610d | 2017-11-25 18:30:03 +0100 | [diff] [blame] | 57 | |
Marc Kupietz | a0ffb39 | 2018-01-25 08:53:43 +0100 | [diff] [blame] | 58 | $('#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 Kupietz | 9597700 | 2019-02-26 09:09:59 +0100 | [diff] [blame] | 66 | function () { |
Marc Kupietz | 7bd5523 | 2019-01-22 15:29:06 +0100 | [diff] [blame] | 67 | $("#mi_tt").attr("title",$("#pmi_ttt").html()); |
Marc Kupietz | a0ffb39 | 2018-01-25 08:53:43 +0100 | [diff] [blame] | 68 | $("#lfmd_tt").attr("title",$("#lfmd_ttt").html()); |
Marc Kupietz | 7bd5523 | 2019-01-22 15:29:06 +0100 | [diff] [blame] | 69 | $("#md_tt").attr("title",$("#md_ttt").html()); |
Marc Kupietz | a0ffb39 | 2018-01-25 08:53:43 +0100 | [diff] [blame] | 70 | $("#npmi_tt").attr("title",$("#npmi_ttt").html()); |
Marc Kupietz | f19814b | 2019-01-21 16:50:19 +0100 | [diff] [blame] | 71 | $("#ll_tt").attr("title",$("#ll_ttt").html()); |
Marc Kupietz | 7bd5523 | 2019-01-22 15:29:06 +0100 | [diff] [blame] | 72 | $("#logdice_tt").attr("title",$("#logdice_ttt").html()); |
Marc Kupietz | 63b268f | 2019-01-22 22:34:29 +0100 | [diff] [blame] | 73 | $("#logdiceaf_tt").attr("title",$("#logdiceaf_ttt").html()); |
Marc Kupietz | a0ffb39 | 2018-01-25 08:53:43 +0100 | [diff] [blame] | 74 | } |
| 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 Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 89 | $("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 Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 99 | |
Marc Kupietz | e871abd | 2018-01-25 16:18:27 +0100 | [diff] [blame] | 100 | var collocatorTable_activated = false; |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 101 | $( "#tabs" ).on( "tabsactivate", function( event, ui ) { |
| 102 | if (localStorage) localStorage['tab'] = ui.newTab.index(); |
Marc Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 103 | if(ui.newTab.index() == 3 && !collocatorTable_activated) { |
Marc Kupietz | e871abd | 2018-01-25 16:18:27 +0100 | [diff] [blame] | 104 | classicCollocatorTable.columns.adjust(); |
| 105 | collocatorTable.columns.adjust(); |
| 106 | collocatorTable_activated = true; |
| 107 | } |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 108 | }); |
| 109 | |
| 110 | $(function(){ |
| 111 | $("#SEARCH").click(function() { |
| 112 | window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self"); |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 113 | }); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 114 | }); |
Marc Kupietz | 0af83e3 | 2017-11-27 09:31:37 +0100 | [diff] [blame] | 115 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 116 | function changeCharColor(txt, heat, word) { |
| 117 | var newText = ""; |
| 118 | for (var i=0, l=txt.length; i<l; i++) { |
Marc Kupietz | 86b5029 | 2019-02-17 21:03:59 +0100 | [diff] [blame] | 119 | newText += (i == 5 ? txt.charAt(i) : '<a href="http://korap.ids-mannheim.de' + korapPath + '/?ql=cosmas2&q=' + |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 120 | CIIsearchWords + ' /' + (i > 5? '%2B' : '-') + 'w' + |
Marc Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 121 | Math.abs(i-5) + ':' + Math.abs(i-5) + ' ' + word + korapVC + |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 122 | '" target="korap"><span style="background-color:' + |
| 123 | getHeatColor(heat[i]/maxHeat)+'">'+txt.charAt(i)+'</span></a>'); |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 124 | } |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 125 | return newText; |
| 126 | } |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 127 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 128 | 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 Kupietz | 0d4c0ca | 2017-12-04 09:18:56 +0100 | [diff] [blame] | 154 | } |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 155 | showMap({target: " "+urlParams.get('word')+" ", mergedEnd: <%= $mergedEnd %>, words: nwords, vecs: nvecs, ranks: nranks, marked: nmarked} ); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 156 | var t = $('#firsttable').DataTable({ |
Marc Kupietz | ee894d5 | 2019-01-09 14:55:14 +0100 | [diff] [blame] | 157 | data: [].concat.apply([], paraResults), |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 158 | "sScrollY": "780px", |
| 159 | "bScrollCollapse": true, |
| 160 | "bPaginate": false, |
| 161 | "bJQueryUI": true, |
Marc Kupietz | 898e548 | 2024-02-20 15:03:07 +0100 | [diff] [blame] | 162 | "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 Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 169 | "initComplete":function(settings, json) { |
| 170 | $('td.paradigmator a').on('mousedown', function(e) { |
Marc Kupietz | 86b5029 | 2019-02-17 21:03:59 +0100 | [diff] [blame] | 171 | return paradigmatorClick(e, paraResults[0][0].word, this.childNodes["0"].textContent); |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 172 | }); |
| 173 | }, |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 174 | "columns": [ |
| 175 | { "data": "rank", type: "allnumeric" }, |
| 176 | { "data": "dist", render: function ( data, type, row ) {return data.toFixed(3) }}, |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 177 | { "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 Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 180 | ], |
| 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 Kupietz | 0d4c0ca | 2017-12-04 09:18:56 +0100 | [diff] [blame] | 195 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 196 | 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 Kupietz | cddc848 | 2019-12-04 08:57:33 +0100 | [diff] [blame] | 210 | if(typeof data !== 'undefined' && data.mergedEnd > 0) { |
Marc Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 211 | vocabDistanceTable = makeVocabDistanceTable("#vocabdistt", baseURL); |
| 212 | } |
Marc Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 213 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 214 | 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 Kupietz | 898e548 | 2024-02-20 15:03:07 +0100 | [diff] [blame] | 222 | "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 Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 230 | { "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 Kupietz | 78b434a | 2018-01-12 22:33:32 +0100 | [diff] [blame] | 264 | }); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 265 | |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 266 | |
| 267 | if($('#sprofiles').length) { |
| 268 | similarProfileTable = $('#sprofiles').DataTable({ |
| 269 | ajax: { |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 270 | method: "GET", |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 271 | url: '/derekovecs/getSimilarProfiles', |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 272 | dataType: 'json', |
| 273 | dataSrc: "", |
| 274 | timeout: 30000, |
| 275 | data: { w: paraResults[0][0].rank } |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 276 | }, |
| 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 Kupietz | 898e548 | 2024-02-20 15:03:07 +0100 | [diff] [blame] | 291 | "columns": [ |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 292 | { "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 Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 304 | |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 305 | // var filterQuot = /(^quot?=[A-Z])|(quot$)/g; |
| 306 | var filterQuot = /^quot/; |
Marc Kupietz | 4784fae | 2019-02-04 12:32:12 +0100 | [diff] [blame] | 307 | var ccResult; |
Marc Kupietz | 86b5029 | 2019-02-17 21:03:59 +0100 | [diff] [blame] | 308 | var baseURL = window.location.pathname.replace(/[/]$/, '') |
Marc Kupietz | 9597700 | 2019-02-26 09:09:59 +0100 | [diff] [blame] | 309 | classicCollocatorTable = makeClassicCollocatorTable('#classicoloctable', baseURL, paraResults[0][0].rank) |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 310 | |
Marc Kupietz | 1acb317 | 2018-02-17 09:41:26 +0100 | [diff] [blame] | 311 | $('#show-details').change(function (e) { |
| 312 | var columns = classicCollocatorTable.columns(".detail"); |
| 313 | if(this.checked) { |
| 314 | columns.visible(true); |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 315 | $("#ccd").css('width', 'auto'); |
Marc Kupietz | 1acb317 | 2018-02-17 09:41:26 +0100 | [diff] [blame] | 316 | } else { |
| 317 | columns.visible(false); |
Marc Kupietz | 08bfd40 | 2019-01-23 10:05:17 +0100 | [diff] [blame] | 318 | $("#ccd").css('width', '680px'); |
Marc Kupietz | 1acb317 | 2018-02-17 09:41:26 +0100 | [diff] [blame] | 319 | } |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 320 | classicCollocatorTable.columns.adjust().draw(); |
Marc Kupietz | 1acb317 | 2018-02-17 09:41:26 +0100 | [diff] [blame] | 321 | } ); |
| 322 | |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 323 | $("td.collocator").click(function(){ |
Rainer Perkuhn | d5010ec | 2024-07-30 14:38:25 +0200 | [diff] [blame] | 324 | queryKorAPCII(this.textContent + " /w1:5,s0 " + CIIsearchWords); |
Marc Kupietz | ad78372 | 2018-01-13 17:45:21 +0100 | [diff] [blame] | 325 | }); |
| 326 | |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 327 | 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 Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 333 | |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 334 | 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 Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 340 | |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 341 | $(function(){ |
| 342 | $("#dropdownoptions").dialog({ |
Marc Kupietz | 9510451 | 2019-12-05 10:13:05 +0100 | [diff] [blame] | 343 | title: "<%= loc 'Options' %>", |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 344 | autoOpen: false, |
| 345 | modal: false, |
| 346 | draggable: false, |
| 347 | height: "auto", |
| 348 | width: "auto", |
| 349 | resizable: false, |
| 350 | buttons: { |
Marc Kupietz | 9510451 | 2019-12-05 10:13:05 +0100 | [diff] [blame] | 351 | "<%= loc 'Cancel'%>": function() { |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 352 | $( this ).dialog( "close" ); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 353 | }, |
Marc Kupietz | 9510451 | 2019-12-05 10:13:05 +0100 | [diff] [blame] | 354 | "<%= loc 'Apply' %>": function() { |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 355 | window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self"); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 356 | } |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 357 | } |
| 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 Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 369 | }); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 370 | }); |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 371 | }); |
| 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 Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 452 | </script> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 453 | <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script> |
Marc Kupietz | 68e29be | 2023-11-04 18:37:35 +0100 | [diff] [blame] | 454 | <script src="/derekovecs/js/calendar-events.js"></script> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 455 | <script src="/derekovecs/js/tsne.js"></script> |
| 456 | <script src="/derekovecs/js/som.js"></script> |
| 457 | <script src="/derekovecs/js/labeler.js"></script> |
Marc K | 20476c7 | 2021-03-11 12:18:01 +0100 | [diff] [blame] | 458 | <script src="/derekovecs/js/derekovecs.js"></script> |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 459 | <script> |
| 460 | |
| 461 | var opt = {epsilon: <%= $epsilon %>, perplexity: <%= $perplexity %>}, |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 462 | mapWidth = 800, // width map |
| 463 | mapHeight = 800, |
| 464 | jitterRadius = 7; |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 465 | |
| 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 Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 474 | 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 Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 482 | (d.x) + "," + |
| 483 | (d.y) + ")"; |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 484 | }); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 485 | } |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 486 | |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 487 | function updateEmbedding() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 488 | var Y = T.getSolution(); |
| 489 | svg.selectAll('.tsnet') |
| 490 | .data(data.words) |
| 491 | .attr("transform", function(d, i) { |
| 492 | return "translate(" + |
Marc Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 493 | ((Y[i][0]*20*ss + tx) + mapWidth/2) + "," + |
| 494 | ((Y[i][1]*20*ss + ty) + mapHeight/2) + ")"; }); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 495 | } |
| 496 | |
| 497 | var svg; |
| 498 | var labels = []; |
| 499 | var anchor_array = []; |
| 500 | var text; |
| 501 | |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 502 | function getMergedClass(i) { |
Marc Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 503 | if(typeof data !== 'undefined' && i > data.mergedEnd) { |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 504 | 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 Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 522 | function drawEmbedding() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 523 | var urlprefix = new URLSearchParams(window.location.search); |
| 524 | urlprefix.delete("word"); |
| 525 | urlprefix.append("word",""); |
Marc Kupietz | 8f9c86a | 2017-12-04 17:17:13 +0100 | [diff] [blame] | 526 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 527 | $("#embed").empty(); |
| 528 | var div = d3.select("#embed"); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 529 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 530 | // get min and max in each column of Y |
| 531 | var Y = T.Y; |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 532 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 533 | svg = div.append("svg") // svg is global |
| 534 | .attr("width", mapWidth) |
| 535 | .attr("height", mapHeight); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 536 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 537 | var g = svg.selectAll(".b") |
| 538 | .data(data.words) |
| 539 | .enter().append("g") |
| 540 | .attr("class", "tsnet"); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 541 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 542 | 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 Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 551 | res += "target"; |
| 552 | } |
| 553 | if(data.mergedEnd && data.ranks[i] >= data.mergedEnd) { |
| 554 | return res+" merged"; |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 555 | } else { |
| 556 | return res; |
| 557 | } |
| 558 | }) |
| 559 | .attr("title", function(d, i) { |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 560 | return getRankTooltip(i); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 561 | }) |
| 562 | .append("text") |
| 563 | .attr("text-anchor", "top") |
| 564 | .attr("font-size", 12) |
| 565 | .text(function(d) { return d; }); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 566 | |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 567 | g.append("svg:title") |
| 568 | .text(function(d, i) { |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 569 | return getRankTooltip(i); |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 570 | }); |
| 571 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 572 | var zoomListener = d3.behavior.zoom() |
| 573 | .scaleExtent([0.1, 10]) |
| 574 | .center([0,0]) |
| 575 | .on("zoom", zoomHandler); |
| 576 | zoomListener(svg); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 577 | } |
| 578 | |
| 579 | var tx=0, ty=0; |
| 580 | var ss=1; |
| 581 | var iter_id=-1; |
| 582 | |
| 583 | function zoomHandler() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 584 | tx = d3.event.translate[0]; |
| 585 | ty = d3.event.translate[1]; |
| 586 | ss = d3.event.scale; |
| 587 | updateEmbedding(); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 588 | } |
| 589 | |
| 590 | var stepnum = 0; |
| 591 | |
| 592 | function stopStep() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 593 | clearInterval(iter_id); |
| 594 | text = svg.selectAll("text"); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 595 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 596 | // 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 Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 607 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 608 | // 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 Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 615 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 616 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 617 | // 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 Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 626 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 627 | iter_id = setInterval(jitterStep, 1); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 628 | } |
| 629 | |
| 630 | var jitter_i=0; |
| 631 | |
| 632 | function jitterStep() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 633 | if(jitter_i++ > 100) { |
| 634 | clearInterval(iter_id); |
| 635 | } else { |
| 636 | labeler.start2(10); |
| 637 | applyJitter(); |
| 638 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 639 | } |
| 640 | |
| 641 | var last_cost=1000; |
| 642 | |
| 643 | function step() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 644 | var i = T.iter; |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 645 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 646 | 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 Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 653 | } else { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 654 | last_cost = cost; |
| 655 | updateEmbedding(); |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 656 | } |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 657 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 658 | } |
| 659 | |
| 660 | function showMap(j) { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 661 | 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 Kupietz | 7811453 | 2017-11-29 17:00:16 +0100 | [diff] [blame] | 667 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 668 | 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 Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 676 | } |
Marc Kupietz | 39179ab | 2017-07-04 16:28:06 +0200 | [diff] [blame] | 677 | var queryword; |
| 678 | |
Marc Kupietz | 66bfd95 | 2017-12-11 09:59:45 +0100 | [diff] [blame] | 679 | function showCollocatorSOM() { |
Marc Kupietz | 86b5029 | 2019-02-17 21:03:59 +0100 | [diff] [blame] | 680 | var baseURL = window.location.pathname.replace(/[/]$/, '') |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 681 | 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 Kupietz | 66bfd95 | 2017-12-11 09:59:45 +0100 | [diff] [blame] | 688 | } |
Marc Kupietz | 86b5029 | 2019-02-17 21:03:59 +0100 | [diff] [blame] | 689 | $.post(baseURL+'/getVecsByRanks', |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 690 | JSON.stringify(nranks), |
| 691 | function(data, status){ |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 692 | showMap({target: " "+urlParams.get('word')+" ", mergedEnd: <%= $mergedEnd %>, words: nwords, vecs: data, ranks: nranks, marked: Array(100).fill(false)} ); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 693 | }, 'json'); |
| 694 | } |
Marc Kupietz | 66bfd95 | 2017-12-11 09:59:45 +0100 | [diff] [blame] | 695 | } |
| 696 | |
Marc Kupietz | 39179ab | 2017-07-04 16:28:06 +0200 | [diff] [blame] | 697 | function onload() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 698 | queryword = document.getElementById('word'); |
Marc Kupietz | 39179ab | 2017-07-04 16:28:06 +0200 | [diff] [blame] | 699 | } |
| 700 | |
| 701 | function queryKorAP() { |
Marc Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 702 | window.open('http://korap.ids-mannheim.de' + korapPath + '?q='+queryword.value+korapVC, 'KorAP'); |
Marc Kupietz | 39179ab | 2017-07-04 16:28:06 +0200 | [diff] [blame] | 703 | } |
Marc Kupietz | 4dc270c | 2017-11-24 10:17:12 +0100 | [diff] [blame] | 704 | |
| 705 | function queryKorAPCII(query) { |
Marc Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 706 | window.open('http://korap.ids-mannheim.de' +korapPath + '?ql=cosmas2&q='+query+korapVC, 'KorAP'); |
Marc Kupietz | 4dc270c | 2017-11-24 10:17:12 +0100 | [diff] [blame] | 707 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 708 | </script> |
| 709 | </head> |
Marc Kupietz | 7b0e5de | 2019-01-31 12:49:32 +0100 | [diff] [blame] | 710 | <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 Kupietz | 6d7462c | 2019-12-05 10:16:38 +0100 | [diff] [blame] | 718 | <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 Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 722 | <div id="pagetitle"> |
Marc Kupietz | c053d97 | 2019-01-10 10:41:51 +0100 | [diff] [blame] | 723 | <h1>DeReKoVecs</h1> |
| 724 | <h2><%== $title %></h2> |
Marc Kupietz | 4fcda0c | 2017-11-29 09:00:31 +0100 | [diff] [blame] | 725 | </div> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 726 | <div id="options" class="widget"> |
| 727 | <form id="queryform"> |
Marc Kupietz | 9510451 | 2019-12-05 10:13:05 +0100 | [diff] [blame] | 728 | <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 Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 732 | </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 Kupietz | 1acb317 | 2018-02-17 09:41:26 +0100 | [diff] [blame] | 759 | <input id="show-details" type="checkbox" name="show-details" value="1" > |
| 760 | <label for="show-details"> |
| 761 | Show details |
| 762 | </label> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 763 | </div> |
| 764 | </form> |
| 765 | </div> |
| 766 | </div> |
| 767 | </div> |
| 768 | <div id="topwrapper"> |
| 769 | <div style="visibility: hidden;" id="tabs"> |
| 770 | <ul> |
Marc Kupietz | d6dfdf0 | 2019-12-06 09:53:34 +0100 | [diff] [blame] | 771 | % 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 Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 778 | % } |
Marc Kupietz | d6dfdf0 | 2019-12-06 09:53:34 +0100 | [diff] [blame] | 779 | <li><a href="#tabs-4">Info</a></li> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 780 | </ul> |
Marc Kupietz | b6514dc | 2019-06-26 11:47:56 +0200 | [diff] [blame] | 781 | % if($mergedEnd && $distantWords) { |
Marc Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 782 | <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 Kupietz | 9597700 | 2019-02-26 09:09:59 +0100 | [diff] [blame] | 787 | <th align="right">#</th><th id="cosD" align="right">D<sub>cos</sub></th><th align="left">word</th> |
Marc Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 788 | </tr> |
| 789 | </thead> |
| 790 | <tbody> |
| 791 | <tr> |
| 792 | <td align="right"> |
Marc Kupietz | 9597700 | 2019-02-26 09:09:59 +0100 | [diff] [blame] | 793 | </td> |
Marc Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 794 | <td align="right"> |
| 795 | </td> |
| 796 | <td></td> |
| 797 | </tr> |
| 798 | </tbody> |
| 799 | </table> |
| 800 | </div> |
| 801 | </div> |
Marc Kupietz | b6514dc | 2019-06-26 11:47:56 +0200 | [diff] [blame] | 802 | % } |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 803 | <div id="tabs-1" style="display: flex; padding: 5px; flex-flow: row wrap;"> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 804 | % if($lists && (@$lists) > 0 && (@$lists)[0]) { |
| 805 | <div id="wrapper"> |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 806 | <div id="first" style="width: 230px; margin-bottom: 15px;"> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 807 | <table class="display compact nowrap" id="firsttable"> |
| 808 | <thead> |
| 809 | <tr> |
Marc Kupietz | 9597700 | 2019-02-26 09:09:59 +0100 | [diff] [blame] | 810 | <th align="right">#</th><th align="right">S<sub>cos</sub></th><th align="left">similars by w2v</th> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 811 | </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 Kupietz | a55a09a | 2018-07-06 13:30:30 +0200 | [diff] [blame] | 824 | % if(0 && $haveSProfiles) { |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 825 | <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 Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 842 | <div id="second"> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 843 | <div id="embed"> |
| 844 | </div> |
| 845 | <div id="cost"> |
| 846 | </div> |
| 847 | </div> |
| 848 | </div> |
Marc Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 849 | % } elsif($word !~ /^\s*$/) { |
| 850 | <div id="wrapper"> |
Marc Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 851 | <script> |
| 852 | $( function() { |
Marc Kupietz | ce6490b | 2019-12-06 11:05:40 +0100 | [diff] [blame] | 853 | $( "<%== loc 'notfounddialog' %>").dialog({ |
Marc Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 854 | 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 Kupietz | ce6490b | 2019-12-06 11:05:40 +0100 | [diff] [blame] | 863 | } /* , |
Marc Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 864 | "Apply": function() { |
| 865 | window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self"); |
Marc Kupietz | ce6490b | 2019-12-06 11:05:40 +0100 | [diff] [blame] | 866 | } */ |
Marc Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 867 | } |
| 868 | }); |
| 869 | }); |
| 870 | </script> |
Marc Kupietz | ce6490b | 2019-12-06 11:05:40 +0100 | [diff] [blame] | 871 | <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 Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 879 | </div> |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 880 | % } |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 881 | </div> |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 882 | <div id="tabs-2" style="display: flex; padding: 5px; flex-flow: row wrap;"> |
Marc Kupietz | d6dfdf0 | 2019-12-06 09:53:34 +0100 | [diff] [blame] | 883 | % 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 Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 889 | </div> |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 890 | <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 Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 892 | <table class="display compact nowrap" id="secondtable"> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 893 | <thead> |
| 894 | <tr> |
| 895 | % if($collocators) { |
| 896 | <th>#</th> |
Marc Kupietz | 4116b43 | 2017-12-06 14:15:32 +0100 | [diff] [blame] | 897 | <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 Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 902 | <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 Kupietz | 9510451 | 2019-12-05 10:13:05 +0100 | [diff] [blame] | 903 | <th align="left"><%= loc 'collocate_w2v' %></th> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 904 | % } |
| 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 Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 921 | </tr> |
| 922 | </tbody> |
| 923 | </table> |
Marc Kupietz | 66bfd95 | 2017-12-11 09:59:45 +0100 | [diff] [blame] | 924 | </div> |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 925 | <div id="ccd" style=""> |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 926 | <table class="display compact nowrap" id="classicoloctable"> |
| 927 | <thead> |
Marc Kupietz | cd136e2 | 2018-01-29 09:18:12 +0100 | [diff] [blame] | 928 | % if($collocators) { |
| 929 | <tr> |
Marc Kupietz | f19814b | 2019-01-21 16:50:19 +0100 | [diff] [blame] | 930 | <th id="ll_tt">LL</th> |
Marc Kupietz | fab14a7 | 2019-01-22 16:20:29 +0100 | [diff] [blame] | 931 | <th id="mi_tt">MI</th> |
| 932 | <th id="md_tt">MI²</th> |
Marc Kupietz | f19814b | 2019-01-21 16:50:19 +0100 | [diff] [blame] | 933 | <th id="lfmd_tt">MI³</th> |
Marc Kupietz | fab14a7 | 2019-01-22 16:20:29 +0100 | [diff] [blame] | 934 | <th id="npmi_tt">nPMI</th> |
| 935 | <th id="dice_tt">dice</th> |
Marc Kupietz | 63b268f | 2019-01-22 22:34:29 +0100 | [diff] [blame] | 936 | <th id="logdice_tt">LD</th> |
| 937 | <th id="logdiceaf_tt">LDaf</th> |
Marc Kupietz | 001bffd | 2019-02-21 08:52:41 +0100 | [diff] [blame] | 938 | <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 Kupietz | 9510451 | 2019-12-05 10:13:05 +0100 | [diff] [blame] | 939 | <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 Kupietz | 5a7f9ac | 2018-01-30 11:22:44 +0100 | [diff] [blame] | 940 | <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 Kupietz | 4784fae | 2019-02-04 12:32:12 +0100 | [diff] [blame] | 944 | <th id="rawfreq_tt" title="raw frequency sum of collocation within window">raw</th> |
Marc Kupietz | 9510451 | 2019-12-05 10:13:05 +0100 | [diff] [blame] | 945 | <th><%= loc 'collocate_ca' %></th> |
Marc Kupietz | cd136e2 | 2018-01-29 09:18:12 +0100 | [diff] [blame] | 946 | </tr> |
Marc Kupietz | 1acb317 | 2018-02-17 09:41:26 +0100 | [diff] [blame] | 947 | % } |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 948 | </thead> |
| 949 | <tbody> |
| 950 | <tr> |
Marc Kupietz | 63b268f | 2019-01-22 22:34:29 +0100 | [diff] [blame] | 951 | <td align="right"></td> |
| 952 | <td align="right"></td> |
| 953 | <td align="right"></td> |
Marc Kupietz | b4b53ca | 2018-01-25 08:57:11 +0100 | [diff] [blame] | 954 | <td align="right"></td> |
Marc Kupietz | 78d7c1a | 2019-02-17 22:31:22 +0100 | [diff] [blame] | 955 | <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 Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 966 | </tr> |
| 967 | </tbody> |
| 968 | </table> |
| 969 | </div> |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 970 | <!-- |
| 971 | <div style="clear:both" ></div> |
| 972 | <div style="float: right; overflow: hidden" id="extra"><button onClick="showCollocatorSOM()"> </button></div> |
| 973 | --> |
Marc Kupietz | 66bfd95 | 2017-12-11 09:59:45 +0100 | [diff] [blame] | 974 | </div> |
Marc Kupietz | d6dfdf0 | 2019-12-06 09:53:34 +0100 | [diff] [blame] | 975 | <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 Kupietz | 2133bd1 | 2022-05-19 09:24:42 +0200 | [diff] [blame] | 988 | % } |
| 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 Kupietz | d6dfdf0 | 2019-12-06 09:53:34 +0100 | [diff] [blame] | 994 | <h3><%== loc 'references' %></h3> |
| 995 | %= include 'references' |
| 996 | </div> |
| 997 | </div> |
| 998 | </div> <!-- tabs --> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 999 | </div> <!-- topwrapper --> |
| 1000 | <div style="clear: both;"></div> |
| 1001 | </div> |
Marc Kupietz | d6dfdf0 | 2019-12-06 09:53:34 +0100 | [diff] [blame] | 1002 | <div class="footer"> |
| 1003 | <span class="footertext"> |
| 1004 | %= include(loc('footer')) |
| 1005 | </span> |
Marc Kupietz | ebea470 | 2018-01-12 09:16:09 +0100 | [diff] [blame] | 1006 | </div> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 1007 | </body> |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 1008 | </html> |