Akron | 194be54 | 2016-01-21 12:52:43 +0100 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
Akron | dcbee64 | 2020-10-30 18:01:43 +0100 | [diff] [blame] | 4 | use KorAP::XML::Annotation::Malt::Dependency; |
Akron | 194be54 | 2016-01-21 12:52:43 +0100 | [diff] [blame] | 5 | use utf8; |
Akron | f3f0c94 | 2016-06-27 13:27:14 +0200 | [diff] [blame] | 6 | use Test::More; |
Akron | 194be54 | 2016-01-21 12:52:43 +0100 | [diff] [blame] | 7 | use Scalar::Util qw/weaken/; |
| 8 | use Data::Dumper; |
Akron | 151676d | 2016-03-14 20:12:14 +0100 | [diff] [blame] | 9 | use lib 't/annotation'; |
Akron | 194be54 | 2016-01-21 12:52:43 +0100 | [diff] [blame] | 10 | use TestInit; |
| 11 | |
Akron | 194be54 | 2016-01-21 12:52:43 +0100 | [diff] [blame] | 12 | |
Akron | f3f0c94 | 2016-06-27 13:27:14 +0200 | [diff] [blame] | 13 | |
| 14 | use_ok('KorAP::XML::Annotation::Malt::Dependency'); |
| 15 | |
| 16 | ok(my $tokens = TestInit::tokens('0002', 'Tree_Tagger'), 'Parse tokens'); |
| 17 | |
| 18 | ok($tokens->add('Malt', 'Dependency'), 'Add Dependency'); |
Akron | 194be54 | 2016-01-21 12:52:43 +0100 | [diff] [blame] | 19 | |
| 20 | my $data = $tokens->to_data->{data}; |
| 21 | |
Akron | f3f0c94 | 2016-06-27 13:27:14 +0200 | [diff] [blame] | 22 | is($data->{tokenSource}, 'tree_tagger#tokens', 'TokenSource'); |
| 23 | like($data->{foundries}, qr!malt/dependency!, 'foundries'); |
| 24 | like($data->{layerInfos}, qr!malt/d=rels!, 'foundries'); |
| 25 | |
| 26 | my $stream = $data->{stream}; |
| 27 | |
| 28 | is($stream->[0]->[0], '-:tokens$<i>31', 'Number of paragraphs'); |
| 29 | |
| 30 | # Term2Term relation |
| 31 | is($stream->[0]->[1], '<:malt/d:KON$<b>32<i>1', 'Term2Term relation'); |
Akron | d19e275 | 2017-11-16 15:48:26 +0100 | [diff] [blame] | 32 | is($stream->[0]->[-1], 's:Maximen', 'Surface'); |
| 33 | |
Akron | f3f0c94 | 2016-06-27 13:27:14 +0200 | [diff] [blame] | 34 | is($stream->[1]->[0], '>:malt/d:KON$<b>32<i>0', 'Term2Term relation'); |
Akron | d19e275 | 2017-11-16 15:48:26 +0100 | [diff] [blame] | 35 | is($stream->[1]->[-1], 's:und', 'Surface'); |
Akron | f3f0c94 | 2016-06-27 13:27:14 +0200 | [diff] [blame] | 36 | |
| 37 | is($stream->[0]->[2], '<:malt/d:KON$<b>32<i>3', 'Term2Term relation'); |
| 38 | is($stream->[3]->[0], '>:malt/d:KON$<b>32<i>0', 'Term2Term relation'); |
Akron | d19e275 | 2017-11-16 15:48:26 +0100 | [diff] [blame] | 39 | is($stream->[3]->[-1], 's:Religion', 'Term2Term relation'); |
Akron | f3f0c94 | 2016-06-27 13:27:14 +0200 | [diff] [blame] | 40 | |
| 41 | # Term2Element and Element2Term relation |
| 42 | is($stream->[0]->[3], '<:malt/d:ROOT$<b>34<i>0<i>49<i>6<i>0', 'Term2Term relation'); |
| 43 | is($stream->[0]->[5], '>:malt/d:ROOT$<b>33<i>0<i>49<i>0<i>6', 'Term2Term relation'); |
| 44 | |
| 45 | # Text element |
Akron | dec4312 | 2020-03-03 11:22:25 +0100 | [diff] [blame] | 46 | is($stream->[0]->[4], '<>:base/s:t$<b>64<i>0<i>238<i>31<b>0', 'Text element'); |
Akron | 14ca9f0 | 2016-01-29 19:38:18 +0100 | [diff] [blame] | 47 | |
Akron | 194be54 | 2016-01-21 12:52:43 +0100 | [diff] [blame] | 48 | done_testing; |
| 49 | __END__ |