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 | |
Akron | fab17d3 | 2020-07-31 14:38:29 +0200 | [diff] [blame^] | 18 | if ($ENV{SKIP_REAL}) { |
| 19 | plan skip_all => 'Skip real tests'; |
| 20 | }; |
| 21 | |
Akron | eaffe93 | 2019-03-07 17:14:42 +0100 | [diff] [blame] | 22 | use Benchmark qw/:hireswallclock/; |
| 23 | |
| 24 | my $t = Benchmark->new; |
| 25 | |
| 26 | use utf8; |
| 27 | use lib 'lib', '../lib'; |
| 28 | |
| 29 | use File::Basename 'dirname'; |
| 30 | use File::Spec::Functions 'catdir'; |
| 31 | |
| 32 | use_ok('KorAP::XML::Krill'); |
| 33 | |
| 34 | # This will check files from the dortmund chat corpus |
| 35 | |
| 36 | # New |
| 37 | my $path = catdir(dirname(__FILE__), '../corpus/NGAFC/B14/00010'); |
| 38 | |
| 39 | ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
| 40 | ok($doc->parse, 'Parse document'); |
| 41 | |
| 42 | is($doc->text_sigle, 'NGAFC/B14/00010', 'Correct text sigle'); |
| 43 | is($doc->doc_sigle, 'NGAFC/B14', 'Correct document sigle'); |
| 44 | is($doc->corpus_sigle, 'NGAFC', 'Correct corpus sigle'); |
| 45 | |
| 46 | my $meta = $doc->meta; |
| 47 | is($meta->{T_title}, 'Re: Ranking der Zuverlässigkeit von Filesystemen, In: de.sci.informatik.misc', |
| 48 | 'Title'); |
| 49 | is($meta->{A_publisher}, 'Usenet', 'Publisher'); |
| 50 | |
| 51 | # Tokenization |
| 52 | use_ok('KorAP::XML::Tokenizer'); |
| 53 | |
| 54 | my ($token_base_foundry, $token_base_layer) = (qw/Base Tokens/); |
| 55 | |
| 56 | # Get tokenization |
| 57 | my $tokens = KorAP::XML::Tokenizer->new( |
| 58 | path => $doc->path, |
| 59 | doc => $doc, |
| 60 | foundry => $token_base_foundry, |
| 61 | layer => $token_base_layer, |
| 62 | name => 'tokens', |
| 63 | log => MyLog->new |
| 64 | ); |
| 65 | |
| 66 | ok($tokens, 'Token Object is fine'); |
| 67 | ok(!$tokens->parse, 'Token parsing is not fine'); |
| 68 | |
| 69 | done_testing; |
| 70 | |
| 71 | |
| 72 | __END__ |