blob: 44a4a114b1c4af035f92d67d96d0f2a3e90a6b45 [file] [log] [blame]
Akron194be542016-01-21 12:52:43 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
Akrondcbee642020-10-30 18:01:43 +01004use KorAP::XML::Annotation::Malt::Dependency;
Akron194be542016-01-21 12:52:43 +01005use utf8;
Akronf3f0c942016-06-27 13:27:14 +02006use Test::More;
Akron194be542016-01-21 12:52:43 +01007use Scalar::Util qw/weaken/;
8use Data::Dumper;
Akron151676d2016-03-14 20:12:14 +01009use lib 't/annotation';
Akron194be542016-01-21 12:52:43 +010010use TestInit;
11
Akron194be542016-01-21 12:52:43 +010012
Akronf3f0c942016-06-27 13:27:14 +020013
14use_ok('KorAP::XML::Annotation::Malt::Dependency');
15
16ok(my $tokens = TestInit::tokens('0002', 'Tree_Tagger'), 'Parse tokens');
17
18ok($tokens->add('Malt', 'Dependency'), 'Add Dependency');
Akron194be542016-01-21 12:52:43 +010019
20my $data = $tokens->to_data->{data};
21
Akronf3f0c942016-06-27 13:27:14 +020022is($data->{tokenSource}, 'tree_tagger#tokens', 'TokenSource');
23like($data->{foundries}, qr!malt/dependency!, 'foundries');
24like($data->{layerInfos}, qr!malt/d=rels!, 'foundries');
25
26my $stream = $data->{stream};
27
28is($stream->[0]->[0], '-:tokens$<i>31', 'Number of paragraphs');
29
30# Term2Term relation
31is($stream->[0]->[1], '<:malt/d:KON$<b>32<i>1', 'Term2Term relation');
Akrond19e2752017-11-16 15:48:26 +010032is($stream->[0]->[-1], 's:Maximen', 'Surface');
33
Akronf3f0c942016-06-27 13:27:14 +020034is($stream->[1]->[0], '>:malt/d:KON$<b>32<i>0', 'Term2Term relation');
Akrond19e2752017-11-16 15:48:26 +010035is($stream->[1]->[-1], 's:und', 'Surface');
Akronf3f0c942016-06-27 13:27:14 +020036
37is($stream->[0]->[2], '<:malt/d:KON$<b>32<i>3', 'Term2Term relation');
38is($stream->[3]->[0], '>:malt/d:KON$<b>32<i>0', 'Term2Term relation');
Akrond19e2752017-11-16 15:48:26 +010039is($stream->[3]->[-1], 's:Religion', 'Term2Term relation');
Akronf3f0c942016-06-27 13:27:14 +020040
41# Term2Element and Element2Term relation
42is($stream->[0]->[3], '<:malt/d:ROOT$<b>34<i>0<i>49<i>6<i>0', 'Term2Term relation');
43is($stream->[0]->[5], '>:malt/d:ROOT$<b>33<i>0<i>49<i>0<i>6', 'Term2Term relation');
44
45# Text element
Akrondec43122020-03-03 11:22:25 +010046is($stream->[0]->[4], '<>:base/s:t$<b>64<i>0<i>238<i>31<b>0', 'Text element');
Akron14ca9f02016-01-29 19:38:18 +010047
Akron194be542016-01-21 12:52:43 +010048done_testing;
49__END__