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