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