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 | 5f532b3 | 2019-01-23 10:03:18 +0100 | [diff] [blame] | 9 | <script src = "https://cdn.datatables.net/1.10.18/js/jquery.dataTables.min.js"></script> |
| 10 | <script src = "https://cdn.datatables.net/fixedcolumns/3.2.5/js/dataTables.fixedColumns.min.js"></script> |
| 11 | <script src = "https://cdn.datatables.net/plug-ins/1.10.18/sorting/scientific.js"></script> |
| 12 | <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML'></script> |
Marc Kupietz | 9ae184c | 2023-11-04 18:21:54 +0100 | [diff] [blame] | 13 | <script src="https://cdnjs.cloudflare.com/ajax/libs/ical.js/1.5.0/ical.js" |
| 14 | integrity="sha512-UxWd2RMDGpYwYuDeU2Fs+nd51gw4ZLQY0D9wWZ3NuanNSk6QQmWCZ6C+rvI0lJ/b/nZtBQ8RVESA9DN9r65dUg==" |
| 15 | crossorigin="anonymous" referrerpolicy="no-referrer"></script> |
| 16 | <script |
| 17 | src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment-with-locales.min.js" |
| 18 | integrity="sha512-42PE0rd+wZ2hNXftlM78BSehIGzezNeQuzihiBCvUEB3CVxHvsShF86wBWwQORNxNINlBPuq7rG4WWhNiTVHFg==" |
| 19 | crossorigin="anonymous" referrerpolicy="no-referrer"></script> |
Marc Kupietz | 5f532b3 | 2019-01-23 10:03:18 +0100 | [diff] [blame] | 20 | <link rel="stylesheet" href="https://cdn.datatables.net/1.10.18/css/jquery.dataTables.min.css"> |
Marc Kupietz | 4949d23 | 2018-03-19 16:43:18 +0100 | [diff] [blame] | 21 | <link rel="stylesheet" href="/derekovecs/css/derekovecs.css"> |
Marc Kupietz | 80bd7b9 | 2017-07-04 16:25:54 +0200 | [diff] [blame] | 22 | <script |
Marc Kupietz | 42e6d09 | 2023-04-18 19:29:12 +0200 | [diff] [blame] | 23 | 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] | 24 | integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" |
| 25 | crossorigin="anonymous"></script> |
Marc Kupietz | 80bd7b9 | 2017-07-04 16:25:54 +0200 | [diff] [blame] | 26 | <script> |
Marc Kupietz | a0ffb39 | 2018-01-25 08:53:43 +0100 | [diff] [blame] | 27 | MathJax.Hub.Config({ |
| 28 | config: ["MMLorHTML.js"], |
| 29 | jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML", "output/PreviewHTML"], |
| 30 | extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js", "fast-preview.js", "AssistiveMML.js", "a11y/accessibility-menu.js"], |
| 31 | TeX: { |
| 32 | extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"] |
| 33 | } |
| 34 | }); |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 35 | var urlParams = new URLSearchParams(window.location.search); |
Marc Kupietz | b3a2e4f | 2017-12-08 17:25:53 +0100 | [diff] [blame] | 36 | var currentWords = urlParams.get("word"); |
Marc Kupietz | a0ffb39 | 2018-01-25 08:53:43 +0100 | [diff] [blame] | 37 | var CIIsearchWords = (currentWords && currentWords.includes(" ") ? '('+currentWords.replace(/ +/g, " oder ")+')' : currentWords); |
Marc Kupietz | 66bfd95 | 2017-12-11 09:59:45 +0100 | [diff] [blame] | 38 | var collocatorTable = null; |
Marc Kupietz | 86b5029 | 2019-02-17 21:03:59 +0100 | [diff] [blame] | 39 | var plainTitle ="<%= $plain_title %>" |
Marc Kupietz | 78d7c1a | 2019-02-17 22:31:22 +0100 | [diff] [blame] | 40 | var korapPath="/"; |
| 41 | if (plainTitle.match(/-en/)) { |
| 42 | korapPath="/instance/english"; |
| 43 | } |
Marc Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 44 | var korapVC=""; |
| 45 | if (plainTitle.match(/WUDD/i)) { |
| 46 | korapVC="&collection=corpusSigle+%3D+%2FW%5BDU%5DD17%2F"; |
| 47 | korapPath="/instance/test"; |
| 48 | } |
| 49 | |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 50 | $(document).ready(function() { |
Marc Kupietz | 3576c62 | 2023-11-05 08:51:58 +0100 | [diff] [blame^] | 51 | insertCalendarEvents(document.getElementById('downtimes'), '/derekovecs/getDowntimeCalendar' ); |
Marc Kupietz | 694610d | 2017-11-25 18:30:03 +0100 | [diff] [blame] | 52 | |
Marc Kupietz | a0ffb39 | 2018-01-25 08:53:43 +0100 | [diff] [blame] | 53 | $('#firstable').hide(); |
| 54 | //Set up a callback to hear back when MathJax is done rendering the equations |
| 55 | // it finds |
| 56 | $('#ccd').load( |
| 57 | '@Url.Action("ActionResultMethod","ControllerName",{controller parameters})', |
| 58 | function () { |
| 59 | MathJax.Hub.Queue( |
| 60 | ["Typeset",MathJax.Hub,"ccd"], |
Marc Kupietz | 9597700 | 2019-02-26 09:09:59 +0100 | [diff] [blame] | 61 | function () { |
Marc Kupietz | 7bd5523 | 2019-01-22 15:29:06 +0100 | [diff] [blame] | 62 | $("#mi_tt").attr("title",$("#pmi_ttt").html()); |
Marc Kupietz | a0ffb39 | 2018-01-25 08:53:43 +0100 | [diff] [blame] | 63 | $("#lfmd_tt").attr("title",$("#lfmd_ttt").html()); |
Marc Kupietz | 7bd5523 | 2019-01-22 15:29:06 +0100 | [diff] [blame] | 64 | $("#md_tt").attr("title",$("#md_ttt").html()); |
Marc Kupietz | a0ffb39 | 2018-01-25 08:53:43 +0100 | [diff] [blame] | 65 | $("#npmi_tt").attr("title",$("#npmi_ttt").html()); |
Marc Kupietz | f19814b | 2019-01-21 16:50:19 +0100 | [diff] [blame] | 66 | $("#ll_tt").attr("title",$("#ll_ttt").html()); |
Marc Kupietz | 7bd5523 | 2019-01-22 15:29:06 +0100 | [diff] [blame] | 67 | $("#logdice_tt").attr("title",$("#logdice_ttt").html()); |
Marc Kupietz | 63b268f | 2019-01-22 22:34:29 +0100 | [diff] [blame] | 68 | $("#logdiceaf_tt").attr("title",$("#logdiceaf_ttt").html()); |
Marc Kupietz | a0ffb39 | 2018-01-25 08:53:43 +0100 | [diff] [blame] | 69 | } |
| 70 | ); |
| 71 | }); |
| 72 | |
| 73 | //set things up so that we can shove raw html into what is shown in the tooltip; |
| 74 | // in this case, we will have already put into the title attribute the html that |
| 75 | // contains the MathJax rendered equations (via what we do in the callback). |
| 76 | $(function () { |
| 77 | $(document).tooltip({ |
| 78 | content: function () { |
| 79 | return $(this).prop('title'); |
| 80 | } |
| 81 | }); |
| 82 | }); |
| 83 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 84 | $("input").bind("keydown", function(event) { |
| 85 | // track enter key |
| 86 | var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode)); |
| 87 | if (keycode == 13) { // keycode for enter key |
| 88 | // force the 'Enter Key' to implicitly click the Update button |
| 89 | document.getElementById('SEARCH').click(); |
| 90 | return false; |
| 91 | } else { |
| 92 | return true; |
| 93 | }}); |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 94 | |
Marc Kupietz | e871abd | 2018-01-25 16:18:27 +0100 | [diff] [blame] | 95 | var collocatorTable_activated = false; |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 96 | $( "#tabs" ).on( "tabsactivate", function( event, ui ) { |
| 97 | if (localStorage) localStorage['tab'] = ui.newTab.index(); |
Marc Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 98 | if(ui.newTab.index() == 3 && !collocatorTable_activated) { |
Marc Kupietz | e871abd | 2018-01-25 16:18:27 +0100 | [diff] [blame] | 99 | classicCollocatorTable.columns.adjust(); |
| 100 | collocatorTable.columns.adjust(); |
| 101 | collocatorTable_activated = true; |
| 102 | } |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 103 | }); |
| 104 | |
| 105 | $(function(){ |
| 106 | $("#SEARCH").click(function() { |
| 107 | window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self"); |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 108 | }); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 109 | }); |
Marc Kupietz | 0af83e3 | 2017-11-27 09:31:37 +0100 | [diff] [blame] | 110 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 111 | function changeCharColor(txt, heat, word) { |
| 112 | var newText = ""; |
| 113 | for (var i=0, l=txt.length; i<l; i++) { |
Marc Kupietz | 86b5029 | 2019-02-17 21:03:59 +0100 | [diff] [blame] | 114 | 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] | 115 | CIIsearchWords + ' /' + (i > 5? '%2B' : '-') + 'w' + |
Marc Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 116 | Math.abs(i-5) + ':' + Math.abs(i-5) + ' ' + word + korapVC + |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 117 | '" target="korap"><span style="background-color:' + |
| 118 | getHeatColor(heat[i]/maxHeat)+'">'+txt.charAt(i)+'</span></a>'); |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 119 | } |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 120 | return newText; |
| 121 | } |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 122 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 123 | function getHeatColor(value) { |
| 124 | var hue=((1-value)*120).toString(10); |
| 125 | return ["hsl(",hue,",90%,70%)"].join(""); |
| 126 | } |
| 127 | |
| 128 | function bitvec2window(n, heat, word) { |
| 129 | var str = n.toString(2).padStart(10, "0") |
| 130 | .replace(/^([0-9]{5})/, '$1x') |
| 131 | .replace(/0/g, '·') |
| 132 | .replace(/1/g, '+'); |
| 133 | return changeCharColor(str, heat, word); |
| 134 | } |
| 135 | |
| 136 | % use Mojo::ByteStream 'b'; |
| 137 | var paraResults = <%= b(Mojo::JSON::to_json($lists)) %>; |
| 138 | var urlprefix = new URLSearchParams(window.location.search); |
| 139 | if (paraResults.length > 0 && paraResults[0] != null) { |
| 140 | var nvecs = [], |
| 141 | nwords = [], |
| 142 | nranks = [], |
| 143 | nmarked = []; |
| 144 | for(var i = 0; i < paraResults.length; i++) { |
| 145 | nwords = nwords.concat(paraResults[i].map(function(a){return a.word;})); |
| 146 | nvecs = nvecs.concat(paraResults[i].map(function(a){return a.vector;})); |
| 147 | nranks = nranks.concat(paraResults[i].map(function(a){return a.rank;})); |
| 148 | nmarked = nmarked.concat(paraResults[i].map(function(a){return a.marked;})); |
Marc Kupietz | 0d4c0ca | 2017-12-04 09:18:56 +0100 | [diff] [blame] | 149 | } |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 150 | 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] | 151 | var t = $('#firsttable').DataTable({ |
Marc Kupietz | ee894d5 | 2019-01-09 14:55:14 +0100 | [diff] [blame] | 152 | data: [].concat.apply([], paraResults), |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 153 | "sScrollY": "780px", |
| 154 | "bScrollCollapse": true, |
| 155 | "bPaginate": false, |
| 156 | "bJQueryUI": true, |
| 157 | "dom": '<"top">rt<"bottom"flp><"clear">', |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 158 | "initComplete":function(settings, json) { |
| 159 | $('td.paradigmator a').on('mousedown', function(e) { |
Marc Kupietz | 86b5029 | 2019-02-17 21:03:59 +0100 | [diff] [blame] | 160 | return paradigmatorClick(e, paraResults[0][0].word, this.childNodes["0"].textContent); |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 161 | }); |
| 162 | }, |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 163 | "columns": [ |
| 164 | { "data": "rank", type: "allnumeric" }, |
| 165 | { "data": "dist", render: function ( data, type, row ) {return data.toFixed(3) }}, |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 166 | { "data": "word", class: "paradigmator", render: function ( data, type, row ) { |
| 167 | urlprefix.set("word", data); return '<a class="' + getMergedClass(row.rank) + '" href="?' + urlprefix + '">' + data + '</a>' |
| 168 | }} |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 169 | ], |
| 170 | "columnDefs": [ |
| 171 | { className: "dt-right", "targets": [0,1] }, |
| 172 | { "searchable": false, |
| 173 | "orderable": false, |
| 174 | "targets": 0 |
| 175 | }, |
| 176 | { "orderSequence": [ "desc" ], "targets": [ 1 ] }, |
| 177 | { "orderSequence": [ "asc", "desc" ], "targets": [ 2 ] }, |
| 178 | ], |
| 179 | "oLanguage": { |
| 180 | "sSearch": "Filter: " |
| 181 | }, |
| 182 | "order": [[ 1, 'desc' ]], |
| 183 | } ); |
Marc Kupietz | 0d4c0ca | 2017-12-04 09:18:56 +0100 | [diff] [blame] | 184 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 185 | t.on( 'order.dt search.dt', function () { |
| 186 | t.column(0, {order:'applied'}).nodes().each( function (cell, i) { |
| 187 | cell.innerHTML = i+1; |
| 188 | } ); |
| 189 | } ).draw(); |
| 190 | |
| 191 | $( "#first" ).clone().prependTo( "#tabs-2" ); |
| 192 | |
| 193 | } |
| 194 | |
| 195 | |
| 196 | var collocatorData = <%= b(Mojo::JSON::to_json($collocators)) %>; |
| 197 | var maxHeat; // = Math.max.apply(Math,collocatorData.map(function(o){return o.cprob;})) |
| 198 | |
Marc Kupietz | cddc848 | 2019-12-04 08:57:33 +0100 | [diff] [blame] | 199 | if(typeof data !== 'undefined' && data.mergedEnd > 0) { |
Marc Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 200 | vocabDistanceTable = makeVocabDistanceTable("#vocabdistt", baseURL); |
| 201 | } |
Marc Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 202 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 203 | if (collocatorData != null) { |
| 204 | maxHeat = Math.max.apply(Math,collocatorData.map(function(o){return Math.max.apply(Math,o.heat);})) |
| 205 | collocatorTable = $('#secondtable').DataTable({ |
| 206 | data: collocatorData, |
| 207 | "sScrollY": "780px", |
| 208 | "bScrollCollapse": true, |
| 209 | "bPaginate": false, |
| 210 | "bJQueryUI": true, |
| 211 | "dom": '<"top">rt<"bottom"flp><"clear">', |
| 212 | "columns": [ |
| 213 | { "data": "rank", type: "allnumeric" }, |
| 214 | { "data": "pos", width: "7%", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitvec2window(data, row.heat, row.word) }}, |
| 215 | { "data": "max", render: function ( data, type, row ) {return data.toFixed(3) }}, |
| 216 | { "data": "average", render: function ( data, type, row ) {return data.toFixed(3) }}, |
| 217 | { "data": "prob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } }, |
| 218 | { "data": "cprob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } }, |
| 219 | { "data": "overall", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } }, |
| 220 | { "data": "word", sClass: "collocator" }, |
| 221 | { "data": "rank", type: "allnumeric" } |
| 222 | ], |
| 223 | "columnDefs": [ |
| 224 | { className: "dt-right", "targets": [0,2,3,4,5,6] }, |
| 225 | { className: "dt-center", "targets": [ 1] }, |
| 226 | { "searchable": false, |
| 227 | "orderable": false, |
| 228 | "targets": [0, 8] |
| 229 | }, |
| 230 | { "type": "scientific", targets: [2,3,4,5,6] }, |
| 231 | { "orderSequence": [ "desc" ], "targets": [ 2, 3, 4, 5, 6 ] }, |
| 232 | { "orderSequence": [ "asc", "desc" ], "targets": [ 1, 7 ] }, |
| 233 | { "targets": [8], "visible": false } |
| 234 | ], |
| 235 | "oLanguage": { |
| 236 | "sSearch": "Filter: " |
| 237 | }, |
| 238 | "order": [[ 4, 'desc' ]], |
| 239 | } ); |
| 240 | $.ajaxSetup({ |
| 241 | type: 'POST', |
| 242 | timeout: 30000, |
| 243 | error: function(xhr) { |
| 244 | $('#display_error') |
| 245 | .html('Error: ' + xhr.status + ' ' + xhr.statusText); |
| 246 | } |
Marc Kupietz | 78b434a | 2018-01-12 22:33:32 +0100 | [diff] [blame] | 247 | }); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 248 | |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 249 | |
| 250 | if($('#sprofiles').length) { |
| 251 | similarProfileTable = $('#sprofiles').DataTable({ |
| 252 | ajax: { |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 253 | method: "GET", |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 254 | url: '/derekovecs/getSimilarProfiles', |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 255 | dataType: 'json', |
| 256 | dataSrc: "", |
| 257 | timeout: 30000, |
| 258 | data: { w: paraResults[0][0].rank } |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 259 | }, |
| 260 | "initComplete":function(settings, json){ |
| 261 | $('td.paradigmator a').on('mousedown', function(e) { |
| 262 | if (e.which === 2) { |
| 263 | e.preventDefault(); |
| 264 | queryKorAPalternatives(paraResults[0][0].word, this.childNodes["0"].textContent); |
| 265 | return false; |
| 266 | } |
| 267 | }); |
| 268 | }, |
| 269 | "sScrollY": "780px", |
| 270 | "bScrollCollapse": true, |
| 271 | "bPaginate": false, |
| 272 | "bJQueryUI": true, |
| 273 | "dom": '<"top">rt<"bottom"flp><"clear">', |
| 274 | "columns": [ |
| 275 | { "data": "v", render: function ( data, type, row ) {return data.toFixed(3) }}, |
| 276 | { "data": "w", sClass: "paradigmator", render: function ( data, type, row ) {urlprefix.set("word", data); return '<a href="?' + urlprefix + '">' + data + '</a>' } } |
| 277 | ], |
| 278 | "columnDefs": [ |
| 279 | { className: "dt-right", "targets": [0] }, |
| 280 | ], |
| 281 | "oLanguage": { |
| 282 | "sSearch": "Filter: " |
| 283 | }, |
| 284 | "order": [[ 0, 'desc' ]], |
| 285 | }); |
| 286 | } |
Marc Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 287 | |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 288 | // var filterQuot = /(^quot?=[A-Z])|(quot$)/g; |
| 289 | var filterQuot = /^quot/; |
Marc Kupietz | 4784fae | 2019-02-04 12:32:12 +0100 | [diff] [blame] | 290 | var ccResult; |
Marc Kupietz | 86b5029 | 2019-02-17 21:03:59 +0100 | [diff] [blame] | 291 | var baseURL = window.location.pathname.replace(/[/]$/, '') |
Marc Kupietz | 9597700 | 2019-02-26 09:09:59 +0100 | [diff] [blame] | 292 | classicCollocatorTable = makeClassicCollocatorTable('#classicoloctable', baseURL, paraResults[0][0].rank) |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 293 | |
Marc Kupietz | 1acb317 | 2018-02-17 09:41:26 +0100 | [diff] [blame] | 294 | $('#show-details').change(function (e) { |
| 295 | var columns = classicCollocatorTable.columns(".detail"); |
| 296 | if(this.checked) { |
| 297 | columns.visible(true); |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 298 | $("#ccd").css('width', 'auto'); |
Marc Kupietz | 1acb317 | 2018-02-17 09:41:26 +0100 | [diff] [blame] | 299 | } else { |
| 300 | columns.visible(false); |
Marc Kupietz | 08bfd40 | 2019-01-23 10:05:17 +0100 | [diff] [blame] | 301 | $("#ccd").css('width', '680px'); |
Marc Kupietz | 1acb317 | 2018-02-17 09:41:26 +0100 | [diff] [blame] | 302 | } |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 303 | classicCollocatorTable.columns.adjust().draw(); |
Marc Kupietz | 1acb317 | 2018-02-17 09:41:26 +0100 | [diff] [blame] | 304 | } ); |
| 305 | |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 306 | $("td.collocator").click(function(){ |
| 307 | queryKorAPCII(this.textContent + " /w5 " + CIIsearchWords); |
Marc Kupietz | ad78372 | 2018-01-13 17:45:21 +0100 | [diff] [blame] | 308 | }); |
| 309 | |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 310 | collocatorTable.on( 'order.dt search.dt', function () { |
| 311 | collocatorTable.column(0, {order:'applied'}).nodes().each( function (cell, i) { |
| 312 | cell.innerHTML = i+1; |
| 313 | } ); |
| 314 | }).draw(); |
| 315 | } |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 316 | |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 317 | if (localStorage && !window.location.hash) { // let's not crash if some user has IE7 |
| 318 | var index = parseInt(localStorage['tab']||'0'); |
| 319 | $("#tabs").tabs({ active: index }); |
| 320 | } |
| 321 | $("#tabs").css("visibility", "visible"); // now we can show the tabs |
| 322 | }); |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 323 | |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 324 | $(function(){ |
| 325 | $("#dropdownoptions").dialog({ |
Marc Kupietz | 9510451 | 2019-12-05 10:13:05 +0100 | [diff] [blame] | 326 | title: "<%= loc 'Options' %>", |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 327 | autoOpen: false, |
| 328 | modal: false, |
| 329 | draggable: false, |
| 330 | height: "auto", |
| 331 | width: "auto", |
| 332 | resizable: false, |
| 333 | buttons: { |
Marc Kupietz | 9510451 | 2019-12-05 10:13:05 +0100 | [diff] [blame] | 334 | "<%= loc 'Cancel'%>": function() { |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 335 | $( this ).dialog( "close" ); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 336 | }, |
Marc Kupietz | 9510451 | 2019-12-05 10:13:05 +0100 | [diff] [blame] | 337 | "<%= loc 'Apply' %>": function() { |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 338 | window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self"); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 339 | } |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 340 | } |
| 341 | }); |
| 342 | }); |
| 343 | |
| 344 | $(function(){ |
| 345 | $("#showoptions").click(function(){ |
| 346 | $("#dropdownoptions").dialog("open"); |
| 347 | var target = $(this); |
| 348 | $("#dropdownoptions").dialog("widget").position({ |
| 349 | my: 'left bottom', |
| 350 | at: 'left bottom', |
| 351 | of: target |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 352 | }); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 353 | }); |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 354 | }); |
| 355 | |
| 356 | $( function() { |
| 357 | $( "#no_iterations" ).spinner({ |
| 358 | spin: function( event, ui ) { |
| 359 | if ( ui.value < 1000 ) { |
| 360 | $( this ).spinner( "value", 1000 ); |
| 361 | return false; |
| 362 | } else if ( ui.value > 10000 ) { |
| 363 | $( this ).spinner( "value", 10000 ); |
| 364 | return false; |
| 365 | } |
| 366 | } |
| 367 | }); |
| 368 | } ); |
| 369 | |
| 370 | $( function() { |
| 371 | $( "#neighbours" ).spinner({ |
| 372 | spin: function( event, ui ) { |
| 373 | if ( ui.value < 0 ) { |
| 374 | $( this ).spinner( "value", 0 ); |
| 375 | return false; |
| 376 | } else if ( ui.value > 200 ) { |
| 377 | $( this ).spinner( "value", 200 ); |
| 378 | return false; |
| 379 | } |
| 380 | } |
| 381 | }); |
| 382 | } ); |
| 383 | |
| 384 | $( function() { |
| 385 | $( "#cutoff" ).spinner({ |
| 386 | spin: function( event, ui ) { |
| 387 | if ( ui.value < 100000 ) { |
| 388 | $( this ).spinner( "value", 100000 ); |
| 389 | return false; |
| 390 | } else if ( ui.value > 2000000 ) { |
| 391 | $( this ).spinner( "value", 2000000 ); |
| 392 | return false; |
| 393 | } |
| 394 | } |
| 395 | }); |
| 396 | } ); |
| 397 | |
| 398 | $( function() { |
| 399 | $( "#tabs" ).tabs().addClass('tabs-min'); |
| 400 | } ); |
| 401 | |
| 402 | $( function() { |
| 403 | $( ".controlgroup-vertical" ).controlgroup({ |
| 404 | "direction": "vertical" |
| 405 | }); |
| 406 | } ); |
| 407 | |
| 408 | $(function() { |
| 409 | $( document ).tooltip({ |
| 410 | content: function() { |
| 411 | return $(this).attr('title'); |
| 412 | }} |
| 413 | ) |
| 414 | }); |
| 415 | |
| 416 | $(function () { |
| 417 | $(document).tooltip({ |
| 418 | content: function () { |
| 419 | return $(this).prop('title'); |
| 420 | }, |
| 421 | show: null, |
| 422 | close: function (event, ui) { |
| 423 | ui.tooltip.hover( |
| 424 | function () { |
| 425 | $(this).stop(true).fadeTo(400, 1); |
| 426 | }, |
| 427 | function () { |
| 428 | $(this).fadeOut("400", function () { |
| 429 | $(this).remove(); |
| 430 | }) |
| 431 | }); |
| 432 | } |
| 433 | }); |
| 434 | }); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 435 | </script> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 436 | <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script> |
Marc Kupietz | 68e29be | 2023-11-04 18:37:35 +0100 | [diff] [blame] | 437 | <script src="/derekovecs/js/calendar-events.js"></script> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 438 | <script src="/derekovecs/js/tsne.js"></script> |
| 439 | <script src="/derekovecs/js/som.js"></script> |
| 440 | <script src="/derekovecs/js/labeler.js"></script> |
Marc K | 20476c7 | 2021-03-11 12:18:01 +0100 | [diff] [blame] | 441 | <script src="/derekovecs/js/derekovecs.js"></script> |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 442 | <script> |
| 443 | |
| 444 | var opt = {epsilon: <%= $epsilon %>, perplexity: <%= $perplexity %>}, |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 445 | mapWidth = 800, // width map |
| 446 | mapHeight = 800, |
| 447 | jitterRadius = 7; |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 448 | |
| 449 | var T = new tsnejs.tSNE(opt); // create a tSNE instance |
| 450 | |
| 451 | var Y; |
| 452 | |
| 453 | var data; |
| 454 | var labeler; |
| 455 | |
| 456 | function applyJitter() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 457 | svg.selectAll('.tsnet') |
| 458 | .data(labels) |
| 459 | .transition() |
| 460 | .duration(50) |
| 461 | .attr("transform", function(d, i) { |
| 462 | T.Y[i][0] = (d.x - mapWidth/2 - tx)/ss/20; |
| 463 | T.Y[i][1] = (d.y - mapHeight/2 - ty)/ss/20; |
| 464 | return "translate(" + |
Marc Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 465 | (d.x) + "," + |
| 466 | (d.y) + ")"; |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 467 | }); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 468 | } |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 469 | |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 470 | function updateEmbedding() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 471 | var Y = T.getSolution(); |
| 472 | svg.selectAll('.tsnet') |
| 473 | .data(data.words) |
| 474 | .attr("transform", function(d, i) { |
| 475 | return "translate(" + |
Marc Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 476 | ((Y[i][0]*20*ss + tx) + mapWidth/2) + "," + |
| 477 | ((Y[i][1]*20*ss + ty) + mapHeight/2) + ")"; }); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 478 | } |
| 479 | |
| 480 | var svg; |
| 481 | var labels = []; |
| 482 | var anchor_array = []; |
| 483 | var text; |
| 484 | |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 485 | function getMergedClass(i) { |
Marc Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 486 | if(typeof data !== 'undefined' && i > data.mergedEnd) { |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 487 | return " merged" |
| 488 | } else { |
| 489 | return ""; |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | function getRankTooltip(i) { |
| 494 | if(data.mergedEnd) { |
| 495 | if(data.ranks[i] < data.mergedEnd) { |
| 496 | return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); |
| 497 | } else { |
| 498 | return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]-data.mergedEnd).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " (merged vocab)"; |
| 499 | } |
| 500 | } else { |
| 501 | return "rank: "+i +" "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); |
| 502 | } |
| 503 | } |
| 504 | |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 505 | function drawEmbedding() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 506 | var urlprefix = new URLSearchParams(window.location.search); |
| 507 | urlprefix.delete("word"); |
| 508 | urlprefix.append("word",""); |
Marc Kupietz | 8f9c86a | 2017-12-04 17:17:13 +0100 | [diff] [blame] | 509 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 510 | $("#embed").empty(); |
| 511 | var div = d3.select("#embed"); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 512 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 513 | // get min and max in each column of Y |
| 514 | var Y = T.Y; |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 515 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 516 | svg = div.append("svg") // svg is global |
| 517 | .attr("width", mapWidth) |
| 518 | .attr("height", mapHeight); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 519 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 520 | var g = svg.selectAll(".b") |
| 521 | .data(data.words) |
| 522 | .enter().append("g") |
| 523 | .attr("class", "tsnet"); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 524 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 525 | g.append("a") |
| 526 | .attr("xlink:href", function(word) { |
| 527 | return "?"+urlprefix+word; }) |
| 528 | .attr("class", function(d, i) { |
| 529 | var res=""; |
| 530 | if(data.marked[i]) { |
| 531 | res="marked "; |
| 532 | } |
| 533 | if(data.target.indexOf(" "+d+" ") >= 0) { |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 534 | res += "target"; |
| 535 | } |
| 536 | if(data.mergedEnd && data.ranks[i] >= data.mergedEnd) { |
| 537 | return res+" merged"; |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 538 | } else { |
| 539 | return res; |
| 540 | } |
| 541 | }) |
| 542 | .attr("title", function(d, i) { |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 543 | return getRankTooltip(i); |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 544 | }) |
| 545 | .append("text") |
| 546 | .attr("text-anchor", "top") |
| 547 | .attr("font-size", 12) |
| 548 | .text(function(d) { return d; }); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 549 | |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 550 | g.append("svg:title") |
| 551 | .text(function(d, i) { |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 552 | return getRankTooltip(i); |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 553 | }); |
| 554 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 555 | var zoomListener = d3.behavior.zoom() |
| 556 | .scaleExtent([0.1, 10]) |
| 557 | .center([0,0]) |
| 558 | .on("zoom", zoomHandler); |
| 559 | zoomListener(svg); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 560 | } |
| 561 | |
| 562 | var tx=0, ty=0; |
| 563 | var ss=1; |
| 564 | var iter_id=-1; |
| 565 | |
| 566 | function zoomHandler() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 567 | tx = d3.event.translate[0]; |
| 568 | ty = d3.event.translate[1]; |
| 569 | ss = d3.event.scale; |
| 570 | updateEmbedding(); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | var stepnum = 0; |
| 574 | |
| 575 | function stopStep() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 576 | clearInterval(iter_id); |
| 577 | text = svg.selectAll("text"); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 578 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 579 | // jitter function needs different data and co-ordinate representation |
| 580 | labels = d3.range(data.words.length).map(function(i) { |
| 581 | var x = (T.Y[i][0]*20*ss + tx) + mapWidth/2; |
| 582 | var y = (T.Y[i][1]*20*ss + ty) + mapHeight/2; |
| 583 | anchor_array.push({x: x, y: y, r: jitterRadius}); |
| 584 | return { |
| 585 | x: x, |
| 586 | y: y, |
| 587 | name: data.words[i] |
| 588 | }; |
| 589 | }); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 590 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 591 | // get the actual label bounding boxes for the jitter function |
| 592 | var index = 0; |
| 593 | text.each(function() { |
| 594 | labels[index].width = this.getBBox().width; |
| 595 | labels[index].height = this.getBBox().height; |
| 596 | index += 1; |
| 597 | }); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 598 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 599 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 600 | // setTimeout(updateEmbedding, 1); |
| 601 | // setTimeout( |
| 602 | labeler = d3.labeler() |
| 603 | .label(labels) |
| 604 | .anchor(anchor_array) |
| 605 | .width(mapWidth) |
| 606 | .height(mapHeight) |
| 607 | .update(applyJitter); |
| 608 | // .start(1000); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 609 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 610 | iter_id = setInterval(jitterStep, 1); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 611 | } |
| 612 | |
| 613 | var jitter_i=0; |
| 614 | |
| 615 | function jitterStep() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 616 | if(jitter_i++ > 100) { |
| 617 | clearInterval(iter_id); |
| 618 | } else { |
| 619 | labeler.start2(10); |
| 620 | applyJitter(); |
| 621 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 622 | } |
| 623 | |
| 624 | var last_cost=1000; |
| 625 | |
| 626 | function step() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 627 | var i = T.iter; |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 628 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 629 | if(i > <%= $no_iterations %>) { |
| 630 | stopStep(); |
| 631 | } else { |
| 632 | var cost = Math.round(T.step() * 100000) / 100000; // do a few steps |
| 633 | $("#cost").html("tsne iteration " + i + ", cost: " + cost.toFixed(5)); |
| 634 | if(i % 250 == 0 && cost >= last_cost) { |
| 635 | stopStep(); |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 636 | } else { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 637 | last_cost = cost; |
| 638 | updateEmbedding(); |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 639 | } |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 640 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 641 | } |
| 642 | |
| 643 | function showMap(j) { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 644 | data=j; |
| 645 | T.iter=0; |
| 646 | iter_id = -1; |
| 647 | last_cost=1000; |
| 648 | T.initDataRaw(data.vecs); // init embedding |
| 649 | drawEmbedding(); // draw initial embedding |
Marc Kupietz | 7811453 | 2017-11-29 17:00:16 +0100 | [diff] [blame] | 650 | |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 651 | if(iter_id >= 0) { |
| 652 | clearInterval(iter_id); |
| 653 | } |
| 654 | //T.debugGrad(); |
| 655 | iter_id = setInterval(step, 1); |
| 656 | if(true) { // (<%= $show_som %>) { |
| 657 | makeSOM(j, <%= $no_iterations %>); |
| 658 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 659 | } |
Marc Kupietz | 39179ab | 2017-07-04 16:28:06 +0200 | [diff] [blame] | 660 | var queryword; |
| 661 | |
Marc Kupietz | 66bfd95 | 2017-12-11 09:59:45 +0100 | [diff] [blame] | 662 | function showCollocatorSOM() { |
Marc Kupietz | 86b5029 | 2019-02-17 21:03:59 +0100 | [diff] [blame] | 663 | var baseURL = window.location.pathname.replace(/[/]$/, '') |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 664 | if (collocatorTable) { |
| 665 | var ctableData = collocatorTable.rows().data(); |
| 666 | var nwords = [], |
| 667 | nranks = []; |
| 668 | for (var i=0; i < ctableData.length && i < 100; i++) { |
| 669 | nranks.push(ctableData[i].rank); |
| 670 | nwords.push(ctableData[i].word); |
Marc Kupietz | 66bfd95 | 2017-12-11 09:59:45 +0100 | [diff] [blame] | 671 | } |
Marc Kupietz | 86b5029 | 2019-02-17 21:03:59 +0100 | [diff] [blame] | 672 | $.post(baseURL+'/getVecsByRanks', |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 673 | JSON.stringify(nranks), |
| 674 | function(data, status){ |
Marc Kupietz | 2e2e4db | 2018-12-21 15:07:37 +0100 | [diff] [blame] | 675 | 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] | 676 | }, 'json'); |
| 677 | } |
Marc Kupietz | 66bfd95 | 2017-12-11 09:59:45 +0100 | [diff] [blame] | 678 | } |
| 679 | |
Marc Kupietz | 39179ab | 2017-07-04 16:28:06 +0200 | [diff] [blame] | 680 | function onload() { |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 681 | queryword = document.getElementById('word'); |
Marc Kupietz | 39179ab | 2017-07-04 16:28:06 +0200 | [diff] [blame] | 682 | } |
| 683 | |
| 684 | function queryKorAP() { |
Marc Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 685 | 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] | 686 | } |
Marc Kupietz | 4dc270c | 2017-11-24 10:17:12 +0100 | [diff] [blame] | 687 | |
| 688 | function queryKorAPCII(query) { |
Marc Kupietz | 7823087 | 2019-08-02 15:15:25 +0200 | [diff] [blame] | 689 | 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] | 690 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 691 | </script> |
| 692 | </head> |
Marc Kupietz | 7b0e5de | 2019-01-31 12:49:32 +0100 | [diff] [blame] | 693 | <body onload="onload()"> <div style="display:none;" id="pmi_ttt">Pointwise mutual information: $$\text{MI}=\text{MI}=\log_2\frac{p(w_1,w_2)}{p(w_1) p(w_2)}$$<p class="citation">Church, K. W. and Hanks, P. (1990): Word association norms, mutual information, and lexicography. Comput. Linguist. 16, 1 (March 1990), 22-29.</p></div> |
| 694 | <div style="display:none;" id="md_ttt">Pointwise mutual information squared [1], also called mutual dependency [2]: $$\text{MI}^2=\text{MD}=\log_2\frac{p^2(w_1,w_2)}{p(w_1) p(w_2)}$$<p class="citation">[1] Daille, B. (1994): <a href="http://www.bdaille.com/index.php?option=com_docman&task=doc_download&gid=8&Itemid=">Approche mixte pour l’extraction automatique de terminologie: statistiques lexicales et filtres linguistiques</a>. PhD thesis, Université Paris 7.</p><p class="citation">[2] Thanopoulos, A., Fakotakis, N., Kokkinakis, G. (2002): <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.11.8101&rep=rep1&type=pdf">Comparative evaluation of collocation extraction metrics</a>. In: Proc. of LREC 2002: 620–625.</p></div> |
| 695 | <div style="display:none;" id="lfmd_ttt">Pointwise mutual information cubed [1], also called log-frequency biased mutual dependency [2]: $$\text{MI}^3=\text{LFMD}=\log_2\frac{p^3(w_1,w_2)}{p(w_1) p(w_2)}$$<p class="citation">[1] Daille, B. (1994): <a href="http://www.bdaille.com/index.php?option=com_docman&task=doc_download&gid=8&Itemid=">Approche mixte pour l’extraction automatique de terminologie: statistiques lexicales et filtres linguistiques</a>. PhD thesis, Université Paris 7.</p><p class="citation">[2] Thanopoulos, A., Fakotakis, N., Kokkinakis, G. (2002): <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.11.8101&rep=rep1&type=pdf">Comparative evaluation of collocation extraction metrics</a>. In: Proc. of LREC 2002: 620–625.</p></div> |
| 696 | <div style="display:none;" id="npmi_ttt">Normalized pointwise mutual information: $$\frac{\log_2\frac{p(w_1,w_2)}{p(w_1)p(w_2)}}{-\log_2(p(w_1,w_2))}$$<p class="citation">Bouma, Gerlof (2009): <a href="https://svn.spraakdata.gu.se/repos/gerlof/pub/www/Docs/npmi-pfd.pdf">Normalized (pointwise) mutual information in collocation extraction</a>. In Proceedings of GSCL.</p></div> |
| 697 | <div style="display:none;" id="ll_ttt">Log-likelihood: $$2\sum_{ij}O_{ij}\log\frac{O_{ij}}{E_{ij}}$$<p class="citation">Dunning, T. (1993): Accurate methods for the statistics of surprise and coincidence. Comput. Linguist. 19, 1 (March 1993), 61-74.</p> |
| 698 | <p class="citation">Evert, Stefan (2004): <a href="http://purl.org/stefan.evert/PUB/Evert2004phd.pdf">The Statistics of Word Cooccurrences: Word Pairs and Collocations.</a> PhD dissertation, IMS, University of Stuttgart. Published in 2005, URN urn:nbn:de:bsz:93-opus-23714.</p></div> |
| 699 | <div style="display:none;" id="logdice_ttt">Log-Dice: $$14 + \log_2 \frac{2f_{1,2}}{f_1 + f_2}$$<p class="citation">Rychlý, Pavel (2008): <a href="http://www.fi.muni.cz/usr/sojka/download/raslan2008/13.pdf">A lexicographer-friendly association score.</a> In Proceedings of Recent Advances in Slavonic Natural Language Processing, RASLAN, 6–9, 2008</p></div> |
| 700 | <div style="display:none;" id="logdiceaf_ttt">Log-Dice using "auto-focus", i.e. the window that yields the highest score.</div> |
Marc Kupietz | 6d7462c | 2019-12-05 10:16:38 +0100 | [diff] [blame] | 701 | <div id="ids_logo"> |
| 702 | <a href="http://www.ids-mannheim.de/" target="_blank"><img src="/derekovecs/img/IDS-neu_farbig.svg" alt="Leibniz-Institut für Deutsche Sprache"/></a> |
| 703 | </div> |
| 704 | <div id="header"> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 705 | <div id="pagetitle"> |
Marc Kupietz | c053d97 | 2019-01-10 10:41:51 +0100 | [diff] [blame] | 706 | <h1>DeReKoVecs</h1> |
| 707 | <h2><%== $title %></h2> |
Marc Kupietz | 4fcda0c | 2017-11-29 09:00:31 +0100 | [diff] [blame] | 708 | </div> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 709 | <div id="options" class="widget"> |
| 710 | <form id="queryform"> |
Marc Kupietz | 9510451 | 2019-12-05 10:13:05 +0100 | [diff] [blame] | 711 | <input id="word" type="text" name="word" placeholder="<%= loc 'words_to_be_searched' %>" value="<%= $word %>" |
| 712 | title="<%= loc 'search_description' %>"/> |
| 713 | <input id="SEARCH" type="button" value="<%= loc 'SEARCH' %>"> |
| 714 | <input type="button" id="showoptions" name="showoptions" value="<%= loc 'Options' %>" /> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 715 | </form> |
| 716 | <div id="dropdownoptions" style="display: none"> |
| 717 | <form id="optionsform"> |
| 718 | <div class="controlgroup-vertical"> |
| 719 | <label for="cutoff">cut-off</label> |
| 720 | <input id="cutoff" type="text" name="cutoff" size="10" value="<%= $cutoff %>" title="Only consider the most frequent x word forms."> |
| 721 | <label for="dedupe">dedupe</label> |
| 722 | <input id="dedupe" type="checkbox" name="dedupe" value="1" <%= ($dedupe ? "checked" : "") %> title="radically filter out any near-duplicates"> |
| 723 | % if($mergedEnd > 0) { |
| 724 | <label for="sbf">backw.</label> |
| 725 | <input id="sbf" type="checkbox" name="sbf" value="1" <%= ($searchBaseVocabFirst ? "checked" : "") %> title="If checkecked base vocabulary will be searched first. Otherwise merged vocabulray will be searched first."> |
| 726 | % } |
| 727 | <label for="neighbours">max. neighbours:</label> |
| 728 | <input id="neighbours" size="4" name="n" value="<%= $no_nbs %>"> |
| 729 | <label for="no_iterations">max. iterations</label> |
| 730 | <input id="no_iterations" name="N" size="4" value="<%= $no_iterations %>"> |
| 731 | <!-- <label for="dosom">SOM</label> |
| 732 | <input id="dosom" type="checkbox" name="som" value="1" <%= ($show_som ? "checked" : "") %>> --> |
| 733 | % if($collocators) { |
| 734 | <label for="sortby">window/sort</label> |
| 735 | <select id="sortby" name="sort"> |
| 736 | <option value="0" <%= ($sort!=1 && $sort!=2? "selected":"") %>>auto focus</option> |
| 737 | <!-- <option value="1" <%= ($sort==1? "selected":"") %>>any single position</option> |
| 738 | <option value="2" <%= ($sort==2? "selected":"") %>>whole window</option> --> |
| 739 | </select> |
| 740 | % } |
| 741 | <input type="button" value="→ KorAP" onclick="queryKorAP();" title="query word with KorAP"/> |
Marc Kupietz | 1acb317 | 2018-02-17 09:41:26 +0100 | [diff] [blame] | 742 | <input id="show-details" type="checkbox" name="show-details" value="1" > |
| 743 | <label for="show-details"> |
| 744 | Show details |
| 745 | </label> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 746 | </div> |
| 747 | </form> |
| 748 | </div> |
| 749 | </div> |
| 750 | </div> |
| 751 | <div id="topwrapper"> |
| 752 | <div style="visibility: hidden;" id="tabs"> |
| 753 | <ul> |
Marc Kupietz | d6dfdf0 | 2019-12-06 09:53:34 +0100 | [diff] [blame] | 754 | % if (defined $word && $word ne '') { |
| 755 | % if($mergedEnd && $distantWords) { |
| 756 | <li><a href="#tabs-0" title="Cos offsets of the words furthest away from their position in the reference corpus."">Offsets</a></li> |
| 757 | % } |
| 758 | <li><a href="#tabs-1"><%= loc 'paradigmatic_tsne' %></a></li> |
| 759 | <li><a href="#tabs-2"><%= loc 'paradigmatic_som' %></a></li> |
| 760 | <li><a href="#tabs-3"><%= loc 'syntagmatic' %></a></li> |
Marc Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 761 | % } |
Marc Kupietz | d6dfdf0 | 2019-12-06 09:53:34 +0100 | [diff] [blame] | 762 | <li><a href="#tabs-4">Info</a></li> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 763 | </ul> |
Marc Kupietz | b6514dc | 2019-06-26 11:47:56 +0200 | [diff] [blame] | 764 | % if($mergedEnd && $distantWords) { |
Marc Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 765 | <div id="tabs-0" style="display: flex; padding: 5px; flex-flow: row wrap;"> |
| 766 | <div id="vocabdist" style="width: 230px; margin-bottom: 15px;"> |
| 767 | <table class="display compact nowrap" id="vocabdistt"> |
| 768 | <thead> |
| 769 | <tr> |
Marc Kupietz | 9597700 | 2019-02-26 09:09:59 +0100 | [diff] [blame] | 770 | <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] | 771 | </tr> |
| 772 | </thead> |
| 773 | <tbody> |
| 774 | <tr> |
| 775 | <td align="right"> |
Marc Kupietz | 9597700 | 2019-02-26 09:09:59 +0100 | [diff] [blame] | 776 | </td> |
Marc Kupietz | d7760b4 | 2019-02-21 09:01:44 +0100 | [diff] [blame] | 777 | <td align="right"> |
| 778 | </td> |
| 779 | <td></td> |
| 780 | </tr> |
| 781 | </tbody> |
| 782 | </table> |
| 783 | </div> |
| 784 | </div> |
Marc Kupietz | b6514dc | 2019-06-26 11:47:56 +0200 | [diff] [blame] | 785 | % } |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 786 | <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] | 787 | % if($lists && (@$lists) > 0 && (@$lists)[0]) { |
| 788 | <div id="wrapper"> |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 789 | <div id="first" style="width: 230px; margin-bottom: 15px;"> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 790 | <table class="display compact nowrap" id="firsttable"> |
| 791 | <thead> |
| 792 | <tr> |
Marc Kupietz | 9597700 | 2019-02-26 09:09:59 +0100 | [diff] [blame] | 793 | <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] | 794 | </tr> |
| 795 | </thead> |
| 796 | <tbody> |
| 797 | <tr> |
| 798 | <td align="right"> |
| 799 | </td> |
| 800 | <td align="right"> |
| 801 | </td> |
| 802 | <td></td> |
| 803 | </tr> |
| 804 | </tbody> |
| 805 | </table> |
| 806 | </div> |
Marc Kupietz | a55a09a | 2018-07-06 13:30:30 +0200 | [diff] [blame] | 807 | % if(0 && $haveSProfiles) { |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 808 | <div id="sprofilesdiv" style="width: 200px; padding-right: 10px;"> |
| 809 | <table class="display compact nowrap" id="sprofiles"> |
| 810 | <thead> |
| 811 | <tr> |
| 812 | <th align="right">cos</th><th align="left">similars by coll. profile</th> |
| 813 | </tr> |
| 814 | </thead> |
| 815 | <tbody> |
| 816 | <tr> |
| 817 | <td align="right"> |
| 818 | </td> |
| 819 | <td></td> |
| 820 | </tr> |
| 821 | </tbody> |
| 822 | </table> |
| 823 | </div> |
| 824 | %} |
Marc Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 825 | <div id="second"> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 826 | <div id="embed"> |
| 827 | </div> |
| 828 | <div id="cost"> |
| 829 | </div> |
| 830 | </div> |
| 831 | </div> |
Marc Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 832 | % } elsif($word !~ /^\s*$/) { |
| 833 | <div id="wrapper"> |
Marc Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 834 | <script> |
| 835 | $( function() { |
Marc Kupietz | ce6490b | 2019-12-06 11:05:40 +0100 | [diff] [blame] | 836 | $( "<%== loc 'notfounddialog' %>").dialog({ |
Marc Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 837 | autoOpen: true, |
| 838 | modal: true, |
| 839 | draggable: false, |
| 840 | height: "auto", |
| 841 | width: "auto", |
| 842 | resizable: false, |
| 843 | buttons: { |
| 844 | "OK": function() { |
| 845 | $( this ).dialog( "close" ); |
Marc Kupietz | ce6490b | 2019-12-06 11:05:40 +0100 | [diff] [blame] | 846 | } /* , |
Marc Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 847 | "Apply": function() { |
| 848 | window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self"); |
Marc Kupietz | ce6490b | 2019-12-06 11:05:40 +0100 | [diff] [blame] | 849 | } */ |
Marc Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 850 | } |
| 851 | }); |
| 852 | }); |
| 853 | </script> |
Marc Kupietz | ce6490b | 2019-12-06 11:05:40 +0100 | [diff] [blame] | 854 | <div id="not-found-dialog_de" style="display: none" title="Nicht gefunden"> |
| 855 | <p>FEHLER: Konnte "<%= $word %>" nicht finden.</p> |
| 856 | <p>Wenn Sie der Meinung sind, dass es Vokabluar enthalten sein sollte, können Sie versuchen den Cut-Off-Parameter in den Optionen zu erhöhen.</p> |
| 857 | </div> |
| 858 | <div id="not-found-dialog_en" style="display: none" title="Not found"> |
| 859 | <p>ERROR: "<%= $word %>" not found in vocabluary.</p> |
| 860 | <p>If you are sure you have spelled the word as intended, you can try to increase the cutoff parameter in the options menu.</p> |
| 861 | </div> |
Marc Kupietz | 81aeed2 | 2019-02-17 21:22:45 +0100 | [diff] [blame] | 862 | </div> |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 863 | % } |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 864 | </div> |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 865 | <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] | 866 | % if(defined $word && $word ne "") { |
| 867 | <div id="som2" style="width: 800;"> |
| 868 | <div id="sominfo1"><span id="somcolor1"> </span> <span id="somword1"> </span> <span id="somcolor2"> </span> <span id="somword2"> </span> <span id="somcolor3"> </span></div> |
| 869 | <div id="sominfo" style="text-align: right">SOM iteration <span id="iterations">0</span></div> |
| 870 | </div> |
| 871 | % } |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 872 | </div> |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 873 | <div id="tabs-3" style="display: flex; padding:5px; flex-flow: row wrap;"> |
| 874 | <div style="margin-right: 20px; margin-bottom: 10px;" id="secondt"> |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 875 | <table class="display compact nowrap" id="secondtable"> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 876 | <thead> |
| 877 | <tr> |
| 878 | % if($collocators) { |
| 879 | <th>#</th> |
Marc Kupietz | 4116b43 | 2017-12-06 14:15:32 +0100 | [diff] [blame] | 880 | <th align="center" title="Activation of the respective collocator in the columns around the target normalized by its maximum (red). Columns selected by the auto-focus funtion (which window of all possible column-combinations maximizes ⊥(a/c)?) are marked with +. Click on the column postions to lauch a KorAP query with target word and collocator in the respective position.">w'</th> |
| 881 | <th align="right" title="Maximum activation of the collocator anywhere in the output layer.">max(a)</th> |
| 882 | <th title="Average raw activation of the collocator in the columns selected by auto-focus." align="right">⟨a⟩</th> |
| 883 | <th title="Sum of activations over the selected colunns normalized by the total activation sum of the selected columns." align="right">Σa/Σw'</th> |
| 884 | <th title="Co-norm of the column-normalized activations over the colunns selected by the auto-focus." align="right">⊥(a/c)</th> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 885 | <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] | 886 | <th align="left"><%= loc 'collocate_w2v' %></th> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 887 | % } |
| 888 | </tr> |
| 889 | </thead> |
| 890 | <tbody> |
| 891 | <tr> |
| 892 | <td align="right"> |
| 893 | </td> |
| 894 | <td align="right"> |
| 895 | </td> |
| 896 | <td align="right"> |
| 897 | </td> |
| 898 | <td align="right"> |
| 899 | </td> |
| 900 | <td align="right"> |
| 901 | </td> |
| 902 | <td align="right"> |
| 903 | </td> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 904 | </tr> |
| 905 | </tbody> |
| 906 | </table> |
Marc Kupietz | 66bfd95 | 2017-12-11 09:59:45 +0100 | [diff] [blame] | 907 | </div> |
Marc Kupietz | deb8f62 | 2018-03-12 09:41:00 +0100 | [diff] [blame] | 908 | <div id="ccd" style=""> |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 909 | <table class="display compact nowrap" id="classicoloctable"> |
| 910 | <thead> |
Marc Kupietz | cd136e2 | 2018-01-29 09:18:12 +0100 | [diff] [blame] | 911 | % if($collocators) { |
| 912 | <tr> |
Marc Kupietz | f19814b | 2019-01-21 16:50:19 +0100 | [diff] [blame] | 913 | <th id="ll_tt">LL</th> |
Marc Kupietz | fab14a7 | 2019-01-22 16:20:29 +0100 | [diff] [blame] | 914 | <th id="mi_tt">MI</th> |
| 915 | <th id="md_tt">MI²</th> |
Marc Kupietz | f19814b | 2019-01-21 16:50:19 +0100 | [diff] [blame] | 916 | <th id="lfmd_tt">MI³</th> |
Marc Kupietz | fab14a7 | 2019-01-22 16:20:29 +0100 | [diff] [blame] | 917 | <th id="npmi_tt">nPMI</th> |
| 918 | <th id="dice_tt">dice</th> |
Marc Kupietz | 63b268f | 2019-01-22 22:34:29 +0100 | [diff] [blame] | 919 | <th id="logdice_tt">LD</th> |
| 920 | <th id="logdiceaf_tt">LDaf</th> |
Marc Kupietz | 001bffd | 2019-02-21 08:52:41 +0100 | [diff] [blame] | 921 | <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] | 922 | <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] | 923 | <th title="PMI³ restricted to left neighbour">l-PMI³</th> |
| 924 | <th title="PMI³ restricted to right neighbour">r-PMI³</th> |
| 925 | <th title="nPMI restricted to left neighbour">l-nPMI</th> |
| 926 | <th title="nPMI restricted to right neighbour">r-nPMI</th> |
Marc Kupietz | 4784fae | 2019-02-04 12:32:12 +0100 | [diff] [blame] | 927 | <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] | 928 | <th><%= loc 'collocate_ca' %></th> |
Marc Kupietz | cd136e2 | 2018-01-29 09:18:12 +0100 | [diff] [blame] | 929 | </tr> |
Marc Kupietz | 1acb317 | 2018-02-17 09:41:26 +0100 | [diff] [blame] | 930 | % } |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 931 | </thead> |
| 932 | <tbody> |
| 933 | <tr> |
Marc Kupietz | 63b268f | 2019-01-22 22:34:29 +0100 | [diff] [blame] | 934 | <td align="right"></td> |
| 935 | <td align="right"></td> |
| 936 | <td align="right"></td> |
Marc Kupietz | b4b53ca | 2018-01-25 08:57:11 +0100 | [diff] [blame] | 937 | <td align="right"></td> |
Marc Kupietz | 78d7c1a | 2019-02-17 22:31:22 +0100 | [diff] [blame] | 938 | <td align="right"></td> |
| 939 | <td align="right"></td> |
| 940 | <td align="right"></td> |
| 941 | <td align="right"></td> |
| 942 | <td align="right"></td> |
| 943 | <td align="left"> </td> |
| 944 | <td align="right"></td> |
| 945 | <td align="right"></td> |
| 946 | <td align="right"></td> |
| 947 | <td align="right"></td> |
| 948 | <td align="left"> </td> |
Marc Kupietz | e6a7a73 | 2018-01-12 09:21:08 +0100 | [diff] [blame] | 949 | </tr> |
| 950 | </tbody> |
| 951 | </table> |
| 952 | </div> |
Marc Kupietz | 384c913 | 2018-03-19 16:45:24 +0100 | [diff] [blame] | 953 | <!-- |
| 954 | <div style="clear:both" ></div> |
| 955 | <div style="float: right; overflow: hidden" id="extra"><button onClick="showCollocatorSOM()"> </button></div> |
| 956 | --> |
Marc Kupietz | 66bfd95 | 2017-12-11 09:59:45 +0100 | [diff] [blame] | 957 | </div> |
Marc Kupietz | d6dfdf0 | 2019-12-06 09:53:34 +0100 | [diff] [blame] | 958 | <div id="tabs-4" style="display: flex; padding:5px; flex-flow: row wrap;"> |
| 959 | <div id="info"> |
| 960 | <h3><%== loc 'about' %></h3> |
| 961 | %= include(loc('abouttext')) |
| 962 | % if($training_args && (@$lists)[0]) { |
| 963 | <h3><%= loc 'training_parameters' %></h3> |
| 964 | % if($training_args =~ /-type\s*3/) { |
| 965 | <p>Calculations are based on a word embedding model trained with an extension of <a href="https://github.com/wlin12/wang2vec/">wang2vec</a> using the following parameters:</p> |
| 966 | <div class="mono"><%= $training_args %></div> |
| 967 | % } else { |
| 968 | <p>Calculations are based on a word embedding model trained with <a href="https://code.google.com/p/word2vec/">word2vec</a> using the following parameters:</p> |
| 969 | <div class="mono"><%= $training_args %></div> |
| 970 | % } |
Marc Kupietz | 2133bd1 | 2022-05-19 09:24:42 +0200 | [diff] [blame] | 971 | % } |
| 972 | <h3>Source Code</h3> |
| 973 | <ul> |
| 974 | <li><a href="https://korap.ids-mannheim.de/gerrit/plugins/gitiles/ids-kl/dereko2vec">dereko2vec</a></li> |
| 975 | <li><a href="https://korap.ids-mannheim.de/gerrit/plugins/gitiles/ids-kl/derekovecs">derekovecs</a></li> |
| 976 | </ul> |
Marc Kupietz | d6dfdf0 | 2019-12-06 09:53:34 +0100 | [diff] [blame] | 977 | <h3><%== loc 'references' %></h3> |
| 978 | %= include 'references' |
| 979 | </div> |
| 980 | </div> |
| 981 | </div> <!-- tabs --> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 982 | </div> <!-- topwrapper --> |
| 983 | <div style="clear: both;"></div> |
| 984 | </div> |
Marc Kupietz | d6dfdf0 | 2019-12-06 09:53:34 +0100 | [diff] [blame] | 985 | <div class="footer"> |
| 986 | <span class="footertext"> |
| 987 | %= include(loc('footer')) |
| 988 | </span> |
Marc Kupietz | ebea470 | 2018-01-12 09:16:09 +0100 | [diff] [blame] | 989 | </div> |
Marc Kupietz | 5827066 | 2017-12-04 12:10:06 +0100 | [diff] [blame] | 990 | </body> |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 991 | </html> |