derekovecs: more tootltip info on cohesion measures using MathJax
diff --git a/templates/index.html.ep b/templates/index.html.ep
index 15c75c9..fc47258 100644
--- a/templates/index.html.ep
+++ b/templates/index.html.ep
@@ -8,20 +8,54 @@
<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>
+ <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML'></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>
+ MathJax.Hub.Config({
+ config: ["MMLorHTML.js"],
+ jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML", "output/PreviewHTML"],
+ extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js", "fast-preview.js", "AssistiveMML.js", "a11y/accessibility-menu.js"],
+ TeX: {
+ extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
+ }
+ });
var urlParams = new URLSearchParams(window.location.search);
var currentWords = urlParams.get("word");
- var CIIsearchWords = (currentWords.includes(" ") ? '('+currentWords.replace(/ +/g, " oder ")+')' : currentWords);
+ var CIIsearchWords = (currentWords && currentWords.includes(" ") ? '('+currentWords.replace(/ +/g, " oder ")+')' : currentWords);
var collocatorTable = null;
- $('#firstable').hide();
$(document).ready(function() {
+ $('#firstable').hide();
+ //Set up a callback to hear back when MathJax is done rendering the equations
+ // it finds
+ $('#ccd').load(
+ '@Url.Action("ActionResultMethod","ControllerName",{controller parameters})',
+ function () {
+ MathJax.Hub.Queue(
+ ["Typeset",MathJax.Hub,"ccd"],
+ function () {
+ $("#lfmd_tt").attr("title",$("#lfmd_ttt").html());
+ $("#npmi_tt").attr("title",$("#npmi_ttt").html());
+ }
+ );
+ });
+
+ //set things up so that we can shove raw html into what is shown in the tooltip;
+ // in this case, we will have already put into the title attribute the html that
+ // contains the MathJax rendered equations (via what we do in the callback).
+ $(function () {
+ $(document).tooltip({
+ content: function () {
+ return $(this).prop('title');
+ }
+ });
+ });
+
$("input").bind("keydown", function(event) {
// track enter key
var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
@@ -327,6 +361,25 @@
)
})
+ $(function () {
+ $(document).tooltip({
+ content: function () {
+ return $(this).prop('title');
+ },
+ show: null,
+ close: function (event, ui) {
+ ui.tooltip.hover(
+ function () {
+ $(this).stop(true).fadeTo(400, 1);
+ },
+ function () {
+ $(this).fadeOut("400", function () {
+ $(this).remove();
+ })
+ });
+ }
+ });
+ });
</script>
<script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="/derekovecs/js/tsne.js"></script>
@@ -550,6 +603,15 @@
border: 1px solid #333;
}
+ th {
+ 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;
+ }
+
+ p.citation {
+ font-size: 8pt;
+ color: #999999;
+ }
</style>
<script>
@@ -784,6 +846,8 @@
</script>
</head>
<body onload="onload()">
+ <div style="display:none;" id="lfmd_ttt">Log-frequency biased mutual dependency: $$log_2\frac{p^3(w_1,w_2)}{p(w_1) p(w_2)}$$<p class="citation">Thanopoulos, A., Fakotakis, N., Kokkinakis, G. (2002): <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.11.8101&rep=rep1&type=pdf">Comparative evaluation of collocation extraction metrics</a>. In: Proc. of LREC 2002: 620–625.</p></div>
+ <div style="display:none;" id="npmi_ttt">Normalized pointwise mutual information: $$\frac{log_2\frac{p(w_1,w_2)}{p(w_1)p(w_2)}}{-log_2(p(w_1,w_2))}$$<p class="citation">Bouma, Gerlof (2009): <a href="https://svn.spraakdata.gu.se/repos/gerlof/pub/www/Docs/npmi-pfd.pdf">Normalized (pointwise) mutual information in collocation extraction</a>. In Proceedings of GSCL.</p></div>
<div id="header">
<div id="pagetitle">
<h1>DeReKo-Vectors</h1>
@@ -933,18 +997,19 @@
</tbody>
</table>
</div>
- <div style="margin-left:20px; float:right; width: 650px">
+ <div id="ccd" style="margin-left:0px; float:right; width:800px;">
<table class="display compact nowrap" id="classicoloctable">
<thead>
<tr>
- <th>llr</th>
- <th title="log-frequency biased mutual dependency">lfmd</th>
+ <th>LLR</th>
+ <th id="lfmd_tt">LFMD</th>
<!-- <th title="frequency biased pointwise mutual information">fpmi</th>-->
- <th title="normalized pointwise mutual information">npmi</th>
- <th title="log-frequency biased mutual dependency - left neighbour only">l-lfmd</th>
- <th title="log-frequency biased mutual dependency - right neighbour only">r-lfmd</th>
- <th title="normalized pointwise mutual information - left neighbour only">l-npmi</th>
- <th title="normalized pointwise mutual information - right neighbour only">r-npmi</th>
+ <th id="npmi_tt">nPMI</th>
+ <th title="log-frequency biased mutual dependency - left neighbour only">l-LFMD</th>
+ <th title="log-frequency biased mutual dependency - right neighbour only">r-LFMD</th>
+ <th title="normalized pointwise mutual information - left neighbour only">l-nPMI</th>
+ <th title="normalized pointwise mutual information - right neighbour only">r-nPMI</th>
+ <th title="raw max frequency of collocation within window">raw</th>
<th>collocator</th>
</tr>
</thead>