blob: b03dad205e78625cf273706e3221a7c15b6ce542 [file] [log] [blame]
Akronef8544f2016-01-16 14:51:07 +01001package TestInit;
2use strict;
3use warnings;
4use File::Basename 'dirname';
5use File::Spec::Functions 'catdir';
Akrone4c2e412016-01-28 15:10:50 +01006use KorAP::XML::Tokenizer;
7use KorAP::XML::Krill;
Akronef8544f2016-01-16 14:51:07 +01008
9sub tokens {
10 my $file = shift;
11 my $path = catdir(dirname(__FILE__), 'corpus', 'doc', $file);
12
Akrone4c2e412016-01-28 15:10:50 +010013 my $doc = KorAP::XML::Krill->new(
Akronef8544f2016-01-16 14:51:07 +010014 path => $path . '/'
15 ) or return;
16
17 $doc->parse;
18
Akrone4c2e412016-01-28 15:10:50 +010019 my $tokens = KorAP::XML::Tokenizer->new(
Akronef8544f2016-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;