New index format including new metadata (hluengen)
diff --git a/t/real_goethe.t b/t/real_goethe.t
index 14437f3..47390ac 100644
--- a/t/real_goethe.t
+++ b/t/real_goethe.t
@@ -65,14 +65,13 @@
my $output = decode_json( $tokens->to_json );
-is(substr($output->{primaryData}, 0, 100), 'Autobiographische einzelheiten Selbstschilderung (1) immer tätiger, nach innen und außen fortwirkend', 'Primary Data');
-is($output->{tokenName}, 'tokens', 'tokenName');
-is($output->{tokenSource}, 'opennlp#tokens', 'tokenSource');
+is(substr($output->{data}->{text}, 0, 100), 'Autobiographische einzelheiten Selbstschilderung (1) immer tätiger, nach innen und außen fortwirkend', 'Primary Data');
+is($output->{data}->{name}, 'tokens', 'tokenName');
+is($output->{data}->{tokenSource}, 'opennlp#tokens', 'tokenSource');
is($output->{version}, '0.02', 'version');
-
-is($output->{foundries}, '', 'Foundries');
-is($output->{layerInfos}, '', 'layerInfos');
-is($output->{data}->[0]->[3], 's:Autobiographische', 'data');
+is($output->{data}->{foundries}, '', 'Foundries');
+is($output->{data}->{layerInfos}, '', 'layerInfos');
+is($output->{data}->{stream}->[0]->[3], 's:Autobiographische', 'data');
is($output->{textSigle}, 'GOE_AGA.03828', 'Correct text sigle');
is($output->{docSigle}, 'GOE_AGA', 'Correct document sigle');
@@ -101,9 +100,9 @@
$output = decode_json( $tokens->to_json );
-is($output->{foundries}, 'base base/paragraphs base/sentences', 'Foundries');
-is($output->{layerInfos}, 'base/s=spans', 'layerInfos');
-my $first_token = join('||', @{$output->{data}->[0]});
+is($output->{data}->{foundries}, 'base base/paragraphs base/sentences', 'Foundries');
+is($output->{data}->{layerInfos}, 'base/s=spans', 'layerInfos');
+my $first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr/s:Autobiographische/, 'data');
like($first_token, qr/_0#0-17/, 'data');
like($first_token, qr!<>:base/s:s#0-30\$<i>2<b>2!, 'data');
@@ -113,39 +112,39 @@
$tokens->add('OpenNLP', 'Sentences');
$output = decode_json( $tokens->to_json );
-is($output->{foundries},
+is($output->{data}->{foundries},
'base base/paragraphs base/sentences opennlp opennlp/sentences',
'Foundries');
-is($output->{layerInfos}, 'base/s=spans opennlp/s=spans', 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+is($output->{data}->{layerInfos}, 'base/s=spans opennlp/s=spans', 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!<>:opennlp/s:s#0-254\$<i>32!, 'data');
$tokens->add('OpenNLP', 'Morpho');
$output = decode_json( $tokens->to_json );
-is($output->{foundries},
+is($output->{data}->{foundries},
'base base/paragraphs base/sentences opennlp opennlp/morpho opennlp/sentences',
'Foundries');
-is($output->{layerInfos}, 'base/s=spans opennlp/p=tokens opennlp/s=spans', 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+is($output->{data}->{layerInfos}, 'base/s=spans opennlp/p=tokens opennlp/s=spans', 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!opennlp/p:ADJA!, 'data');
## Treetagger
$tokens->add('TreeTagger', 'Sentences');
$output = decode_json( $tokens->to_json );
-is($output->{foundries},
+is($output->{data}->{foundries},
'base base/paragraphs base/sentences opennlp opennlp/morpho opennlp/sentences treetagger treetagger/sentences',
'Foundries');
-is($output->{layerInfos}, 'base/s=spans opennlp/p=tokens opennlp/s=spans tt/s=spans', 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+is($output->{data}->{layerInfos}, 'base/s=spans opennlp/p=tokens opennlp/s=spans tt/s=spans', 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!<>:tt/s:s#0-179\$<i>21<b>2!, 'data');
$tokens->add('TreeTagger', 'Morpho');
$output = decode_json( $tokens->to_json );
-is($output->{foundries},
+is($output->{data}->{foundries},
'base base/paragraphs base/sentences opennlp opennlp/morpho opennlp/sentences treetagger treetagger/morpho treetagger/sentences',
'Foundries');
-is($output->{layerInfos}, 'base/s=spans opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans', 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+is($output->{data}->{layerInfos}, 'base/s=spans opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans', 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!tt/l:autobiographisch\$<b>165!, 'data');
like($first_token, qr!tt/p:ADJA\$<b>165!, 'data');
like($first_token, qr!tt/l:Autobiographische\$<b>89!, 'data');
@@ -154,38 +153,38 @@
## CoreNLP
$tokens->add('CoreNLP', 'NamedEntities');
$output = decode_json( $tokens->to_json );
-is($output->{foundries},
+is($output->{data}->{foundries},
'base base/paragraphs base/sentences corenlp corenlp/namedentities opennlp opennlp/morpho opennlp/sentences treetagger treetagger/morpho treetagger/sentences',
'Foundries');
-is($output->{layerInfos}, 'base/s=spans corenlp/ne=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans', 'layerInfos');
+is($output->{data}->{layerInfos}, 'base/s=spans corenlp/ne=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans', 'layerInfos');
diag "Missing test for NamedEntities";
# Problematic:
-# diag Dumper $output->{data}->[180];
-# diag Dumper $output->{data}->[341];
+# diag Dumper $output->{data}->{stream}->[180];
+# diag Dumper $output->{data}->{stream}->[341];
$tokens->add('CoreNLP', 'Sentences');
$output = decode_json( $tokens->to_json );
-is($output->{foundries},
+is($output->{data}->{foundries},
'base base/paragraphs base/sentences corenlp corenlp/namedentities corenlp/sentences opennlp opennlp/morpho opennlp/sentences treetagger treetagger/morpho treetagger/sentences',
'Foundries');
-is($output->{layerInfos}, 'base/s=spans corenlp/ne=tokens corenlp/s=spans opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans', 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+is($output->{data}->{layerInfos}, 'base/s=spans corenlp/ne=tokens corenlp/s=spans opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans', 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!<>:corenlp/s:s#0-254\$<i>32!, 'data');
$tokens->add('CoreNLP', 'Morpho');
$output = decode_json( $tokens->to_json );
-like($output->{foundries}, qr!corenlp/morpho!, 'Foundries');
-like($output->{layerInfos}, qr!corenlp/p=tokens!, 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+like($output->{data}->{foundries}, qr!corenlp/morpho!, 'Foundries');
+like($output->{data}->{layerInfos}, qr!corenlp/p=tokens!, 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!corenlp/p:ADJA!, 'data');
$tokens->add('CoreNLP', 'Constituency');
$output = decode_json( $tokens->to_json );
-like($output->{foundries}, qr!corenlp/constituency!, 'Foundries');
-like($output->{layerInfos}, qr!corenlp/c=spans!, 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+like($output->{data}->{foundries}, qr!corenlp/constituency!, 'Foundries');
+like($output->{data}->{layerInfos}, qr!corenlp/c=spans!, 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!<>:corenlp/c:NP#0-17\$<i>1<b>6!, 'data');
like($first_token, qr!<>:corenlp/c:CNP#0-17\$<i>1<b>7!, 'data');
like($first_token, qr!<>:corenlp/c:NP#0-17\$<i>1<b>8!, 'data');
@@ -200,9 +199,9 @@
## Glemm
$tokens->add('Glemm', 'Morpho');
$output = decode_json( $tokens->to_json );
-like($output->{foundries}, qr!glemm/morpho!, 'Foundries');
-like($output->{layerInfos}, qr!glemm/l=tokens!, 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+like($output->{data}->{foundries}, qr!glemm/morpho!, 'Foundries');
+like($output->{data}->{layerInfos}, qr!glemm/l=tokens!, 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!glemm/l:__autobiographisch!, 'data');
like($first_token, qr!glemm/l:\+_Auto!, 'data');
like($first_token, qr!glemm/l:\+_biographisch!, 'data');
@@ -212,43 +211,43 @@
## Connexor
$tokens->add('Connexor', 'Sentences');
$output = decode_json( $tokens->to_json );
-like($output->{foundries}, qr!connexor/sentences!, 'Foundries');
-like($output->{layerInfos}, qr!cnx/s=spans!, 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+like($output->{data}->{foundries}, qr!connexor/sentences!, 'Foundries');
+like($output->{data}->{layerInfos}, qr!cnx/s=spans!, 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!<>:cnx/s:s#0-179\$<i>21<b>2!, 'data');
$tokens->add('Connexor', 'Morpho');
$output = decode_json( $tokens->to_json );
-like($output->{foundries}, qr!connexor/morpho!, 'Foundries');
-like($output->{layerInfos}, qr!cnx/p=tokens!, 'layerInfos');
-like($output->{layerInfos}, qr!cnx/l=tokens!, 'layerInfos');
-like($output->{layerInfos}, qr!cnx/m=tokens!, 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+like($output->{data}->{foundries}, qr!connexor/morpho!, 'Foundries');
+like($output->{data}->{layerInfos}, qr!cnx/p=tokens!, 'layerInfos');
+like($output->{data}->{layerInfos}, qr!cnx/l=tokens!, 'layerInfos');
+like($output->{data}->{layerInfos}, qr!cnx/m=tokens!, 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!cnx/l:autobiografisch!, 'data');
like($first_token, qr!cnx/p:A!, 'data');
$tokens->add('Connexor', 'Phrase');
$output = decode_json( $tokens->to_json );
-like($output->{foundries}, qr!connexor/phrase!, 'Foundries');
-like($output->{layerInfos}, qr!cnx/c=spans!, 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+like($output->{data}->{foundries}, qr!connexor/phrase!, 'Foundries');
+like($output->{data}->{layerInfos}, qr!cnx/c=spans!, 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!<>:cnx/c:np#0-30\$<i>2!, 'data');
$tokens->add('Connexor', 'Syntax');
$output = decode_json( $tokens->to_json );
-like($output->{foundries}, qr!connexor/syntax!, 'Foundries');
-like($output->{layerInfos}, qr!cnx/syn=tokens!, 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+like($output->{data}->{foundries}, qr!connexor/syntax!, 'Foundries');
+like($output->{data}->{layerInfos}, qr!cnx/syn=tokens!, 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!cnx/syn:\@PREMOD!, 'data');
## Mate
$tokens->add('Mate', 'Morpho');
$output = decode_json( $tokens->to_json );
-like($output->{foundries}, qr!mate/morpho!, 'Foundries');
-like($output->{layerInfos}, qr!mate/p=tokens!, 'layerInfos');
-like($output->{layerInfos}, qr!mate/l=tokens!, 'layerInfos');
-like($output->{layerInfos}, qr!mate/m=tokens!, 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+like($output->{data}->{foundries}, qr!mate/morpho!, 'Foundries');
+like($output->{data}->{layerInfos}, qr!mate/p=tokens!, 'layerInfos');
+like($output->{data}->{layerInfos}, qr!mate/l=tokens!, 'layerInfos');
+like($output->{data}->{layerInfos}, qr!mate/m=tokens!, 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!mate/l:autobiographisch!, 'data');
like($first_token, qr!mate/p:NN!, 'data');
like($first_token, qr!mate/m:case:nom!, 'data');
@@ -261,25 +260,25 @@
## XIP
$tokens->add('XIP', 'Sentences');
$output = decode_json( $tokens->to_json );
-like($output->{foundries}, qr!xip/sentences!, 'Foundries');
-like($output->{layerInfos}, qr!xip/s=spans!, 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+like($output->{data}->{foundries}, qr!xip/sentences!, 'Foundries');
+like($output->{data}->{layerInfos}, qr!xip/s=spans!, 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!<>:xip/s:s#0-179\$<i>21!, 'data');
$tokens->add('XIP', 'Morpho');
$output = decode_json( $tokens->to_json );
-like($output->{foundries}, qr!xip/morpho!, 'Foundries');
-like($output->{layerInfos}, qr!xip/l=tokens!, 'layerInfos');
-like($output->{layerInfos}, qr!xip/p=tokens!, 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+like($output->{data}->{foundries}, qr!xip/morpho!, 'Foundries');
+like($output->{data}->{layerInfos}, qr!xip/l=tokens!, 'layerInfos');
+like($output->{data}->{layerInfos}, qr!xip/p=tokens!, 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!<>:xip/s:s#0-179\$<i>21!, 'data');
$tokens->add('XIP', 'Constituency');
$output = decode_json( $tokens->to_json );
-like($output->{foundries}, qr!xip/constituency!, 'Foundries');
-like($output->{layerInfos}, qr!xip/c=spans!, 'layerInfos');
-$first_token = join('||', @{$output->{data}->[0]});
+like($output->{data}->{foundries}, qr!xip/constituency!, 'Foundries');
+like($output->{data}->{layerInfos}, qr!xip/c=spans!, 'layerInfos');
+$first_token = join('||', @{$output->{data}->{stream}->[0]});
like($first_token, qr!<>:xip/c:NP#0-17\$<i>1<b>1!, 'data');
like($first_token, qr!<>:xip/c:AP#0-17\$<i>1<b>2!, 'data');
like($first_token, qr!<>:xip/c:ADJ#0-17\$<i>1<b>3!, 'data');
@@ -287,7 +286,7 @@
diag "No test for xip dependency";
-# diag Dumper $output->{data}->[0];
+# diag Dumper $output->{data}->{stream}->[0];
# print timestr(timediff(Benchmark->new, $t));
diff --git a/t/real_goethe_benchmark.t b/t/real_goethe_benchmark.t
index 66152dd..b70aa96 100644
--- a/t/real_goethe_benchmark.t
+++ b/t/real_goethe_benchmark.t
@@ -66,6 +66,6 @@
is($tokens->doc->to_hash->{title}, 'Autobiographische Einzelheiten');
-b($tokens->to_json)->spurt('AGA.03828.json');
+b($tokens->to_json)->spurt('AGA-03828.json');
diag timestr(timediff(Benchmark->new, $t));