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