Marc Kupietz | 3e3e326 | 2022-04-12 23:11:45 +0200 | [diff] [blame^] | 1 | use strict; |
| 2 | use warnings; |
| 3 | use Test::More tests => 3; |
| 4 | use Mojo::JSON qw(decode_json encode_json to_json); |
| 5 | |
| 6 | use_ok('IDS::DeReKoVecs::Read'); |
| 7 | |
| 8 | IDS::DeReKoVecs::Read::init_net( |
| 9 | "example-models/wpd19_10000/wpd19_10000.vecs", |
| 10 | "example-models/wpd19_10000/wpd19_10000.net", |
| 11 | 0, 1 |
| 12 | ); |
| 13 | my $word = "Grund"; |
| 14 | my $dedupe = 0; |
| 15 | my $nosp = 0; |
| 16 | my $res; |
| 17 | my $cutoff = 50000; |
| 18 | |
| 19 | subtest '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 | |
| 25 | subtest '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 | |
| 31 | done_testing; |