blob: f58204f74e87601a9d1bb4d55f3f6038f63863e4 [file] [log] [blame]
Akron194be542016-01-21 12:52:43 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
Akronf3f0c942016-06-27 13:27:14 +02005use Log::Log4perl;
6
7Log::Log4perl->init({
Akrona5920b12016-06-29 18:51:21 +02008 'log4perl.rootLogger' => 'ERROR, STDERR',
Akronf3f0c942016-06-27 13:27:14 +02009 'log4perl.appender.STDERR' => 'Log::Log4perl::Appender::ScreenColoredLevels',
10 'log4perl.appender.STDERR.layout' => 'PatternLayout',
11 'log4perl.appender.STDERR.layout.ConversionPattern' => '[%r] %F %L %c - %m%n'
12});
13
14use Test::More;
Akron194be542016-01-21 12:52:43 +010015use Scalar::Util qw/weaken/;
16use Data::Dumper;
Akron151676d2016-03-14 20:12:14 +010017use lib 't/annotation';
Akron194be542016-01-21 12:52:43 +010018use TestInit;
19
Akron194be542016-01-21 12:52:43 +010020
Akronf3f0c942016-06-27 13:27:14 +020021
22use_ok('KorAP::XML::Annotation::Malt::Dependency');
23
24ok(my $tokens = TestInit::tokens('0002', 'Tree_Tagger'), 'Parse tokens');
25
26ok($tokens->add('Malt', 'Dependency'), 'Add Dependency');
Akron194be542016-01-21 12:52:43 +010027
28my $data = $tokens->to_data->{data};
29
Akronf3f0c942016-06-27 13:27:14 +020030is($data->{tokenSource}, 'tree_tagger#tokens', 'TokenSource');
31like($data->{foundries}, qr!malt/dependency!, 'foundries');
32like($data->{layerInfos}, qr!malt/d=rels!, 'foundries');
33
34my $stream = $data->{stream};
35
36is($stream->[0]->[0], '-:tokens$<i>31', 'Number of paragraphs');
37
38# Term2Term relation
39is($stream->[0]->[1], '<:malt/d:KON$<b>32<i>1', 'Term2Term relation');
Akrond19e2752017-11-16 15:48:26 +010040is($stream->[0]->[-1], 's:Maximen', 'Surface');
41
Akronf3f0c942016-06-27 13:27:14 +020042is($stream->[1]->[0], '>:malt/d:KON$<b>32<i>0', 'Term2Term relation');
Akrond19e2752017-11-16 15:48:26 +010043is($stream->[1]->[-1], 's:und', 'Surface');
Akronf3f0c942016-06-27 13:27:14 +020044
45is($stream->[0]->[2], '<:malt/d:KON$<b>32<i>3', 'Term2Term relation');
46is($stream->[3]->[0], '>:malt/d:KON$<b>32<i>0', 'Term2Term relation');
Akrond19e2752017-11-16 15:48:26 +010047is($stream->[3]->[-1], 's:Religion', 'Term2Term relation');
Akronf3f0c942016-06-27 13:27:14 +020048
49# Term2Element and Element2Term relation
50is($stream->[0]->[3], '<:malt/d:ROOT$<b>34<i>0<i>49<i>6<i>0', 'Term2Term relation');
51is($stream->[0]->[5], '>:malt/d:ROOT$<b>33<i>0<i>49<i>0<i>6', 'Term2Term relation');
52
53# Text element
54is($stream->[0]->[4], '<>:base/s:t$<b>64<i>0<i>238<i>30<b>0', 'Text element');
Akron14ca9f02016-01-29 19:38:18 +010055
Akron194be542016-01-21 12:52:43 +010056done_testing;
57__END__