w2v-server: don't crash on unknown words
diff --git a/w2v-server.pl b/w2v-server.pl
index 1ea1e48..a44df71 100755
--- a/w2v-server.pl
+++ b/w2v-server.pl
@@ -58,7 +58,7 @@
}
}
$word =~ s/ *\| */ | /g;
- $c->render(template=>"index", word=>$word, no_nbs=>$no_nbs, no_iterations => $no_iterations, epsilon=> $epsilon, perplexity=> $perplexity, show_som=>$som, sort=>$sort, training_args=>$training_args, lists=> \@lists, collocators=> $res->{syntagmatic});
+ $c->render(template=>"index", word=>$word, no_nbs=>$no_nbs, no_iterations => $no_iterations, epsilon=> $epsilon, perplexity=> $perplexity, show_som=>$som, sort=>$sort, training_args=>$training_args, lists=> \@lists, collocators=> $res->{syntagmatic});
};
$daemon->run; # app->start;
@@ -882,7 +882,7 @@
<th align="right">#</th><th align="right">cos</th><th align="left">paradigmatic</th><th title="Position in winodw around target word. Absolute value can be too low because of sub-sampling frequent words.">@</th><th align="right" title=""Responsivenes" of the collocator at the relative position @. Approximation of the probability that the combination of the target word and the collocator at the relative position @ come from the corpus.">resp.</th><th title="Probability of the collocator at window location @."align="right">p(c<sub><small>@</small></sub>)</th><th align="right">Σp(c<sub><small>@</small></sub>)/|w|</th><th align="left">syntagmatic</th>
</tr>
% my $j=0; my @words; my @vecs; my @ranks; for my $list (@$lists) {
- % my $i=0; while(1) {
+ % my $i=0; while($list) {
% my $item = (@$list)[$i];
% my $c = (@$collocators)[$i];
% last if(!$c && !$item);