blob: 54d5ce8b1306c2e859d6805e9d09102bd19eff21 [file] [log] [blame]
Nils Diewald8e323ee2014-04-23 17:28:14 +00001use strict;
2use warnings;
3use utf8;
4use Test::More;
5use Benchmark ':hireswallclock';
Akronfbf66382016-07-12 19:44:01 +02006use Mojo::DOM;
Akron3ec0a1c2017-01-18 14:41:55 +01007use Mojo::File;
Akronfbf66382016-07-12 19:44:01 +02008use Mojo::ByteStream 'b';
9use Data::Dumper;
Nils Diewald8e323ee2014-04-23 17:28:14 +000010use lib 'lib', '../lib';
11
12use File::Basename 'dirname';
13use File::Spec::Functions 'catdir';
14
Akrone4c2e412016-01-28 15:10:50 +010015use_ok('KorAP::XML::Krill');
Nils Diewald8e323ee2014-04-23 17:28:14 +000016
17# WPD/00001
Akron9c0488f2016-01-28 14:17:15 +010018my $path = catdir(dirname(__FILE__), 'corpus/WPD/00001');
Akrone4c2e412016-01-28 15:10:50 +010019ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +020020like($doc->path, qr!\Q$path\E/!, 'Path');
Nils Diewald8e323ee2014-04-23 17:28:14 +000021
Akrone4c2e412016-01-28 15:10:50 +010022ok($doc = KorAP::XML::Krill->new( path => $path ), 'Load Korap::Document');
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +020023like($doc->path, qr!\Q$path\E/$!, 'Path');
Nils Diewald8e323ee2014-04-23 17:28:14 +000024
25ok($doc->parse, 'Parse document');
26
27# Metdata
Akron1cd5b872016-03-22 00:23:46 +010028is($doc->text_sigle, 'WPD/AAA/00001', 'ID');
Nils Diewaldfeccbb12015-06-18 20:06:45 +000029
Akron35db6e32016-03-17 22:42:22 +010030my $meta = $doc->meta;
31is($meta->{title}, 'A', 'title');
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +020032
Akron35db6e32016-03-17 22:42:22 +010033ok(!$meta->{sub_title}, 'subTitle');
Nils Diewald840c9242014-10-28 19:51:26 +000034is($doc->corpus_sigle, 'WPD', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +010035is($meta->{pub_date}, '20050328', 'pubDate');
36is($meta->{pub_place}, 'URL:http://de.wikipedia.org', 'pubPlace');
37is($meta->{text_class}->[0], 'freizeit-unterhaltung', 'TextClass');
38is($meta->{text_class}->[1], 'reisen', 'TextClass');
39is($meta->{text_class}->[2], 'wissenschaft', 'TextClass');
40is($meta->{text_class}->[3], 'populaerwissenschaft', 'TextClass');
41ok(!$meta->{text_class}->[4], 'TextClass');
42is($meta->{author}, 'Ruru; Jens.Ol; Aglarech; u.a.', 'author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +000043
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +020044
Nils Diewaldfeccbb12015-06-18 20:06:45 +000045#is($doc->author->[0], 'Ruru', 'author');
46#is($doc->author->[1], 'Jens.Ol', 'author');
47#is($doc->author->[2], 'Aglarech', 'author');
48#ok(!$doc->author->[3], 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +000049
50# Additional information
Akron35db6e32016-03-17 22:42:22 +010051ok(!$meta->{editor}, 'Editor');
52is($meta->{publisher}, 'Wikipedia', 'Publisher');
53is($meta->{creation_date}, '20050000', 'Creation date');
54ok(!$meta->{text_type}, 'No text_type');
55ok(!$meta->{text_type_art}, 'no text_type art');
56ok(!$meta->{text_type_ref}, 'no text_type ref');
57ok(!$meta->{text_domain}, 'no text_domain');
58ok(!$meta->{text_column}, 'no text_column');
59ok(!$meta->keywords('keywords'), 'no keywords');
60is($meta->keywords('text_class'), 'freizeit-unterhaltung reisen wissenschaft populaerwissenschaft', 'no text classes');
Nils Diewaldfeccbb12015-06-18 20:06:45 +000061
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 Diewald8e323ee2014-04-23 17:28:14 +000066
Nils Diewald8e323ee2014-04-23 17:28:14 +000067# A01/13047
Akron9c0488f2016-01-28 14:17:15 +010068$path = catdir(dirname(__FILE__), 'corpus/A01/13047');
Akrone4c2e412016-01-28 15:10:50 +010069ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +000070
71ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +010072$meta = $doc->meta;
73is($meta->{title}, 'Fischer und Kolp im Sonnenhügel', 'title');
74
75ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +010076is($doc->text_sigle, 'A01/APR/13047', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +000077is($doc->corpus_sigle, 'A01', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +010078is($meta->{pub_date}, '20010402', 'pubDate');
79ok(!$meta->{pub_place}, 'pubPlace');
80is($meta->{text_class}->[0], 'freizeit-unterhaltung', 'TextClass');
81is($meta->{text_class}->[1], 'vereine-veranstaltungen', 'TextClass');
82ok(!$meta->{text_class}->[2], 'TextClass');
83ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +000084
85# Additional information
Akron35db6e32016-03-17 22:42:22 +010086ok(!$meta->{editor}, 'Editor');
87ok(!$meta->{publisher}, 'Publisher');
88is($meta->{creation_date}, '20010402', 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +000089#ok(!$doc->coll_title, 'Collection title');
90#ok(!$doc->coll_sub_title, 'Collection subtitle');
91#ok(!$doc->coll_editor, 'Collection editor');
92#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +010093ok(!$meta->{text_type}, 'text_type');
94is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +000095
Nils Diewald8e323ee2014-04-23 17:28:14 +000096# ERL/0001
Akron9c0488f2016-01-28 14:17:15 +010097$path = catdir(dirname(__FILE__), 'corpus/ERL/00001');
Akrone4c2e412016-01-28 15:10:50 +010098ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +000099
100ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100101
102$meta = $doc->meta;
103is($meta->{title}, 'Amtsblatt des Landesbezirks Baden [diverse Erlasse]', 'title'); # Amtsblatt des Landesbezirks Baden [diverse Erlasse]
Akrona8665782016-01-27 21:47:57 +0100104# MK2/ERL.00001
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000105
Akron35db6e32016-03-17 22:42:22 +0100106ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100107is($doc->text_sigle, 'MK2/ERL/00001', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000108is($doc->corpus_sigle, 'MK2', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100109is($meta->{pub_date}, '00000000', 'pubDate');
110is($meta->{pub_place}, 'Karlsruhe', 'pubPlace');
111is($meta->{text_class}->[0], 'politik', 'TextClass');
112is($meta->{text_class}->[1], 'kommunalpolitik', 'TextClass');
113ok(!$meta->{text_class}->[2], 'TextClass');
114ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000115
116# Additional information
Akron35db6e32016-03-17 22:42:22 +0100117ok(!$meta->{editor}, 'Editor');
118is($meta->{publisher}, 'Badenia Verlag und Druckerei', 'Publisher');
119is($meta->{creation_date}, '19600000', 'Creation date');
Akrona8665782016-01-27 21:47:57 +0100120
121# !!!
122# diag 'Non-acceptance of creation date ranges may be temporary';
123
124
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000125#ok(!$doc->coll_title, 'Collection title');
126#ok(!$doc->coll_sub_title, 'Collection subtitle');
127#ok(!$doc->coll_editor, 'Collection editor');
128#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100129is($meta->{text_type}, 'Erlass', 'text_type');
130ok(!$meta->{text_type_art}, 'text_type art');
131
Nils Diewald8e323ee2014-04-23 17:28:14 +0000132
Nils Diewald8e323ee2014-04-23 17:28:14 +0000133# A01/02035-substring
Akron9c0488f2016-01-28 14:17:15 +0100134$path = catdir(dirname(__FILE__), 'corpus/A00/02035-substring');
Akrone4c2e412016-01-28 15:10:50 +0100135ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000136ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100137
138$meta = $doc->meta;
139
140is($meta->{title}, 'St. Galler Tagblatt, 11.01.2000, Ressort: TB-RSP (Abk.)', 'title'); # A00/JAN.02035
141ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100142is($doc->text_sigle, 'A00/JAN/02035', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000143is($doc->corpus_sigle, 'A00', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100144is($meta->{pub_date}, '20000111', 'pubDate');
145ok(!$meta->{pub_place}, 'pubPlace');
146is($meta->{text_class}->[0], 'sport', 'TextClass');
147is($meta->{text_class}->[1], 'ballsport', 'TextClass');
148ok(!$meta->{text_class}->[2], 'TextClass');
149ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000150
151# Additional information
Akron35db6e32016-03-17 22:42:22 +0100152ok(!$meta->{editor}, 'Editor');
153ok(!$meta->{publisher}, 'Publisher');
154is($meta->{creation_date}, "20000111", 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000155#ok(!$doc->coll_title, 'Collection title');
156#ok(!$doc->coll_sub_title, 'Collection subtitle');
157#ok(!$doc->coll_editor, 'Collection editor');
158#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100159ok(!$meta->{text_type}, 'text_type');
160is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000161
Nils Diewald8e323ee2014-04-23 17:28:14 +0000162# A01/02873-meta
Akron9c0488f2016-01-28 14:17:15 +0100163$path = catdir(dirname(__FILE__), 'corpus/A00/02873-meta');
Akrone4c2e412016-01-28 15:10:50 +0100164ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000165ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100166$meta = $doc->meta;
167
168is($meta->{title}, 'Tradition und Moderne', 'title');
169ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100170is($doc->text_sigle, 'A00/JAN/02873', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000171is($doc->corpus_sigle, 'A00', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100172is($meta->{pub_date}, '20000113', 'pubDate');
173ok(!$meta->{pub_place}, 'pubPlace');
174is($meta->{text_class}->[0], 'kultur', 'TextClass');
175is($meta->{text_class}->[1], 'film', 'TextClass');
176ok(!$meta->{text_class}->[2], 'TextClass');
177ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000178
Akrona8665782016-01-27 21:47:57 +0100179
Nils Diewald8e323ee2014-04-23 17:28:14 +0000180# Additional information
Akron35db6e32016-03-17 22:42:22 +0100181ok(!$meta->{editor}, 'Editor');
182ok(!$meta->{publisher}, 'Publisher');
183is($meta->{creation_date}, "20000113", 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000184#ok(!$doc->coll_title, 'Collection title');
185#ok(!$doc->coll_sub_title, 'Collection subtitle');
186#ok(!$doc->coll_editor, 'Collection editor');
187#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100188ok(!$meta->{text_type}, 'text_type');
189is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000190
191
192# A01/05663-unbalanced
Akron9c0488f2016-01-28 14:17:15 +0100193$path = catdir(dirname(__FILE__), 'corpus/A00/05663-unbalanced');
Akrone4c2e412016-01-28 15:10:50 +0100194ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000195ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100196$meta = $doc->meta;
197
198is($meta->{title}, 'Mehr Arbeitslose im Dezember', 'title');
199ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100200is($doc->text_sigle, 'A00/JAN/05663', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000201is($doc->corpus_sigle, 'A00', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100202is($meta->{pub_date}, '20000124', 'pubDate');
203ok(!$meta->{pub_place}, 'pubPlace');
204is($meta->{text_class}->[0], 'gesundheit-ernaehrung', 'TextClass');
205is($meta->{text_class}->[1], 'gesundheit', 'TextClass');
206ok(!$meta->{text_class}->[2], 'TextClass');
207ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000208
Akrona8665782016-01-27 21:47:57 +0100209
Nils Diewald8e323ee2014-04-23 17:28:14 +0000210# Additional information
Akron35db6e32016-03-17 22:42:22 +0100211ok(!$meta->{editor}, 'Editor');
212ok(!$meta->{publisher}, 'Publisher');
213is($meta->{creation_date}, "20000124", 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000214#ok(!$doc->coll_title, 'Collection title');
215#ok(!$doc->coll_sub_title, 'Collection subtitle');
216#ok(!$doc->coll_editor, 'Collection editor');
217#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100218ok(!$meta->{text_type}, 'text_type');
219is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000220
Nils Diewald8e323ee2014-04-23 17:28:14 +0000221# A01/07452-deep
Akron9c0488f2016-01-28 14:17:15 +0100222$path = catdir(dirname(__FILE__), 'corpus/A00/07452-deep');
Akrone4c2e412016-01-28 15:10:50 +0100223ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000224ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100225$meta = $doc->meta;
226
227is($meta->{title}, 'Wil im Dezember 1999', 'title');
228ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100229is($doc->text_sigle, 'A00/JAN/07452', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000230is($doc->corpus_sigle, 'A00', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100231is($meta->{pub_date}, '20000129', 'pubDate');
232ok(!$meta->{pub_place}, 'pubPlace');
233is($meta->{text_class}->[0], 'politik', 'TextClass');
234is($meta->{text_class}->[1], 'kommunalpolitik', 'TextClass');
235ok(!$meta->{text_class}->[2], 'TextClass');
236ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000237
Akrona8665782016-01-27 21:47:57 +0100238
Nils Diewald8e323ee2014-04-23 17:28:14 +0000239# Additional information
Akron35db6e32016-03-17 22:42:22 +0100240ok(!$meta->{editor}, 'Editor');
241ok(!$meta->{publisher}, 'Publisher');
242is($meta->{creation_date}, "20000129", 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000243#ok(!$doc->coll_title, 'Collection title');
244#ok(!$doc->coll_sub_title, 'Collection subtitle');
245#ok(!$doc->coll_editor, 'Collection editor');
246#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100247ok(!$meta->{text_type}, 'text_type');
248is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000249
Nils Diewald98767bb2014-04-25 20:31:19 +0000250# ART
Akron9c0488f2016-01-28 14:17:15 +0100251$path = catdir(dirname(__FILE__), 'corpus/artificial');
Akrone4c2e412016-01-28 15:10:50 +0100252ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000253#is($doc->path, $path . '/', 'Path');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000254
Akrone4c2e412016-01-28 15:10:50 +0100255ok($doc = KorAP::XML::Krill->new( path => $path ), 'Load Korap::Document');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000256#is($doc->path, $path . '/', 'Path');
Nils Diewald98767bb2014-04-25 20:31:19 +0000257
258ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100259$meta = $doc->meta;
Nils Diewald98767bb2014-04-25 20:31:19 +0000260
261# Metdata
Akron35db6e32016-03-17 22:42:22 +0100262is($meta->{title}, 'Artificial Title', 'title');
263is($meta->{sub_title}, 'Artificial Subtitle', 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100264is($doc->text_sigle, 'ART/ABC/00001', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000265is($doc->corpus_sigle, 'ART', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100266is($meta->{pub_date}, '20010402', 'pubDate');
267is($meta->{pub_place}, 'Mannheim', 'pubPlace');
268is($meta->{pub_place_key}, 'DE', 'pubPlace key');
269is($meta->{text_class}->[0], 'freizeit-unterhaltung', 'TextClass');
270is($meta->{text_class}->[1], 'vereine-veranstaltungen', 'TextClass');
271ok(!$meta->{text_class}->[2], 'TextClass');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000272#is($doc->author->[0], 'Ruru', 'author');
273#is($doc->author->[1], 'Jens.Ol', 'author');
274#is($doc->author->[2], 'Aglarech', 'author');
Akron35db6e32016-03-17 22:42:22 +0100275is($meta->{author}, 'Ruru; Jens.Ol; Aglarech; u.a.', 'author');
Nils Diewald98767bb2014-04-25 20:31:19 +0000276
277# Additional information
Akron35db6e32016-03-17 22:42:22 +0100278is($meta->{editor}, 'Nils Diewald', 'Editor');
279is($meta->{publisher}, 'Artificial articles Inc.', 'Publisher');
280is($meta->{creation_date}, '19990601', 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000281#is($doc->coll_title, 'Artificial articles', 'Collection title');
282#is($doc->coll_sub_title, 'Best of!', 'Collection subtitle');
283#is($doc->coll_editor, 'Nils Diewald', 'Collection editor');
284#is($doc->coll_author, 'Nils Diewald', 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100285is($meta->{text_type}, 'Zeitung: Tageszeitung', 'No text_type');
286is($meta->{text_type_art}, 'Bericht', 'text_type art');
287
Nils Diewald8e323ee2014-04-23 17:28:14 +0000288
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000289# Multipath headers
Akron9c0488f2016-01-28 14:17:15 +0100290$path = catdir(dirname(__FILE__), 'corpus/VDI/JAN/00001');
Akrone4c2e412016-01-28 15:10:50 +0100291ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +0200292like($doc->path, qr!\Q$path\E/!, 'Path');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000293
Akrone4c2e412016-01-28 15:10:50 +0100294ok($doc = KorAP::XML::Krill->new( path => $path ), 'Load Korap::Document');
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +0200295like($doc->path, qr!\Q$path\E/$!, 'Path');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000296
297ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100298$meta = $doc->meta;
Akrona8665782016-01-27 21:47:57 +0100299
Akron1cd5b872016-03-22 00:23:46 +0100300is($doc->text_sigle, 'VDI14/JAN/00001', 'text sigle');
301is($doc->doc_sigle, 'VDI14/JAN', 'doc sigle');
Akron35db6e32016-03-17 22:42:22 +0100302is($meta->corpus_sigle, 'VDI14', 'corpus sigle');
Akrona8665782016-01-27 21:47:57 +0100303
Akron35db6e32016-03-17 22:42:22 +0100304is($meta->{title}, '10- Zz mit Zahl', 'title');
Akrona8665782016-01-27 21:47:57 +0100305
Akron35db6e32016-03-17 22:42:22 +0100306ok(!$meta->{sub_title}, 'subtitle');
307is($meta->{pub_date}, '20140117', 'pubdate');
308is($meta->{pub_place}, 'Düsseldorf', 'pubplace');
309is($meta->{author}, 'Windhövel, Kerstin', 'author');
310is($meta->{publisher}, 'VDI Verlag GmbH', 'publisher');
311ok(!$meta->{editor}, 'editor');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000312
Akron35db6e32016-03-17 22:42:22 +0100313ok(!$meta->{text_type}, 'text type');
314ok(!$meta->{text_type_art}, 'text type art');
315ok(!$meta->{text_type_ref}, 'text type ref');
316ok(!$meta->{text_column}, 'text column');
317ok(!$meta->{text_domain}, 'text domain');
318ok(!$meta->{creation_date}, 'creation date');
Akron6396c302016-03-18 16:05:39 +0100319ok(!$meta->{availability}, 'License');
Akron35db6e32016-03-17 22:42:22 +0100320ok(!$meta->{pages}, 'Pages');
321ok(!$meta->{file_edition_statement}, 'file edition statement');
322ok(!$meta->{bibl_edition_statement}, 'bibl edition statement');
323is($meta->{reference}, 'VDI nachrichten, 17.01.2014, S. 10; 10- Zz mit Zahl [Ausführliche Zitierung nicht verfügbar]', 'Reference');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000324
Akron35db6e32016-03-17 22:42:22 +0100325ok(!$doc->{language}, 'Language');
Akrona8665782016-01-27 21:47:57 +0100326# !!!
327# diag 'This may be "de" in the future';
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000328
Akron35db6e32016-03-17 22:42:22 +0100329is($meta->{doc_title}, 'VDI nachrichten, Januar 2014', 'Doc title');
330ok(!$meta->{doc_sub_title}, 'Doc Sub title');
331ok(!$meta->{doc_editor}, 'Doc editor');
332ok(!$meta->{doc_author}, 'Doc author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000333
Akron35db6e32016-03-17 22:42:22 +0100334is($meta->{corpus_title}, 'VDI nachrichten', 'Corpus title');
335ok(!$meta->{corpus_sub_title}, 'Corpus Sub title');
336is($meta->{corpus_editor}, 'Verein Deutscher Ingenieure', 'Corpus editor');
337ok(!$meta->{corpus_author}, 'Corpus author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000338
Akron35db6e32016-03-17 22:42:22 +0100339is($meta->keywords('keywords'), '', 'Keywords');
340is($meta->keywords('text_class'), 'Freizeit-Unterhaltung Reisen Politik Ausland', 'Text class');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000341
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000342# WDD
Akron9c0488f2016-01-28 14:17:15 +0100343$path = catdir(dirname(__FILE__), 'corpus/WDD/G27/38989');
Akrone4c2e412016-01-28 15:10:50 +0100344ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +0200345like($doc->path, qr!\Q$path\E/!, 'Path');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000346ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100347$meta = $doc->meta;
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000348
Akron1cd5b872016-03-22 00:23:46 +0100349is($doc->text_sigle, 'WDD11/G27/38989', 'text sigle');
350is($doc->doc_sigle, 'WDD11/G27', 'doc sigle');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000351is($doc->corpus_sigle, 'WDD11', 'corpus sigle');
352
Akron35db6e32016-03-17 22:42:22 +0100353is($meta->{title}, 'Diskussion:Gunter A. Pilz', 'title');
354ok(!$meta->{sub_title}, 'subtitle');
355is($meta->{pub_date}, '20111029', 'pubdate');
356is($meta->{pub_place}, 'URL:http://de.wikipedia.org', 'pubplace');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000357
Akron35db6e32016-03-17 22:42:22 +0100358is($meta->{author}, '€pa, u.a.', 'author');
359is($meta->{publisher}, 'Wikipedia', 'publisher');
360ok(!$meta->{editor}, 'editor');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000361
Akron35db6e32016-03-17 22:42:22 +0100362is($meta->{text_type}, 'Diskussionen zu Enzyklopädie-Artikeln', 'text type');
363ok(!$meta->{text_type_art}, 'text type art');
364ok(!$meta->{text_type_ref}, 'text type ref');
365ok(!$meta->{text_column}, 'text column');
366ok(!$meta->{text_domain}, 'text domain');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000367
Akron35db6e32016-03-17 22:42:22 +0100368is($meta->{creation_date}, '20070707', 'creation date');
Akron6396c302016-03-18 16:05:39 +0100369is($meta->{availability}, 'CC-BY-SA', 'License');
Akron35db6e32016-03-17 22:42:22 +0100370ok(!$meta->{pages}, 'Pages');
371ok(!$meta->{file_edition_statement}, 'file edition statement');
372ok(!$meta->{bibl_edition_statement}, 'bibl edition statement');
373is($meta->{reference}, 'Diskussion:Gunter A. Pilz, In: Wikipedia - URL:http://de.wikipedia.org/wiki/Diskussion:Gunter_A._Pilz: Wikipedia, 2007', 'Reference');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000374
Akron35db6e32016-03-17 22:42:22 +0100375is($meta->{language}, 'de', 'Language');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000376
Akron35db6e32016-03-17 22:42:22 +0100377is($meta->{doc_title}, 'Wikipedia, Diskussionen zu Artikeln mit Anfangsbuchstabe G, Teil 27', 'Doc title');
378ok(!$meta->{doc_sub_title}, 'Doc Sub title');
379ok(!$meta->{doc_editor}, 'Doc editor');
380ok(!$meta->{doc_author}, 'Doc author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000381
Akron35db6e32016-03-17 22:42:22 +0100382is($meta->{corpus_title}, 'Wikipedia', 'Corpus title');
383ok(!$meta->{corpus_sub_title}, 'Corpus Sub title');
384is($meta->{corpus_editor}, 'wikipedia.org', 'Corpus editor');
385ok(!$meta->{corpus_author}, 'Corpus author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000386
Akron35db6e32016-03-17 22:42:22 +0100387is($meta->keywords('keywords'), '', 'Keywords');
388is($meta->keywords('text_class'), '', 'Text class');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000389
Akron35db6e32016-03-17 22:42:22 +0100390is($meta->{availability}, 'CC-BY-SA', 'Availability');
Akrona8665782016-01-27 21:47:57 +0100391
Akronfbf66382016-07-12 19:44:01 +0200392use_ok('KorAP::XML::Meta::I5');
393
394$path = catdir(dirname(__FILE__), 'corpus', 'I5', 'rei-example.i5');
395ok($meta = KorAP::XML::Meta::I5->new, 'Construct meta object');
Akron3ec0a1c2017-01-18 14:41:55 +0100396my $dom = Mojo::DOM->new->parse(Mojo::File->new($path)->slurp);
Akronfbf66382016-07-12 19:44:01 +0200397ok($meta->parse($dom->at('idsHeader'), 'corpus'), 'Parse corpus header');
398
399my $hash = $meta->to_hash;
400is($hash->{availability}, 'CC-BY-SA', 'Availability');
401is($hash->{language}, 'de', 'Language');
402is($hash->{corpus_title}, 'Reden und Interviews', 'Corpus title');
403is($hash->{corpus_sigle}, 'REI', 'Corpus Sigle');
404
405ok($meta->parse($dom->find('idsHeader')->[1], 'doc'), 'Parse corpus header');
406
407$hash = $meta->to_hash;
408is($hash->{availability}, 'CC-BY-SA', 'Availability');
409is($hash->{language}, 'de', 'Language');
410is($hash->{corpus_title}, 'Reden und Interviews', 'Corpus title');
411is($hash->{corpus_sigle}, 'REI', 'Corpus Sigle');
412is($hash->{doc_sigle}, 'REI/BNG', 'Document Sigle');
413is($hash->{doc_title}, 'Reden der Bundestagsfraktion Bündnis 90/DIE GRÜNEN, (2002-2006)', 'Document Sigle');
414
415ok($meta->parse($dom->find('idsHeader')->[2], 'text'), 'Parse corpus header');
416
417$hash = $meta->to_hash;
418is($hash->{availability}, 'CC-BY-SA', 'Availability');
419is($hash->{language}, 'de', 'Language');
420is($hash->{corpus_title}, 'Reden und Interviews', 'Corpus title');
421is($hash->{corpus_sigle}, 'REI', 'Corpus Sigle');
422is($hash->{doc_sigle}, 'REI/BNG', 'Document Sigle');
423is($hash->{doc_title}, 'Reden der Bundestagsfraktion Bündnis 90/DIE GRÜNEN, (2002-2006)', 'Document Sigle');
424
425is($hash->{text_sigle}, 'REI/BNG/00001');
426is($hash->{title}, 'Energiewirtschaft');
427is($hash->{sub_title}, 'Rede im Deutschen Bundestag am 19.01.2002');
428is($hash->{creation_date}, '20020119');
429is($hash->{pub_date}, '20020119');
430is($hash->{pub_place_key}, 'DE');
431is($hash->{reference}, 'Hustedt, Michaele: Energiewirtschaft. Rede im Deutschen Bundestag am 19.01.2002, Hrsg: Bundestagsfraktion Bündnis 90/DIE GRÜNEN [Ausführliche Zitierung nicht verfügbar]');
432is($hash->{text_class}->[0], 'politik');
433is($hash->{text_class}->[1], 'inland');
434is($hash->{author}, 'Hustedt, Michaele');
435is($hash->{pub_place}, 'Berlin');
Akrona8665782016-01-27 21:47:57 +0100436
Nils Diewald8e323ee2014-04-23 17:28:14 +0000437done_testing;
438__END__
Akronfbf66382016-07-12 19:44:01 +0200439
440
441