blob: 716bb8e0a98b902b96eb72df8faa1831af5ae8b6 [file] [log] [blame]
Nils Diewald8e323ee2014-04-23 17:28:14 +00001#!/usr/bin/env perl
2# source ~/perl5/perlbrew/etc/bashrc
3# perlbrew switch perl-blead@korap
4use strict;
5use warnings;
6use utf8;
7use Test::More;
8use Benchmark ':hireswallclock';
9use lib 'lib', '../lib';
10
11use File::Basename 'dirname';
12use File::Spec::Functions 'catdir';
13
14use_ok('KorAP::Document');
15
16# WPD/00001
17my $path = catdir(dirname(__FILE__), 'WPD/00001');
18ok(my $doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document');
19is($doc->path, $path . '/', 'Path');
20
21ok($doc = KorAP::Document->new( path => $path ), 'Load Korap::Document');
22is($doc->path, $path . '/', 'Path');
23
24ok($doc->parse, 'Parse document');
25
26# Metdata
27is($doc->title, 'A', 'title');
28ok(!$doc->sub_title, 'subTitle');
29is($doc->id, 'WPD_AAA.00001', 'ID');
30is($doc->corpus_id, 'WPD', 'corpusID');
31is($doc->pub_date, '20050328', 'pubDate');
32is($doc->pub_place, 'URL:http://de.wikipedia.org', 'pubPlace');
33is($doc->text_class->[0], 'freizeit-unterhaltung', 'TextClass');
34is($doc->text_class->[1], 'reisen', 'TextClass');
35is($doc->text_class->[2], 'wissenschaft', 'TextClass');
36is($doc->text_class->[3], 'populaerwissenschaft', 'TextClass');
37ok(!$doc->text_class->[4], 'TextClass');
38is($doc->author->[0], 'Ruru', 'author');
39is($doc->author->[1], 'Jens.Ol', 'author');
40is($doc->author->[2], 'Aglarech', 'author');
41ok(!$doc->author->[3], 'author');
42
43# Additional information
44ok(!$doc->editor, 'Editor');
45is($doc->publisher, 'Wikipedia', 'Publisher');
46is($doc->creation_date, '20050000', 'Creation date');
47is($doc->coll_title, 'Wikipedia', 'Collection title');
48is($doc->coll_sub_title, 'Die freie Enzyklopädie', 'Collection subtitle');
49is($doc->coll_editor, 'wikipedia.org', 'Collection editor');
50ok(!$doc->coll_author, 'Collection author');
51ok(!$doc->text_type, 'No text_type');
52ok(!$doc->text_type_art, 'text_type art');
53
54# BRZ13/00001
55$path = catdir(dirname(__FILE__), 'BRZ13/00001');
56ok($doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document');
57
58ok($doc->parse, 'Parse document');
59is($doc->title, 'Sexueller Missbrauch –„Das schreiende Kind steckt noch tief in mir“', 'title');
60ok(!$doc->sub_title, 'subTitle');
61is($doc->id, 'BRZ13_APR.00001', 'ID');
62is($doc->corpus_id, 'BRZ13', 'corpusID');
63is($doc->pub_date, '20130402', 'pubDate');
64is($doc->pub_place, 'Braunschweig', 'pubPlace');
65is($doc->text_class->[0], 'staat-gesellschaft', 'TextClass');
66is($doc->text_class->[1], 'familie-geschlecht', 'TextClass');
67ok(!$doc->text_class->[2], 'TextClass');
68ok(!$doc->author->[0], 'author');
69
70# Additional information
71ok(!$doc->editor, 'Editor');
72is($doc->publisher, 'Braunschweiger Zeitungsverlag, Druckhaus Albert Limbach GmbH & Co. KG', 'Publisher');
73is($doc->creation_date, '20130402', 'Creation date');
74is($doc->coll_title, 'Braunschweiger Zeitung', 'Collection title');
75ok(!$doc->coll_sub_title, 'Collection subtitle');
76ok(!$doc->coll_editor, 'Collection editor');
77ok(!$doc->coll_author, 'Collection author');
78is($doc->text_type, 'Zeitung: Tageszeitung', 'text_type');
79ok(!$doc->text_type_art, 'text_type art');
80
81# A01/13047
82$path = catdir(dirname(__FILE__), 'A01/13047');
83ok($doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document');
84
85ok($doc->parse, 'Parse document');
86is($doc->title, 'Fischer und Kolp im Sonnenhügel', 'title');
87ok(!$doc->sub_title, 'subTitle');
88is($doc->id, 'A01_APR.13047', 'ID');
89is($doc->corpus_id, 'A01', 'corpusID');
90is($doc->pub_date, '20010402', 'pubDate');
91ok(!$doc->pub_place, 'pubPlace');
92is($doc->text_class->[0], 'freizeit-unterhaltung', 'TextClass');
93is($doc->text_class->[1], 'vereine-veranstaltungen', 'TextClass');
94ok(!$doc->text_class->[2], 'TextClass');
95ok(!$doc->author->[0], 'author');
96
97
98# Additional information
99ok(!$doc->editor, 'Editor');
100ok(!$doc->publisher, 'Publisher');
101is($doc->creation_date, '20010402', 'Creation date');
102ok(!$doc->coll_title, 'Collection title');
103ok(!$doc->coll_sub_title, 'Collection subtitle');
104ok(!$doc->coll_editor, 'Collection editor');
105ok(!$doc->coll_author, 'Collection author');
106ok(!$doc->text_type, 'text_type');
107is($doc->text_type_art, 'Bericht', 'text_type art');
108
109
110# ERL/0001
111$path = catdir(dirname(__FILE__), 'ERL/00001');
112ok($doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document');
113
114ok($doc->parse, 'Parse document');
115is($doc->title, 'Amtsblatt des Landesbezirks Baden [diverse Erlasse]', 'title');
116ok(!$doc->sub_title, 'subTitle');
117is($doc->id, 'MK2_ERL.00001', 'ID');
118is($doc->corpus_id, 'MK2', 'corpusID');
119is($doc->pub_date, '00000000', 'pubDate');
120is($doc->pub_place, 'Karlsruhe', 'pubPlace');
121is($doc->text_class->[0], 'politik', 'TextClass');
122is($doc->text_class->[1], 'kommunalpolitik', 'TextClass');
123ok(!$doc->text_class->[2], 'TextClass');
124ok(!$doc->author->[0], 'author');
125
126# Additional information
127ok(!$doc->editor, 'Editor');
128is($doc->publisher, 'Badenia Verlag und Druckerei', 'Publisher');
129ok(!$doc->creation_date, 'Creation date');
130diag 'Non-acceptance of creation date ranges is temporary';
131ok(!$doc->coll_title, 'Collection title');
132ok(!$doc->coll_sub_title, 'Collection subtitle');
133ok(!$doc->coll_editor, 'Collection editor');
134ok(!$doc->coll_author, 'Collection author');
135is($doc->text_type, 'Erlass', 'text_type');
136ok(!$doc->text_type_art, 'text_type art');
137
138
139# A01/02035-substring
140$path = catdir(dirname(__FILE__), 'A01/02035-substring');
141ok($doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document');
142
143ok($doc->parse, 'Parse document');
144ok(!$doc->title, 'title');
145ok(!$doc->sub_title, 'subTitle');
146is($doc->id, 'A00_JAN.02035', 'ID');
147is($doc->corpus_id, 'A00', 'corpusID');
148is($doc->pub_date, '20000111', 'pubDate');
149ok(!$doc->pub_place, 'pubPlace');
150is($doc->text_class->[0], 'sport', 'TextClass');
151is($doc->text_class->[1], 'ballsport', 'TextClass');
152ok(!$doc->text_class->[2], 'TextClass');
153ok(!$doc->author->[0], 'author');
154
155# Additional information
156ok(!$doc->editor, 'Editor');
157ok(!$doc->publisher, 'Publisher');
158is($doc->creation_date, "20000111", 'Creation date');
159ok(!$doc->coll_title, 'Collection title');
160ok(!$doc->coll_sub_title, 'Collection subtitle');
161ok(!$doc->coll_editor, 'Collection editor');
162ok(!$doc->coll_author, 'Collection author');
163ok(!$doc->text_type, 'text_type');
164is($doc->text_type_art, 'Bericht', 'text_type art');
165
166
167# A01/02873-meta
168$path = catdir(dirname(__FILE__), 'A01/02873-meta');
169ok($doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document');
170
171ok($doc->parse, 'Parse document');
172is($doc->title, 'Tradition und Moderne', 'title');
173ok(!$doc->sub_title, 'subTitle');
174is($doc->id, 'A00_JAN.02873', 'ID');
175is($doc->corpus_id, 'A00', 'corpusID');
176is($doc->pub_date, '20000113', 'pubDate');
177ok(!$doc->pub_place, 'pubPlace');
178is($doc->text_class->[0], 'kultur', 'TextClass');
179is($doc->text_class->[1], 'film', 'TextClass');
180ok(!$doc->text_class->[2], 'TextClass');
181ok(!$doc->author->[0], 'author');
182
183# Additional information
184ok(!$doc->editor, 'Editor');
185ok(!$doc->publisher, 'Publisher');
186is($doc->creation_date, "20000113", 'Creation date');
187ok(!$doc->coll_title, 'Collection title');
188ok(!$doc->coll_sub_title, 'Collection subtitle');
189ok(!$doc->coll_editor, 'Collection editor');
190ok(!$doc->coll_author, 'Collection author');
191ok(!$doc->text_type, 'text_type');
192is($doc->text_type_art, 'Bericht', 'text_type art');
193
194
195# A01/05663-unbalanced
196$path = catdir(dirname(__FILE__), 'A01/05663-unbalanced');
197ok($doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document');
198
199ok($doc->parse, 'Parse document');
200is($doc->title, 'Mehr Arbeitslose im Dezember', 'title');
201ok(!$doc->sub_title, 'subTitle');
202is($doc->id, 'A00_JAN.05663', 'ID');
203is($doc->corpus_id, 'A00', 'corpusID');
204is($doc->pub_date, '20000124', 'pubDate');
205ok(!$doc->pub_place, 'pubPlace');
206is($doc->text_class->[0], 'gesundheit-ernaehrung', 'TextClass');
207is($doc->text_class->[1], 'gesundheit', 'TextClass');
208ok(!$doc->text_class->[2], 'TextClass');
209ok(!$doc->author->[0], 'author');
210
211# Additional information
212ok(!$doc->editor, 'Editor');
213ok(!$doc->publisher, 'Publisher');
214is($doc->creation_date, "20000124", 'Creation date');
215ok(!$doc->coll_title, 'Collection title');
216ok(!$doc->coll_sub_title, 'Collection subtitle');
217ok(!$doc->coll_editor, 'Collection editor');
218ok(!$doc->coll_author, 'Collection author');
219ok(!$doc->text_type, 'text_type');
220is($doc->text_type_art, 'Bericht', 'text_type art');
221
222
223
224# A01/07452-deep
225$path = catdir(dirname(__FILE__), 'A01/07452-deep');
226ok($doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document');
227
228ok($doc->parse, 'Parse document');
229is($doc->title, 'Wil im Dezember 1999', 'title');
230ok(!$doc->sub_title, 'subTitle');
231is($doc->id, 'A00_JAN.07452', 'ID');
232is($doc->corpus_id, 'A00', 'corpusID');
233is($doc->pub_date, '20000129', 'pubDate');
234ok(!$doc->pub_place, 'pubPlace');
235is($doc->text_class->[0], 'politik', 'TextClass');
236is($doc->text_class->[1], 'kommunalpolitik', 'TextClass');
237ok(!$doc->text_class->[2], 'TextClass');
238ok(!$doc->author->[0], 'author');
239
240# Additional information
241ok(!$doc->editor, 'Editor');
242ok(!$doc->publisher, 'Publisher');
243is($doc->creation_date, "20000129", 'Creation date');
244ok(!$doc->coll_title, 'Collection title');
245ok(!$doc->coll_sub_title, 'Collection subtitle');
246ok(!$doc->coll_editor, 'Collection editor');
247ok(!$doc->coll_author, 'Collection author');
248ok(!$doc->text_type, 'text_type');
249is($doc->text_type_art, 'Bericht', 'text_type art');
250
251
252
253done_testing;
254__END__
255
256
257
258
259
260
261
262
263
264
265
266
267