blob: afd1e2a7fb2a8753e60e51a1fbfa1588362a7cb6 [file] [log] [blame]
Akron5f511d22016-01-05 20:54:34 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
5use Test::More;
6use Scalar::Util qw/weaken/;
7use Data::Dumper;
Akron11ef51d2016-01-18 19:07:56 +01008use lib 't/index';
9use TestInit;
Akron5f511d22016-01-05 20:54:34 +010010
Akron11ef51d2016-01-18 19:07:56 +010011ok(my $tokens = TestInit::tokens('0001'), 'Parse tokens');
Akron5f511d22016-01-05 20:54:34 +010012
13ok($tokens->add('XIP', 'Constituency'), 'Add Structure');
14
15my $data = $tokens->to_data->{data};
16like($data->{foundries}, qr!xip/constituency!, 'data');
17like($data->{layerInfos}, qr!xip/c=spans!, 'data');
18
19# The length includes the punct - but that doesn't matter
20is($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 +010021is($data->{stream}->[0]->[2], '<>:xip/c:PP$<b>64<i>0<i>30<i>4<b>2', 'pp phrase');
22is($data->{stream}->[0]->[4], '<>:xip/c:TOP$<b>64<i>0<i>129<i>17<b>0', 'top phrase');
23is($data->{stream}->[0]->[5], '<>:xip/c:MC$<b>64<i>0<i>129<i>17<b>1', 'mc phrase');
Akron5f511d22016-01-05 20:54:34 +010024is($data->{stream}->[-1]->[0], '<>:xip/c:VERB$<b>64<i>124<i>128<i>18<b>4', 'Noun phrase');
25
Akron2d83a5a2016-02-26 00:21:16 +010026
Akron5f511d22016-01-05 20:54:34 +010027done_testing;
28
29__END__
30
31
32
33