Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 1 | use strict; |
| 2 | use warnings; |
| 3 | use utf8; |
| 4 | use Test::More; |
| 5 | use Benchmark ':hireswallclock'; |
| 6 | use lib 'lib', '../lib'; |
| 7 | |
| 8 | use File::Basename 'dirname'; |
| 9 | use File::Spec::Functions 'catdir'; |
| 10 | |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 11 | use_ok('KorAP::XML::Krill'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 12 | |
| 13 | # WPD/00001 |
Akron | 9c0488f | 2016-01-28 14:17:15 +0100 | [diff] [blame] | 14 | my $path = catdir(dirname(__FILE__), 'corpus/WPD/00001'); |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 15 | ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 16 | like($doc->path, qr!$path/!, 'Path'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 17 | |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 18 | ok($doc = KorAP::XML::Krill->new( path => $path ), 'Load Korap::Document'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 19 | like($doc->path, qr!$path/$!, 'Path'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 20 | |
| 21 | ok($doc->parse, 'Parse document'); |
| 22 | |
| 23 | # Metdata |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 24 | is($doc->text_sigle, 'WPD_AAA.00001', 'ID'); |
| 25 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 26 | my $meta = $doc->meta; |
| 27 | is($meta->{title}, 'A', 'title'); |
| 28 | ok(!$meta->{sub_title}, 'subTitle'); |
Nils Diewald | 840c924 | 2014-10-28 19:51:26 +0000 | [diff] [blame] | 29 | is($doc->corpus_sigle, 'WPD', 'corpusID'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 30 | is($meta->{pub_date}, '20050328', 'pubDate'); |
| 31 | is($meta->{pub_place}, 'URL:http://de.wikipedia.org', 'pubPlace'); |
| 32 | is($meta->{text_class}->[0], 'freizeit-unterhaltung', 'TextClass'); |
| 33 | is($meta->{text_class}->[1], 'reisen', 'TextClass'); |
| 34 | is($meta->{text_class}->[2], 'wissenschaft', 'TextClass'); |
| 35 | is($meta->{text_class}->[3], 'populaerwissenschaft', 'TextClass'); |
| 36 | ok(!$meta->{text_class}->[4], 'TextClass'); |
| 37 | is($meta->{author}, 'Ruru; Jens.Ol; Aglarech; u.a.', 'author'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 38 | |
| 39 | #is($doc->author->[0], 'Ruru', 'author'); |
| 40 | #is($doc->author->[1], 'Jens.Ol', 'author'); |
| 41 | #is($doc->author->[2], 'Aglarech', 'author'); |
| 42 | #ok(!$doc->author->[3], 'author'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 43 | |
| 44 | # Additional information |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 45 | ok(!$meta->{editor}, 'Editor'); |
| 46 | is($meta->{publisher}, 'Wikipedia', 'Publisher'); |
| 47 | is($meta->{creation_date}, '20050000', 'Creation date'); |
| 48 | ok(!$meta->{text_type}, 'No text_type'); |
| 49 | ok(!$meta->{text_type_art}, 'no text_type art'); |
| 50 | ok(!$meta->{text_type_ref}, 'no text_type ref'); |
| 51 | ok(!$meta->{text_domain}, 'no text_domain'); |
| 52 | ok(!$meta->{text_column}, 'no text_column'); |
| 53 | ok(!$meta->keywords('keywords'), 'no keywords'); |
| 54 | is($meta->keywords('text_class'), 'freizeit-unterhaltung reisen wissenschaft populaerwissenschaft', 'no text classes'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 55 | |
| 56 | #is($doc->coll_title, 'Wikipedia', 'Collection title'); |
| 57 | #is($doc->coll_sub_title, 'Die freie Enzyklopädie', 'Collection subtitle'); |
| 58 | #is($doc->coll_editor, 'wikipedia.org', 'Collection editor'); |
| 59 | #ok(!$doc->coll_author, 'Collection author'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 60 | |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 61 | # A01/13047 |
Akron | 9c0488f | 2016-01-28 14:17:15 +0100 | [diff] [blame] | 62 | $path = catdir(dirname(__FILE__), 'corpus/A01/13047'); |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 63 | ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 64 | |
| 65 | ok($doc->parse, 'Parse document'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 66 | $meta = $doc->meta; |
| 67 | is($meta->{title}, 'Fischer und Kolp im Sonnenhügel', 'title'); |
| 68 | |
| 69 | ok(!$meta->{sub_title}, 'subTitle'); |
Nils Diewald | 840c924 | 2014-10-28 19:51:26 +0000 | [diff] [blame] | 70 | is($doc->text_sigle, 'A01_APR.13047', 'ID'); |
| 71 | is($doc->corpus_sigle, 'A01', 'corpusID'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 72 | is($meta->{pub_date}, '20010402', 'pubDate'); |
| 73 | ok(!$meta->{pub_place}, 'pubPlace'); |
| 74 | is($meta->{text_class}->[0], 'freizeit-unterhaltung', 'TextClass'); |
| 75 | is($meta->{text_class}->[1], 'vereine-veranstaltungen', 'TextClass'); |
| 76 | ok(!$meta->{text_class}->[2], 'TextClass'); |
| 77 | ok(!$meta->{author}, 'author'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 78 | |
| 79 | # Additional information |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 80 | ok(!$meta->{editor}, 'Editor'); |
| 81 | ok(!$meta->{publisher}, 'Publisher'); |
| 82 | is($meta->{creation_date}, '20010402', 'Creation date'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 83 | #ok(!$doc->coll_title, 'Collection title'); |
| 84 | #ok(!$doc->coll_sub_title, 'Collection subtitle'); |
| 85 | #ok(!$doc->coll_editor, 'Collection editor'); |
| 86 | #ok(!$doc->coll_author, 'Collection author'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 87 | ok(!$meta->{text_type}, 'text_type'); |
| 88 | is($meta->{text_type_art}, 'Bericht', 'text_type art'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 89 | |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 90 | # ERL/0001 |
Akron | 9c0488f | 2016-01-28 14:17:15 +0100 | [diff] [blame] | 91 | $path = catdir(dirname(__FILE__), 'corpus/ERL/00001'); |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 92 | ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 93 | |
| 94 | ok($doc->parse, 'Parse document'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 95 | |
| 96 | $meta = $doc->meta; |
| 97 | is($meta->{title}, 'Amtsblatt des Landesbezirks Baden [diverse Erlasse]', 'title'); # Amtsblatt des Landesbezirks Baden [diverse Erlasse] |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 98 | # MK2/ERL.00001 |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 99 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 100 | ok(!$meta->{sub_title}, 'subTitle'); |
Nils Diewald | 840c924 | 2014-10-28 19:51:26 +0000 | [diff] [blame] | 101 | is($doc->text_sigle, 'MK2_ERL.00001', 'ID'); |
| 102 | is($doc->corpus_sigle, 'MK2', 'corpusID'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 103 | is($meta->{pub_date}, '00000000', 'pubDate'); |
| 104 | is($meta->{pub_place}, 'Karlsruhe', 'pubPlace'); |
| 105 | is($meta->{text_class}->[0], 'politik', 'TextClass'); |
| 106 | is($meta->{text_class}->[1], 'kommunalpolitik', 'TextClass'); |
| 107 | ok(!$meta->{text_class}->[2], 'TextClass'); |
| 108 | ok(!$meta->{author}, 'author'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 109 | |
| 110 | # Additional information |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 111 | ok(!$meta->{editor}, 'Editor'); |
| 112 | is($meta->{publisher}, 'Badenia Verlag und Druckerei', 'Publisher'); |
| 113 | is($meta->{creation_date}, '19600000', 'Creation date'); |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 114 | |
| 115 | # !!! |
| 116 | # diag 'Non-acceptance of creation date ranges may be temporary'; |
| 117 | |
| 118 | |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 119 | #ok(!$doc->coll_title, 'Collection title'); |
| 120 | #ok(!$doc->coll_sub_title, 'Collection subtitle'); |
| 121 | #ok(!$doc->coll_editor, 'Collection editor'); |
| 122 | #ok(!$doc->coll_author, 'Collection author'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 123 | is($meta->{text_type}, 'Erlass', 'text_type'); |
| 124 | ok(!$meta->{text_type_art}, 'text_type art'); |
| 125 | |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 126 | |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 127 | # A01/02035-substring |
Akron | 9c0488f | 2016-01-28 14:17:15 +0100 | [diff] [blame] | 128 | $path = catdir(dirname(__FILE__), 'corpus/A00/02035-substring'); |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 129 | ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 130 | ok($doc->parse, 'Parse document'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 131 | |
| 132 | $meta = $doc->meta; |
| 133 | |
| 134 | is($meta->{title}, 'St. Galler Tagblatt, 11.01.2000, Ressort: TB-RSP (Abk.)', 'title'); # A00/JAN.02035 |
| 135 | ok(!$meta->{sub_title}, 'subTitle'); |
Nils Diewald | 840c924 | 2014-10-28 19:51:26 +0000 | [diff] [blame] | 136 | is($doc->text_sigle, 'A00_JAN.02035', 'ID'); |
| 137 | is($doc->corpus_sigle, 'A00', 'corpusID'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 138 | is($meta->{pub_date}, '20000111', 'pubDate'); |
| 139 | ok(!$meta->{pub_place}, 'pubPlace'); |
| 140 | is($meta->{text_class}->[0], 'sport', 'TextClass'); |
| 141 | is($meta->{text_class}->[1], 'ballsport', 'TextClass'); |
| 142 | ok(!$meta->{text_class}->[2], 'TextClass'); |
| 143 | ok(!$meta->{author}, 'author'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 144 | |
| 145 | # Additional information |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 146 | ok(!$meta->{editor}, 'Editor'); |
| 147 | ok(!$meta->{publisher}, 'Publisher'); |
| 148 | is($meta->{creation_date}, "20000111", 'Creation date'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 149 | #ok(!$doc->coll_title, 'Collection title'); |
| 150 | #ok(!$doc->coll_sub_title, 'Collection subtitle'); |
| 151 | #ok(!$doc->coll_editor, 'Collection editor'); |
| 152 | #ok(!$doc->coll_author, 'Collection author'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 153 | ok(!$meta->{text_type}, 'text_type'); |
| 154 | is($meta->{text_type_art}, 'Bericht', 'text_type art'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 155 | |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 156 | # A01/02873-meta |
Akron | 9c0488f | 2016-01-28 14:17:15 +0100 | [diff] [blame] | 157 | $path = catdir(dirname(__FILE__), 'corpus/A00/02873-meta'); |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 158 | ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 159 | ok($doc->parse, 'Parse document'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 160 | $meta = $doc->meta; |
| 161 | |
| 162 | is($meta->{title}, 'Tradition und Moderne', 'title'); |
| 163 | ok(!$meta->{sub_title}, 'subTitle'); |
Nils Diewald | 840c924 | 2014-10-28 19:51:26 +0000 | [diff] [blame] | 164 | is($doc->text_sigle, 'A00_JAN.02873', 'ID'); |
| 165 | is($doc->corpus_sigle, 'A00', 'corpusID'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 166 | is($meta->{pub_date}, '20000113', 'pubDate'); |
| 167 | ok(!$meta->{pub_place}, 'pubPlace'); |
| 168 | is($meta->{text_class}->[0], 'kultur', 'TextClass'); |
| 169 | is($meta->{text_class}->[1], 'film', 'TextClass'); |
| 170 | ok(!$meta->{text_class}->[2], 'TextClass'); |
| 171 | ok(!$meta->{author}, 'author'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 172 | |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 173 | |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 174 | # Additional information |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 175 | ok(!$meta->{editor}, 'Editor'); |
| 176 | ok(!$meta->{publisher}, 'Publisher'); |
| 177 | is($meta->{creation_date}, "20000113", 'Creation date'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 178 | #ok(!$doc->coll_title, 'Collection title'); |
| 179 | #ok(!$doc->coll_sub_title, 'Collection subtitle'); |
| 180 | #ok(!$doc->coll_editor, 'Collection editor'); |
| 181 | #ok(!$doc->coll_author, 'Collection author'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 182 | ok(!$meta->{text_type}, 'text_type'); |
| 183 | is($meta->{text_type_art}, 'Bericht', 'text_type art'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 184 | |
| 185 | |
| 186 | # A01/05663-unbalanced |
Akron | 9c0488f | 2016-01-28 14:17:15 +0100 | [diff] [blame] | 187 | $path = catdir(dirname(__FILE__), 'corpus/A00/05663-unbalanced'); |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 188 | ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 189 | ok($doc->parse, 'Parse document'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 190 | $meta = $doc->meta; |
| 191 | |
| 192 | is($meta->{title}, 'Mehr Arbeitslose im Dezember', 'title'); |
| 193 | ok(!$meta->{sub_title}, 'subTitle'); |
Nils Diewald | 840c924 | 2014-10-28 19:51:26 +0000 | [diff] [blame] | 194 | is($doc->text_sigle, 'A00_JAN.05663', 'ID'); |
| 195 | is($doc->corpus_sigle, 'A00', 'corpusID'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 196 | is($meta->{pub_date}, '20000124', 'pubDate'); |
| 197 | ok(!$meta->{pub_place}, 'pubPlace'); |
| 198 | is($meta->{text_class}->[0], 'gesundheit-ernaehrung', 'TextClass'); |
| 199 | is($meta->{text_class}->[1], 'gesundheit', 'TextClass'); |
| 200 | ok(!$meta->{text_class}->[2], 'TextClass'); |
| 201 | ok(!$meta->{author}, 'author'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 202 | |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 203 | |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 204 | # Additional information |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 205 | ok(!$meta->{editor}, 'Editor'); |
| 206 | ok(!$meta->{publisher}, 'Publisher'); |
| 207 | is($meta->{creation_date}, "20000124", 'Creation date'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 208 | #ok(!$doc->coll_title, 'Collection title'); |
| 209 | #ok(!$doc->coll_sub_title, 'Collection subtitle'); |
| 210 | #ok(!$doc->coll_editor, 'Collection editor'); |
| 211 | #ok(!$doc->coll_author, 'Collection author'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 212 | ok(!$meta->{text_type}, 'text_type'); |
| 213 | is($meta->{text_type_art}, 'Bericht', 'text_type art'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 214 | |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 215 | # A01/07452-deep |
Akron | 9c0488f | 2016-01-28 14:17:15 +0100 | [diff] [blame] | 216 | $path = catdir(dirname(__FILE__), 'corpus/A00/07452-deep'); |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 217 | ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 218 | ok($doc->parse, 'Parse document'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 219 | $meta = $doc->meta; |
| 220 | |
| 221 | is($meta->{title}, 'Wil im Dezember 1999', 'title'); |
| 222 | ok(!$meta->{sub_title}, 'subTitle'); |
Nils Diewald | 840c924 | 2014-10-28 19:51:26 +0000 | [diff] [blame] | 223 | is($doc->text_sigle, 'A00_JAN.07452', 'ID'); |
| 224 | is($doc->corpus_sigle, 'A00', 'corpusID'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 225 | is($meta->{pub_date}, '20000129', 'pubDate'); |
| 226 | ok(!$meta->{pub_place}, 'pubPlace'); |
| 227 | is($meta->{text_class}->[0], 'politik', 'TextClass'); |
| 228 | is($meta->{text_class}->[1], 'kommunalpolitik', 'TextClass'); |
| 229 | ok(!$meta->{text_class}->[2], 'TextClass'); |
| 230 | ok(!$meta->{author}, 'author'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 231 | |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 232 | |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 233 | # Additional information |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 234 | ok(!$meta->{editor}, 'Editor'); |
| 235 | ok(!$meta->{publisher}, 'Publisher'); |
| 236 | is($meta->{creation_date}, "20000129", 'Creation date'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 237 | #ok(!$doc->coll_title, 'Collection title'); |
| 238 | #ok(!$doc->coll_sub_title, 'Collection subtitle'); |
| 239 | #ok(!$doc->coll_editor, 'Collection editor'); |
| 240 | #ok(!$doc->coll_author, 'Collection author'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 241 | ok(!$meta->{text_type}, 'text_type'); |
| 242 | is($meta->{text_type_art}, 'Bericht', 'text_type art'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 243 | |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 244 | # ART |
Akron | 9c0488f | 2016-01-28 14:17:15 +0100 | [diff] [blame] | 245 | $path = catdir(dirname(__FILE__), 'corpus/artificial'); |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 246 | ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 247 | #is($doc->path, $path . '/', 'Path'); |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 248 | |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 249 | ok($doc = KorAP::XML::Krill->new( path => $path ), 'Load Korap::Document'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 250 | #is($doc->path, $path . '/', 'Path'); |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 251 | |
| 252 | ok($doc->parse, 'Parse document'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 253 | $meta = $doc->meta; |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 254 | |
| 255 | # Metdata |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 256 | is($meta->{title}, 'Artificial Title', 'title'); |
| 257 | is($meta->{sub_title}, 'Artificial Subtitle', 'subTitle'); |
Nils Diewald | 840c924 | 2014-10-28 19:51:26 +0000 | [diff] [blame] | 258 | is($doc->text_sigle, 'ART_ABC.00001', 'ID'); |
| 259 | is($doc->corpus_sigle, 'ART', 'corpusID'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 260 | is($meta->{pub_date}, '20010402', 'pubDate'); |
| 261 | is($meta->{pub_place}, 'Mannheim', 'pubPlace'); |
| 262 | is($meta->{pub_place_key}, 'DE', 'pubPlace key'); |
| 263 | is($meta->{text_class}->[0], 'freizeit-unterhaltung', 'TextClass'); |
| 264 | is($meta->{text_class}->[1], 'vereine-veranstaltungen', 'TextClass'); |
| 265 | ok(!$meta->{text_class}->[2], 'TextClass'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 266 | #is($doc->author->[0], 'Ruru', 'author'); |
| 267 | #is($doc->author->[1], 'Jens.Ol', 'author'); |
| 268 | #is($doc->author->[2], 'Aglarech', 'author'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 269 | is($meta->{author}, 'Ruru; Jens.Ol; Aglarech; u.a.', 'author'); |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 270 | |
| 271 | # Additional information |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 272 | is($meta->{editor}, 'Nils Diewald', 'Editor'); |
| 273 | is($meta->{publisher}, 'Artificial articles Inc.', 'Publisher'); |
| 274 | is($meta->{creation_date}, '19990601', 'Creation date'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 275 | #is($doc->coll_title, 'Artificial articles', 'Collection title'); |
| 276 | #is($doc->coll_sub_title, 'Best of!', 'Collection subtitle'); |
| 277 | #is($doc->coll_editor, 'Nils Diewald', 'Collection editor'); |
| 278 | #is($doc->coll_author, 'Nils Diewald', 'Collection author'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 279 | is($meta->{text_type}, 'Zeitung: Tageszeitung', 'No text_type'); |
| 280 | is($meta->{text_type_art}, 'Bericht', 'text_type art'); |
| 281 | |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 282 | |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 283 | # Multipath headers |
Akron | 9c0488f | 2016-01-28 14:17:15 +0100 | [diff] [blame] | 284 | $path = catdir(dirname(__FILE__), 'corpus/VDI/JAN/00001'); |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 285 | ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 286 | like($doc->path, qr!$path/!, 'Path'); |
| 287 | |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 288 | ok($doc = KorAP::XML::Krill->new( path => $path ), 'Load Korap::Document'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 289 | like($doc->path, qr!$path/$!, 'Path'); |
| 290 | |
| 291 | ok($doc->parse, 'Parse document'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 292 | $meta = $doc->meta; |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 293 | |
| 294 | is($doc->text_sigle, 'VDI14_JAN.00001', 'text sigle'); |
| 295 | is($doc->doc_sigle, 'VDI14_JAN', 'doc sigle'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 296 | is($meta->corpus_sigle, 'VDI14', 'corpus sigle'); |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 297 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 298 | is($meta->{title}, '10- Zz mit Zahl', 'title'); |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 299 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 300 | ok(!$meta->{sub_title}, 'subtitle'); |
| 301 | is($meta->{pub_date}, '20140117', 'pubdate'); |
| 302 | is($meta->{pub_place}, 'Düsseldorf', 'pubplace'); |
| 303 | is($meta->{author}, 'Windhövel, Kerstin', 'author'); |
| 304 | is($meta->{publisher}, 'VDI Verlag GmbH', 'publisher'); |
| 305 | ok(!$meta->{editor}, 'editor'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 306 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 307 | ok(!$meta->{text_type}, 'text type'); |
| 308 | ok(!$meta->{text_type_art}, 'text type art'); |
| 309 | ok(!$meta->{text_type_ref}, 'text type ref'); |
| 310 | ok(!$meta->{text_column}, 'text column'); |
| 311 | ok(!$meta->{text_domain}, 'text domain'); |
| 312 | ok(!$meta->{creation_date}, 'creation date'); |
| 313 | ok(!$meta->{license}, 'License'); |
| 314 | ok(!$meta->{pages}, 'Pages'); |
| 315 | ok(!$meta->{file_edition_statement}, 'file edition statement'); |
| 316 | ok(!$meta->{bibl_edition_statement}, 'bibl edition statement'); |
| 317 | is($meta->{reference}, 'VDI nachrichten, 17.01.2014, S. 10; 10- Zz mit Zahl [Ausführliche Zitierung nicht verfügbar]', 'Reference'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 318 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 319 | ok(!$doc->{language}, 'Language'); |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 320 | # !!! |
| 321 | # diag 'This may be "de" in the future'; |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 322 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 323 | is($meta->{doc_title}, 'VDI nachrichten, Januar 2014', 'Doc title'); |
| 324 | ok(!$meta->{doc_sub_title}, 'Doc Sub title'); |
| 325 | ok(!$meta->{doc_editor}, 'Doc editor'); |
| 326 | ok(!$meta->{doc_author}, 'Doc author'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 327 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 328 | is($meta->{corpus_title}, 'VDI nachrichten', 'Corpus title'); |
| 329 | ok(!$meta->{corpus_sub_title}, 'Corpus Sub title'); |
| 330 | is($meta->{corpus_editor}, 'Verein Deutscher Ingenieure', 'Corpus editor'); |
| 331 | ok(!$meta->{corpus_author}, 'Corpus author'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 332 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 333 | is($meta->keywords('keywords'), '', 'Keywords'); |
| 334 | is($meta->keywords('text_class'), 'Freizeit-Unterhaltung Reisen Politik Ausland', 'Text class'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 335 | |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 336 | # WDD |
Akron | 9c0488f | 2016-01-28 14:17:15 +0100 | [diff] [blame] | 337 | $path = catdir(dirname(__FILE__), 'corpus/WDD/G27/38989'); |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 338 | ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 339 | like($doc->path, qr!$path/!, 'Path'); |
| 340 | ok($doc->parse, 'Parse document'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 341 | $meta = $doc->meta; |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 342 | |
| 343 | is($doc->text_sigle, 'WDD11_G27.38989', 'text sigle'); |
| 344 | is($doc->doc_sigle, 'WDD11_G27', 'doc sigle'); |
| 345 | is($doc->corpus_sigle, 'WDD11', 'corpus sigle'); |
| 346 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 347 | is($meta->{title}, 'Diskussion:Gunter A. Pilz', 'title'); |
| 348 | ok(!$meta->{sub_title}, 'subtitle'); |
| 349 | is($meta->{pub_date}, '20111029', 'pubdate'); |
| 350 | is($meta->{pub_place}, 'URL:http://de.wikipedia.org', 'pubplace'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 351 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 352 | is($meta->{author}, '€pa, u.a.', 'author'); |
| 353 | is($meta->{publisher}, 'Wikipedia', 'publisher'); |
| 354 | ok(!$meta->{editor}, 'editor'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 355 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 356 | is($meta->{text_type}, 'Diskussionen zu Enzyklopädie-Artikeln', 'text type'); |
| 357 | ok(!$meta->{text_type_art}, 'text type art'); |
| 358 | ok(!$meta->{text_type_ref}, 'text type ref'); |
| 359 | ok(!$meta->{text_column}, 'text column'); |
| 360 | ok(!$meta->{text_domain}, 'text domain'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 361 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 362 | is($meta->{creation_date}, '20070707', 'creation date'); |
| 363 | is($meta->{license}, 'CC-BY-SA', 'License'); |
| 364 | ok(!$meta->{pages}, 'Pages'); |
| 365 | ok(!$meta->{file_edition_statement}, 'file edition statement'); |
| 366 | ok(!$meta->{bibl_edition_statement}, 'bibl edition statement'); |
| 367 | is($meta->{reference}, 'Diskussion:Gunter A. Pilz, In: Wikipedia - URL:http://de.wikipedia.org/wiki/Diskussion:Gunter_A._Pilz: Wikipedia, 2007', 'Reference'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 368 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 369 | is($meta->{language}, 'de', 'Language'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 370 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 371 | is($meta->{doc_title}, 'Wikipedia, Diskussionen zu Artikeln mit Anfangsbuchstabe G, Teil 27', 'Doc title'); |
| 372 | ok(!$meta->{doc_sub_title}, 'Doc Sub title'); |
| 373 | ok(!$meta->{doc_editor}, 'Doc editor'); |
| 374 | ok(!$meta->{doc_author}, 'Doc author'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 375 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 376 | is($meta->{corpus_title}, 'Wikipedia', 'Corpus title'); |
| 377 | ok(!$meta->{corpus_sub_title}, 'Corpus Sub title'); |
| 378 | is($meta->{corpus_editor}, 'wikipedia.org', 'Corpus editor'); |
| 379 | ok(!$meta->{corpus_author}, 'Corpus author'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 380 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 381 | is($meta->keywords('keywords'), '', 'Keywords'); |
| 382 | is($meta->keywords('text_class'), '', 'Text class'); |
Nils Diewald | feccbb1 | 2015-06-18 20:06:45 +0000 | [diff] [blame] | 383 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame^] | 384 | is($meta->{availability}, 'CC-BY-SA', 'Availability'); |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 385 | |
| 386 | |
Nils Diewald | 8e323ee | 2014-04-23 17:28:14 +0000 | [diff] [blame] | 387 | done_testing; |
| 388 | __END__ |