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