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