<!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);

     $('#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) {
             var newText = "";
             for (var i=0, l=txt.length; i<l; i++) {
                 newText += (i == 5 ? txt.charAt(i) : '<span style="background-color:'+getHeatColor(heat[i]/maxHeat)+'">'+txt.charAt(i)+'</span>');
             }
             return newText;
         }

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

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

         % use Mojo::ByteStream 'b';
         % my $urlprefix = url_with->query([word=>'']);
         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, urlprefix: "?"+urlprefix} );
             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) }},
                     { "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) { // 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;
     }

     #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);
         $("#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) {
              urlprefix.set("word", word); return "?"+urlprefix; })
          .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>
