w2v-server: start with hypnotoad ./w2v_server.pl
diff --git a/w2v-server.pl b/w2v-server.pl
index 04998a9..7d2bbdb 100755
--- a/w2v-server.pl
+++ b/w2v-server.pl
@@ -8,7 +8,7 @@
use Encode qw(decode encode);
use Getopt::Std;
-use Mojo::Server::Daemon;
+#use Mojo::Server::Daemon;
use Cwd;
my $DEFAULT_VECS="/vol/work/kupietz/Work2/kl/trunk/Analysemethoden/word2vec/models/dereko-2020-ii-ALPHA.vecs";
@@ -41,10 +41,11 @@
our $opt_p = 5676;
our $opt_m;
our $opt_M;
-our $opt_n = '';
+our $opt_n = $DEFAULT_NET;
our $opt_d;
our $opt_D;
-our $opt_G;
+our $opt_G = 1;
+our $opt_C;
my %marked;
my $title="";
@@ -67,19 +68,15 @@
close($handle);
}
-# -cbow 1 -size 200 -window 8 -negative 25 -hs 0 -sample 1e-4 -threads 40 -binary 1 -iter 15
-if(!$ARGV[0]) {
- init_net("vectors15.bin", $opt_n, ($opt_i? 1 : 0), 0);
-} else {
- init_net($ARGV[0], $opt_n, ($opt_i? 1 : 0), 1);
- if(open(FILE, "$ARGV[0].args")) {
- $training_args = <FILE>;
- }
- close(FILE);
- $title = fname2corpusname($ARGV[0]);
+my $vecs_name = (@ARGV > 0 && -r $ARGV[0] ? $ARGV[0] : $DEFAULT_VECS);
+init_net($vecs_name, $opt_n, ($opt_i? 1 : 0), 1);
+if(open(FILE, "$vecs_name.args")) {
+ $training_args = <FILE>;
}
+close(FILE);
+$title = fname2corpusname($vecs_name);
-my $have_sprofiles = load_sprofiles($ARGV[0]);
+my $have_sprofiles = load_sprofiles($vecs_name);
if($opt_m) {
$mergedEnd = mergeVectors($opt_m);
@@ -97,10 +94,10 @@
exit;
}
-my $daemon = Mojo::Server::Daemon->new(
- app => app,
- listen => ['http://'.($opt_l ? $opt_l : '*').":$opt_p"]
-);
+#my $daemon = Mojo::Server::Daemon->new(
+# app => app,
+# listen => ['http://'.($opt_l ? $opt_l : '*').":$opt_p"]
+#);
if($opt_G) {
print "Filtering garbage\n";
@@ -409,7 +406,8 @@
}
);
-$daemon->run;
+app->start;
+#$daemon->run;
# app->start;
# exit;