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