blob: afd1e2a7fb2a8753e60e51a1fbfa1588362a7cb6 [file] [log] [blame]
Akronca9dbb32016-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;
Akronb5d34612016-01-18 19:07:56 +01008use lib 't/index';
9use TestInit;
Akronca9dbb32016-01-05 20:54:34 +010010
Akronb5d34612016-01-18 19:07:56 +010011ok(my $tokens = TestInit::tokens('0001'), 'Parse tokens');
Akronca9dbb32016-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');
Akrone7bc37d2016-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');
Akronca9dbb32016-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
Akrone7bc37d2016-02-26 00:21:16 +010026
Akronca9dbb32016-01-05 20:54:34 +010027done_testing;
28
29__END__
30
31
32
33