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 | |
| 20 | like($doc->path, qr!$path/!, 'Path'); |
| 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 | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 30 | is($meta->{title}, '@ Koelle_am_Rhing 10:18', 'title'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 31 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 32 | ok(!$meta->{sub_title}, 'no subtitle'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 33 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 34 | is($meta->{publisher}, 'tagesschau.de', 'Publisher'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 35 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 36 | is($meta->{pub_date}, '20140930'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 37 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 38 | ok(!$meta->{pub_place}, 'No pub place'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 39 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 40 | is($meta->{doc_title}, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title'); |
| 41 | is($meta->{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 | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 43 | is($meta->{'funder'}, 'Bundesministerium für Bildung und Forschung', 'Funder'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 44 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 45 | is($meta->{author}, 'privat23', 'Author'); |
| 46 | ok(!$meta->{'sgbr_author_sex'}, 'No Sex'); |
| 47 | ok(!$meta->{'sgbr_kodex'}, 'No kodex'); |
| 48 | is($meta->{reference}, 'http://meta.tagesschau.de/node/090285#comment-1732187', 'Publace ref'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 49 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 50 | is($meta->keywords('keywords'), ''); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 51 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 52 | is($meta->{language}, 'de', 'Language'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 53 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 54 | ok(!$meta->{editor}, 'Editor'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 55 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 56 | ok(!$meta->{text_type}, 'Text Type'); |
| 57 | ok(!$meta->{text_type_art}, 'Text Type Art'); |
| 58 | ok(!$meta->{text_type_ref}, 'Text Type Ref'); |
| 59 | ok(!$meta->{text_column}, 'Text Column'); |
| 60 | ok(!$meta->{text_domain}, 'Text Domain'); |
| 61 | ok(!$meta->{creation_date}, 'Creation Date'); |
| 62 | ok(!$meta->{license}, 'License'); |
| 63 | ok(!$meta->{pages}, 'Pages'); |
| 64 | ok(!$meta->{file_edition_statement}, 'File Edition Statement'); |
| 65 | ok(!$meta->{bibl_edition_statement}, 'Bibl Edition Statement'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 66 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 67 | ok(!$meta->{doc_editor}, 'Doc: editor'); |
| 68 | ok(!$meta->{doc_author}, 'Doc: author'); |
| 69 | |
| 70 | ok(!$meta->{corpus_title}, 'Corpus: title'); |
| 71 | ok(!$meta->{corpus_sub_title}, 'Corpus: subtitle'); |
| 72 | ok(!$meta->{corpus_editor}, 'Corpus: editor'); |
| 73 | ok(!$meta->{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 | |
| 88 | like($doc->path, qr!$path/!, 'Path'); |
| 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; |
| 98 | is($meta->{title}, '@fitnessfrosch', 'title'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 99 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 100 | ok(!$meta->{sub_title}, 'no subtitle'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 101 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 102 | is($meta->{publisher}, 'tagesschau.de', 'Publisher'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 103 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 104 | is($meta->{pub_date}, '20141001'); |
| 105 | is($meta->{'sgbr_date'}, '2014-10-01 00:50:00'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 106 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 107 | ok(!$meta->{pub_place}, 'No pub place'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 108 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 109 | is($meta->{doc_title}, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title'); |
| 110 | is($meta->{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 | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 112 | is($meta->{'funder'}, 'Bundesministerium für Bildung und Forschung', 'Funder'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 113 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 114 | is($meta->{author}, 'weltoffen', 'Author'); |
| 115 | ok(!$meta->{'sgbr_author_sex'}, 'No Sex'); |
| 116 | ok(!$meta->{'sgbr_kodex'}, 'No kodex'); |
| 117 | is($meta->{reference}, 'http://meta.tagesschau.de/node/090308#comment-1732754', 'Publace ref'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 118 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 119 | is($meta->keywords('keywords'), ''); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 120 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 121 | is($meta->{language}, 'de', 'Language'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 122 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 123 | ok(!$meta->{editor}, 'Editor'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 124 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 125 | ok(!$meta->{text_type}, 'Text Type'); |
| 126 | ok(!$meta->{text_type_art}, 'Text Type Art'); |
| 127 | ok(!$meta->{text_type_ref}, 'Text Type Ref'); |
| 128 | ok(!$meta->{text_column}, 'Text Column'); |
| 129 | ok(!$meta->{text_domain}, 'Text Domain'); |
| 130 | ok(!$meta->{creation_date}, 'Creation Date'); |
| 131 | ok(!$meta->{license}, 'License'); |
| 132 | ok(!$meta->{pages}, 'Pages'); |
| 133 | ok(!$meta->{file_edition_statement}, 'File Edition Statement'); |
| 134 | ok(!$meta->{bibl_edition_statement}, 'Bibl Edition Statement'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame] | 135 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 136 | ok(!$meta->{doc_editor}, 'Doc: editor'); |
| 137 | ok(!$meta->{doc_author}, 'Doc: author'); |
| 138 | |
| 139 | ok(!$meta->{corpus_title}, 'Corpus: title'); |
| 140 | ok(!$meta->{corpus_sub_title}, 'Corpus: subtitle'); |
| 141 | ok(!$meta->{corpus_editor}, 'Corpus: editor'); |
| 142 | ok(!$meta->{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 | |