blob: f45afb388d0acd4ed1b190b8e7037dce358c7c4c [file] [log] [blame]
Marc Kupietz3e3e3262022-04-12 23:11:45 +02001use strict;
2use warnings;
3use Test::More tests => 3;
4use Mojo::JSON qw(decode_json encode_json to_json);
5
6use_ok('IDS::DeReKoVecs::Read');
7
8IDS::DeReKoVecs::Read::init_net(
9 "example-models/wpd19_10000/wpd19_10000.vecs",
10 "example-models/wpd19_10000/wpd19_10000.net",
11 0, 1
12);
13my $word = "Grund";
14my $dedupe = 0;
15my $nosp = 0;
16my $res;
17my $cutoff = 50000;
18
19subtest 'predictive neighbours' => sub {
20 $res = get_neighbours( $word, 100, 0, 0, $cutoff, $dedupe, $nosp );
21 is( $res->{paradigmatic}->[1]->{word}, "Reaktion", "primary paradigmatic neighbour of Grund" );
22 is( $res->{syntagmatic}->[0]->{word}, "Hitchcock", "primary syntagmatic neighbour of Grund" );
23};
24
25subtest 'count based collocates' => sub {
26 $res = IDS::DeReKoVecs::Read::getClassicCollocators( getWordNumber($word) );
27 $res = decode_json($res);
28 is( $res->{collocates}->[0]->{word}, "diesem", "primary collocate of Grund" );
29};
30
31done_testing;