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