Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>DeReKo-Word-Vector-Distances: <%= $word %></title> |
Marc Kupietz | 80bd7b9 | 2017-07-04 16:25:54 +0200 | [diff] [blame] | 5 | <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> |
Marc Kupietz | 6dbadd1 | 2017-11-29 16:43:33 +0100 | [diff] [blame] | 6 | <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] | 7 | <script src="http://code.jquery.com/jquery-latest.min.js"></script> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 8 | <script src = "https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script> |
| 9 | <script src = "https://cdn.datatables.net/fixedcolumns/3.2.3/js/dataTables.fixedColumns.min.js"></script> |
Marc Kupietz | 2279614 | 2017-12-01 13:19:15 +0100 | [diff] [blame] | 10 | <script src = "https://cdn.datatables.net/plug-ins/1.10.16/sorting/scientific.js"></script> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 11 | <link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css"> |
Marc Kupietz | 80bd7b9 | 2017-07-04 16:25:54 +0200 | [diff] [blame] | 12 | <script |
Marc Kupietz | 6dbadd1 | 2017-11-29 16:43:33 +0100 | [diff] [blame] | 13 | src="http://code.jquery.com/ui/1.12.1/jquery-ui.min.js" |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 14 | integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" |
| 15 | crossorigin="anonymous"></script> |
Marc Kupietz | 80bd7b9 | 2017-07-04 16:25:54 +0200 | [diff] [blame] | 16 | <script> |
Marc Kupietz | a6e08f0 | 2017-12-01 22:06:21 +0100 | [diff] [blame] | 17 | var urlParams = new URLSearchParams(window.location.search); |
| 18 | |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 19 | $('#firstable').hide(); |
| 20 | $(document).ready(function() { |
Marc Kupietz | 694610d | 2017-11-25 18:30:03 +0100 | [diff] [blame] | 21 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 22 | $("input").bind("keydown", function(event) { |
| 23 | // track enter key |
| 24 | var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode)); |
| 25 | if (keycode == 13) { // keycode for enter key |
| 26 | // force the 'Enter Key' to implicitly click the Update button |
| 27 | document.getElementById('SEARCH').click(); |
| 28 | return false; |
| 29 | } else { |
| 30 | return true; |
| 31 | }}); |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 32 | |
Marc Kupietz | b2b7aa6 | 2017-12-02 14:41:46 +0100 | [diff] [blame] | 33 | $( "#tabs" ).on( "tabsactivate", function( event, ui ) { |
| 34 | if (localStorage) localStorage['tab'] = ui.newTab.index(); |
| 35 | }); |
Marc Kupietz | 0af83e3 | 2017-11-27 09:31:37 +0100 | [diff] [blame] | 36 | |
Marc Kupietz | 896c909 | 2017-12-02 14:40:43 +0100 | [diff] [blame] | 37 | $(function(){ |
| 38 | $("#SEARCH").click(function() { |
| 39 | window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self"); |
| 40 | }); |
| 41 | }); |
Marc Kupietz | 2f6b74a | 2017-12-01 13:20:21 +0100 | [diff] [blame] | 42 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 43 | function changeCharColor(txt, heat) { |
| 44 | var newText = ""; |
| 45 | for (var i=0, l=txt.length; i<l; i++) { |
Marc Kupietz | 728b8ed | 2017-12-02 11:13:49 +0100 | [diff] [blame] | 46 | newText += (i == 5 ? txt.charAt(i) : '<span style="background-color:'+getHeatColor(heat[i]/maxHeat)+'">'+txt.charAt(i)+'</span>'); |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 47 | } |
| 48 | return newText; |
| 49 | } |
| 50 | |
| 51 | function getHeatColor(value) { |
| 52 | var hue=((1-value)*120).toString(10); |
Marc Kupietz | 728b8ed | 2017-12-02 11:13:49 +0100 | [diff] [blame] | 53 | return ["hsl(",hue,",90%,70%)"].join(""); |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | function bitvec2window(n, heat) { |
| 57 | var str = n.toString(2).padStart(10, "0") |
| 58 | .replace(/^([0-9]{5})/, '$1x') |
| 59 | .replace(/0/g, '·') |
| 60 | .replace(/1/g, '+'); |
| 61 | return changeCharColor(str, heat); |
| 62 | } |
| 63 | |
Marc Kupietz | 0d4c0ca | 2017-12-04 09:18:56 +0100 | [diff] [blame^] | 64 | % use Mojo::ByteStream 'b'; |
| 65 | % my $urlprefix = url_with->query([word=>'']); |
| 66 | var paraResults = <%= b(Mojo::JSON::to_json($lists)) %>; |
| 67 | var urlprefix = new URLSearchParams(window.location.search); |
| 68 | if (paraResults.length > 0) { |
| 69 | var nvecs = [], |
| 70 | nwords = [], |
| 71 | nranks = [], |
| 72 | nmarked = []; |
| 73 | for(var i = 0; i < paraResults.length; i++) { |
| 74 | nwords = nwords.concat(paraResults[i].map(function(a){return a.word;})); |
| 75 | nvecs = nvecs.concat(paraResults[i].map(function(a){return a.vector;})); |
| 76 | nranks = nranks.concat(paraResults[i].map(function(a){return a.rank;})); |
| 77 | nmarked = nmarked.concat(paraResults[i].map(function(a){return a.marked;})); |
| 78 | } |
| 79 | showMap({target: " "+urlParams.get('word')+" ", mergedEnd: 0, words: nwords, vecs: nvecs, ranks: nranks, marked: nmarked, urlprefix: "?"+urlprefix} ); |
| 80 | var t = $('#firsttable').DataTable({ |
| 81 | data: paraResults[0], |
| 82 | "sScrollY": "780px", |
| 83 | "bScrollCollapse": true, |
| 84 | "bPaginate": false, |
| 85 | "bJQueryUI": true, |
| 86 | "dom": '<"top">rt<"bottom"flp><"clear">', |
| 87 | "columns": [ |
| 88 | { "data": "rank", type: "allnumeric" }, |
| 89 | { "data": "dist", render: function ( data, type, row ) {return data.toFixed(3) }}, |
| 90 | { "data": "word", render: function ( data, type, row ) {urlprefix.set("word", data); return '<a href="?' + urlprefix + '">' + data + '</a>' }} |
| 91 | ], |
| 92 | "columnDefs": [ |
| 93 | { className: "dt-right", "targets": [0,1] }, |
| 94 | { "searchable": false, |
| 95 | "orderable": false, |
| 96 | "targets": 0 |
| 97 | }, |
| 98 | { "orderSequence": [ "desc" ], "targets": [ 1 ] }, |
| 99 | { "orderSequence": [ "asc", "desc" ], "targets": [ 2 ] }, |
| 100 | ], |
| 101 | "order": [[ 1, 'desc' ]], |
| 102 | } ); |
| 103 | |
| 104 | t.on( 'order.dt search.dt', function () { |
| 105 | t.column(0, {order:'applied'}).nodes().each( function (cell, i) { |
| 106 | cell.innerHTML = i+1; |
| 107 | } ); |
| 108 | } ).draw(); |
| 109 | |
| 110 | $( "#first" ).clone().prependTo( "#tabs-2" ); |
| 111 | |
| 112 | } |
| 113 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 114 | var collocatorData = <%= b(Mojo::JSON::to_json($collocators)) %>; |
| 115 | var maxHeat; // = Math.max.apply(Math,collocatorData.map(function(o){return o.cprob;})) |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 116 | |
| 117 | if (collocatorData != null) { |
Marc Kupietz | 896c909 | 2017-12-02 14:40:43 +0100 | [diff] [blame] | 118 | maxHeat = Math.max.apply(Math,collocatorData.map(function(o){return Math.max.apply(Math,o.heat);})) |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 119 | var t = $('#secondtable').DataTable({ |
| 120 | data: collocatorData, |
Marc Kupietz | 0d4c0ca | 2017-12-04 09:18:56 +0100 | [diff] [blame^] | 121 | "sScrollY": "780px", |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 122 | "bScrollCollapse": true, |
| 123 | "bPaginate": false, |
| 124 | "bJQueryUI": true, |
| 125 | "dom": '<"top">rt<"bottom"flp><"clear">', |
| 126 | "columns": [ |
| 127 | { "data": "rank", type: "allnumeric" }, |
| 128 | { "data": "pos", width: "7%", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitvec2window(data, row.heat) }}, |
| 129 | { "data": "max", render: function ( data, type, row ) {return data.toFixed(3) }}, |
| 130 | { "data": "conorm", render: function ( data, type, row ) {return data.toFixed(3) }}, |
| 131 | { "data": "prob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } }, |
| 132 | { "data": "cprob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } }, |
| 133 | { "data": "overall", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } }, |
| 134 | { "data": "word", sClass: "collocator" } |
| 135 | ], |
| 136 | "columnDefs": [ |
| 137 | { className: "dt-right", "targets": [0,2,3,4,5,6] }, |
| 138 | { className: "dt-center", "targets": [ 1] }, |
| 139 | { "searchable": false, |
| 140 | "orderable": false, |
| 141 | "targets": 0 |
| 142 | }, |
| 143 | { "type": "scientific", targets: [2,3,4,5,6] }, |
| 144 | { "orderSequence": [ "desc" ], "targets": [ 2, 3, 4, 5, 6 ] }, |
| 145 | { "orderSequence": [ "asc", "desc" ], "targets": [ 1, 7 ] }, |
| 146 | ], |
| 147 | "order": [[ 4, 'desc' ]], |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 148 | } ); |
Marc Kupietz | 0af83e3 | 2017-11-27 09:31:37 +0100 | [diff] [blame] | 149 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 150 | t.on( 'order.dt search.dt', function () { |
| 151 | t.column(0, {order:'applied'}).nodes().each( function (cell, i) { |
| 152 | cell.innerHTML = i+1; |
| 153 | } ); |
| 154 | } ).draw(); |
Marc Kupietz | ddaba63 | 2017-12-02 17:30:56 +0100 | [diff] [blame] | 155 | |
| 156 | if (localStorage) { // let's not crash if some user has IE7 |
| 157 | var index = parseInt(localStorage['tab']||'0'); |
| 158 | $("#tabs").tabs({ active: index }); |
| 159 | } |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 160 | } |
| 161 | $("#tabs").css("visibility", "visible"); // now we can show the tabs |
Marc Kupietz | 6e2fc10 | 2017-12-01 22:07:23 +0100 | [diff] [blame] | 162 | |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 163 | }); |
Marc Kupietz | 6e2fc10 | 2017-12-01 22:07:23 +0100 | [diff] [blame] | 164 | |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 165 | $(function(){ |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 166 | $("#dropdownoptions").dialog({ |
| 167 | title: "Options", |
| 168 | autoOpen: false, |
| 169 | modal: false, |
| 170 | draggable: false, |
| 171 | height: "auto", |
| 172 | width: "auto", |
| 173 | resizable: false, |
| 174 | buttons: { |
| 175 | "Cancel": function() { |
| 176 | $( this ).dialog( "close" ); |
| 177 | }, |
| 178 | "Apply": function() { |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 179 | window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self"); |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 180 | } |
| 181 | } |
| 182 | }); |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 183 | }); |
| 184 | |
| 185 | $(function(){ |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 186 | $("td.collocator").click(function(){ |
| 187 | queryKorAPCII(this.textContent + " /w5 " + urlParams.get('word')); |
| 188 | }); |
| 189 | }); |
| 190 | |
| 191 | $(function(){ |
| 192 | $("#showoptions").click(function(){ |
| 193 | $("#dropdownoptions").dialog("open"); |
| 194 | var target = $(this); |
| 195 | $("#dropdownoptions").dialog("widget").position({ |
| 196 | my: 'left bottom', |
| 197 | at: 'left bottom', |
| 198 | of: target |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 199 | }); |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 200 | }); |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 201 | }); |
| 202 | |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 203 | $( function() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 204 | $( "#no_iterations" ).spinner({ |
| 205 | spin: function( event, ui ) { |
| 206 | if ( ui.value < 1000 ) { |
| 207 | $( this ).spinner( "value", 1000 ); |
| 208 | return false; |
| 209 | } else if ( ui.value > 10000 ) { |
| 210 | $( this ).spinner( "value", 10000 ); |
| 211 | return false; |
| 212 | } |
| 213 | } |
| 214 | }); |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 215 | } ); |
Marc Kupietz | 3305b0a | 2017-11-27 10:46:20 +0100 | [diff] [blame] | 216 | |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 217 | $( function() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 218 | $( "#neighbours" ).spinner({ |
| 219 | spin: function( event, ui ) { |
| 220 | if ( ui.value < 0 ) { |
| 221 | $( this ).spinner( "value", 0 ); |
| 222 | return false; |
| 223 | } else if ( ui.value > 200 ) { |
| 224 | $( this ).spinner( "value", 200 ); |
| 225 | return false; |
| 226 | } |
| 227 | } |
| 228 | }); |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 229 | } ); |
| 230 | |
| 231 | $( function() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 232 | $( "#cutoff" ).spinner({ |
| 233 | spin: function( event, ui ) { |
| 234 | if ( ui.value < 100000 ) { |
| 235 | $( this ).spinner( "value", 100000 ); |
| 236 | return false; |
| 237 | } else if ( ui.value > 2000000 ) { |
| 238 | $( this ).spinner( "value", 2000000 ); |
| 239 | return false; |
| 240 | } |
| 241 | } |
| 242 | }); |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 243 | } ); |
| 244 | |
| 245 | $( function() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 246 | $( "#tabs" ).tabs().addClass('tabs-min'); |
Marc Kupietz | 4fcda0c | 2017-11-29 09:00:31 +0100 | [diff] [blame] | 247 | } ); |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 248 | |
| 249 | $( function() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 250 | $( ".controlgroup-vertical" ).controlgroup({ |
| 251 | "direction": "vertical" |
| 252 | }); |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 253 | } ); |
| 254 | |
| 255 | $(function() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 256 | $( document ).tooltip({ |
| 257 | content: function() { |
| 258 | return $(this).attr('title'); |
| 259 | }} |
| 260 | ) |
Marc Kupietz | 6e2fc10 | 2017-12-01 22:07:23 +0100 | [diff] [blame] | 261 | }) |
Marc Kupietz | 694610d | 2017-11-25 18:30:03 +0100 | [diff] [blame] | 262 | |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 263 | </script> |
| 264 | <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script> |
Marc Kupietz | 554aff5 | 2017-11-09 14:42:09 +0100 | [diff] [blame] | 265 | <script src="/derekovecs/js/tsne.js"></script> |
| 266 | <script src="/derekovecs/js/som.js"></script> |
| 267 | <script src="/derekovecs/js/labeler.js"></script> |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 268 | <style> |
| 269 | body, input { |
Marc Kupietz | 6dbadd1 | 2017-11-29 16:43:33 +0100 | [diff] [blame] | 270 | font-family: Lato, sans-serif; |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 271 | font-size: 11pt; |
| 272 | } |
Marc Kupietz | 30ca434 | 2017-11-22 21:21:20 +0100 | [diff] [blame] | 273 | |
Marc Kupietz | 6dbadd1 | 2017-11-29 16:43:33 +0100 | [diff] [blame] | 274 | h1, h2, h3 { |
| 275 | margin: 5px 10px 0 0; |
| 276 | color: rgb(246,168,0); |
| 277 | font-family: "Univers LT Std 47 Cn Lt", "Univers LT Std 67 Cn Lt", "Roboto Condensed", "Univers LT Std 67 Cn Bold", "UniversLTStd-BoldCn", "Times", 'League Gothic', Impact, sans-serif; |
| 278 | font-weight: bold; |
| 279 | line-height: 1.35; |
| 280 | letter-spacing: normal; |
| 281 | text-transform: uppercase; |
| 282 | text-shadow: none; |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 283 | word-wrap: break-word; |
| 284 | } |
| 285 | |
| 286 | |
Marc Kupietz | 81bf39c | 2017-11-29 17:04:35 +0100 | [diff] [blame] | 287 | showoptions, #SEARCH { |
| 288 | margin-left: 10px; |
| 289 | margin-right: 10px; |
Marc Kupietz | 6dbadd1 | 2017-11-29 16:43:33 +0100 | [diff] [blame] | 290 | } |
| 291 | |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 292 | .tabs-left-vertical .ui-tabs-nav { |
| 293 | position: absolute; |
| 294 | width: 21em; |
| 295 | transform: translate(-100%,0%) rotate(-90deg); |
| 296 | transform-origin: 100% 0%; |
| 297 | } |
Marc Kupietz | 4fcda0c | 2017-11-29 09:00:31 +0100 | [diff] [blame] | 298 | |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 299 | .tabs-left-vertical .ui-tabs-nav li { |
| 300 | float: right; |
| 301 | } |
Marc Kupietz | 4fcda0c | 2017-11-29 09:00:31 +0100 | [diff] [blame] | 302 | |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 303 | .tabs-left-vertical .ui-tabs-panel { |
| 304 | padding-left: 3.5em; |
| 305 | } |
| 306 | |
| 307 | .tabs-left-vertical .ui-tabs-panel { |
| 308 | height: 20em; |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 309 | } |
Marc Kupietz | 4fcda0c | 2017-11-29 09:00:31 +0100 | [diff] [blame] | 310 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 311 | .mono { |
| 312 | font-family: "DejaVu Sans Mono", Inconsolata, SourceCodePro, Courier; |
| 313 | } |
Marc Kupietz | 30ca434 | 2017-11-22 21:21:20 +0100 | [diff] [blame] | 314 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 315 | .ui-tooltip-content { |
| 316 | font-size: 9pt; |
| 317 | color: #222222; |
| 318 | } |
Marc Kupietz | f4b4939 | 2016-04-28 10:49:56 +0200 | [diff] [blame] | 319 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 320 | svg > .ui-tooltip-content { |
| 321 | font-size: 8pt; |
| 322 | color: #222222; |
| 323 | } |
| 324 | |
| 325 | a.merged { |
| 326 | color: green; |
| 327 | fill: green; |
| 328 | } |
| 329 | |
| 330 | #first a { |
| 331 | text-decoration: none; |
| 332 | } |
| 333 | |
| 334 | a.marked, #first a.marked { |
| 335 | text-decoration: underline; |
| 336 | } |
| 337 | |
| 338 | a.target { |
| 339 | color: red; |
| 340 | fill: red; |
| 341 | } |
Marc Kupietz | 694610d | 2017-11-25 18:30:03 +0100 | [diff] [blame] | 342 | |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 343 | table.display { |
| 344 | width: 40% important!; |
| 345 | margin: 1; /* <- works for me this way ****/ |
| 346 | } |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 347 | |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 348 | table.dataTable thead th, table.dataTable thead td, table.dataTable tbody td { |
| 349 | padding: 2px 2px; |
| 350 | // border-bottom: 1px solid #111; |
| 351 | } |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 352 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 353 | #collocators { |
| 354 | margin-bottom: 15px; |
| 355 | } |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 356 | |
Marc Kupietz | 81bf39c | 2017-11-29 17:04:35 +0100 | [diff] [blame] | 357 | #header { |
| 358 | width: 100%; |
| 359 | // border: 1px solid red; |
| 360 | overflow: hidden; /* will contain if #first is longer than #second */ |
| 361 | } |
| 362 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 363 | #topwrapper { |
| 364 | width: 100%; |
| 365 | // border: 1px solid red; |
| 366 | overflow: hidden; /* will contain if #first is longer than #second */ |
| 367 | } |
| 368 | |
| 369 | #wrapper { |
| 370 | // border: 1px solid red; |
| 371 | overflow: hidden; /* will contain if #first is longer than #second */ |
| 372 | } |
| 373 | |
Marc Kupietz | 81bf39c | 2017-11-29 17:04:35 +0100 | [diff] [blame] | 374 | #pagetitle { |
| 375 | max-width: 460px; |
| 376 | margin-right: 20px; |
| 377 | float: left; |
| 378 | overflow: hidden; /* if you don't want #second to wrap below #first */ |
| 379 | // border: 1px solid green; |
| 380 | } |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 381 | |
Marc Kupietz | 81bf39c | 2017-11-29 17:04:35 +0100 | [diff] [blame] | 382 | #options { |
| 383 | float: left; |
| 384 | width: 800px; |
| 385 | margin: 10px; |
| 386 | overflow: hidden; /* if you don't want #second to wrap below #first */ |
| 387 | } |
| 388 | |
| 389 | #word { |
| 390 | width: 50%; |
| 391 | } |
| 392 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 393 | #first { |
| 394 | margin-right: 20px; |
| 395 | float: left; |
| 396 | overflow: hidden; /* if you don't want #second to wrap below #first */ |
| 397 | // border: 1px solid green; |
| 398 | } |
| 399 | #tabs { |
| 400 | margin-right: 20px; |
| 401 | overflow: hidden; /* if you don't want #second to wrap below #first */ |
| 402 | } |
Marc Kupietz | df3d4b5 | 2017-11-29 16:57:27 +0100 | [diff] [blame] | 403 | |
| 404 | .tabs-min { |
| 405 | background: transparent; |
| 406 | border: none; |
| 407 | } |
| 408 | |
| 409 | .tabs-min .ui-widget-header { |
| 410 | background: transparent; |
| 411 | border: none; |
| 412 | border-bottom: 1px solid #c0c0c0; |
| 413 | -moz-border-radius: 0px; |
| 414 | -webkit-border-radius: 0px; |
| 415 | border-radius: 0px; |
| 416 | } |
| 417 | |
| 418 | .tabs-min .ui-tabs-nav .ui-state-default { |
| 419 | background: transparent; |
| 420 | border: none; |
| 421 | } |
| 422 | |
| 423 | .tabs-min .ui-tabs-nav .ui-state-active { |
| 424 | background: transparent url(img/uiTabsArrow.png) no-repeat bottom center; |
| 425 | border: none; |
| 426 | } |
| 427 | |
| 428 | .tabs-min .ui-tabs-nav .ui-state-default a { |
| 429 | color: #c0c0c0; |
| 430 | } |
| 431 | |
| 432 | .tabs-min .ui-tabs-nav .ui-state-active a { |
| 433 | color: rgb(246,168,0); |
| 434 | } |
| 435 | |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 436 | #embed { |
| 437 | max-width: 802px; |
| 438 | border: 1px solid #333; |
| 439 | } |
| 440 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 441 | #second { |
| 442 | min-width: 800px; |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 443 | // border: 1px solid #333; |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 444 | overflow: hidden; /* if you don't want #second to wrap below #first */ |
| 445 | } |
| 446 | #som2 svg { |
| 447 | border: 1px solid #333; |
| 448 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 449 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 450 | #cost { |
| 451 | font-size: 8pt; |
| 452 | color: #222222; |
| 453 | margin-top: 4px; |
| 454 | margin-bottom: 12px; |
| 455 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 456 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 457 | #sominfo1, #sominfo { |
| 458 | font-size: 8pt; |
| 459 | color: #222222; |
| 460 | margin-top: 0px; |
| 461 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 462 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 463 | #somcolor1, #somcolor2, #somcolor3 { |
| 464 | display: inline-block; |
| 465 | height: 10px; |
| 466 | width: 10px; |
| 467 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 468 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 469 | #third { |
| 470 | border: 1px solid #333; |
| 471 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 472 | |
| 473 | </style> |
| 474 | <script> |
| 475 | |
| 476 | var opt = {epsilon: <%= $epsilon %>, perplexity: <%= $perplexity %>}, |
| 477 | mapWidth = 800, // width map |
| 478 | mapHeight = 800, |
| 479 | jitterRadius = 7; |
| 480 | |
| 481 | var T = new tsnejs.tSNE(opt); // create a tSNE instance |
| 482 | |
| 483 | var Y; |
| 484 | |
| 485 | var data; |
| 486 | var labeler; |
| 487 | |
| 488 | function applyJitter() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 489 | svg.selectAll('.tsnet') |
| 490 | .data(labels) |
| 491 | .transition() |
| 492 | .duration(50) |
| 493 | .attr("transform", function(d, i) { |
| 494 | T.Y[i][0] = (d.x - mapWidth/2 - tx)/ss/20; |
| 495 | T.Y[i][1] = (d.y - mapHeight/2 - ty)/ss/20; |
| 496 | return "translate(" + |
Marc Kupietz | 0d4c0ca | 2017-12-04 09:18:56 +0100 | [diff] [blame^] | 497 | (d.x) + "," + |
| 498 | (d.y) + ")"; |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 499 | }); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 500 | } |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 501 | |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 502 | function updateEmbedding() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 503 | var Y = T.getSolution(); |
| 504 | svg.selectAll('.tsnet') |
| 505 | .data(data.words) |
| 506 | .attr("transform", function(d, i) { |
| 507 | return "translate(" + |
Marc Kupietz | 0d4c0ca | 2017-12-04 09:18:56 +0100 | [diff] [blame^] | 508 | ((Y[i][0]*20*ss + tx) + mapWidth/2) + "," + |
| 509 | ((Y[i][1]*20*ss + ty) + mapHeight/2) + ")"; }); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 510 | } |
| 511 | |
| 512 | var svg; |
| 513 | var labels = []; |
| 514 | var anchor_array = []; |
| 515 | var text; |
| 516 | |
| 517 | function drawEmbedding() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 518 | $("#embed").empty(); |
| 519 | var div = d3.select("#embed"); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 520 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 521 | // get min and max in each column of Y |
| 522 | var Y = T.Y; |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 523 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 524 | svg = div.append("svg") // svg is global |
| 525 | .attr("width", mapWidth) |
| 526 | .attr("height", mapHeight); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 527 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 528 | var g = svg.selectAll(".b") |
| 529 | .data(data.words) |
| 530 | .enter().append("g") |
| 531 | .attr("class", "tsnet"); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 532 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 533 | g.append("a") |
| 534 | .attr("xlink:href", function(word) { |
| 535 | return (data.urlprefix+word);}) |
| 536 | .attr("class", function(d, i) { |
| 537 | var res=""; |
| 538 | if(data.marked[i]) { |
| 539 | res="marked "; |
| 540 | } |
| 541 | if(data.target.indexOf(" "+d+" ") >= 0) { |
| 542 | return res+"target"; |
| 543 | } else if(data.ranks[i] < data.mergedEnd) { |
| 544 | return res+"merged"; |
| 545 | } else { |
| 546 | return res; |
| 547 | } |
| 548 | }) |
| 549 | .attr("title", function(d, i) { |
| 550 | if(data.mergedEnd > 0) { |
| 551 | if(data.ranks[i] >= data.mergedEnd) { |
| 552 | return "rank: "+i +" "+"freq. rank: "+(data.ranks[i]).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); |
| 553 | } else { |
| 554 | return "rank: "+i +" "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " (merged vocab)"; |
| 555 | } |
| 556 | } else { |
| 557 | return "rank: "+i +" "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); |
| 558 | } |
| 559 | }) |
| 560 | .append("text") |
| 561 | .attr("text-anchor", "top") |
| 562 | .attr("font-size", 12) |
| 563 | .text(function(d) { return d; }); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 564 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 565 | var zoomListener = d3.behavior.zoom() |
| 566 | .scaleExtent([0.1, 10]) |
| 567 | .center([0,0]) |
| 568 | .on("zoom", zoomHandler); |
| 569 | zoomListener(svg); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 570 | } |
| 571 | |
| 572 | var tx=0, ty=0; |
| 573 | var ss=1; |
| 574 | var iter_id=-1; |
| 575 | |
| 576 | function zoomHandler() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 577 | tx = d3.event.translate[0]; |
| 578 | ty = d3.event.translate[1]; |
| 579 | ss = d3.event.scale; |
| 580 | updateEmbedding(); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 581 | } |
| 582 | |
| 583 | var stepnum = 0; |
| 584 | |
| 585 | function stopStep() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 586 | clearInterval(iter_id); |
| 587 | text = svg.selectAll("text"); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 588 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 589 | // jitter function needs different data and co-ordinate representation |
| 590 | labels = d3.range(data.words.length).map(function(i) { |
| 591 | var x = (T.Y[i][0]*20*ss + tx) + mapWidth/2; |
| 592 | var y = (T.Y[i][1]*20*ss + ty) + mapHeight/2; |
| 593 | anchor_array.push({x: x, y: y, r: jitterRadius}); |
| 594 | return { |
| 595 | x: x, |
| 596 | y: y, |
| 597 | name: data.words[i] |
| 598 | }; |
| 599 | }); |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 600 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 601 | // get the actual label bounding boxes for the jitter function |
| 602 | var index = 0; |
| 603 | text.each(function() { |
| 604 | labels[index].width = this.getBBox().width; |
| 605 | labels[index].height = this.getBBox().height; |
| 606 | index += 1; |
| 607 | }); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 608 | |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 609 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 610 | // setTimeout(updateEmbedding, 1); |
| 611 | // setTimeout( |
| 612 | labeler = d3.labeler() |
| 613 | .label(labels) |
| 614 | .anchor(anchor_array) |
| 615 | .width(mapWidth) |
| 616 | .height(mapHeight) |
| 617 | .update(applyJitter); |
| 618 | // .start(1000); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 619 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 620 | iter_id = setInterval(jitterStep, 1); |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 621 | } |
| 622 | |
| 623 | var jitter_i=0; |
| 624 | |
| 625 | function jitterStep() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 626 | if(jitter_i++ > 100) { |
| 627 | clearInterval(iter_id); |
| 628 | } else { |
| 629 | labeler.start2(10); |
| 630 | applyJitter(); |
| 631 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 632 | } |
| 633 | |
| 634 | var last_cost=1000; |
| 635 | |
| 636 | function step() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 637 | var i = T.iter; |
Marc Kupietz | 34c0817 | 2017-11-29 17:08:47 +0100 | [diff] [blame] | 638 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 639 | if(i > <%= $no_iterations %>) { |
| 640 | stopStep(); |
| 641 | } else { |
| 642 | var cost = Math.round(T.step() * 100000) / 100000; // do a few steps |
| 643 | $("#cost").html("tsne iteration " + i + ", cost: " + cost.toFixed(5)); |
| 644 | if(i % 250 == 0 && cost >= last_cost) { |
| 645 | stopStep(); |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 646 | } else { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 647 | last_cost = cost; |
| 648 | updateEmbedding(); |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 649 | } |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 650 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 651 | } |
| 652 | |
| 653 | function showMap(j) { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 654 | data=j; |
| 655 | T.iter=0; |
| 656 | T.initDataRaw(data.vecs); // init embedding |
| 657 | drawEmbedding(); // draw initial embedding |
Marc Kupietz | 7811453 | 2017-11-29 17:00:16 +0100 | [diff] [blame] | 658 | |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 659 | if(iter_id >= 0) { |
| 660 | clearInterval(iter_id); |
| 661 | } |
| 662 | //T.debugGrad(); |
| 663 | iter_id = setInterval(step, 1); |
| 664 | if(true) { // (<%= $show_som %>) { |
| 665 | makeSOM(j, <%= $no_iterations %>); |
| 666 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 667 | } |
Marc Kupietz | 39179ab | 2017-07-04 16:28:06 +0200 | [diff] [blame] | 668 | var queryword; |
| 669 | |
| 670 | function onload() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 671 | queryword = document.getElementById('word'); |
Marc Kupietz | 39179ab | 2017-07-04 16:28:06 +0200 | [diff] [blame] | 672 | } |
| 673 | |
| 674 | function queryKorAP() { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 675 | window.open('http://korap.ids-mannheim.de/kalamar/?q='+queryword.value, 'KorAP'); |
Marc Kupietz | 39179ab | 2017-07-04 16:28:06 +0200 | [diff] [blame] | 676 | } |
Marc Kupietz | 4dc270c | 2017-11-24 10:17:12 +0100 | [diff] [blame] | 677 | |
| 678 | function queryKorAPCII(query) { |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 679 | window.open('http://korap.ids-mannheim.de/kalamar/?ql=cosmas2&q='+query, 'KorAP'); |
Marc Kupietz | 4dc270c | 2017-11-24 10:17:12 +0100 | [diff] [blame] | 680 | } |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 681 | </script> |
| 682 | </head> |
Marc Kupietz | 39179ab | 2017-07-04 16:28:06 +0200 | [diff] [blame] | 683 | <body onload="onload()"> |
Marc Kupietz | 81bf39c | 2017-11-29 17:04:35 +0100 | [diff] [blame] | 684 | <div id="header"> |
| 685 | <div id="pagetitle"> |
| 686 | <h1>DeReKo-Vectors</h1> |
| 687 | </div> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 688 | <div id="options" class="widget"> |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 689 | <form id="queryform"> |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 690 | <input id="word" type="text" name="word" placeholder="Word(s) to be searched" value="<%= $word %>" |
Marc Kupietz | 81bf39c | 2017-11-29 17:04:35 +0100 | [diff] [blame] | 691 | 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."/> |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 692 | <input id="SEARCH" type="button" value="SEARCH"> |
| 693 | <input type="button" id="showoptions" name="showoptions" value="Options" /> |
| 694 | </form> |
Marc Kupietz | 6e2fc10 | 2017-12-01 22:07:23 +0100 | [diff] [blame] | 695 | <div id="dropdownoptions" style="display: none"> |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 696 | <form id="optionsform"> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 697 | <div class="controlgroup-vertical"> |
| 698 | <label for="cutoff">cut-off</label> |
| 699 | <input id="cutoff" type="text" name="cutoff" size="10" value="<%= $cutoff %>" title="Only consider the most frequent x word forms."> |
| 700 | <label for="dedupe">dedupe</label> |
| 701 | <input id="dedupe" type="checkbox" name="dedupe" value="1" <%= ($dedupe ? "checked" : "") %> title="radically filter out any near-duplicates"> |
| 702 | % if($mergedEnd > 0) { |
Marc Kupietz | 7811453 | 2017-11-29 17:00:16 +0100 | [diff] [blame] | 703 | <label for="sbf">backw.</label> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 704 | <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."> |
| 705 | % } |
| 706 | <label for="neighbours">max. neighbours:</label> |
| 707 | <input id="neighbours" size="4" name="n" value="<%= $no_nbs %>"> |
Marc Kupietz | c1e42c3 | 2017-11-29 16:47:56 +0100 | [diff] [blame] | 708 | <label for="no_iterations">max. iterations</label> |
| 709 | <input id="no_iterations" name="N" size="4" value="<%= $no_iterations %>"> |
Marc Kupietz | 7811453 | 2017-11-29 17:00:16 +0100 | [diff] [blame] | 710 | <!-- <label for="dosom">SOM</label> |
| 711 | <input id="dosom" type="checkbox" name="som" value="1" <%= ($show_som ? "checked" : "") %>> --> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 712 | % if($collocators) { |
| 713 | <label for="sortby">window/sort</label> |
| 714 | <select id="sortby" name="sort"> |
| 715 | <option value="0" <%= ($sort!=1 && $sort!=2? "selected":"") %>>auto focus</option> |
Marc Kupietz | a77acce | 2017-11-30 16:59:07 +0100 | [diff] [blame] | 716 | <!-- <option value="1" <%= ($sort==1? "selected":"") %>>any single position</option> |
| 717 | <option value="2" <%= ($sort==2? "selected":"") %>>whole window</option> --> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 718 | </select> |
| 719 | % } |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 720 | <input type="button" value="→ KorAP" onclick="queryKorAP();" title="query word with KorAP"/> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 721 | </div> |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 722 | </form> |
| 723 | </div> |
Marc Kupietz | 0af83e3 | 2017-11-27 09:31:37 +0100 | [diff] [blame] | 724 | </div> |
Marc Kupietz | 81bf39c | 2017-11-29 17:04:35 +0100 | [diff] [blame] | 725 | </div> |
| 726 | <div id="topwrapper"> |
Marc Kupietz | 6e2fc10 | 2017-12-01 22:07:23 +0100 | [diff] [blame] | 727 | <div style="visibility: hidden;" id="tabs"> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 728 | <ul> |
Marc Kupietz | 4fcda0c | 2017-11-29 09:00:31 +0100 | [diff] [blame] | 729 | <li><a href="#tabs-1">Semantics (TSNE-map)</a></li> |
| 730 | <li><a href="#tabs-2">Semantics (SOM)</a></li> |
| 731 | <li><a href="#tabs-3">Syntagmatic (collocators)</a></li> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 732 | </ul> |
| 733 | <div id="tabs-1"> |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 734 | % if($lists && (@$lists) > 0 && (@$lists)[0]) { |
| 735 | <div id="wrapper"> |
Marc Kupietz | aaae015 | 2017-12-01 23:31:56 +0100 | [diff] [blame] | 736 | <div id="first" style="width: 320px"> |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 737 | <table class="display compact nowrap" id="firsttable"> |
| 738 | <thead> |
| 739 | <tr> |
Marc Kupietz | aaae015 | 2017-12-01 23:31:56 +0100 | [diff] [blame] | 740 | <th align="right">#</th><th align="right">cos</th><th align="left">similars</th> |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 741 | </tr> |
| 742 | </thead> |
| 743 | <tbody> |
Marc Kupietz | 0d4c0ca | 2017-12-04 09:18:56 +0100 | [diff] [blame^] | 744 | <tr> |
| 745 | <td align="right"> |
| 746 | </td> |
| 747 | <td align="right"> |
| 748 | </td> |
| 749 | <td></td> |
| 750 | </tr> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 751 | </tbody> |
| 752 | </table> |
| 753 | </div> |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 754 | <script> |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 755 | </script> |
Marc Kupietz | 896c909 | 2017-12-02 14:40:43 +0100 | [diff] [blame] | 756 | <div id="second"> |
| 757 | <div id="embed"> |
| 758 | </div> |
| 759 | <div id="cost"> |
| 760 | </div> |
| 761 | </div> |
| 762 | </div> |
Marc Kupietz | 0d4c0ca | 2017-12-04 09:18:56 +0100 | [diff] [blame^] | 763 | % } elsif($word !~ /^\s*$/) { |
| 764 | <div id="wrapper"> |
| 765 | <div id="not-found-dialog" title="Not found"> |
| 766 | <p>ERROR: "<%= $word %>" not found in vocabluary.</p> |
| 767 | <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> |
| 768 | </div> |
| 769 | <script> |
| 770 | $( function() { |
Marc Kupietz | 896c909 | 2017-12-02 14:40:43 +0100 | [diff] [blame] | 771 | $( "#not-found-dialog" ).dialog({ |
| 772 | autoOpen: true, |
| 773 | modal: true, |
| 774 | draggable: false, |
| 775 | height: "auto", |
| 776 | width: "auto", |
| 777 | resizable: false, |
| 778 | buttons: { |
| 779 | "OK": function() { |
| 780 | $( this ).dialog( "close" ); |
| 781 | }, |
| 782 | "Apply": function() { |
| 783 | window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self"); |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 784 | } |
Marc Kupietz | 896c909 | 2017-12-02 14:40:43 +0100 | [diff] [blame] | 785 | } |
Marc Kupietz | 2f6b74a | 2017-12-01 13:20:21 +0100 | [diff] [blame] | 786 | }); |
Marc Kupietz | 896c909 | 2017-12-02 14:40:43 +0100 | [diff] [blame] | 787 | }); |
| 788 | </script> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 789 | </div> |
| 790 | % } |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 791 | </div> |
Marc Kupietz | 4fcda0c | 2017-11-29 09:00:31 +0100 | [diff] [blame] | 792 | <div id="tabs-2"> |
| 793 | <div id="som2" style="width: 800; height: 800px"> |
| 794 | </div> |
| 795 | <div id="sominfo1"><span id="somcolor1"> </span> <span id="somword1"> </span> <span id="somcolor2"> </span> <span id="somword2"> </span> <span id="somcolor3"> </span></div> |
| 796 | <div id="sominfo">SOM iteration <span id="iterations">0</span></div> |
| 797 | </div> |
| 798 | <div id="tabs-3"> |
Marc Kupietz | 6e2fc10 | 2017-12-01 22:07:23 +0100 | [diff] [blame] | 799 | <div style="width: 800px" id="secondt"> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 800 | <table class="display compact nowrap" id="secondtable"> |
| 801 | <thead> |
| 802 | <tr> |
| 803 | % if($collocators) { |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 804 | <th>#</th> |
Marc Kupietz | 2279614 | 2017-12-01 13:19:15 +0100 | [diff] [blame] | 805 | <th align="center" title="The columns (c) around the target are considered for summation are marked with *.">w'</th> |
Marc Kupietz | d64f3f2 | 2017-11-30 12:07:42 +0100 | [diff] [blame] | 806 | <th align="right" title="Raw (max.) activation of the collocator in the output layers.">max(a)</th> |
Marc Kupietz | a77acce | 2017-11-30 16:59:07 +0100 | [diff] [blame] | 807 | <th title="Co-normalized raw activation sum of the collocator in the selected columns." align="right">⊥Σa</th> |
| 808 | <th title="Sum of activations over the selected colunns normalized by the total activation sum of the selected columns." align="right">Σa/Σc</th> |
| 809 | <th title="Sum of the column normalized activations over the selected colunns." align="right">Σ(a/c)</th> |
| 810 | <th title="Sum of the activations over the whole window normalized by the total window sum (no auto-focus)." align="right">Σa/Σw</th> |
| 811 | <th align="left">collocator</th> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 812 | % } |
| 813 | </tr> |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 814 | </thead> |
| 815 | <tbody> |
Marc Kupietz | 2279614 | 2017-12-01 13:19:15 +0100 | [diff] [blame] | 816 | <tr> |
| 817 | <td align="right"> |
| 818 | </td> |
Marc Kupietz | b6c615d | 2017-12-02 10:38:20 +0100 | [diff] [blame] | 819 | <td align="right"> |
| 820 | </td> |
| 821 | <td align="right"> |
| 822 | </td> |
| 823 | <td align="right"> |
| 824 | </td> |
| 825 | <td align="right"> |
| 826 | </td> |
| 827 | <td align="right"> |
| 828 | </td> |
Marc Kupietz | 0d4c0ca | 2017-12-04 09:18:56 +0100 | [diff] [blame^] | 829 | <script |
| 830 | src="http://code.jquery.com/ui/1.12.1/jquery-ui.min.js" |
| 831 | </td> |
Marc Kupietz | 2279614 | 2017-12-01 13:19:15 +0100 | [diff] [blame] | 832 | </tr> |
Marc Kupietz | dab9f22 | 2017-11-29 14:22:59 +0100 | [diff] [blame] | 833 | </tbody> |
| 834 | </table> |
| 835 | </div> <!-- - tab2 --> |
Marc Kupietz | 4fcda0c | 2017-11-29 09:00:31 +0100 | [diff] [blame] | 836 | </div> <!-- tabs --> |
| 837 | </div> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 838 | </div> <!-- topwrapper --> |
| 839 | <div style="clear: both;"></div> |
Marc Kupietz | 0af83e3 | 2017-11-27 09:31:37 +0100 | [diff] [blame] | 840 | </div> |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 841 | % if($training_args) { |
| 842 | <p> |
| 843 | Word vector model trained with <a href="https://code.google.com/p/word2vec/">word2vec</a> using the following parameters: <pre><%= $training_args %></pre> |
| 844 | </p> |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 845 | % } |
Marc Kupietz | 4abcd68 | 2017-11-28 20:51:08 +0100 | [diff] [blame] | 846 | </body> |
Marc Kupietz | 8330522 | 2016-04-28 09:57:22 +0200 | [diff] [blame] | 847 | </html> |