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