Add and test term-to-element and element-to-term relation
Change-Id: I55e562a5295f40617b41786c8758557a72e9537d
diff --git a/t/real/goethe.t b/t/real/goethe.t
index eeefb39..770f70e 100644
--- a/t/real/goethe.t
+++ b/t/real/goethe.t
@@ -129,7 +129,7 @@
$tokens->add('Base', 'Sentences');
$tokens->add('Base', 'Paragraphs');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
is($output->{data}->{foundries}, 'base base/paragraphs base/sentences', 'Foundries');
is($output->{data}->{layerInfos}, 'base/s=spans', 'layerInfos');
@@ -151,7 +151,7 @@
like($first_token, qr!<>:opennlp/s:s\$<b>64<i>0<i>254<i>32!, 'data');
$tokens->add('OpenNLP', 'Morpho');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
is($output->{data}->{foundries},
'base base/paragraphs base/sentences opennlp opennlp/morpho opennlp/sentences',
'Foundries');
@@ -161,7 +161,7 @@
## Treetagger
$tokens->add('TreeTagger', 'Sentences');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
is($output->{data}->{foundries},
'base base/paragraphs base/sentences opennlp opennlp/morpho opennlp/sentences treetagger treetagger/sentences',
'Foundries');
@@ -170,7 +170,7 @@
like($first_token, qr!<>:tt/s:s\$<b>64<i>0<i>179<i>21<b>0!, 'data');
$tokens->add('TreeTagger', 'Morpho');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
is($output->{data}->{foundries},
'base base/paragraphs base/sentences opennlp opennlp/morpho opennlp/sentences treetagger treetagger/morpho treetagger/sentences',
'Foundries');
@@ -184,7 +184,7 @@
## CoreNLP
$tokens->add('CoreNLP', 'NamedEntities');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
is($output->{data}->{foundries},
'base base/paragraphs base/sentences corenlp corenlp/namedentities opennlp opennlp/morpho opennlp/sentences treetagger treetagger/morpho treetagger/sentences',
'Foundries');
@@ -206,14 +206,14 @@
like($first_token, qr!<>:corenlp/s:s\$<b>64<i>0<i>254<i>32<b>0!, 'data');
$tokens->add('CoreNLP', 'Morpho');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
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 );
+$output = $tokens->to_data;
like($output->{data}->{foundries}, qr!corenlp/constituency!, 'Foundries');
like($output->{data}->{layerInfos}, qr!corenlp/c=spans!, 'layerInfos');
$first_token = join('||', @{$output->{data}->{stream}->[0]});
@@ -230,7 +230,7 @@
## Glemm
$tokens->add('Glemm', 'Morpho');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
like($output->{data}->{foundries}, qr!glemm/morpho!, 'Foundries');
like($output->{data}->{layerInfos}, qr!glemm/l=tokens!, 'layerInfos');
$first_token = join('||', @{$output->{data}->{stream}->[0]});
@@ -242,14 +242,14 @@
## Connexor
$tokens->add('Connexor', 'Sentences');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
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\$<b>64<i>0<i>179<i>21<b>0!, 'data');
$tokens->add('Connexor', 'Morpho');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
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');
@@ -259,14 +259,14 @@
like($first_token, qr!cnx/p:A!, 'data');
$tokens->add('Connexor', 'Phrase');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
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\$<b>64<i>0<i>30<i>2!, 'data');
$tokens->add('Connexor', 'Syntax');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
like($output->{data}->{foundries}, qr!connexor/syntax!, 'Foundries');
like($output->{data}->{layerInfos}, qr!cnx/syn=tokens!, 'layerInfos');
$first_token = join('||', @{$output->{data}->{stream}->[0]});
@@ -274,7 +274,7 @@
## Mate
$tokens->add('Mate', 'Morpho');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
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');
@@ -286,18 +286,16 @@
like($first_token, qr!mate/m:number:pl!, 'data');
like($first_token, qr!mate/m:gender:\*!, 'data');
-# diag "No test for mate dependency";
-
## XIP
$tokens->add('XIP', 'Sentences');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
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\$<b>64<i>0<i>179<i>21!, 'data');
$tokens->add('XIP', 'Morpho');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
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');
@@ -305,7 +303,7 @@
like($first_token, qr!<>:xip/s:s\$<b>64<i>0<i>179<i>21!, 'data');
$tokens->add('XIP', 'Constituency');
-$output = decode_json( $tokens->to_json );
+$output = $tokens->to_data;
like($output->{data}->{foundries}, qr!xip/constituency!, 'Foundries');
like($output->{data}->{layerInfos}, qr!xip/c=spans!, 'layerInfos');
$first_token = join('||', @{$output->{data}->{stream}->[0]});
@@ -314,9 +312,10 @@
like($first_token, qr!<>:xip/c:ADJ\$<b>64<i>0<i>17<i>1<b>3!, 'data');
like($first_token, qr!<>:xip/c:TOP\$<b>64<i>0<i>179<i>21<b>0!, 'data');
+# diag "No test for mate dependency";
# diag "No test for xip dependency";
-# print timestr(timediff(Benchmark->new, $t));
+# diag timestr(timediff(Benchmark->new, $t));
done_testing;
__END__