blob: 8a4cc4e53a8bff9e67a10adb97cdb5f03b7c68b8 [file] [log] [blame]
Akron8c84aa52016-02-13 21:26:54 +01001use strict;
2use warnings;
3use Test::More;
4use File::Basename 'dirname';
5use File::Spec::Functions 'catdir';
6use Data::Dumper;
7use KorAP::XML::Tokenizer;
8use KorAP::XML::Krill;
9use utf8;
10
11my $path = catdir(dirname(__FILE__), 'CMC-TSK', '2014-09', '2843');
12
13ok(my $doc = KorAP::XML::Krill->new(
Akron35db6e32016-03-17 22:42:22 +010014 path => $path . '/',
15 meta_type => 'Sgbr'
Akron8c84aa52016-02-13 21:26:54 +010016), 'Create Document');
17
18ok($doc->parse, 'Parse document');
19
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +020020like($doc->path, qr!\Q$path\E/!, 'Path');
Akron8c84aa52016-02-13 21:26:54 +010021
22# Metdata
Akron1cd5b872016-03-22 00:23:46 +010023is($doc->text_sigle, 'CMC-TSK/2014-09/2843', 'ID-text');
Akron8c84aa52016-02-13 21:26:54 +010024
Akron1cd5b872016-03-22 00:23:46 +010025is($doc->doc_sigle, 'CMC-TSK/2014-09', 'ID-doc');
Akron8c84aa52016-02-13 21:26:54 +010026is($doc->corpus_sigle, 'CMC-TSK', 'ID-corpus');
27
Akron35db6e32016-03-17 22:42:22 +010028my $meta = $doc->meta;
Akron8c84aa52016-02-13 21:26:54 +010029
Akron35db6e32016-03-17 22:42:22 +010030is($meta->{title}, '@ Koelle_am_Rhing 10:18', 'title');
Akron8c84aa52016-02-13 21:26:54 +010031
Akron35db6e32016-03-17 22:42:22 +010032ok(!$meta->{sub_title}, 'no subtitle');
Akron8c84aa52016-02-13 21:26:54 +010033
Akron35db6e32016-03-17 22:42:22 +010034is($meta->{publisher}, 'tagesschau.de', 'Publisher');
Akron8c84aa52016-02-13 21:26:54 +010035
Akron35db6e32016-03-17 22:42:22 +010036is($meta->{pub_date}, '20140930');
Akron8c84aa52016-02-13 21:26:54 +010037
Akron35db6e32016-03-17 22:42:22 +010038ok(!$meta->{pub_place}, 'No pub place');
Akron8c84aa52016-02-13 21:26:54 +010039
Akron35db6e32016-03-17 22:42:22 +010040is($meta->{doc_title}, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title');
41is($meta->{doc_sub_title}, 'Subkorpus Internettexte, Subkorpus Leserkommentare Tagesschau, Subkorpus September 2014, Subkorpus Beispielauszug', 'Doc Sub title');
Akron8c84aa52016-02-13 21:26:54 +010042
Akron35db6e32016-03-17 22:42:22 +010043is($meta->{'funder'}, 'Bundesministerium für Bildung und Forschung', 'Funder');
Akron8c84aa52016-02-13 21:26:54 +010044
Akron35db6e32016-03-17 22:42:22 +010045is($meta->{author}, 'privat23', 'Author');
46ok(!$meta->{'sgbr_author_sex'}, 'No Sex');
47ok(!$meta->{'sgbr_kodex'}, 'No kodex');
48is($meta->{reference}, 'http://meta.tagesschau.de/node/090285#comment-1732187', 'Publace ref');
Akron8c84aa52016-02-13 21:26:54 +010049
Akron35db6e32016-03-17 22:42:22 +010050is($meta->keywords('keywords'), '');
Akron8c84aa52016-02-13 21:26:54 +010051
Akron35db6e32016-03-17 22:42:22 +010052is($meta->{language}, 'de', 'Language');
Akron8c84aa52016-02-13 21:26:54 +010053
Akron35db6e32016-03-17 22:42:22 +010054ok(!$meta->{editor}, 'Editor');
Akron8c84aa52016-02-13 21:26:54 +010055
Akron35db6e32016-03-17 22:42:22 +010056ok(!$meta->{text_type}, 'Text Type');
57ok(!$meta->{text_type_art}, 'Text Type Art');
58ok(!$meta->{text_type_ref}, 'Text Type Ref');
59ok(!$meta->{text_column}, 'Text Column');
60ok(!$meta->{text_domain}, 'Text Domain');
61ok(!$meta->{creation_date}, 'Creation Date');
62ok(!$meta->{license}, 'License');
63ok(!$meta->{pages}, 'Pages');
64ok(!$meta->{file_edition_statement}, 'File Edition Statement');
65ok(!$meta->{bibl_edition_statement}, 'Bibl Edition Statement');
Akron8c84aa52016-02-13 21:26:54 +010066
Akron35db6e32016-03-17 22:42:22 +010067ok(!$meta->{doc_editor}, 'Doc: editor');
68ok(!$meta->{doc_author}, 'Doc: author');
69
70ok(!$meta->{corpus_title}, 'Corpus: title');
71ok(!$meta->{corpus_sub_title}, 'Corpus: subtitle');
72ok(!$meta->{corpus_editor}, 'Corpus: editor');
73ok(!$meta->{corpus_author}, 'Corpus: author');
Akron8c84aa52016-02-13 21:26:54 +010074
75my $hash = $doc->to_hash;
76is($hash->{title}, '@ Koelle_am_Rhing 10:18', 'Corpus title');
77
Akron8c84aa52016-02-13 21:26:54 +010078# Second document
Akron8c84aa52016-02-13 21:26:54 +010079$path = catdir(dirname(__FILE__), 'CMC-TSK', '2014-09', '3401');
80
81ok($doc = KorAP::XML::Krill->new(
Akron35db6e32016-03-17 22:42:22 +010082 path => $path . '/',
83 meta_type => 'Sgbr'
Akron8c84aa52016-02-13 21:26:54 +010084), 'Create Document');
85
86ok($doc->parse, 'Parse document');
87
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +020088like($doc->path, qr!\Q$path\E/!, 'Path');
Akron8c84aa52016-02-13 21:26:54 +010089
90# Metdata
Akron1cd5b872016-03-22 00:23:46 +010091is($doc->text_sigle, 'CMC-TSK/2014-09/3401', 'ID-text');
Akron8c84aa52016-02-13 21:26:54 +010092
Akron1cd5b872016-03-22 00:23:46 +010093is($doc->doc_sigle, 'CMC-TSK/2014-09', 'ID-doc');
Akron8c84aa52016-02-13 21:26:54 +010094is($doc->corpus_sigle, 'CMC-TSK', 'ID-corpus');
95
Akron8c84aa52016-02-13 21:26:54 +010096
Akron35db6e32016-03-17 22:42:22 +010097$meta = $doc->meta;
98is($meta->{title}, '@fitnessfrosch', 'title');
Akron8c84aa52016-02-13 21:26:54 +010099
Akron35db6e32016-03-17 22:42:22 +0100100ok(!$meta->{sub_title}, 'no subtitle');
Akron8c84aa52016-02-13 21:26:54 +0100101
Akron35db6e32016-03-17 22:42:22 +0100102is($meta->{publisher}, 'tagesschau.de', 'Publisher');
Akron8c84aa52016-02-13 21:26:54 +0100103
Akron35db6e32016-03-17 22:42:22 +0100104is($meta->{pub_date}, '20141001');
105is($meta->{'sgbr_date'}, '2014-10-01 00:50:00');
Akron8c84aa52016-02-13 21:26:54 +0100106
Akron35db6e32016-03-17 22:42:22 +0100107ok(!$meta->{pub_place}, 'No pub place');
Akron8c84aa52016-02-13 21:26:54 +0100108
Akron35db6e32016-03-17 22:42:22 +0100109is($meta->{doc_title}, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title');
110is($meta->{doc_sub_title}, 'Subkorpus Internettexte, Subkorpus Leserkommentare Tagesschau, Subkorpus September 2014, Subkorpus Beispielauszug', 'Doc Sub title');
Akron8c84aa52016-02-13 21:26:54 +0100111
Akron35db6e32016-03-17 22:42:22 +0100112is($meta->{'funder'}, 'Bundesministerium für Bildung und Forschung', 'Funder');
Akron8c84aa52016-02-13 21:26:54 +0100113
Akron35db6e32016-03-17 22:42:22 +0100114is($meta->{author}, 'weltoffen', 'Author');
115ok(!$meta->{'sgbr_author_sex'}, 'No Sex');
116ok(!$meta->{'sgbr_kodex'}, 'No kodex');
117is($meta->{reference}, 'http://meta.tagesschau.de/node/090308#comment-1732754', 'Publace ref');
Akron8c84aa52016-02-13 21:26:54 +0100118
Akron35db6e32016-03-17 22:42:22 +0100119is($meta->keywords('keywords'), '');
Akron8c84aa52016-02-13 21:26:54 +0100120
Akron35db6e32016-03-17 22:42:22 +0100121is($meta->{language}, 'de', 'Language');
Akron8c84aa52016-02-13 21:26:54 +0100122
Akron35db6e32016-03-17 22:42:22 +0100123ok(!$meta->{editor}, 'Editor');
Akron8c84aa52016-02-13 21:26:54 +0100124
Akron35db6e32016-03-17 22:42:22 +0100125ok(!$meta->{text_type}, 'Text Type');
126ok(!$meta->{text_type_art}, 'Text Type Art');
127ok(!$meta->{text_type_ref}, 'Text Type Ref');
128ok(!$meta->{text_column}, 'Text Column');
129ok(!$meta->{text_domain}, 'Text Domain');
130ok(!$meta->{creation_date}, 'Creation Date');
131ok(!$meta->{license}, 'License');
132ok(!$meta->{pages}, 'Pages');
133ok(!$meta->{file_edition_statement}, 'File Edition Statement');
134ok(!$meta->{bibl_edition_statement}, 'Bibl Edition Statement');
Akron8c84aa52016-02-13 21:26:54 +0100135
Akron35db6e32016-03-17 22:42:22 +0100136ok(!$meta->{doc_editor}, 'Doc: editor');
137ok(!$meta->{doc_author}, 'Doc: author');
138
139ok(!$meta->{corpus_title}, 'Corpus: title');
140ok(!$meta->{corpus_sub_title}, 'Corpus: subtitle');
141ok(!$meta->{corpus_editor}, 'Corpus: editor');
142ok(!$meta->{corpus_author}, 'Corpus: author');
Akron8c84aa52016-02-13 21:26:54 +0100143
144$hash = $doc->to_hash;
145is($hash->{title}, '@fitnessfrosch', 'Corpus title');
146
147done_testing;
148__END__
149