blob: 5ecf73d01a95151ef4578e80d685c1f84ee36dfd [file] [log] [blame]
Akron5f511d22016-01-05 20:54:34 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
5use Test::More;
Akrondcbee642020-10-30 18:01:43 +01006use KorAP::XML::Annotation::XIP::Constituency;
Akron5f511d22016-01-05 20:54:34 +01007use Scalar::Util qw/weaken/;
8use Data::Dumper;
Akron151676d2016-03-14 20:12:14 +01009use lib 't/annotation';
Akron11ef51d2016-01-18 19:07:56 +010010use TestInit;
Akron5f511d22016-01-05 20:54:34 +010011
Akron11ef51d2016-01-18 19:07:56 +010012ok(my $tokens = TestInit::tokens('0001'), 'Parse tokens');
Akron5f511d22016-01-05 20:54:34 +010013
14ok($tokens->add('XIP', 'Constituency'), 'Add Structure');
15
16my $data = $tokens->to_data->{data};
17like($data->{foundries}, qr!xip/constituency!, 'data');
18like($data->{layerInfos}, qr!xip/c=spans!, 'data');
19
20# The length includes the punct - but that doesn't matter
21is($data->{stream}->[0]->[1], '<>:xip/c:PREP$<b>64<i>0<i>3<i>1<b>3', 'Prep phrase');
Akron2d83a5a2016-02-26 00:21:16 +010022is($data->{stream}->[0]->[2], '<>:xip/c:PP$<b>64<i>0<i>30<i>4<b>2', 'pp phrase');
Akrondec43122020-03-03 11:22:25 +010023is($data->{stream}->[0]->[4], '<>:xip/c:TOP$<b>64<i>0<i>129<i>18<b>0', 'top phrase');
24is($data->{stream}->[0]->[5], '<>:xip/c:MC$<b>64<i>0<i>129<i>18<b>1', 'mc phrase');
Akron5f511d22016-01-05 20:54:34 +010025is($data->{stream}->[-1]->[0], '<>:xip/c:VERB$<b>64<i>124<i>128<i>18<b>4', 'Noun phrase');
26
Akron2d83a5a2016-02-26 00:21:16 +010027
Akron5f511d22016-01-05 20:54:34 +010028done_testing;
29
30__END__
31
32
33
34