Akron | 2532f1b | 2023-05-15 13:41:24 +0200 | [diff] [blame] | 1 | use strict; |
| 2 | use warnings; |
| 3 | use Test::More; |
| 4 | use Data::Dumper; |
| 5 | use JSON::XS; |
| 6 | |
| 7 | if ($ENV{SKIP_REAL}) { |
| 8 | plan skip_all => 'Skip real tests'; |
| 9 | }; |
| 10 | |
| 11 | use Benchmark qw/:hireswallclock/; |
| 12 | |
| 13 | my $t = Benchmark->new; |
| 14 | |
| 15 | use utf8; |
| 16 | use lib 'lib', '../lib'; |
| 17 | |
| 18 | use File::Basename 'dirname'; |
| 19 | use File::Spec::Functions 'catdir'; |
| 20 | |
| 21 | use_ok('KorAP::XML::Krill'); |
| 22 | |
| 23 | # This will check preliminary HNC-Files |
| 24 | |
| 25 | # HNC/DOC00001/00001 |
| 26 | my $path = catdir(dirname(__FILE__), 'corpus','ICCGER','CCBY-LTE','WMA-00005'); |
| 27 | |
| 28 | ok(my $doc = KorAP::XML::Krill->new( |
| 29 | path => $path . '/', |
| 30 | meta_type => 'ICC' |
| 31 | ), 'Load Korap::Document'); |
| 32 | ok($doc->parse, 'Parse document'); |
| 33 | |
| 34 | is($doc->text_sigle, 'ICCGER/CCBY-LTE/WMA-00005', 'Correct text sigle'); |
| 35 | is($doc->doc_sigle, 'ICCGER/CCBY-LTE', 'Correct document sigle'); |
| 36 | is($doc->corpus_sigle, 'ICCGER', 'Correct corpus sigle'); |
| 37 | |
| 38 | my $meta = $doc->meta; |
| 39 | like($meta->{T_title}, qr!Affinit.tschromatografie!, 'Title'); |
| 40 | is($meta->{S_pub_place}, 'Zug', 'PubPlace'); |
| 41 | |
| 42 | is($meta->{T_author}, 'Wilke, Marco; Weller, Michael G.', 'Author'); |
| 43 | |
| 44 | is($meta->{D_pub_date}, '20190000', 'Publication date'); |
| 45 | |
| 46 | ok(!$meta->{T_sub_title}, 'SubTitle'); |
| 47 | |
| 48 | is($meta->{A_publisher}, 'Sigwerb Sigwerb', 'Publisher'); |
| 49 | |
| 50 | is($meta->{S_license}, 'Lizenz (Deutsch): License LogoCreative Commons - CC BY - Namensnennung 4.0 International', 'Licence'); |
| 51 | |
| 52 | is($meta->{S_iccGenre}, 'Learned_Technology', 'Editor'); |
| 53 | |
| 54 | is($meta->{A_source}, 'German Reference Corpus DeReKo', 'Editor'); |
| 55 | |
| 56 | |
| 57 | # Norwegian |
| 58 | $path = catdir(dirname(__FILE__), 'corpus','ICCNOR','199', '00002'); |
| 59 | |
| 60 | ok($doc = KorAP::XML::Krill->new( |
| 61 | path => $path . '/', |
| 62 | meta_type => 'ICC' |
| 63 | ), 'Load Korap::Document'); |
| 64 | ok($doc->parse, 'Parse document'); |
| 65 | |
| 66 | is($doc->text_sigle, 'NO/199/00002', 'Correct text sigle'); |
| 67 | is($doc->doc_sigle, 'NO/199', 'Correct document sigle'); |
| 68 | is($doc->corpus_sigle, 'NO', 'Correct corpus sigle'); |
| 69 | |
| 70 | $meta = $doc->meta; |
| 71 | like($meta->{T_title}, qr!Pengesnakk!, 'Title'); |
| 72 | is($meta->{S_pub_place}, 'https://www.pengesnakk.no/', 'PubPlace'); |
| 73 | |
| 74 | is($meta->{T_author}, 'Kristoffersen, Lise Vermelid', 'Author'); |
| 75 | |
| 76 | is($meta->{D_pub_date}, '20190000', 'Publication date'); |
| 77 | |
| 78 | ok(!$meta->{T_sub_title}, 'SubTitle'); |
| 79 | |
| 80 | ok(!$meta->{A_publisher}, 'Publisher'); |
| 81 | |
| 82 | ok(!$meta->{S_license}, 'Licence'); |
| 83 | |
| 84 | is($meta->{S_iccGenre}, 'blog', 'Editor'); |
| 85 | |
| 86 | ok(!$meta->{A_source}, 'Editor'); |
| 87 | |
| 88 | # English |
| 89 | $path = catdir(dirname(__FILE__), 'corpus','ICCENG','144', '00005'); |
| 90 | |
| 91 | ok($doc = KorAP::XML::Krill->new( |
| 92 | path => $path . '/', |
| 93 | meta_type => 'ICC' |
| 94 | ), 'Load Korap::Document'); |
| 95 | ok($doc->parse, 'Parse document'); |
| 96 | |
| 97 | is($doc->text_sigle, 'EN/144/00005', 'Correct text sigle'); |
| 98 | is($doc->doc_sigle, 'EN/144', 'Correct document sigle'); |
| 99 | is($doc->corpus_sigle, 'EN', 'Correct corpus sigle'); |
| 100 | |
| 101 | $meta = $doc->meta; |
| 102 | like($meta->{T_title}, qr!Irish News!, 'Title'); |
| 103 | ok(!$meta->{S_pub_place}, 'PubPlace'); |
| 104 | |
| 105 | ok(!$meta->{T_author}, 'Author'); |
| 106 | |
| 107 | is($meta->{D_pub_date}, '19940000', 'Publication date'); |
| 108 | |
| 109 | ok(!$meta->{T_sub_title}, 'SubTitle'); |
| 110 | |
| 111 | ok(!$meta->{A_publisher}, 'Publisher'); |
| 112 | |
| 113 | ok(!$meta->{S_license}, 'Licence'); |
| 114 | |
| 115 | is($meta->{S_iccGenre}, 'PreEdi', 'Editor'); |
| 116 | |
| 117 | ok(!$meta->{A_source}, 'Editor'); |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | done_testing; |
| 123 | __END__ |