blob: ac164220dcd29e1cab8d006681da589984b884a6 [file] [log] [blame]
Akron1622dd92015-12-09 22:34:26 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
5use Test::More;
6use Scalar::Util qw/weaken/;
7
8use_ok('KorAP::Document');
9
10use File::Basename 'dirname';
11use File::Spec::Functions 'catdir';
12
13my $path = catdir(dirname(__FILE__), 'GOE-2', 'AGX', '00002' );
14ok(my $doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document');
15like($doc->path, qr!$path/$!, 'Path');
16ok($doc->parse, 'Parse document');
17
18ok($doc->primary->data, 'Primary data in existence');
19is($doc->primary->data_length, 8888, 'Data length');
20
21use_ok('KorAP::Tokenizer');
22
23ok(my $tokens = KorAP::Tokenizer->new(
24 path => $doc->path,
25 doc => $doc,
26 foundry => 'Tree_Tagger',
27 layer => 'Tokens',
28 name => 'tokens'
29), 'New Tokenizer');
30
31ok($tokens->parse, 'Parse');
32
33ok($tokens->add('Struct', 'Structure'), 'Add Structure');
34
35
36done_testing;
37__END__
38
39
40sub new_tokenizer {
41 my $x = $doc;
42 weaken $x;
43 return KorAP::Tokenizer->new(
44 path => $x->path,
45 doc => $x,
46 foundry => 'DeReKo',
47 layer => 'Structure',
48 name => 'spans'
49 )
50};
51
52__END__