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