Akron | eaffe93 | 2019-03-07 17:14:42 +0100 | [diff] [blame^] | 1 | package MyLog; |
| 2 | use Mojo::Base -base; |
| 3 | |
| 4 | has is_debug => 0; |
| 5 | has warn => sub {}; |
| 6 | has debug => sub {}; |
| 7 | has trace => sub {}; |
| 8 | has error => sub {}; |
| 9 | |
| 10 | package main; |
| 11 | use strict; |
| 12 | use warnings; |
| 13 | use Test::More; |
| 14 | use Data::Dumper; |
| 15 | use JSON::XS; |
| 16 | use Log::Log4perl; |
| 17 | |
| 18 | use Benchmark qw/:hireswallclock/; |
| 19 | |
| 20 | my $t = Benchmark->new; |
| 21 | |
| 22 | use utf8; |
| 23 | use lib 'lib', '../lib'; |
| 24 | |
| 25 | use File::Basename 'dirname'; |
| 26 | use File::Spec::Functions 'catdir'; |
| 27 | |
| 28 | use_ok('KorAP::XML::Krill'); |
| 29 | |
| 30 | # This will check files from the dortmund chat corpus |
| 31 | |
| 32 | # New |
| 33 | my $path = catdir(dirname(__FILE__), '../corpus/NGAFC/B14/00010'); |
| 34 | |
| 35 | ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
| 36 | ok($doc->parse, 'Parse document'); |
| 37 | |
| 38 | is($doc->text_sigle, 'NGAFC/B14/00010', 'Correct text sigle'); |
| 39 | is($doc->doc_sigle, 'NGAFC/B14', 'Correct document sigle'); |
| 40 | is($doc->corpus_sigle, 'NGAFC', 'Correct corpus sigle'); |
| 41 | |
| 42 | my $meta = $doc->meta; |
| 43 | is($meta->{T_title}, 'Re: Ranking der Zuverlässigkeit von Filesystemen, In: de.sci.informatik.misc', |
| 44 | 'Title'); |
| 45 | is($meta->{A_publisher}, 'Usenet', 'Publisher'); |
| 46 | |
| 47 | # Tokenization |
| 48 | use_ok('KorAP::XML::Tokenizer'); |
| 49 | |
| 50 | my ($token_base_foundry, $token_base_layer) = (qw/Base Tokens/); |
| 51 | |
| 52 | # Get tokenization |
| 53 | my $tokens = KorAP::XML::Tokenizer->new( |
| 54 | path => $doc->path, |
| 55 | doc => $doc, |
| 56 | foundry => $token_base_foundry, |
| 57 | layer => $token_base_layer, |
| 58 | name => 'tokens', |
| 59 | log => MyLog->new |
| 60 | ); |
| 61 | |
| 62 | ok($tokens, 'Token Object is fine'); |
| 63 | ok(!$tokens->parse, 'Token parsing is not fine'); |
| 64 | |
| 65 | done_testing; |
| 66 | |
| 67 | |
| 68 | __END__ |