Akron | 2e840a7 | 2022-02-03 09:49:26 +0100 | [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 utf8; |
| 12 | use lib 'lib', '../lib'; |
| 13 | |
| 14 | use File::Basename 'dirname'; |
| 15 | use File::Spec::Functions 'catdir'; |
| 16 | |
| 17 | use_ok('KorAP::XML::Krill'); |
| 18 | |
| 19 | my $path = catdir(dirname(__FILE__), 'corpus','NDY','296','008718'); |
| 20 | |
| 21 | ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
| 22 | ok($doc->parse, 'Parse document'); |
| 23 | |
| 24 | is($doc->text_sigle, 'NDY/296/008718', 'Correct text sigle'); |
| 25 | is($doc->doc_sigle, 'NDY/296', 'Correct document sigle'); |
| 26 | is($doc->corpus_sigle, 'NDY', 'Correct corpus sigle'); |
| 27 | |
| 28 | my $meta = $doc->meta; |
| 29 | |
| 30 | like($meta->{T_title}, qr!^Kommentar zu: LOCKE hat mein MERCEDES AMG ZERSTÖRT!, 'Title'); |
| 31 | ok(!$meta->{T_sub_title}, 'SubTitle'); |
| 32 | is($meta->{T_author}, 'Livia Banse', 'Author'); |
| 33 | ok(!$meta->{A_editor}, 'Editor'); |
| 34 | is($meta->{S_pub_place}, 'San Bruno, California'); |
| 35 | is($meta->{A_publisher}, 'YouTube', 'Publisher'); |
| 36 | |
| 37 | is($meta->{S_text_type},'Kurzmeldungen: YouTube-Kommentare', 'No Text Type'); |
| 38 | ok(!$meta->{S_text_type_art}, 'No Text Type Art'); |
| 39 | ok(!$meta->{S_text_type_ref}, 'No Text Type Ref'); |
| 40 | ok(!$meta->{S_text_domain}, 'No Text Domain'); |
| 41 | ok(!$meta->{S_text_column}, 'No Text Column'); |
| 42 | |
| 43 | is($meta->{K_text_class}->[0], 'entertainment', 'Correct Text Class'); |
| 44 | ok(!$meta->{K_text_class}->[1], 'Correct Text Class'); |
| 45 | |
| 46 | is($meta->{D_pub_date}, '20171204', 'Creation date'); |
| 47 | is($meta->{D_creation_date}, '20171204', 'Creation date'); |
| 48 | is($meta->{S_availability}, 'QAO-NC-LOC:ids', 'License'); |
| 49 | ok(!$meta->{A_pages}, 'Pages'); |
| 50 | |
| 51 | ok(!$meta->{A_file_edition_statement}, 'File Statement'); |
| 52 | ok(!$meta->{A_bibl_edition_statement}, 'Bibl Statement'); |
| 53 | |
| 54 | like($meta->{A_reference}, qr!NDY\/296\.008718, YouTube, 04\.12\.2017\. Livia Banse: Kommentar zu: LOCKE hat mein MERCEDES AMG ZERSTÖRT.* \(AutoUnfall\), - YouTube!, 'Reference'); |
| 55 | |
| 56 | is($meta->{S_language}, 'de', 'Language'); |
| 57 | |
| 58 | is($meta->{T_corpus_title}, 'YouTube', 'Correct Corpus title'); |
| 59 | ok(!$meta->{T_corpus_sub_title}, 'Correct Corpus sub title'); |
| 60 | ok(!$meta->{T_corpus_author}, 'Correct Corpus author'); |
| 61 | ok(!$meta->{A_corpus_editor}, 'Correct Corpus editor'); |
| 62 | |
| 63 | like($meta->{T_doc_title}, qr!LOCKE hat mein MERCEDES AMG ZERSTÖRT\!.* \(AutoUnfall\)!, 'Correct Doc title'); |
| 64 | ok(!$meta->{T_doc_sub_title}, 'Correct Doc sub title'); |
| 65 | is($meta->{T_doc_author},'Leon Machère', 'Correct Doc author'); |
| 66 | ok(!$meta->{A_doc_editor}, 'Correct doc editor'); |
| 67 | |
| 68 | |
Akron | 2daf8fe | 2023-02-27 12:55:04 +0100 | [diff] [blame] | 69 | # Tokenization |
| 70 | use_ok('KorAP::XML::Tokenizer'); |
| 71 | |
| 72 | my ($token_base_foundry, $token_base_layer) = (qw/Base Tokens/); |
| 73 | |
| 74 | # Get tokenization |
| 75 | my $tokens = KorAP::XML::Tokenizer->new( |
| 76 | path => $doc->path, |
| 77 | doc => $doc, |
| 78 | foundry => $token_base_foundry, |
| 79 | layer => $token_base_layer, |
| 80 | name => 'tokens' |
| 81 | ); |
| 82 | |
| 83 | ok($tokens, 'Token Object is fine'); |
| 84 | ok($tokens->parse, 'Token parsing is fine'); |
| 85 | |
Akron | 2e840a7 | 2022-02-03 09:49:26 +0100 | [diff] [blame] | 86 | done_testing; |
| 87 | __END__ |