Added meta data for Schreibgebrauch and fixed Metadata parsing for I5

Change-Id: Ib2c9c5cce11c67bb093b2c0aa61449adff69e16e
diff --git a/t/index/corpus/doc/0001/header.xml b/t/index/corpus/doc/0001/header.xml
index fb770f7..dd5c085 100644
--- a/t/index/corpus/doc/0001/header.xml
+++ b/t/index/corpus/doc/0001/header.xml
@@ -19,7 +19,7 @@
           <h.title type="main">Beispiel Text</h.title>
 	  <h.title type="sub">Beispiel Text Untertitel</h.title>
           <h.author>Mustermann, Max</h.author>
-	  <editor>Monkika Mustermann</editor>
+	  <editor>Monika Mustermann</editor>
           <imprint/>
           <biblScope type="pp"/>
           <biblScope type="suppl"/>
diff --git a/t/index/meta.t b/t/index/meta.t
new file mode 100644
index 0000000..dadcb4c
--- /dev/null
+++ b/t/index/meta.t
@@ -0,0 +1,58 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use utf8;
+use Test::More;
+use Scalar::Util qw/weaken/;
+use Data::Dumper;
+use lib 't/index';
+use TestInit;
+use File::Basename 'dirname';
+use File::Spec::Functions 'catdir';
+
+
+my $path = catdir(dirname(__FILE__), 'corpus', 'doc', '0001');
+
+ok(my $doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document');
+ok($doc->parse, 'Parse document');
+like($doc->path, qr!$path/!, 'Path');
+
+# Metdata
+is($doc->text_sigle, 'Corpus_Doc.0001', 'ID-text');
+is($doc->doc_sigle, 'Corpus_Doc', 'ID-doc');
+is($doc->corpus_sigle, 'Corpus', 'ID-corpus');
+
+is($doc->title, 'Beispiel Text', 'title');
+is($doc->sub_title, 'Beispiel Text Untertitel', 'title');
+is($doc->pub_date, '20010402', 'Publication date');
+is($doc->pub_place, 'Mannheim', 'Publication place');
+is($doc->author, 'Mustermann, Max', 'Author');
+
+is($doc->publisher, 'Artificial articles Inc.', 'Publisher');
+is($doc->editor, 'Monika Mustermann', 'Editor');
+is($doc->text_type, 'Zeitung: Tageszeitung', 'Text Type');
+is($doc->text_type_art, 'Bericht', 'Text Type Art');
+is($doc->text_type_ref, 'Aphorismen', 'Text Type Ref');
+ok(!$doc->text_column, 'Text Column');
+ok(!$doc->text_domain, 'Text Domain');
+is($doc->creation_date, '19990601', 'Creation Date');
+ok(!$doc->license, 'License');
+ok(!$doc->pages, 'Pages');
+ok(!$doc->file_edition_statement, 'File Edition Statement');
+ok(!$doc->bibl_edition_statement, 'Bibl Edition Statement');
+ok(!$doc->reference, 'Reference');
+is($doc->language, 'de', 'Language');
+
+is($doc->doc_title, 'Beispiel Dokument', 'Doc: title');
+ok(!$doc->doc_sub_title, 'Doc: subtitle');
+ok(!$doc->doc_editor, 'Doc: editor');
+ok(!$doc->doc_author, 'Doc: author');
+
+is($doc->corpus_title, 'Beispiel-Corpus', 'Corpus: title');
+ok(!$doc->corpus_sub_title, 'Corpus: subtitle');
+ok(!$doc->corpus_editor, 'Corpus: editor');
+ok(!$doc->corpus_author, 'Corpus: author');
+
+done_testing;
+
+__END__
diff --git a/t/index/opennlp_morpho.t b/t/index/opennlp_morpho.t
index 82182a2..cf57006 100644
--- a/t/index/opennlp_morpho.t
+++ b/t/index/opennlp_morpho.t
@@ -10,6 +10,41 @@
 
 ok(my $tokens = TestInit::tokens('0001'), 'Parse tokens');
 
+is($tokens->stream->pos(0)->to_string, '[(0-3)-:tokens$<i>18|_0$<i>0<i>3|i:zum|s:Zum]', 'Token is correct');
+
+is($tokens->stream->pos(1)->to_string, '[(4-11)_1$<i>4<i>11|i:letzten|s:letzten]', 'Token is correct');
+
+my $i = 2;
+foreach ([12,23, 'kulturellen'],
+	 [24,30, 'Anlass'],
+	 [31,35, 'lädt'],
+	 [36,39, 'die'],
+	 [40,47, 'Leitung'],
+	 [48,51, 'des'],
+	 [52,63, 'Schulheimes'],
+	 [64,73, 'Hofbergli'],
+	 [74,77, 'ein'],
+	 [79,84, 'bevor'],
+	 [85,88, 'der'],
+	 [89,96, 'Betrieb'],
+	 [97,101, 'Ende'],
+	 [102,111, 'Schuljahr'],
+	 [112,123, 'eingestellt'],
+	 [124,128, 'wird']
+       ) {
+  is($tokens->stream->pos($i++)->to_string,
+     '[('.$_->[0].'-'.$_->[1].')'.
+       '_'.($i-1).
+	 '$<i>'.$_->[0].'<i>' . $_->[1] . '|' .
+	 'i:'.lc($_->[2]).'|s:'.$_->[2].']',
+     'Token is correct');
+};
+
+ok(!$tokens->stream->pos($i++), 'No more tokens');
+
+
+
+
 ok($tokens->add('OpenNLP', 'Morpho'), 'Add Structure');
 
 my $data = $tokens->to_data->{data};
diff --git a/t/index/primary.t b/t/index/primary.t
new file mode 100644
index 0000000..7abf629
--- /dev/null
+++ b/t/index/primary.t
@@ -0,0 +1,31 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use utf8;
+use Test::More;
+use Scalar::Util qw/weaken/;
+use Data::Dumper;
+use lib 't/index';
+use TestInit;
+use File::Basename 'dirname';
+use File::Spec::Functions 'catdir';
+
+
+my $path = catdir(dirname(__FILE__), 'corpus', 'doc', '0001');
+
+ok(my $doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document');
+ok($doc->parse, 'Parse document');
+like($doc->path, qr!$path/!, 'Path');
+
+is($doc->primary->data,
+   'Zum letzten kulturellen Anlass lädt die Leitung des Schulheimes Hofbergli ein, '.
+     'bevor der Betrieb Ende Schuljahr eingestellt wird.', 'Primary data');
+
+is($doc->primary->data_length, 129, 'Primary data length');
+
+is($doc->primary->data(0,3), 'Zum', 'Get primary data');
+
+
+done_testing;
+
+__END__