derekovecs: default to min_analyzed(lD)-0.1 if reference collocate is not analyzed
diff --git a/templates/index.html.ep b/templates/index.html.ep
index dda695d..b9dae8a 100644
--- a/templates/index.html.ep
+++ b/templates/index.html.ep
@@ -961,7 +961,7 @@
<th id="dice_tt">dice</th>
<th id="logdice_tt">LD</th>
<th id="logdiceaf_tt">LDaf</th>
- <th id="delta_tt" title="Delta to log-Dice score in reference corpus.">Δ</th>
+ <th id="delta_tt" title="Delta to log-Dice score in reference corpus. ⚠: If the collocate is not within the top 200 of the reference corpus, a reference value of min(lD)-0.1 is assumed.">Δ</th>
<th id="af_win" title="Positions around the target word that are selected by the auto-focus function are marked with ◾. Positions at which the collocate appears at least once are marked with ◽.">af-window</th>
<th title="PMI³ restricted to left neighbour">l-PMI³</th>
<th title="PMI³ restricted to right neighbour">r-PMI³</th>
diff --git a/w2v-server.pl b/w2v-server.pl
index 8bf0f14..2f402ec 100755
--- a/w2v-server.pl
+++ b/w2v-server.pl
@@ -140,12 +140,14 @@
my $d1 = decode_json($cccache{$word});
my $d2 = decode_json($s2);
my %d2ld;
+ my $minLd = 14;
foreach my $i (@{$d2->{collocates}}) {
$d2ld{$i->{word}}=$i->{ld};
+ $minLd=$i->{ld} if($i->{ld} < $minLd);
}
foreach my $i (@{$d1->{collocates}}) {
my $w = $i->{word};
- $i->{delta} = $i->{ld} - (defined $d2ld{$w} ? $d2ld{$w} : 0);
+ $i->{delta} = $i->{ld} - (defined $d2ld{$w} ? $d2ld{$w} : $minLd-0.1);
}
return(encode_json($d1));
} else {