Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 1 | use strict; |
| 2 | use warnings; |
| 3 | use Test::More; |
| 4 | use File::Basename 'dirname'; |
| 5 | use File::Spec::Functions 'catdir'; |
| 6 | use Data::Dumper; |
| 7 | use KorAP::XML::Tokenizer; |
| 8 | use KorAP::XML::Krill; |
| 9 | use utf8; |
| 10 | |
| 11 | my $path = catdir(dirname(__FILE__), 'CMC-TSK', '2014-09', '2843'); |
| 12 | |
| 13 | ok(my $doc = KorAP::XML::Krill->new( |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 14 | path => $path . '/', |
| 15 | meta_type => 'Sgbr' |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 16 | ), 'Create Document'); |
| 17 | |
| 18 | ok($doc->parse, 'Parse document'); |
| 19 | |
Nils Diewald | b3e9ccd | 2016-10-24 15:16:52 +0200 | [diff] [blame] | 20 | like($doc->path, qr!\Q$path\E/!, 'Path'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 21 | |
| 22 | # Metdata |
Akron | 1cd5b87 | 2016-03-22 00:23:46 +0100 | [diff] [blame] | 23 | is($doc->text_sigle, 'CMC-TSK/2014-09/2843', 'ID-text'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 24 | |
Akron | 1cd5b87 | 2016-03-22 00:23:46 +0100 | [diff] [blame] | 25 | is($doc->doc_sigle, 'CMC-TSK/2014-09', 'ID-doc'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 26 | is($doc->corpus_sigle, 'CMC-TSK', 'ID-corpus'); |
| 27 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 28 | my $meta = $doc->meta; |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 29 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 30 | is($meta->{T_title}, '@ Koelle_am_Rhing 10:18', 'title'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 31 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 32 | ok(!$meta->{T_sub_title}, 'no subtitle'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 33 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 34 | is($meta->{A_publisher}, 'tagesschau.de', 'Publisher'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 35 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 36 | is($meta->{D_pub_date}, '20140930'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 37 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 38 | ok(!$meta->{S_pub_place}, 'No pub place'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 39 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 40 | is($meta->{T_doc_title}, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title'); |
| 41 | is($meta->{T_doc_sub_title}, 'Subkorpus Internettexte, Subkorpus Leserkommentare Tagesschau, Subkorpus September 2014, Subkorpus Beispielauszug', 'Doc Sub title'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 42 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 43 | is($meta->{'A_funder'}, 'Bundesministerium für Bildung und Forschung', 'Funder'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 44 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 45 | is($meta->{T_author}, 'privat23', 'Author'); |
| 46 | ok(!$meta->{'S_sgbr_author_sex'}, 'No Sex'); |
| 47 | ok(!$meta->{'S_sgbr_kodex'}, 'No kodex'); |
| 48 | is($meta->{A_reference}, 'http://meta.tagesschau.de/node/090285#comment-1732187', 'Publace ref'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 49 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 50 | is($meta->keywords('K_keywords'), ''); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 51 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 52 | is($meta->{S_language}, 'de', 'Language'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 53 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 54 | ok(!$meta->{A_editor}, 'Editor'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 55 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 56 | ok(!$meta->{S_text_type}, 'Text Type'); |
| 57 | ok(!$meta->{S_text_type_art}, 'Text Type Art'); |
| 58 | ok(!$meta->{S_text_type_ref}, 'Text Type Ref'); |
| 59 | ok(!$meta->{S_text_column}, 'Text Column'); |
| 60 | ok(!$meta->{S_text_domain}, 'Text Domain'); |
| 61 | ok(!$meta->{D_creation_date}, 'Creation Date'); |
| 62 | ok(!$meta->{S_license}, 'License'); |
| 63 | ok(!$meta->{A_pages}, 'Pages'); |
| 64 | ok(!$meta->{A_file_edition_statement}, 'File Edition Statement'); |
| 65 | ok(!$meta->{A_bibl_edition_statement}, 'Bibl Edition Statement'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 66 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 67 | ok(!$meta->{A_doc_editor}, 'Doc: editor'); |
| 68 | ok(!$meta->{T_doc_author}, 'Doc: author'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 69 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 70 | ok(!$meta->{T_corpus_title}, 'Corpus: title'); |
| 71 | ok(!$meta->{T_corpus_sub_title}, 'Corpus: subtitle'); |
| 72 | ok(!$meta->{A_corpus_editor}, 'Corpus: editor'); |
| 73 | ok(!$meta->{T_corpus_author}, 'Corpus: author'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 74 | |
| 75 | my $hash = $doc->to_hash; |
| 76 | is($hash->{title}, '@ Koelle_am_Rhing 10:18', 'Corpus title'); |
| 77 | |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 78 | # Second document |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 79 | $path = catdir(dirname(__FILE__), 'CMC-TSK', '2014-09', '3401'); |
| 80 | |
| 81 | ok($doc = KorAP::XML::Krill->new( |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 82 | path => $path . '/', |
| 83 | meta_type => 'Sgbr' |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 84 | ), 'Create Document'); |
| 85 | |
| 86 | ok($doc->parse, 'Parse document'); |
| 87 | |
Nils Diewald | b3e9ccd | 2016-10-24 15:16:52 +0200 | [diff] [blame] | 88 | like($doc->path, qr!\Q$path\E/!, 'Path'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 89 | |
| 90 | # Metdata |
Akron | 1cd5b87 | 2016-03-22 00:23:46 +0100 | [diff] [blame] | 91 | is($doc->text_sigle, 'CMC-TSK/2014-09/3401', 'ID-text'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 92 | |
Akron | 1cd5b87 | 2016-03-22 00:23:46 +0100 | [diff] [blame] | 93 | is($doc->doc_sigle, 'CMC-TSK/2014-09', 'ID-doc'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 94 | is($doc->corpus_sigle, 'CMC-TSK', 'ID-corpus'); |
| 95 | |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 96 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 97 | $meta = $doc->meta; |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 98 | is($meta->{T_title}, '@fitnessfrosch', 'title'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 99 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 100 | ok(!$meta->{T_sub_title}, 'no subtitle'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 101 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 102 | is($meta->{A_publisher}, 'tagesschau.de', 'Publisher'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 103 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 104 | is($meta->{D_pub_date}, '20141001'); |
| 105 | is($meta->{'D_sgbr_date'}, '2014-10-01 00:50:00'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 106 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 107 | ok(!$meta->{S_pub_place}, 'No pub place'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 108 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 109 | is($meta->{T_doc_title}, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title'); |
| 110 | is($meta->{T_doc_sub_title}, 'Subkorpus Internettexte, Subkorpus Leserkommentare Tagesschau, Subkorpus September 2014, Subkorpus Beispielauszug', 'Doc Sub title'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 111 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 112 | is($meta->{'A_funder'}, 'Bundesministerium für Bildung und Forschung', 'Funder'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 113 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 114 | is($meta->{T_author}, 'weltoffen', 'Author'); |
| 115 | ok(!$meta->{'S_sgbr_author_sex'}, 'No Sex'); |
| 116 | ok(!$meta->{'S_sgbr_kodex'}, 'No kodex'); |
| 117 | is($meta->{A_reference}, 'http://meta.tagesschau.de/node/090308#comment-1732754', 'Publace ref'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 118 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 119 | is($meta->keywords('K_keywords'), ''); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 120 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 121 | is($meta->{S_language}, 'de', 'Language'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 122 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 123 | ok(!$meta->{A_editor}, 'Editor'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 124 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 125 | ok(!$meta->{S_text_type}, 'Text Type'); |
| 126 | ok(!$meta->{S_text_type_art}, 'Text Type Art'); |
| 127 | ok(!$meta->{S_text_type_ref}, 'Text Type Ref'); |
| 128 | ok(!$meta->{S_text_column}, 'Text Column'); |
| 129 | ok(!$meta->{S_text_domain}, 'Text Domain'); |
| 130 | ok(!$meta->{D_creation_date}, 'Creation Date'); |
| 131 | ok(!$meta->{S_license}, 'License'); |
| 132 | ok(!$meta->{A_pages}, 'Pages'); |
| 133 | ok(!$meta->{A_file_edition_statement}, 'File Edition Statement'); |
| 134 | ok(!$meta->{A_bibl_edition_statement}, 'Bibl Edition Statement'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 135 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 136 | ok(!$meta->{A_doc_editor}, 'Doc: editor'); |
| 137 | ok(!$meta->{T_doc_author}, 'Doc: author'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 138 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame] | 139 | ok(!$meta->{T_corpus_title}, 'Corpus: title'); |
| 140 | ok(!$meta->{T_corpus_sub_title}, 'Corpus: subtitle'); |
| 141 | ok(!$meta->{A_corpus_editor}, 'Corpus: editor'); |
| 142 | ok(!$meta->{T_corpus_author}, 'Corpus: author'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 143 | |
| 144 | $hash = $doc->to_hash; |
| 145 | is($hash->{title}, '@fitnessfrosch', 'Corpus title'); |
| 146 | |
| 147 | done_testing; |
| 148 | __END__ |
| 149 | |