Akron | 5f511d2 | 2016-01-05 20:54:34 +0100 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | use utf8; |
| 5 | use Test::More; |
Akron | dcbee64 | 2020-10-30 18:01:43 +0100 | [diff] [blame] | 6 | use KorAP::XML::Annotation::XIP::Constituency; |
Akron | 5f511d2 | 2016-01-05 20:54:34 +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 | 11ef51d | 2016-01-18 19:07:56 +0100 | [diff] [blame] | 10 | use TestInit; |
Akron | 5f511d2 | 2016-01-05 20:54:34 +0100 | [diff] [blame] | 11 | |
Akron | 11ef51d | 2016-01-18 19:07:56 +0100 | [diff] [blame] | 12 | ok(my $tokens = TestInit::tokens('0001'), 'Parse tokens'); |
Akron | 5f511d2 | 2016-01-05 20:54:34 +0100 | [diff] [blame] | 13 | |
| 14 | ok($tokens->add('XIP', 'Constituency'), 'Add Structure'); |
| 15 | |
| 16 | my $data = $tokens->to_data->{data}; |
| 17 | like($data->{foundries}, qr!xip/constituency!, 'data'); |
| 18 | like($data->{layerInfos}, qr!xip/c=spans!, 'data'); |
| 19 | |
| 20 | # The length includes the punct - but that doesn't matter |
| 21 | is($data->{stream}->[0]->[1], '<>:xip/c:PREP$<b>64<i>0<i>3<i>1<b>3', 'Prep phrase'); |
Akron | 2d83a5a | 2016-02-26 00:21:16 +0100 | [diff] [blame] | 22 | is($data->{stream}->[0]->[2], '<>:xip/c:PP$<b>64<i>0<i>30<i>4<b>2', 'pp phrase'); |
Akron | dec4312 | 2020-03-03 11:22:25 +0100 | [diff] [blame] | 23 | is($data->{stream}->[0]->[4], '<>:xip/c:TOP$<b>64<i>0<i>129<i>18<b>0', 'top phrase'); |
| 24 | is($data->{stream}->[0]->[5], '<>:xip/c:MC$<b>64<i>0<i>129<i>18<b>1', 'mc phrase'); |
Akron | 5f511d2 | 2016-01-05 20:54:34 +0100 | [diff] [blame] | 25 | is($data->{stream}->[-1]->[0], '<>:xip/c:VERB$<b>64<i>124<i>128<i>18<b>4', 'Noun phrase'); |
| 26 | |
Akron | 2d83a5a | 2016-02-26 00:21:16 +0100 | [diff] [blame] | 27 | |
Akron | 5f511d2 | 2016-01-05 20:54:34 +0100 | [diff] [blame] | 28 | done_testing; |
| 29 | |
| 30 | __END__ |
| 31 | |
| 32 | |
| 33 | |
| 34 | |