w2v-server.pl: allow multiple words
diff --git a/w2v-server.pl b/w2v-server.pl
index 4c95d9b..f69b667 100644
--- a/w2v-server.pl
+++ b/w2v-server.pl
@@ -12,13 +12,15 @@
   my $c    = shift;
 	my $word=$c->param('word');
 	my $no_nbs=$c->param('n') || 100;
-	my $list;
+	my @lists;
 	if(defined($word) && $word !~ /^\s*$/) {
 		$c->inactivity_timeout(300);
-		$c->app->log->debug('Looking for neighbours of '.$word);
-		$list = get_neighbours(encode("iso-8859-1", $word), $no_nbs);
+    for my $w (split('\s+', $word)) {
+			$c->app->log->debug('Looking for neighbours of '.$w);
+			push(@lists, get_neighbours(encode("iso-8859-1", $w), $no_nbs));
+		}
 	}
-  $c->render(template=>"index", word=>$word, no_nbs=>$no_nbs, list=> $list);
+  $c->render(template=>"index", word=>$word, no_nbs=>$no_nbs, lists=> \@lists);
 };
 
 app->start;
@@ -182,6 +184,9 @@
 	<script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
 	<script src="http://klinux10/word2vec/tsne.js"></script>
 <style>
+body {
+	font-family: Arial, sans-serif;
+}
 svg {
 //  border: 1px solid #333;
   margin-right: 10px;
@@ -252,7 +257,7 @@
     .attr("text-anchor", "top")
     .attr("font-size", 12)
     .attr("fill", function(d) {
-			if(d == data.target) {
+			if(data.target.indexOf(" "+d+" ") >= 0) {
 				return "red";
 			} else {
 				return "#333"
@@ -313,20 +318,23 @@
 </head>
 <body>
 	<form action="<%=url_for('/')->to_abs%>" method="GET">
-		Word: <input type="text" name="word" value="<%= $word %>"> 
-		Neighbours: <input type="text" name="n" value="<%= $no_nbs %>">
-		<input type="submit" value="Show neighbours">
+		word(s) (space-separated): <input type="text" name="word" value="<%= $word %>"> 
+		max. neighbours: <input type="text" name="n" value="<%= $no_nbs %>">
+		<input type="submit" value="Show">
 	</form>
 	<br>
-	% if($list) {
+	% if($lists) {
 	<div id="wrapper">
 		<table id="first">
 			<tr>
 				<th align="right">Pos.</th><th align="left">Word</th><th align="right">Cosine dist.</th>
 			</tr>
-			% my $i=1; my @words; my @vecs; for my $item (@$list) {
-			% push @vecs, $item->{vector};
-			% push @words, $item->{word};
+			% my $j=0; my @words; my @vecs; for my $list (@$lists) {
+			% my $i=1; for my $item (@$list) {
+			% if(!grep{$_ eq $item->{word}} @words) {
+      %   push @vecs, $item->{vector};
+			%   push @words, $item->{word};
+      % }
 			<tr>
 				<td align="right">
   				<%= $i++ %>.
@@ -341,11 +349,12 @@
 				</td>
 			</tr>
 			% }
+			% }
 		</table>
 		<script>
 		 % use Mojo::ByteStream 'b';
 		 $(window).load(function() {
-			 showMap(<%= b(Mojo::JSON::to_json({target => $word, words => \@words, vecs => \@vecs})); %>);
+			 showMap(<%= b(Mojo::JSON::to_json({target => " $word ", words => \@words, vecs => \@vecs})); %>);
 		 });
     </script>
 		% }