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