Add getModelName
Change-Id: I07a7e1db71eb522237721700c444d6873c81f5c0
diff --git a/README.md b/README.md
index d5b66ec..fc61424 100644
--- a/README.md
+++ b/README.md
@@ -57,6 +57,7 @@
| getCollocationAssociation | w, c | get association scores for specific node collocate pairs |
| getSimilarity | w1, w2 | get cosine similarity of w1 and w2 |
| getVersion | | get version of derekovecs |
+| getModelName | | get name of model (inferred from the file name) |
### Get classical (count-based) collocates
@@ -141,7 +142,7 @@
**Author**: [Marc Kupietz](https://www.ids-mannheim.de/digspra/personal/kupietz.html)
-Copyright (c) 2016-2022, [Leibniz Institute for the German Language](http://www.ids-mannheim.de/), Mannheim, Germany
+Copyright (c) 2016-2023, [Leibniz Institute for the German Language](http://www.ids-mannheim.de/), Mannheim, Germany
DeReKoVecs is published under the [Apache 2.0 License](LICENSE).
diff --git a/script/derekovecs-server b/script/derekovecs-server
index 21d7d81..1e67011 100755
--- a/script/derekovecs-server
+++ b/script/derekovecs-server
@@ -290,6 +290,16 @@
$self->render(data => $VERSION, format=>'text');
};
+any '/getModelName' => sub {
+ my $self = shift;
+ $self->render(data => $title, format=>'text');
+};
+
+any '*/getModelName' => sub {
+ my $self = shift;
+ $self->render(data => $title, format=>'text');
+};
+
get '*/img/*' => sub {
my $c = shift;
my $url = $c->req->url;
diff --git a/t/server-test.t b/t/server-test.t
index 3146511..851c1a8 100644
--- a/t/server-test.t
+++ b/t/server-test.t
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests=>6;
+use Test::More tests=>7;
use Mojo::JSON qw(decode_json encode_json to_json);
use REST::Client;
use Data::Dump qw(dump);
@@ -39,6 +39,10 @@
$res = $client->responseContent();
like($res, qr/\d+\.?\d*\.?\d*/, "version ok");
+$client->GET('http://localhost:3000/getModelName');
+$res = $client->responseContent();
+is($res, "wpd19_10000", "model name ok");
+
for (my $i=0; $i<4; $i++) {
$pid++;
print STDERR "killing PID $pid\n";