blob: 78be93cd976a8566173387412ccb72142033995a [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 Diewaldfeccbb12015-06-18 20:06:45 +000019like($doc->path, qr!$path/!, '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 Diewaldfeccbb12015-06-18 20:06:45 +000022like($doc->path, qr!$path/$!, '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');
31ok(!$meta->{sub_title}, 'subTitle');
Nils Diewald840c9242014-10-28 19:51:26 +000032is($doc->corpus_sigle, 'WPD', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +010033is($meta->{pub_date}, '20050328', 'pubDate');
34is($meta->{pub_place}, 'URL:http://de.wikipedia.org', 'pubPlace');
35is($meta->{text_class}->[0], 'freizeit-unterhaltung', 'TextClass');
36is($meta->{text_class}->[1], 'reisen', 'TextClass');
37is($meta->{text_class}->[2], 'wissenschaft', 'TextClass');
38is($meta->{text_class}->[3], 'populaerwissenschaft', 'TextClass');
39ok(!$meta->{text_class}->[4], 'TextClass');
40is($meta->{author}, 'Ruru; Jens.Ol; Aglarech; u.a.', 'author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +000041
42#is($doc->author->[0], 'Ruru', 'author');
43#is($doc->author->[1], 'Jens.Ol', 'author');
44#is($doc->author->[2], 'Aglarech', 'author');
45#ok(!$doc->author->[3], 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +000046
47# Additional information
Akron35db6e32016-03-17 22:42:22 +010048ok(!$meta->{editor}, 'Editor');
49is($meta->{publisher}, 'Wikipedia', 'Publisher');
50is($meta->{creation_date}, '20050000', 'Creation date');
51ok(!$meta->{text_type}, 'No text_type');
52ok(!$meta->{text_type_art}, 'no text_type art');
53ok(!$meta->{text_type_ref}, 'no text_type ref');
54ok(!$meta->{text_domain}, 'no text_domain');
55ok(!$meta->{text_column}, 'no text_column');
56ok(!$meta->keywords('keywords'), 'no keywords');
57is($meta->keywords('text_class'), 'freizeit-unterhaltung reisen wissenschaft populaerwissenschaft', 'no text classes');
Nils Diewaldfeccbb12015-06-18 20:06:45 +000058
59#is($doc->coll_title, 'Wikipedia', 'Collection title');
60#is($doc->coll_sub_title, 'Die freie Enzyklopädie', 'Collection subtitle');
61#is($doc->coll_editor, 'wikipedia.org', 'Collection editor');
62#ok(!$doc->coll_author, 'Collection author');
Nils Diewald8e323ee2014-04-23 17:28:14 +000063
Nils Diewald8e323ee2014-04-23 17:28:14 +000064# A01/13047
Akron9c0488f2016-01-28 14:17:15 +010065$path = catdir(dirname(__FILE__), 'corpus/A01/13047');
Akrone4c2e412016-01-28 15:10:50 +010066ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +000067
68ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +010069$meta = $doc->meta;
70is($meta->{title}, 'Fischer und Kolp im Sonnenhügel', 'title');
71
72ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +010073is($doc->text_sigle, 'A01/APR/13047', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +000074is($doc->corpus_sigle, 'A01', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +010075is($meta->{pub_date}, '20010402', 'pubDate');
76ok(!$meta->{pub_place}, 'pubPlace');
77is($meta->{text_class}->[0], 'freizeit-unterhaltung', 'TextClass');
78is($meta->{text_class}->[1], 'vereine-veranstaltungen', 'TextClass');
79ok(!$meta->{text_class}->[2], 'TextClass');
80ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +000081
82# Additional information
Akron35db6e32016-03-17 22:42:22 +010083ok(!$meta->{editor}, 'Editor');
84ok(!$meta->{publisher}, 'Publisher');
85is($meta->{creation_date}, '20010402', 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +000086#ok(!$doc->coll_title, 'Collection title');
87#ok(!$doc->coll_sub_title, 'Collection subtitle');
88#ok(!$doc->coll_editor, 'Collection editor');
89#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +010090ok(!$meta->{text_type}, 'text_type');
91is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +000092
Nils Diewald8e323ee2014-04-23 17:28:14 +000093# ERL/0001
Akron9c0488f2016-01-28 14:17:15 +010094$path = catdir(dirname(__FILE__), 'corpus/ERL/00001');
Akrone4c2e412016-01-28 15:10:50 +010095ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +000096
97ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +010098
99$meta = $doc->meta;
100is($meta->{title}, 'Amtsblatt des Landesbezirks Baden [diverse Erlasse]', 'title'); # Amtsblatt des Landesbezirks Baden [diverse Erlasse]
Akrona8665782016-01-27 21:47:57 +0100101# MK2/ERL.00001
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000102
Akron35db6e32016-03-17 22:42:22 +0100103ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100104is($doc->text_sigle, 'MK2/ERL/00001', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000105is($doc->corpus_sigle, 'MK2', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100106is($meta->{pub_date}, '00000000', 'pubDate');
107is($meta->{pub_place}, 'Karlsruhe', 'pubPlace');
108is($meta->{text_class}->[0], 'politik', 'TextClass');
109is($meta->{text_class}->[1], 'kommunalpolitik', 'TextClass');
110ok(!$meta->{text_class}->[2], 'TextClass');
111ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000112
113# Additional information
Akron35db6e32016-03-17 22:42:22 +0100114ok(!$meta->{editor}, 'Editor');
115is($meta->{publisher}, 'Badenia Verlag und Druckerei', 'Publisher');
116is($meta->{creation_date}, '19600000', 'Creation date');
Akrona8665782016-01-27 21:47:57 +0100117
118# !!!
119# diag 'Non-acceptance of creation date ranges may be temporary';
120
121
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000122#ok(!$doc->coll_title, 'Collection title');
123#ok(!$doc->coll_sub_title, 'Collection subtitle');
124#ok(!$doc->coll_editor, 'Collection editor');
125#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100126is($meta->{text_type}, 'Erlass', 'text_type');
127ok(!$meta->{text_type_art}, 'text_type art');
128
Nils Diewald8e323ee2014-04-23 17:28:14 +0000129
Nils Diewald8e323ee2014-04-23 17:28:14 +0000130# A01/02035-substring
Akron9c0488f2016-01-28 14:17:15 +0100131$path = catdir(dirname(__FILE__), 'corpus/A00/02035-substring');
Akrone4c2e412016-01-28 15:10:50 +0100132ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000133ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100134
135$meta = $doc->meta;
136
137is($meta->{title}, 'St. Galler Tagblatt, 11.01.2000, Ressort: TB-RSP (Abk.)', 'title'); # A00/JAN.02035
138ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100139is($doc->text_sigle, 'A00/JAN/02035', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000140is($doc->corpus_sigle, 'A00', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100141is($meta->{pub_date}, '20000111', 'pubDate');
142ok(!$meta->{pub_place}, 'pubPlace');
143is($meta->{text_class}->[0], 'sport', 'TextClass');
144is($meta->{text_class}->[1], 'ballsport', 'TextClass');
145ok(!$meta->{text_class}->[2], 'TextClass');
146ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000147
148# Additional information
Akron35db6e32016-03-17 22:42:22 +0100149ok(!$meta->{editor}, 'Editor');
150ok(!$meta->{publisher}, 'Publisher');
151is($meta->{creation_date}, "20000111", 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000152#ok(!$doc->coll_title, 'Collection title');
153#ok(!$doc->coll_sub_title, 'Collection subtitle');
154#ok(!$doc->coll_editor, 'Collection editor');
155#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100156ok(!$meta->{text_type}, 'text_type');
157is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000158
Nils Diewald8e323ee2014-04-23 17:28:14 +0000159# A01/02873-meta
Akron9c0488f2016-01-28 14:17:15 +0100160$path = catdir(dirname(__FILE__), 'corpus/A00/02873-meta');
Akrone4c2e412016-01-28 15:10:50 +0100161ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000162ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100163$meta = $doc->meta;
164
165is($meta->{title}, 'Tradition und Moderne', 'title');
166ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100167is($doc->text_sigle, 'A00/JAN/02873', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000168is($doc->corpus_sigle, 'A00', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100169is($meta->{pub_date}, '20000113', 'pubDate');
170ok(!$meta->{pub_place}, 'pubPlace');
171is($meta->{text_class}->[0], 'kultur', 'TextClass');
172is($meta->{text_class}->[1], 'film', 'TextClass');
173ok(!$meta->{text_class}->[2], 'TextClass');
174ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000175
Akrona8665782016-01-27 21:47:57 +0100176
Nils Diewald8e323ee2014-04-23 17:28:14 +0000177# Additional information
Akron35db6e32016-03-17 22:42:22 +0100178ok(!$meta->{editor}, 'Editor');
179ok(!$meta->{publisher}, 'Publisher');
180is($meta->{creation_date}, "20000113", 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000181#ok(!$doc->coll_title, 'Collection title');
182#ok(!$doc->coll_sub_title, 'Collection subtitle');
183#ok(!$doc->coll_editor, 'Collection editor');
184#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100185ok(!$meta->{text_type}, 'text_type');
186is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000187
188
189# A01/05663-unbalanced
Akron9c0488f2016-01-28 14:17:15 +0100190$path = catdir(dirname(__FILE__), 'corpus/A00/05663-unbalanced');
Akrone4c2e412016-01-28 15:10:50 +0100191ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000192ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100193$meta = $doc->meta;
194
195is($meta->{title}, 'Mehr Arbeitslose im Dezember', 'title');
196ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100197is($doc->text_sigle, 'A00/JAN/05663', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000198is($doc->corpus_sigle, 'A00', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100199is($meta->{pub_date}, '20000124', 'pubDate');
200ok(!$meta->{pub_place}, 'pubPlace');
201is($meta->{text_class}->[0], 'gesundheit-ernaehrung', 'TextClass');
202is($meta->{text_class}->[1], 'gesundheit', 'TextClass');
203ok(!$meta->{text_class}->[2], 'TextClass');
204ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000205
Akrona8665782016-01-27 21:47:57 +0100206
Nils Diewald8e323ee2014-04-23 17:28:14 +0000207# Additional information
Akron35db6e32016-03-17 22:42:22 +0100208ok(!$meta->{editor}, 'Editor');
209ok(!$meta->{publisher}, 'Publisher');
210is($meta->{creation_date}, "20000124", 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000211#ok(!$doc->coll_title, 'Collection title');
212#ok(!$doc->coll_sub_title, 'Collection subtitle');
213#ok(!$doc->coll_editor, 'Collection editor');
214#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100215ok(!$meta->{text_type}, 'text_type');
216is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000217
Nils Diewald8e323ee2014-04-23 17:28:14 +0000218# A01/07452-deep
Akron9c0488f2016-01-28 14:17:15 +0100219$path = catdir(dirname(__FILE__), 'corpus/A00/07452-deep');
Akrone4c2e412016-01-28 15:10:50 +0100220ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000221ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100222$meta = $doc->meta;
223
224is($meta->{title}, 'Wil im Dezember 1999', 'title');
225ok(!$meta->{sub_title}, 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100226is($doc->text_sigle, 'A00/JAN/07452', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000227is($doc->corpus_sigle, 'A00', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100228is($meta->{pub_date}, '20000129', 'pubDate');
229ok(!$meta->{pub_place}, 'pubPlace');
230is($meta->{text_class}->[0], 'politik', 'TextClass');
231is($meta->{text_class}->[1], 'kommunalpolitik', 'TextClass');
232ok(!$meta->{text_class}->[2], 'TextClass');
233ok(!$meta->{author}, 'author');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000234
Akrona8665782016-01-27 21:47:57 +0100235
Nils Diewald8e323ee2014-04-23 17:28:14 +0000236# Additional information
Akron35db6e32016-03-17 22:42:22 +0100237ok(!$meta->{editor}, 'Editor');
238ok(!$meta->{publisher}, 'Publisher');
239is($meta->{creation_date}, "20000129", 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000240#ok(!$doc->coll_title, 'Collection title');
241#ok(!$doc->coll_sub_title, 'Collection subtitle');
242#ok(!$doc->coll_editor, 'Collection editor');
243#ok(!$doc->coll_author, 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100244ok(!$meta->{text_type}, 'text_type');
245is($meta->{text_type_art}, 'Bericht', 'text_type art');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000246
Nils Diewald98767bb2014-04-25 20:31:19 +0000247# ART
Akron9c0488f2016-01-28 14:17:15 +0100248$path = catdir(dirname(__FILE__), 'corpus/artificial');
Akrone4c2e412016-01-28 15:10:50 +0100249ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000250#is($doc->path, $path . '/', 'Path');
Nils Diewald8e323ee2014-04-23 17:28:14 +0000251
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 Diewald98767bb2014-04-25 20:31:19 +0000254
255ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100256$meta = $doc->meta;
Nils Diewald98767bb2014-04-25 20:31:19 +0000257
258# Metdata
Akron35db6e32016-03-17 22:42:22 +0100259is($meta->{title}, 'Artificial Title', 'title');
260is($meta->{sub_title}, 'Artificial Subtitle', 'subTitle');
Akron1cd5b872016-03-22 00:23:46 +0100261is($doc->text_sigle, 'ART/ABC/00001', 'ID');
Nils Diewald840c9242014-10-28 19:51:26 +0000262is($doc->corpus_sigle, 'ART', 'corpusID');
Akron35db6e32016-03-17 22:42:22 +0100263is($meta->{pub_date}, '20010402', 'pubDate');
264is($meta->{pub_place}, 'Mannheim', 'pubPlace');
265is($meta->{pub_place_key}, 'DE', 'pubPlace key');
266is($meta->{text_class}->[0], 'freizeit-unterhaltung', 'TextClass');
267is($meta->{text_class}->[1], 'vereine-veranstaltungen', 'TextClass');
268ok(!$meta->{text_class}->[2], 'TextClass');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000269#is($doc->author->[0], 'Ruru', 'author');
270#is($doc->author->[1], 'Jens.Ol', 'author');
271#is($doc->author->[2], 'Aglarech', 'author');
Akron35db6e32016-03-17 22:42:22 +0100272is($meta->{author}, 'Ruru; Jens.Ol; Aglarech; u.a.', 'author');
Nils Diewald98767bb2014-04-25 20:31:19 +0000273
274# Additional information
Akron35db6e32016-03-17 22:42:22 +0100275is($meta->{editor}, 'Nils Diewald', 'Editor');
276is($meta->{publisher}, 'Artificial articles Inc.', 'Publisher');
277is($meta->{creation_date}, '19990601', 'Creation date');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000278#is($doc->coll_title, 'Artificial articles', 'Collection title');
279#is($doc->coll_sub_title, 'Best of!', 'Collection subtitle');
280#is($doc->coll_editor, 'Nils Diewald', 'Collection editor');
281#is($doc->coll_author, 'Nils Diewald', 'Collection author');
Akron35db6e32016-03-17 22:42:22 +0100282is($meta->{text_type}, 'Zeitung: Tageszeitung', 'No text_type');
283is($meta->{text_type_art}, 'Bericht', 'text_type art');
284
Nils Diewald8e323ee2014-04-23 17:28:14 +0000285
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000286# Multipath headers
Akron9c0488f2016-01-28 14:17:15 +0100287$path = catdir(dirname(__FILE__), 'corpus/VDI/JAN/00001');
Akrone4c2e412016-01-28 15:10:50 +0100288ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000289like($doc->path, qr!$path/!, 'Path');
290
Akrone4c2e412016-01-28 15:10:50 +0100291ok($doc = KorAP::XML::Krill->new( path => $path ), 'Load Korap::Document');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000292like($doc->path, qr!$path/$!, 'Path');
293
294ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100295$meta = $doc->meta;
Akrona8665782016-01-27 21:47:57 +0100296
Akron1cd5b872016-03-22 00:23:46 +0100297is($doc->text_sigle, 'VDI14/JAN/00001', 'text sigle');
298is($doc->doc_sigle, 'VDI14/JAN', 'doc sigle');
Akron35db6e32016-03-17 22:42:22 +0100299is($meta->corpus_sigle, 'VDI14', 'corpus sigle');
Akrona8665782016-01-27 21:47:57 +0100300
Akron35db6e32016-03-17 22:42:22 +0100301is($meta->{title}, '10- Zz mit Zahl', 'title');
Akrona8665782016-01-27 21:47:57 +0100302
Akron35db6e32016-03-17 22:42:22 +0100303ok(!$meta->{sub_title}, 'subtitle');
304is($meta->{pub_date}, '20140117', 'pubdate');
305is($meta->{pub_place}, 'Düsseldorf', 'pubplace');
306is($meta->{author}, 'Windhövel, Kerstin', 'author');
307is($meta->{publisher}, 'VDI Verlag GmbH', 'publisher');
308ok(!$meta->{editor}, 'editor');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000309
Akron35db6e32016-03-17 22:42:22 +0100310ok(!$meta->{text_type}, 'text type');
311ok(!$meta->{text_type_art}, 'text type art');
312ok(!$meta->{text_type_ref}, 'text type ref');
313ok(!$meta->{text_column}, 'text column');
314ok(!$meta->{text_domain}, 'text domain');
315ok(!$meta->{creation_date}, 'creation date');
Akron6396c302016-03-18 16:05:39 +0100316ok(!$meta->{availability}, 'License');
Akron35db6e32016-03-17 22:42:22 +0100317ok(!$meta->{pages}, 'Pages');
318ok(!$meta->{file_edition_statement}, 'file edition statement');
319ok(!$meta->{bibl_edition_statement}, 'bibl edition statement');
320is($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 +0000321
Akron35db6e32016-03-17 22:42:22 +0100322ok(!$doc->{language}, 'Language');
Akrona8665782016-01-27 21:47:57 +0100323# !!!
324# diag 'This may be "de" in the future';
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000325
Akron35db6e32016-03-17 22:42:22 +0100326is($meta->{doc_title}, 'VDI nachrichten, Januar 2014', 'Doc title');
327ok(!$meta->{doc_sub_title}, 'Doc Sub title');
328ok(!$meta->{doc_editor}, 'Doc editor');
329ok(!$meta->{doc_author}, 'Doc author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000330
Akron35db6e32016-03-17 22:42:22 +0100331is($meta->{corpus_title}, 'VDI nachrichten', 'Corpus title');
332ok(!$meta->{corpus_sub_title}, 'Corpus Sub title');
333is($meta->{corpus_editor}, 'Verein Deutscher Ingenieure', 'Corpus editor');
334ok(!$meta->{corpus_author}, 'Corpus author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000335
Akron35db6e32016-03-17 22:42:22 +0100336is($meta->keywords('keywords'), '', 'Keywords');
337is($meta->keywords('text_class'), 'Freizeit-Unterhaltung Reisen Politik Ausland', 'Text class');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000338
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000339# WDD
Akron9c0488f2016-01-28 14:17:15 +0100340$path = catdir(dirname(__FILE__), 'corpus/WDD/G27/38989');
Akrone4c2e412016-01-28 15:10:50 +0100341ok($doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000342like($doc->path, qr!$path/!, 'Path');
343ok($doc->parse, 'Parse document');
Akron35db6e32016-03-17 22:42:22 +0100344$meta = $doc->meta;
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000345
Akron1cd5b872016-03-22 00:23:46 +0100346is($doc->text_sigle, 'WDD11/G27/38989', 'text sigle');
347is($doc->doc_sigle, 'WDD11/G27', 'doc sigle');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000348is($doc->corpus_sigle, 'WDD11', 'corpus sigle');
349
Akron35db6e32016-03-17 22:42:22 +0100350is($meta->{title}, 'Diskussion:Gunter A. Pilz', 'title');
351ok(!$meta->{sub_title}, 'subtitle');
352is($meta->{pub_date}, '20111029', 'pubdate');
353is($meta->{pub_place}, 'URL:http://de.wikipedia.org', 'pubplace');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000354
Akron35db6e32016-03-17 22:42:22 +0100355is($meta->{author}, '€pa, u.a.', 'author');
356is($meta->{publisher}, 'Wikipedia', 'publisher');
357ok(!$meta->{editor}, 'editor');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000358
Akron35db6e32016-03-17 22:42:22 +0100359is($meta->{text_type}, 'Diskussionen zu Enzyklopädie-Artikeln', 'text type');
360ok(!$meta->{text_type_art}, 'text type art');
361ok(!$meta->{text_type_ref}, 'text type ref');
362ok(!$meta->{text_column}, 'text column');
363ok(!$meta->{text_domain}, 'text domain');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000364
Akron35db6e32016-03-17 22:42:22 +0100365is($meta->{creation_date}, '20070707', 'creation date');
Akron6396c302016-03-18 16:05:39 +0100366is($meta->{availability}, 'CC-BY-SA', 'License');
Akron35db6e32016-03-17 22:42:22 +0100367ok(!$meta->{pages}, 'Pages');
368ok(!$meta->{file_edition_statement}, 'file edition statement');
369ok(!$meta->{bibl_edition_statement}, 'bibl edition statement');
370is($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 +0000371
Akron35db6e32016-03-17 22:42:22 +0100372is($meta->{language}, 'de', 'Language');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000373
Akron35db6e32016-03-17 22:42:22 +0100374is($meta->{doc_title}, 'Wikipedia, Diskussionen zu Artikeln mit Anfangsbuchstabe G, Teil 27', 'Doc title');
375ok(!$meta->{doc_sub_title}, 'Doc Sub title');
376ok(!$meta->{doc_editor}, 'Doc editor');
377ok(!$meta->{doc_author}, 'Doc author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000378
Akron35db6e32016-03-17 22:42:22 +0100379is($meta->{corpus_title}, 'Wikipedia', 'Corpus title');
380ok(!$meta->{corpus_sub_title}, 'Corpus Sub title');
381is($meta->{corpus_editor}, 'wikipedia.org', 'Corpus editor');
382ok(!$meta->{corpus_author}, 'Corpus author');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000383
Akron35db6e32016-03-17 22:42:22 +0100384is($meta->keywords('keywords'), '', 'Keywords');
385is($meta->keywords('text_class'), '', 'Text class');
Nils Diewaldfeccbb12015-06-18 20:06:45 +0000386
Akron35db6e32016-03-17 22:42:22 +0100387is($meta->{availability}, 'CC-BY-SA', 'Availability');
Akrona8665782016-01-27 21:47:57 +0100388
Akronfbf66382016-07-12 19:44:01 +0200389use_ok('KorAP::XML::Meta::I5');
390
391$path = catdir(dirname(__FILE__), 'corpus', 'I5', 'rei-example.i5');
392ok($meta = KorAP::XML::Meta::I5->new, 'Construct meta object');
393my $dom = Mojo::DOM->new->parse(b($path)->slurp);
394ok($meta->parse($dom->at('idsHeader'), 'corpus'), 'Parse corpus header');
395
396my $hash = $meta->to_hash;
397is($hash->{availability}, 'CC-BY-SA', 'Availability');
398is($hash->{language}, 'de', 'Language');
399is($hash->{corpus_title}, 'Reden und Interviews', 'Corpus title');
400is($hash->{corpus_sigle}, 'REI', 'Corpus Sigle');
401
402ok($meta->parse($dom->find('idsHeader')->[1], 'doc'), 'Parse corpus header');
403
404$hash = $meta->to_hash;
405is($hash->{availability}, 'CC-BY-SA', 'Availability');
406is($hash->{language}, 'de', 'Language');
407is($hash->{corpus_title}, 'Reden und Interviews', 'Corpus title');
408is($hash->{corpus_sigle}, 'REI', 'Corpus Sigle');
409is($hash->{doc_sigle}, 'REI/BNG', 'Document Sigle');
410is($hash->{doc_title}, 'Reden der Bundestagsfraktion Bündnis 90/DIE GRÜNEN, (2002-2006)', 'Document Sigle');
411
412ok($meta->parse($dom->find('idsHeader')->[2], 'text'), 'Parse corpus header');
413
414$hash = $meta->to_hash;
415is($hash->{availability}, 'CC-BY-SA', 'Availability');
416is($hash->{language}, 'de', 'Language');
417is($hash->{corpus_title}, 'Reden und Interviews', 'Corpus title');
418is($hash->{corpus_sigle}, 'REI', 'Corpus Sigle');
419is($hash->{doc_sigle}, 'REI/BNG', 'Document Sigle');
420is($hash->{doc_title}, 'Reden der Bundestagsfraktion Bündnis 90/DIE GRÜNEN, (2002-2006)', 'Document Sigle');
421
422is($hash->{text_sigle}, 'REI/BNG/00001');
423is($hash->{title}, 'Energiewirtschaft');
424is($hash->{sub_title}, 'Rede im Deutschen Bundestag am 19.01.2002');
425is($hash->{creation_date}, '20020119');
426is($hash->{pub_date}, '20020119');
427is($hash->{pub_place_key}, 'DE');
428is($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]');
429is($hash->{text_class}->[0], 'politik');
430is($hash->{text_class}->[1], 'inland');
431is($hash->{author}, 'Hustedt, Michaele');
432is($hash->{pub_place}, 'Berlin');
Akrona8665782016-01-27 21:47:57 +0100433
Nils Diewald8e323ee2014-04-23 17:28:14 +0000434done_testing;
435__END__
Akronfbf66382016-07-12 19:44:01 +0200436
437
438