Akron | b27f694 | 2015-12-09 22:34:26 +0100 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | use utf8; |
| 5 | use Test::More; |
| 6 | use Scalar::Util qw/weaken/; |
| 7 | |
| 8 | use_ok('KorAP::Document'); |
| 9 | |
| 10 | use File::Basename 'dirname'; |
| 11 | use File::Spec::Functions 'catdir'; |
| 12 | |
| 13 | my $path = catdir(dirname(__FILE__), 'GOE-2', 'AGX', '00002' ); |
| 14 | ok(my $doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document'); |
| 15 | like($doc->path, qr!$path/$!, 'Path'); |
| 16 | ok($doc->parse, 'Parse document'); |
| 17 | |
| 18 | ok($doc->primary->data, 'Primary data in existence'); |
| 19 | is($doc->primary->data_length, 8888, 'Data length'); |
| 20 | |
| 21 | use_ok('KorAP::Tokenizer'); |
| 22 | |
| 23 | ok(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 | |
| 31 | ok($tokens->parse, 'Parse'); |
| 32 | |
| 33 | ok($tokens->add('Struct', 'Structure'), 'Add Structure'); |
| 34 | |
| 35 | |
| 36 | done_testing; |
| 37 | __END__ |
| 38 | |
| 39 | |
| 40 | sub 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__ |