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