blob: a775cbd3d594680a81c5ca5d98d4b608e1d56dcc [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;
7use Mojo::ByteStream 'b';
8use Data::Dumper;
Nils Diewald8e323ee2014-04-23 17:28:14 +00009use lib 'lib', '../lib';
10
11use File::Basename 'dirname';
12use File::Spec::Functions 'catdir';
13
Akrone4c2e412016-01-28 15:10:50 +010014use_ok('KorAP::XML::Krill');
Nils Diewald8e323ee2014-04-23 17:28:14 +000015
16# WPD/00001
Akron9c0488f2016-01-28 14:17:15 +010017my $path = catdir(dirname(__FILE__), 'corpus/WPD/00001');
Akrone4c2e412016-01-28 15:10:50 +010018ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +020019like($doc->path, qr!\Q$path\E/!, 'Path');
Nils Diewald8e323ee2014-04-23 17:28:14 +000020
Akrone4c2e412016-01-28 15:10:50 +010021ok($doc = KorAP::XML::Krill->new( path => $path ), 'Load Korap::Document');
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +020022like($doc->path, qr!\Q$path\E/$!, 'Path');
Nils Diewald8e323ee2014-04-23 17:28:14 +000023
24ok($doc->parse, 'Parse document');
25
26# Metdata
Akron1cd5b872016-03-22 00:23:46 +010027is($doc->text_sigle, 'WPD/AAA/00001', 'ID');
Nils Diewaldfeccbb12015-06-18 20:06:45 +000028
Akron35db6e32016-03-17 22:42:22 +010029my $meta = $doc->meta;
30is($meta->{title}, 'A', 'title');
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +020031
Akron35db6e32016-03-17 22:42:22 +010032ok(!$meta->{sub_title}, 'subTitle');
Nils Diewald840c9242014-10-28 19:51:26 +000033is($doc->corpus_sigle, 'WPD', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +010034is($meta->{pub_date}, '20050328', 'pubDate');
35is($meta->{pub_place}, 'URL:http://de.wikipedia.org', 'pubPlace');
36is($meta->{text_class}->[0], 'freizeit-unterhaltung', 'TextClass');
37is($meta->{text_class}->[1], 'reisen', 'TextClass');
38is($meta->{text_class}->[2], 'wissenschaft', 'TextClass');
39is($meta->{text_class}->[3], 'populaerwissenschaft', 'TextClass');
40ok(!$meta->{text_class}->[4], 'TextClass');
41is($meta->{author}, 'Ruru; Jens.Ol; Aglarech; u.a.', 'author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +000042
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +020043
Nils Diewaldfeccbb12015-06-18 20:06:45 +000044#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 Diewald8e323ee2014-04-23 17:28:14 +000048
49# Additional information
Akron35db6e32016-03-17 22:42:22 +010050ok(!$meta->{editor}, 'Editor');
51is($meta->{publisher}, 'Wikipedia', 'Publisher');
52is($meta->{creation_date}, '20050000', 'Creation date');
53ok(!$meta->{text_type}, 'No text_type');
54ok(!$meta->{text_type_art}, 'no text_type art');
55ok(!$meta->{text_type_ref}, 'no text_type ref');
56ok(!$meta->{text_domain}, 'no text_domain');
57ok(!$meta->{text_column}, 'no text_column');
58ok(!$meta->keywords('keywords'), 'no keywords');
59is($meta->keywords('text_class'), 'freizeit-unterhaltung reisen wissenschaft populaerwissenschaft', 'no text classes');
Nils Diewaldfeccbb12015-06-18 20:06:45 +000060
61#is($doc->coll_title, 'Wikipedia', 'Collection title');
62#is($doc->coll_sub_title, 'Die freie Enzyklopädie', 'Collection subtitle');
63#is($doc->coll_editor, 'wikipedia.org', 'Collection editor');
64#ok(!$doc->coll_author, 'Collection author');
Nils Diewald8e323ee2014-04-23 17:28:14 +000065
Nils Diewald8e323ee2014-04-23 17:28:14 +000066# A01/13047
Akron9c0488f2016-01-28 14:17:15 +010067$path = catdir(dirname(__FILE__), 'corpus/A01/13047');
Akrone4c2e412016-01-28 15:10:50 +010068ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +000069
70ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +010071$meta = $doc->meta;
72is($meta->{title}, 'Fischer und Kolp im Sonnenhügel', 'title');
73
74ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +010075is($doc->text_sigle, 'A01/APR/13047', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +000076is($doc->corpus_sigle, 'A01', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +010077is($meta->{pub_date}, '20010402', 'pubDate');
78ok(!$meta->{pub_place}, 'pubPlace');
79is($meta->{text_class}->[0], 'freizeit-unterhaltung', 'TextClass');
80is($meta->{text_class}->[1], 'vereine-veranstaltungen', 'TextClass');
81ok(!$meta->{text_class}->[2], 'TextClass');
82ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +000083
84# Additional information
Akron35db6e32016-03-17 22:42:22 +010085ok(!$meta->{editor}, 'Editor');
86ok(!$meta->{publisher}, 'Publisher');
87is($meta->{creation_date}, '20010402', 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +000088#ok(!$doc->coll_title, 'Collection title');
89#ok(!$doc->coll_sub_title, 'Collection subtitle');
90#ok(!$doc->coll_editor, 'Collection editor');
91#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +010092ok(!$meta->{text_type}, 'text_type');
93is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +000094
Nils Diewald8e323ee2014-04-23 17:28:14 +000095# ERL/0001
Akron9c0488f2016-01-28 14:17:15 +010096$path = catdir(dirname(__FILE__), 'corpus/ERL/00001');
Akrone4c2e412016-01-28 15:10:50 +010097ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +000098
99ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100100
101$meta = $doc->meta;
102is($meta->{title}, 'Amtsblatt des Landesbezirks Baden [diverse Erlasse]', 'title'); # Amtsblatt des Landesbezirks Baden [diverse Erlasse]
Akrona8665782016-01-27 21:47:57 +0100103# MK2/ERL.00001
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000104
Akron35db6e32016-03-17 22:42:22 +0100105ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100106is($doc->text_sigle, 'MK2/ERL/00001', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000107is($doc->corpus_sigle, 'MK2', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100108is($meta->{pub_date}, '00000000', 'pubDate');
109is($meta->{pub_place}, 'Karlsruhe', 'pubPlace');
110is($meta->{text_class}->[0], 'politik', 'TextClass');
111is($meta->{text_class}->[1], 'kommunalpolitik', 'TextClass');
112ok(!$meta->{text_class}->[2], 'TextClass');
113ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000114
115# Additional information
Akron35db6e32016-03-17 22:42:22 +0100116ok(!$meta->{editor}, 'Editor');
117is($meta->{publisher}, 'Badenia Verlag und Druckerei', 'Publisher');
118is($meta->{creation_date}, '19600000', 'Creation date');
Akrona8665782016-01-27 21:47:57 +0100119
120# !!!
121# diag 'Non-acceptance of creation date ranges may be temporary';
122
123
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000124#ok(!$doc->coll_title, 'Collection title');
125#ok(!$doc->coll_sub_title, 'Collection subtitle');
126#ok(!$doc->coll_editor, 'Collection editor');
127#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100128is($meta->{text_type}, 'Erlass', 'text_type');
129ok(!$meta->{text_type_art}, 'text_type art');
130
Nils Diewald8e323ee2014-04-23 17:28:14 +0000131
Nils Diewald8e323ee2014-04-23 17:28:14 +0000132# A01/02035-substring
Akron9c0488f2016-01-28 14:17:15 +0100133$path = catdir(dirname(__FILE__), 'corpus/A00/02035-substring');
Akrone4c2e412016-01-28 15:10:50 +0100134ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000135ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100136
137$meta = $doc->meta;
138
139is($meta->{title}, 'St. Galler Tagblatt, 11.01.2000, Ressort: TB-RSP (Abk.)', 'title'); # A00/JAN.02035
140ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100141is($doc->text_sigle, 'A00/JAN/02035', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000142is($doc->corpus_sigle, 'A00', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100143is($meta->{pub_date}, '20000111', 'pubDate');
144ok(!$meta->{pub_place}, 'pubPlace');
145is($meta->{text_class}->[0], 'sport', 'TextClass');
146is($meta->{text_class}->[1], 'ballsport', 'TextClass');
147ok(!$meta->{text_class}->[2], 'TextClass');
148ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000149
150# Additional information
Akron35db6e32016-03-17 22:42:22 +0100151ok(!$meta->{editor}, 'Editor');
152ok(!$meta->{publisher}, 'Publisher');
153is($meta->{creation_date}, "20000111", 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000154#ok(!$doc->coll_title, 'Collection title');
155#ok(!$doc->coll_sub_title, 'Collection subtitle');
156#ok(!$doc->coll_editor, 'Collection editor');
157#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100158ok(!$meta->{text_type}, 'text_type');
159is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000160
Nils Diewald8e323ee2014-04-23 17:28:14 +0000161# A01/02873-meta
Akron9c0488f2016-01-28 14:17:15 +0100162$path = catdir(dirname(__FILE__), 'corpus/A00/02873-meta');
Akrone4c2e412016-01-28 15:10:50 +0100163ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000164ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100165$meta = $doc->meta;
166
167is($meta->{title}, 'Tradition und Moderne', 'title');
168ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100169is($doc->text_sigle, 'A00/JAN/02873', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000170is($doc->corpus_sigle, 'A00', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100171is($meta->{pub_date}, '20000113', 'pubDate');
172ok(!$meta->{pub_place}, 'pubPlace');
173is($meta->{text_class}->[0], 'kultur', 'TextClass');
174is($meta->{text_class}->[1], 'film', 'TextClass');
175ok(!$meta->{text_class}->[2], 'TextClass');
176ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000177
Akrona8665782016-01-27 21:47:57 +0100178
Nils Diewald8e323ee2014-04-23 17:28:14 +0000179# Additional information
Akron35db6e32016-03-17 22:42:22 +0100180ok(!$meta->{editor}, 'Editor');
181ok(!$meta->{publisher}, 'Publisher');
182is($meta->{creation_date}, "20000113", 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000183#ok(!$doc->coll_title, 'Collection title');
184#ok(!$doc->coll_sub_title, 'Collection subtitle');
185#ok(!$doc->coll_editor, 'Collection editor');
186#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100187ok(!$meta->{text_type}, 'text_type');
188is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000189
190
191# A01/05663-unbalanced
Akron9c0488f2016-01-28 14:17:15 +0100192$path = catdir(dirname(__FILE__), 'corpus/A00/05663-unbalanced');
Akrone4c2e412016-01-28 15:10:50 +0100193ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000194ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100195$meta = $doc->meta;
196
197is($meta->{title}, 'Mehr Arbeitslose im Dezember', 'title');
198ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100199is($doc->text_sigle, 'A00/JAN/05663', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000200is($doc->corpus_sigle, 'A00', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100201is($meta->{pub_date}, '20000124', 'pubDate');
202ok(!$meta->{pub_place}, 'pubPlace');
203is($meta->{text_class}->[0], 'gesundheit-ernaehrung', 'TextClass');
204is($meta->{text_class}->[1], 'gesundheit', 'TextClass');
205ok(!$meta->{text_class}->[2], 'TextClass');
206ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000207
Akrona8665782016-01-27 21:47:57 +0100208
Nils Diewald8e323ee2014-04-23 17:28:14 +0000209# Additional information
Akron35db6e32016-03-17 22:42:22 +0100210ok(!$meta->{editor}, 'Editor');
211ok(!$meta->{publisher}, 'Publisher');
212is($meta->{creation_date}, "20000124", 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000213#ok(!$doc->coll_title, 'Collection title');
214#ok(!$doc->coll_sub_title, 'Collection subtitle');
215#ok(!$doc->coll_editor, 'Collection editor');
216#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100217ok(!$meta->{text_type}, 'text_type');
218is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000219
Nils Diewald8e323ee2014-04-23 17:28:14 +0000220# A01/07452-deep
Akron9c0488f2016-01-28 14:17:15 +0100221$path = catdir(dirname(__FILE__), 'corpus/A00/07452-deep');
Akrone4c2e412016-01-28 15:10:50 +0100222ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000223ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100224$meta = $doc->meta;
225
226is($meta->{title}, 'Wil im Dezember 1999', 'title');
227ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100228is($doc->text_sigle, 'A00/JAN/07452', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000229is($doc->corpus_sigle, 'A00', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100230is($meta->{pub_date}, '20000129', 'pubDate');
231ok(!$meta->{pub_place}, 'pubPlace');
232is($meta->{text_class}->[0], 'politik', 'TextClass');
233is($meta->{text_class}->[1], 'kommunalpolitik', 'TextClass');
234ok(!$meta->{text_class}->[2], 'TextClass');
235ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000236
Akrona8665782016-01-27 21:47:57 +0100237
Nils Diewald8e323ee2014-04-23 17:28:14 +0000238# Additional information
Akron35db6e32016-03-17 22:42:22 +0100239ok(!$meta->{editor}, 'Editor');
240ok(!$meta->{publisher}, 'Publisher');
241is($meta->{creation_date}, "20000129", 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000242#ok(!$doc->coll_title, 'Collection title');
243#ok(!$doc->coll_sub_title, 'Collection subtitle');
244#ok(!$doc->coll_editor, 'Collection editor');
245#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100246ok(!$meta->{text_type}, 'text_type');
247is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000248
Nils Diewald98767bb2014-04-25 20:31:19 +0000249# ART
Akron9c0488f2016-01-28 14:17:15 +0100250$path = catdir(dirname(__FILE__), 'corpus/artificial');
Akrone4c2e412016-01-28 15:10:50 +0100251ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000252#is($doc->path, $path . '/', 'Path');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000253
Akrone4c2e412016-01-28 15:10:50 +0100254ok($doc = KorAP::XML::Krill->new( path => $path ), 'Load Korap::Document');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000255#is($doc->path, $path . '/', 'Path');
Nils Diewald98767bb2014-04-25 20:31:19 +0000256
257ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100258$meta = $doc->meta;
Nils Diewald98767bb2014-04-25 20:31:19 +0000259
260# Metdata
Akron35db6e32016-03-17 22:42:22 +0100261is($meta->{title}, 'Artificial Title', 'title');
262is($meta->{sub_title}, 'Artificial Subtitle', 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100263is($doc->text_sigle, 'ART/ABC/00001', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000264is($doc->corpus_sigle, 'ART', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100265is($meta->{pub_date}, '20010402', 'pubDate');
266is($meta->{pub_place}, 'Mannheim', 'pubPlace');
267is($meta->{pub_place_key}, 'DE', 'pubPlace key');
268is($meta->{text_class}->[0], 'freizeit-unterhaltung', 'TextClass');
269is($meta->{text_class}->[1], 'vereine-veranstaltungen', 'TextClass');
270ok(!$meta->{text_class}->[2], 'TextClass');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000271#is($doc->author->[0], 'Ruru', 'author');
272#is($doc->author->[1], 'Jens.Ol', 'author');
273#is($doc->author->[2], 'Aglarech', 'author');
Akron35db6e32016-03-17 22:42:22 +0100274is($meta->{author}, 'Ruru; Jens.Ol; Aglarech; u.a.', 'author');
Nils Diewald98767bb2014-04-25 20:31:19 +0000275
276# Additional information
Akron35db6e32016-03-17 22:42:22 +0100277is($meta->{editor}, 'Nils Diewald', 'Editor');
278is($meta->{publisher}, 'Artificial articles Inc.', 'Publisher');
279is($meta->{creation_date}, '19990601', 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000280#is($doc->coll_title, 'Artificial articles', 'Collection title');
281#is($doc->coll_sub_title, 'Best of!', 'Collection subtitle');
282#is($doc->coll_editor, 'Nils Diewald', 'Collection editor');
283#is($doc->coll_author, 'Nils Diewald', 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100284is($meta->{text_type}, 'Zeitung: Tageszeitung', 'No text_type');
285is($meta->{text_type_art}, 'Bericht', 'text_type art');
286
Nils Diewald8e323ee2014-04-23 17:28:14 +0000287
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000288# Multipath headers
Akron9c0488f2016-01-28 14:17:15 +0100289$path = catdir(dirname(__FILE__), 'corpus/VDI/JAN/00001');
Akrone4c2e412016-01-28 15:10:50 +0100290ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +0200291like($doc->path, qr!\Q$path\E/!, 'Path');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000292
Akrone4c2e412016-01-28 15:10:50 +0100293ok($doc = KorAP::XML::Krill->new( path => $path ), 'Load Korap::Document');
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +0200294like($doc->path, qr!\Q$path\E/$!, 'Path');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000295
296ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100297$meta = $doc->meta;
Akrona8665782016-01-27 21:47:57 +0100298
Akron1cd5b872016-03-22 00:23:46 +0100299is($doc->text_sigle, 'VDI14/JAN/00001', 'text sigle');
300is($doc->doc_sigle, 'VDI14/JAN', 'doc sigle');
Akron35db6e32016-03-17 22:42:22 +0100301is($meta->corpus_sigle, 'VDI14', 'corpus sigle');
Akrona8665782016-01-27 21:47:57 +0100302
Akron35db6e32016-03-17 22:42:22 +0100303is($meta->{title}, '10- Zz mit Zahl', 'title');
Akrona8665782016-01-27 21:47:57 +0100304
Akron35db6e32016-03-17 22:42:22 +0100305ok(!$meta->{sub_title}, 'subtitle');
306is($meta->{pub_date}, '20140117', 'pubdate');
307is($meta->{pub_place}, 'Düsseldorf', 'pubplace');
308is($meta->{author}, 'Windhövel, Kerstin', 'author');
309is($meta->{publisher}, 'VDI Verlag GmbH', 'publisher');
310ok(!$meta->{editor}, 'editor');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000311
Akron35db6e32016-03-17 22:42:22 +0100312ok(!$meta->{text_type}, 'text type');
313ok(!$meta->{text_type_art}, 'text type art');
314ok(!$meta->{text_type_ref}, 'text type ref');
315ok(!$meta->{text_column}, 'text column');
316ok(!$meta->{text_domain}, 'text domain');
317ok(!$meta->{creation_date}, 'creation date');
Akron6396c302016-03-18 16:05:39 +0100318ok(!$meta->{availability}, 'License');
Akron35db6e32016-03-17 22:42:22 +0100319ok(!$meta->{pages}, 'Pages');
320ok(!$meta->{file_edition_statement}, 'file edition statement');
321ok(!$meta->{bibl_edition_statement}, 'bibl edition statement');
322is($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 +0000323
Akron35db6e32016-03-17 22:42:22 +0100324ok(!$doc->{language}, 'Language');
Akrona8665782016-01-27 21:47:57 +0100325# !!!
326# diag 'This may be "de" in the future';
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000327
Akron35db6e32016-03-17 22:42:22 +0100328is($meta->{doc_title}, 'VDI nachrichten, Januar 2014', 'Doc title');
329ok(!$meta->{doc_sub_title}, 'Doc Sub title');
330ok(!$meta->{doc_editor}, 'Doc editor');
331ok(!$meta->{doc_author}, 'Doc author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000332
Akron35db6e32016-03-17 22:42:22 +0100333is($meta->{corpus_title}, 'VDI nachrichten', 'Corpus title');
334ok(!$meta->{corpus_sub_title}, 'Corpus Sub title');
335is($meta->{corpus_editor}, 'Verein Deutscher Ingenieure', 'Corpus editor');
336ok(!$meta->{corpus_author}, 'Corpus author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000337
Akron35db6e32016-03-17 22:42:22 +0100338is($meta->keywords('keywords'), '', 'Keywords');
339is($meta->keywords('text_class'), 'Freizeit-Unterhaltung Reisen Politik Ausland', 'Text class');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000340
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000341# WDD
Akron9c0488f2016-01-28 14:17:15 +0100342$path = catdir(dirname(__FILE__), 'corpus/WDD/G27/38989');
Akrone4c2e412016-01-28 15:10:50 +0100343ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +0200344like($doc->path, qr!\Q$path\E/!, 'Path');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000345ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100346$meta = $doc->meta;
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000347
Akron1cd5b872016-03-22 00:23:46 +0100348is($doc->text_sigle, 'WDD11/G27/38989', 'text sigle');
349is($doc->doc_sigle, 'WDD11/G27', 'doc sigle');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000350is($doc->corpus_sigle, 'WDD11', 'corpus sigle');
351
Akron35db6e32016-03-17 22:42:22 +0100352is($meta->{title}, 'Diskussion:Gunter A. Pilz', 'title');
353ok(!$meta->{sub_title}, 'subtitle');
354is($meta->{pub_date}, '20111029', 'pubdate');
355is($meta->{pub_place}, 'URL:http://de.wikipedia.org', 'pubplace');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000356
Akron35db6e32016-03-17 22:42:22 +0100357is($meta->{author}, '€pa, u.a.', 'author');
358is($meta->{publisher}, 'Wikipedia', 'publisher');
359ok(!$meta->{editor}, 'editor');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000360
Akron35db6e32016-03-17 22:42:22 +0100361is($meta->{text_type}, 'Diskussionen zu Enzyklopädie-Artikeln', 'text type');
362ok(!$meta->{text_type_art}, 'text type art');
363ok(!$meta->{text_type_ref}, 'text type ref');
364ok(!$meta->{text_column}, 'text column');
365ok(!$meta->{text_domain}, 'text domain');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000366
Akron35db6e32016-03-17 22:42:22 +0100367is($meta->{creation_date}, '20070707', 'creation date');
Akron6396c302016-03-18 16:05:39 +0100368is($meta->{availability}, 'CC-BY-SA', 'License');
Akron35db6e32016-03-17 22:42:22 +0100369ok(!$meta->{pages}, 'Pages');
370ok(!$meta->{file_edition_statement}, 'file edition statement');
371ok(!$meta->{bibl_edition_statement}, 'bibl edition statement');
372is($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 +0000373
Akron35db6e32016-03-17 22:42:22 +0100374is($meta->{language}, 'de', 'Language');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000375
Akron35db6e32016-03-17 22:42:22 +0100376is($meta->{doc_title}, 'Wikipedia, Diskussionen zu Artikeln mit Anfangsbuchstabe G, Teil 27', 'Doc title');
377ok(!$meta->{doc_sub_title}, 'Doc Sub title');
378ok(!$meta->{doc_editor}, 'Doc editor');
379ok(!$meta->{doc_author}, 'Doc author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000380
Akron35db6e32016-03-17 22:42:22 +0100381is($meta->{corpus_title}, 'Wikipedia', 'Corpus title');
382ok(!$meta->{corpus_sub_title}, 'Corpus Sub title');
383is($meta->{corpus_editor}, 'wikipedia.org', 'Corpus editor');
384ok(!$meta->{corpus_author}, 'Corpus author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000385
Akron35db6e32016-03-17 22:42:22 +0100386is($meta->keywords('keywords'), '', 'Keywords');
387is($meta->keywords('text_class'), '', 'Text class');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000388
Akron35db6e32016-03-17 22:42:22 +0100389is($meta->{availability}, 'CC-BY-SA', 'Availability');
Akrona8665782016-01-27 21:47:57 +0100390
Akronfbf66382016-07-12 19:44:01 +0200391use_ok('KorAP::XML::Meta::I5');
392
393$path = catdir(dirname(__FILE__), 'corpus', 'I5', 'rei-example.i5');
394ok($meta = KorAP::XML::Meta::I5->new, 'Construct meta object');
395my $dom = Mojo::DOM->new->parse(b($path)->slurp);
396ok($meta->parse($dom->at('idsHeader'), 'corpus'), 'Parse corpus header');
397
398my $hash = $meta->to_hash;
399is($hash->{availability}, 'CC-BY-SA', 'Availability');
400is($hash->{language}, 'de', 'Language');
401is($hash->{corpus_title}, 'Reden und Interviews', 'Corpus title');
402is($hash->{corpus_sigle}, 'REI', 'Corpus Sigle');
403
404ok($meta->parse($dom->find('idsHeader')->[1], 'doc'), 'Parse corpus header');
405
406$hash = $meta->to_hash;
407is($hash->{availability}, 'CC-BY-SA', 'Availability');
408is($hash->{language}, 'de', 'Language');
409is($hash->{corpus_title}, 'Reden und Interviews', 'Corpus title');
410is($hash->{corpus_sigle}, 'REI', 'Corpus Sigle');
411is($hash->{doc_sigle}, 'REI/BNG', 'Document Sigle');
412is($hash->{doc_title}, 'Reden der Bundestagsfraktion Bündnis 90/DIE GRÜNEN, (2002-2006)', 'Document Sigle');
413
414ok($meta->parse($dom->find('idsHeader')->[2], 'text'), 'Parse corpus header');
415
416$hash = $meta->to_hash;
417is($hash->{availability}, 'CC-BY-SA', 'Availability');
418is($hash->{language}, 'de', 'Language');
419is($hash->{corpus_title}, 'Reden und Interviews', 'Corpus title');
420is($hash->{corpus_sigle}, 'REI', 'Corpus Sigle');
421is($hash->{doc_sigle}, 'REI/BNG', 'Document Sigle');
422is($hash->{doc_title}, 'Reden der Bundestagsfraktion Bündnis 90/DIE GRÜNEN, (2002-2006)', 'Document Sigle');
423
424is($hash->{text_sigle}, 'REI/BNG/00001');
425is($hash->{title}, 'Energiewirtschaft');
426is($hash->{sub_title}, 'Rede im Deutschen Bundestag am 19.01.2002');
427is($hash->{creation_date}, '20020119');
428is($hash->{pub_date}, '20020119');
429is($hash->{pub_place_key}, 'DE');
430is($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]');
431is($hash->{text_class}->[0], 'politik');
432is($hash->{text_class}->[1], 'inland');
433is($hash->{author}, 'Hustedt, Michaele');
434is($hash->{pub_place}, 'Berlin');
Akrona8665782016-01-27 21:47:57 +0100435
Nils Diewald8e323ee2014-04-23 17:28:14 +0000436done_testing;
437__END__
Akronfbf66382016-07-12 19:44:01 +0200438
439
440