derekovecs/collocatordb: add auto-focus to collocation analysis
Use the sub-window that yields the highest score – currently only for log-dice.
diff --git a/templates/index.html.ep b/templates/index.html.ep
index 17c20b0..03944b7 100644
--- a/templates/index.html.ep
+++ b/templates/index.html.ep
@@ -47,6 +47,7 @@
$("#npmi_tt").attr("title",$("#npmi_ttt").html());
$("#ll_tt").attr("title",$("#ll_ttt").html());
$("#logdice_tt").attr("title",$("#logdice_ttt").html());
+ $("#logdiceaf_tt").attr("title",$("#logdiceaf_ttt").html());
}
);
});
@@ -106,6 +107,14 @@
return ["hsl(",hue,",90%,70%)"].join("");
}
+ function bitmask2window(n) {
+ var str = n.toString(2).padStart(10, "0")
+ .replace(/^([0-9]{5})/, '$1 ')
+ .replace(/0/g, '·')
+ .replace(/1/g, '+');
+ return str;
+ }
+
function bitvec2window(n, heat, word) {
var str = n.toString(2).padStart(10, "0")
.replace(/^([0-9]{5})/, '$1x')
@@ -277,7 +286,7 @@
queryKorAPCII(this.textContent + " /w5 " + CIIsearchWords);
});
classicCollocatorTable.columns(".detail").visible(false);
- $("#ccd").css('width', '520px');
+ $("#ccd").css('width', '680px');
classicCollocatorTable.columns.adjust().draw();
},
"sScrollY": "780px",
@@ -295,6 +304,8 @@
{ "data": "npmi", render: function ( data, type, row ) {return data.toFixed(3) }},
{ "data": "dice", render: function ( data, type, row ) {return data.toExponential(2) }},
{ "data": "ld", render: function ( data, type, row ) {return data.toFixed(2) }},
+ { "data": "af", render: function ( data, type, row ) {return data.toFixed(2) }},
+ { "data": "win", width: "auto", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitmask2window(data) }},
{ "data": "llfmd", render: function ( data, type, row ) {return data.toFixed(1) }},
{ "data": "rlfmd", render: function ( data, type, row ) {return data.toFixed(1) }},
{ "data": "lnpmi", render: function ( data, type, row ) {return data.toFixed(2) }},
@@ -303,19 +314,19 @@
{ "data": "word", sClass: "collocator" }
],
"columnDefs": [
- { className: "dt-right", "targets": [0,1,2,3,4,5,6,7,8,9,10,11] },
- { className: "dt-right detail", "targets": [5,7,8,9,10] },
+ { className: "dt-right", "targets": [0,1,2,3,4,5,6,7,9,10,11,12,13] },
+ { className: "dt-right detail", "targets": [5,9,10,11,12] },
{ "searchable": false,
"orderable": false,
"targets": []
},
- { "orderSequence": [ "desc" ], "targets": [0,1,2,3,4,5,6,7,8,9,10,11] },
- { "orderSequence": [ "asc", "desc" ], "targets": [12] },
+ { "orderSequence": [ "desc" ], "targets": [0,1,2,3,4,5,6,7,9,10,11,12,13] },
+ { "orderSequence": [ "asc", "desc" ], "targets": [8,14] },
],
"oLanguage": {
"sSearch": "Filter: "
},
- "order": [[ 6, 'desc' ]],
+ "order": [[ 7, 'desc' ]],
});
@@ -905,7 +916,9 @@
<th id="lfmd_tt">MI³</th>
<th id="npmi_tt">nPMI</th>
<th id="dice_tt">dice</th>
- <th id="logdice_tt">ld</th>
+ <th id="logdice_tt">LD</th>
+ <th id="logdiceaf_tt">LDaf</th>
+ <th id="af_win">af-window</th>
<th title="PMI³ restricted to left neighbour">l-PMI³</th>
<th title="PMI³ restricted to right neighbour">r-PMI³</th>
<th title="nPMI restricted to left neighbour">l-nPMI</th>
@@ -930,6 +943,10 @@
<td align="right">
</td>
<td align="right"></td>
+ <td align="left"></td>
+ <td align="right"></td>
+ <td align="right"></td>
+ <td align="right"></td>
<td align="right"></td>
<td align="left"></td>
</tr>