blob: 444df9ab08abc2932a83845599d8744c32d44743 [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');
40is($stream->[1]->[0], '>:malt/d:KON$<b>32<i>0', 'Term2Term relation');
41
42is($stream->[0]->[2], '<:malt/d:KON$<b>32<i>3', 'Term2Term relation');
43is($stream->[3]->[0], '>:malt/d:KON$<b>32<i>0', 'Term2Term relation');
44
45# Term2Element and Element2Term relation
46is($stream->[0]->[3], '<:malt/d:ROOT$<b>34<i>0<i>49<i>6<i>0', 'Term2Term relation');
47is($stream->[0]->[5], '>:malt/d:ROOT$<b>33<i>0<i>49<i>0<i>6', 'Term2Term relation');
48
49# Text element
50is($stream->[0]->[4], '<>:base/s:t$<b>64<i>0<i>238<i>30<b>0', 'Text element');
Akron14ca9f02016-01-29 19:38:18 +010051
Akron194be542016-01-21 12:52:43 +010052done_testing;
53__END__