blob: b03dad205e78625cf273706e3221a7c15b6ce542 [file] [log] [blame]
Akron601fc152016-01-16 14:51:07 +01001package TestInit;
2use strict;
3use warnings;
4use File::Basename 'dirname';
5use File::Spec::Functions 'catdir';
Akron8fa76bc2016-01-28 15:10:50 +01006use KorAP::XML::Tokenizer;
7use KorAP::XML::Krill;
Akron601fc152016-01-16 14:51:07 +01008
9sub tokens {
10 my $file = shift;
11 my $path = catdir(dirname(__FILE__), 'corpus', 'doc', $file);
12
Akron8fa76bc2016-01-28 15:10:50 +010013 my $doc = KorAP::XML::Krill->new(
Akron601fc152016-01-16 14:51:07 +010014 path => $path . '/'
15 ) or return;
16
17 $doc->parse;
18
Akron8fa76bc2016-01-28 15:10:50 +010019 my $tokens = KorAP::XML::Tokenizer->new(
Akron601fc152016-01-16 14:51:07 +010020 path => $doc->path,
21 doc => $doc,
22 foundry => 'OpenNLP',
23 layer => 'Tokens',
24 name => 'tokens'
25 ) or return;
26
27 $tokens->parse or return;
28
29 return $tokens;
30};
31
321;