<!DOCTYPE html>
<html>
  <head>
    <title>DeReKo-Word-Vector-Distances: <%= $word %></title>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
    <link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Condensed" rel="stylesheet">
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script src = "https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
    <script src = "https://cdn.datatables.net/fixedcolumns/3.2.3/js/dataTables.fixedColumns.min.js"></script>
    <script src = "https://cdn.datatables.net/plug-ins/1.10.16/sorting/scientific.js"></script>
    <link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
    <script
        src="http://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
        integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
        crossorigin="anonymous"></script>
    <script>
     var urlParams = new URLSearchParams(window.location.search);
     var currentWord = urlParams.get("word");

     $('#firstable').hide();
     $(document).ready(function() {

         $("input").bind("keydown", function(event) {
             // track enter key
             var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
             if (keycode == 13) { // keycode for enter key
                 // force the 'Enter Key' to implicitly click the Update button
                 document.getElementById('SEARCH').click();
                 return false;
             } else  {
                 return true;
             }});

         $( "#tabs" ).on( "tabsactivate", function( event, ui ) {
             if (localStorage) localStorage['tab'] = ui.newTab.index();
         });

         $(function(){
             $("#SEARCH").click(function() {
                 window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
             });
         });

         function changeCharColor(txt, heat, word) {
             var newText = "";
             for (var i=0, l=txt.length; i<l; i++) {
                 newText += (i == 5 ? txt.charAt(i) : '<a href="http://korap.ids-mannheim.de/kalamar/?ql=cosmas2&q=' +
                                                      currentWord + ' /' +  (i > 5? '%2B' : '-') + 'w' +
                                                      Math.abs(i-5) + ':' +  Math.abs(i-5) + ' ' + word +
                                                      '" target="korap"><span style="background-color:' +
                                                      getHeatColor(heat[i]/maxHeat)+'">'+txt.charAt(i)+'</span></a>');
             }
             return newText;
         }

         function getHeatColor(value) {
             var hue=((1-value)*120).toString(10);
             return ["hsl(",hue,",90%,70%)"].join("");
         }

         function bitvec2window(n, heat, word) {
             var str = n.toString(2).padStart(10, "0")
                        .replace(/^([0-9]{5})/, '$1x')
                        .replace(/0/g, '·')
                        .replace(/1/g, '+');
             return changeCharColor(str, heat, word);
         }

         % use Mojo::ByteStream 'b';
         var paraResults = <%= b(Mojo::JSON::to_json($lists)) %>;
         var urlprefix =  new URLSearchParams(window.location.search);
         if (paraResults.length > 0  && paraResults[0] != null) {
             var nvecs = [],
                 nwords = [],
                 nranks = [],
                 nmarked = [];
             for(var i = 0; i < paraResults.length; i++) {
                 nwords = nwords.concat(paraResults[i].map(function(a){return a.word;}));
                 nvecs = nvecs.concat(paraResults[i].map(function(a){return a.vector;}));
                 nranks = nranks.concat(paraResults[i].map(function(a){return a.rank;}));
                 nmarked = nmarked.concat(paraResults[i].map(function(a){return a.marked;}));
             }
             showMap({target: " "+urlParams.get('word')+" ", mergedEnd: 0, words: nwords, vecs: nvecs, ranks: nranks, marked: nmarked} );
             var t = $('#firsttable').DataTable({
                 data: paraResults[0],
                 "sScrollY": "780px",
                 "bScrollCollapse": true,
                 "bPaginate": false,
                 "bJQueryUI": true,
                 "dom": '<"top">rt<"bottom"flp><"clear">',
                 "columns": [
                     { "data": "rank", type: "allnumeric" },
                     { "data": "dist",  render: function ( data, type, row ) {return data.toFixed(3) }},
                     { "data": "word",  render: function ( data, type, row ) {urlprefix.set("word", data); return  '<a href="?' + urlprefix + '">' + data + '</a>' }}
                 ],
                 "columnDefs": [
                     { className: "dt-right", "targets": [0,1] },
                     { "searchable": false,
                       "orderable": false,
                       "targets": 0
                     },
                     { "orderSequence": [ "desc" ], "targets": [ 1 ] },
                     { "orderSequence": [ "asc", "desc" ], "targets": [ 2 ] },
                 ],
                 "oLanguage": {
                     "sSearch": "Filter: "
                 },
                 "order": [[ 1, 'desc' ]],
             } );

             t.on( 'order.dt search.dt', function () {
                 t.column(0, {order:'applied'}).nodes().each( function (cell, i) {
                     cell.innerHTML = i+1;
                 } );
             } ).draw();

             $( "#first" ).clone().prependTo( "#tabs-2" );

         }

         var collocatorData = <%= b(Mojo::JSON::to_json($collocators)) %>;
         var maxHeat; // = Math.max.apply(Math,collocatorData.map(function(o){return o.cprob;}))

         if (collocatorData != null) {
             maxHeat = Math.max.apply(Math,collocatorData.map(function(o){return Math.max.apply(Math,o.heat);}))
             var t = $('#secondtable').DataTable({
                 data: collocatorData,
                 "sScrollY": "780px",
                 "bScrollCollapse": true,
                 "bPaginate": false,
                 "bJQueryUI": true,
                 "dom": '<"top">rt<"bottom"flp><"clear">',
                 "columns": [
                     { "data": "rank", type: "allnumeric" },
                     { "data": "pos", width: "7%", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitvec2window(data, row.heat, row.word) }},
                     { "data": "max",  render: function ( data, type, row ) {return data.toFixed(3) }},
                     { "data": "conorm", render: function ( data, type, row ) {return data.toFixed(3) }},
                     { "data": "prob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) }  },
                     { "data": "cprob", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) }  },
                     { "data": "overall", type: "scientific", render: function ( data, type, row ) {return data.toExponential(3) } },
                     { "data": "word",  sClass: "collocator" }
                 ],
                 "columnDefs": [
                     { className: "dt-right", "targets": [0,2,3,4,5,6] },
                     { className: "dt-center", "targets": [ 1] },
                     { "searchable": false,
                       "orderable": false,
                       "targets": 0
                     },
                     { "type": "scientific", targets: [2,3,4,5,6] },
                     { "orderSequence": [ "desc" ], "targets": [ 2, 3, 4, 5, 6 ] },
                     { "orderSequence": [ "asc", "desc" ], "targets": [ 1, 7 ] },
                 ],
                 "oLanguage": {
                     "sSearch": "Filter: "
                 },
                 "order": [[ 4, 'desc' ]],
             } );

             t.on( 'order.dt search.dt', function () {
                 t.column(0, {order:'applied'}).nodes().each( function (cell, i) {
                     cell.innerHTML = i+1;
                 } );
             } ).draw();

             if (localStorage && !window.location.hash) { // let's not crash if some user has IE7
                 var index = parseInt(localStorage['tab']||'0');
                 $("#tabs").tabs({ active: index });
             }
         }
         $("#tabs").css("visibility", "visible"); // now we can show the tabs

     });

     $(function(){
         $("#dropdownoptions").dialog({
             title: "Options",
             autoOpen: false,
             modal: false,
             draggable: false,
             height: "auto",
             width: "auto",
             resizable: false,
             buttons: {
                 "Cancel": function() {
                     $( this ).dialog( "close" );
                 },
                 "Apply": function() {
                     window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
                 }
             }
         });
     });

     $(function(){
         $("td.collocator").click(function(){
             queryKorAPCII(this.textContent + " /w5 " + urlParams.get('word'));
         });
     });

     $(function(){
         $("#showoptions").click(function(){
             $("#dropdownoptions").dialog("open");
             var target = $(this);
             $("#dropdownoptions").dialog("widget").position({
                 my: 'left bottom',
                 at: 'left bottom',
                 of: target
             });
         });
     });

     $( function() {
         $( "#no_iterations" ).spinner({
             spin: function( event, ui ) {
                 if ( ui.value < 1000 ) {
                     $( this ).spinner( "value", 1000 );
                     return false;
                 } else if ( ui.value > 10000 ) {
                     $( this ).spinner( "value", 10000 );
                     return false;
                 }
             }
         });
     } );

     $( function() {
         $( "#neighbours" ).spinner({
             spin: function( event, ui ) {
                 if ( ui.value < 0 ) {
                     $( this ).spinner( "value", 0 );
                     return false;
                 } else if ( ui.value > 200 ) {
                     $( this ).spinner( "value", 200 );
                     return false;
                 }
             }
         });
     } );

     $( function() {
         $( "#cutoff" ).spinner({
             spin: function( event, ui ) {
                 if ( ui.value < 100000 ) {
                     $( this ).spinner( "value", 100000 );
                     return false;
                 } else if ( ui.value > 2000000 ) {
                     $( this ).spinner( "value", 2000000 );
                     return false;
                 }
             }
         });
     } );

     $( function() {
         $( "#tabs" ).tabs().addClass('tabs-min');
     } );

     $( function() {
         $( ".controlgroup-vertical" ).controlgroup({
             "direction": "vertical"
         });
     } );

     $(function() {
         $( document ).tooltip({
             content: function() {
                 return $(this).attr('title');
             }}
         )
     })

    </script>
    <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
    <script src="/derekovecs/js/tsne.js"></script>
    <script src="/derekovecs/js/som.js"></script>
    <script src="/derekovecs/js/labeler.js"></script>
    <style>
     body, input {
       font-family: Lato, sans-serif;
       font-size: 11pt;
     }

     h1,  h2, h3 {
       margin: 5px 10px 0 0;
       color: rgb(246,168,0);
       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;
       font-weight: bold;
       line-height: 1.35;
       letter-spacing: normal;
       text-transform: uppercase;
       text-shadow: none;
       word-wrap: break-word;
     }


     showoptions, #SEARCH {
       margin-left: 10px;
       margin-right: 10px;
     }

     .tabs-left-vertical .ui-tabs-nav {
       position: absolute;
       width: 21em;
       transform: translate(-100%,0%) rotate(-90deg);
       transform-origin: 100% 0%;
     }

     .tabs-left-vertical .ui-tabs-nav li {
       float: right;
     }

     .tabs-left-vertical .ui-tabs-panel {
       padding-left: 3.5em;
     }

     .tabs-left-vertical .ui-tabs-panel {
       height: 20em;
     }

     .mono {
       font-family: "DejaVu Sans Mono", Inconsolata, SourceCodePro, Courier;
     }

     .ui-tooltip-content {
       font-size: 9pt;
       color: #222222;
     }

     svg > .ui-tooltip-content {
       font-size: 8pt;
       color: #222222;
     }

     a.merged {
       color: green;
       fill: green;
     }

     #first a {
       text-decoration: none;
     }

     a.marked, #first a.marked {
       text-decoration: underline;
     }

     a.target {
       color: red;
       fill: red;
     }

     table.display {
       width: 40% important!;
       margin: 1;  /* <- works for me this way ****/
     }

     table.dataTable thead th, table.dataTable thead td, table.dataTable tbody td {
       padding: 2px 2px;
       //  border-bottom: 1px solid #111;
     }

     td.collocator {
       cursor: pointer;
     }

     #collocators {
       margin-bottom: 15px;
     }

     #header {
       width: 100%;
       //   border: 1px solid red;
       overflow: hidden; /* will contain if #first is longer than #second */
     }

     #topwrapper {
       width: 100%;
       //   border: 1px solid red;
       overflow: hidden; /* will contain if #first is longer than #second */
     }

     #wrapper {
       //   border: 1px solid red;
       overflow: hidden; /* will contain if #first is longer than #second */
     }

     #pagetitle {
       max-width: 460px;
       margin-right: 20px;
       float: left;
       overflow: hidden; /* if you don't want #second to wrap below #first */
       //    border: 1px solid green;
     }

     #options {
       float: left;
       width: 800px;
       margin: 10px;
       overflow: hidden; /* if you don't want #second to wrap below #first */
     }

     #word {
       width: 50%;
     }

     #first {
       margin-right: 20px;
       float: left;
       overflow: hidden; /* if you don't want #second to wrap below #first */
       //    border: 1px solid green;
     }
     #tabs {
       margin-right: 20px;
       overflow: hidden; /* if you don't want #second to wrap below #first */
     }

     .tabs-min {
       background: transparent;
       border: none;
     }

     .tabs-min .ui-widget-header {
       background: transparent;
       border: none;
       border-bottom: 1px solid #c0c0c0;
       -moz-border-radius: 0px;
       -webkit-border-radius: 0px;
       border-radius: 0px;
     }

     .tabs-min .ui-tabs-nav .ui-state-default {
       background: transparent;
       border: none;
     }

     .tabs-min .ui-tabs-nav .ui-state-active {
       background: transparent url(derekovecs/img/uiTabsArrow.png) no-repeat bottom center;
       border: none;
     }

     .tabs-min .ui-tabs-nav .ui-state-default a {
       color: #c0c0c0;
     }

     .tabs-min .ui-tabs-nav .ui-state-active a {
       color: rgb(246,168,0);
     }

     #embed {
       max-width: 802px;
       border: 1px solid #333;
     }

     #second {
       min-width: 800px;
       //       border: 1px solid #333;
       overflow: hidden; /* if you don't want #second to wrap below #first */
     }
     #som2 svg {
       border: 1px solid #333;
     }

     #cost {
       font-size: 8pt;
       color: #222222;
       margin-top: 4px;
       margin-bottom: 12px;
     }

     #sominfo1, #sominfo {
       font-size: 8pt;
       color: #222222;
       margin-top: 0px;
     }

     #somcolor1, #somcolor2, #somcolor3 {
       display: inline-block;
       height: 10px;
       width: 10px;
     }

     #third {
       border: 1px solid #333;
     }

    </style>
    <script>

     var opt = {epsilon: <%= $epsilon %>, perplexity: <%= $perplexity %>},
         mapWidth = 800, // width map
         mapHeight = 800,
         jitterRadius = 7;

     var T = new tsnejs.tSNE(opt); // create a tSNE instance

     var Y;

     var data;
     var labeler;

     function applyJitter() {
         svg.selectAll('.tsnet')
            .data(labels)
            .transition()
            .duration(50)
            .attr("transform", function(d, i) {
                T.Y[i][0] = (d.x - mapWidth/2 - tx)/ss/20;
                T.Y[i][1] = (d.y - mapHeight/2 - ty)/ss/20;
                return "translate(" +
                                 (d.x) + "," +
                                 (d.y) + ")";
            });
     }

     function updateEmbedding() {
         var Y = T.getSolution();
         svg.selectAll('.tsnet')
            .data(data.words)
            .attr("transform", function(d, i) {
                return "translate(" +
                                  ((Y[i][0]*20*ss + tx) + mapWidth/2) + "," +
                                  ((Y[i][1]*20*ss + ty) + mapHeight/2) + ")"; });
     }

     var svg;
     var labels = [];
     var anchor_array = [];
     var text;

     function drawEmbedding() {
         var urlprefix =  new URLSearchParams(window.location.search);
         urlprefix.delete("word");
         urlprefix.append("word","");

         $("#embed").empty();
         var div = d3.select("#embed");

         // get min and max in each column of Y
         var Y = T.Y;

         svg = div.append("svg") // svg is global
                  .attr("width", mapWidth)
                  .attr("height", mapHeight);

         var g = svg.selectAll(".b")
                    .data(data.words)
                    .enter().append("g")
                    .attr("class", "tsnet");

         g.append("a")
          .attr("xlink:href", function(word) {
              return "?"+urlprefix+word; })
          .attr("class", function(d, i) {
              var res="";
              if(data.marked[i]) {
                  res="marked ";
              }
              if(data.target.indexOf(" "+d+" ") >= 0) {
                  return res+"target";
              } else if(data.ranks[i] < data.mergedEnd) {
                  return res+"merged";
              } else {
                  return res;
              }
          })
          .attr("title", function(d, i) {
              if(data.mergedEnd > 0) {
                  if(data.ranks[i] >= data.mergedEnd) {
                      return "rank: "+i +"  "+"freq. rank: "+(data.ranks[i]).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                  } else {
                      return "rank: "+i +"  "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " (merged vocab)";
                  }
              } else {
                  return "rank: "+i +"  "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
              }
          })
          .append("text")
          .attr("text-anchor", "top")
          .attr("font-size", 12)
          .text(function(d) { return d; });

         var zoomListener = d3.behavior.zoom()
                              .scaleExtent([0.1, 10])
                              .center([0,0])
                              .on("zoom", zoomHandler);
         zoomListener(svg);
     }

     var tx=0, ty=0;
     var ss=1;
     var iter_id=-1;

     function zoomHandler() {
         tx = d3.event.translate[0];
         ty = d3.event.translate[1];
         ss = d3.event.scale;
         updateEmbedding();
     }

     var stepnum = 0;

     function stopStep() {
         clearInterval(iter_id);
         text = svg.selectAll("text");

         // jitter function needs different data and co-ordinate representation
         labels = d3.range(data.words.length).map(function(i) {
             var x = (T.Y[i][0]*20*ss + tx) + mapWidth/2;
             var y = (T.Y[i][1]*20*ss + ty) + mapHeight/2;
             anchor_array.push({x: x, y: y, r: jitterRadius});
             return {
                 x: x,
                 y: y,
                 name: data.words[i]
             };
         });

         // get the actual label bounding boxes for the jitter function
         var index = 0;
         text.each(function() {
             labels[index].width = this.getBBox().width;
             labels[index].height = this.getBBox().height;
             index += 1;
         });


         //  setTimeout(updateEmbedding, 1);
         //  setTimeout(
         labeler =   d3.labeler()
                       .label(labels)
                       .anchor(anchor_array)
                       .width(mapWidth)
                       .height(mapHeight)
                       .update(applyJitter);
         //         .start(1000);

         iter_id = setInterval(jitterStep, 1);
     }

     var jitter_i=0;

     function jitterStep() {
         if(jitter_i++ > 100) {
             clearInterval(iter_id);
         } else {
             labeler.start2(10);
             applyJitter();
         }
     }

     var last_cost=1000;

     function step() {
         var i = T.iter;

         if(i > <%= $no_iterations %>) {
             stopStep();
         } else {
             var cost = Math.round(T.step() * 100000) / 100000; // do a few steps
             $("#cost").html("tsne iteration " + i + ", cost: " + cost.toFixed(5));
             if(i % 250 == 0 && cost >= last_cost) {
                 stopStep();
             } else {
                 last_cost = cost;
                 updateEmbedding();
             }
         }
     }

     function showMap(j) {
         data=j;
         T.iter=0;
         T.initDataRaw(data.vecs); // init embedding
         drawEmbedding(); // draw initial embedding

         if(iter_id >= 0) {
             clearInterval(iter_id);
         }
         //T.debugGrad();
         iter_id = setInterval(step, 1);
         if(true) { // (<%= $show_som %>) {
             makeSOM(j, <%= $no_iterations %>);
         }
     }
     var queryword;

     function onload() {
         queryword = document.getElementById('word');
     }

     function queryKorAP() {
         window.open('http://korap.ids-mannheim.de/kalamar/?q='+queryword.value, 'KorAP');
     }

     function queryKorAPCII(query) {
         window.open('http://korap.ids-mannheim.de/kalamar/?ql=cosmas2&q='+query, 'KorAP');
     }
    </script>
  </head>
  <body onload="onload()">
    <div id="header">
      <div id="pagetitle">
        <h1>DeReKo-Vectors</h1>
      </div>
      <div id="options"  class="widget">
        <form id="queryform">
          <input id="word" type="text" name="word"  placeholder="Word(s) to be searched" value="<%= $word %>"
                 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."/>
          <input id="SEARCH" type="button" value="SEARCH">
          <input type="button" id="showoptions" name="showoptions" value="Options" />
        </form>
        <div id="dropdownoptions" style="display: none">
          <form id="optionsform">
            <div class="controlgroup-vertical">
              <label for="cutoff">cut-off</label>
              <input id="cutoff" type="text" name="cutoff" size="10"  value="<%= $cutoff %>" title="Only consider the most frequent x word forms.">
              <label for="dedupe">dedupe</label>
              <input id="dedupe" type="checkbox" name="dedupe" value="1" <%= ($dedupe ? "checked" : "") %> title="radically filter out any near-duplicates">
              % if($mergedEnd > 0) {
                <label for="sbf">backw.</label>
                <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.">
              % }
              <label for="neighbours">max. neighbours:</label>
              <input id="neighbours" size="4" name="n" value="<%= $no_nbs %>">
              <label for="no_iterations">max. iterations</label>
              <input id="no_iterations" name="N" size="4" value="<%= $no_iterations %>">
              <!-- <label for="dosom">SOM</label>
                   <input id="dosom" type="checkbox" name="som" value="1" <%= ($show_som ? "checked" : "") %>> -->
              % if($collocators) {
                <label for="sortby">window/sort</label>
                <select id="sortby" name="sort">
                  <option value="0"  <%= ($sort!=1 && $sort!=2? "selected":"") %>>auto focus</option>
                  <!-- <option value="1"  <%= ($sort==1? "selected":"") %>>any single position</option>
                       <option value="2" <%= ($sort==2? "selected":"") %>>whole window</option> -->
                </select>
              % }
              <input type="button" value="→ KorAP" onclick="queryKorAP();" title="query word with KorAP"/>
            </div>
          </form>
        </div>
      </div>
    </div>
    <div id="topwrapper">
      <div style="visibility: hidden;" id="tabs">
        <ul>
          <li><a href="#tabs-1">Semantics (TSNE-map)</a></li>
          <li><a href="#tabs-2">Semantics (SOM)</a></li>
          <li><a href="#tabs-3">Syntagmatic (collocators)</a></li>
        </ul>
        <div id="tabs-1">
          % if($lists && (@$lists) > 0 && (@$lists)[0]) {
            <div id="wrapper">
              <div id="first" style="width: 320px">
                <table class="display compact nowrap" id="firsttable">
                  <thead>
                    <tr>
                      <th align="right">#</th><th align="right">cos</th><th align="left">similars</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td align="right">
                      </td>
                      <td align="right">
                      </td>
                      <td></td>
                    </tr>
                  </tbody>
                </table>
              </div>
              <script>
              </script>
              <div id="second">
                <div id="embed">
                </div>
                <div id="cost">
                </div>
              </div>
            </div>
          % } elsif($word !~ /^\s*$/) {
          <div id="wrapper">
            <div id="not-found-dialog" title="Not found">
              <p>ERROR: "<%= $word %>" not found in vocabluary.</p>
              <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>
            </div>
            <script>
             $( function() {
                 $( "#not-found-dialog" ).dialog({
                     autoOpen: true,
                     modal: true,
                     draggable: false,
                     height: "auto",
                     width: "auto",
                     resizable: false,
                     buttons: {
                         "OK": function() {
                             $( this ).dialog( "close" );
                         },
                         "Apply": function() {
                             window.open($(location).attr('pathname')+'?'+$('form').serialize(), "_self");
                         }
                     }
                 });
             });
            </script>
          </div>
            % }
        </div>
        <div id="tabs-2">
          <div id="som2" style="width: 800; height: 800px">
          </div>
          <div id="sominfo1"><span id="somcolor1">   </span> <span id="somword1"> </span> <span id="somcolor2">   </span> <span id="somword2"> </span> <span id="somcolor3">   </span></div>
          <div id="sominfo">SOM iteration <span id="iterations">0</span></div>
        </div>
        <div id="tabs-3">
          <div style="width: 800px" id="secondt">
            <table class="display compact nowrap" id="secondtable">
              <thead>
                <tr>
                  % if($collocators) {
                    <th>#</th>
                    <th align="center" title="The columns (c) around the target are considered for summation are marked with *.">w'</th>
                    <th align="right" title="Raw (max.) activation of the collocator in the output layers.">max(a)</th>
                    <th title="Co-normalized raw activation sum of the collocator in the selected columns." align="right">⊥Σa</th>
                    <th title="Sum of activations over the selected colunns normalized by the total activation sum of the selected columns." align="right">Σa/Σc</th>
                    <th title="Sum of the column normalized activations over the selected colunns." align="right">Σ(a/c)</th>
                    <th title="Sum of the activations over the whole window normalized by the total window sum (no auto-focus)." align="right">Σa/Σw</th>
                    <th align="left">collocator</th>
                  % }
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td align="right">
                  </td>
                  <td align="right">
                  </td>
                  <td align="right">
                  </td>
                  <td align="right">
                  </td>
                  <td align="right">
                  </td>
                  <td align="right">
                  </td>
                  <script
                      src="http://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
                      </td>
                </tr>
              </tbody>
            </table>
          </div> <!-- - tab2 -->
        </div> <!-- tabs -->
      </div>
    </div> <!-- topwrapper  -->
    <div style="clear: both;"></div>
    </div>
    % if($training_args) {
      <p>
        Word vector model trained with <a href="https://code.google.com/p/word2vec/">word2vec</a> using the following parameters: <pre><%= $training_args %></pre>
      </p>
    % }
  </body>
</html>
