blob: 194c49c54a15749a3359b62154cb3b5313ca3a11 [file] [log] [blame]
Akron414ec952020-08-03 15:48:43 +02001use strict;
2use warnings;
3use Test::More;
4use File::Basename 'dirname';
5use File::Spec::Functions 'catdir';
6use Data::Dumper;
7use KorAP::XML::Tokenizer;
8use KorAP::XML::Krill;
9use utf8;
10
11if ($ENV{SKIP_REAL}) {
12 plan skip_all => 'Skip real tests';
13};
14
15my $path = catdir(dirname(__FILE__), 'CMC-TSK', '2014-09', 3401);
16
17ok(my $doc = KorAP::XML::Krill->new(
18 path => $path . '/'
19), 'Create Document');
20
21ok($doc->parse('Sgbr'), 'Parse document');
22
23ok(my $tokens = KorAP::XML::Tokenizer->new(
24 path => $doc->path,
25 doc => $doc,
26 foundry => 'Sgbr',
27 layer => 'Lemma',
28 name => 'tokens'
29), 'Create tokens based on lemmata');
30
31ok($tokens->parse, 'Parse tokenization based on lemmata');
32
33ok($tokens->add('Base', 'Sentences'), 'Add Sentences');
34
35my $stream = $tokens->to_data->{data}->{stream};
36
37is($stream->[0]->[0], '-:base/sentences$<i>1');
38is($stream->[0]->[1], '-:tokens$<i>15');
39is($stream->[0]->[2], '<>:base/s:t$<b>64<i>0<i>115<i>15<b>0');
40is($stream->[0]->[3], '<>:base/s:s$<b>64<i>16<i>114<i>15<b>2');
41is($stream->[0]->[4], '_0$<i>17<i>18');
42
43done_testing;