Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | # source ~/perl5/perlbrew/etc/bashrc |
| 3 | # perlbrew switch perl-blead@korap |
| 4 | use strict; |
| 5 | use warnings; |
| 6 | use utf8; |
| 7 | use Test::More; |
| 8 | use Benchmark ':hireswallclock'; |
| 9 | use lib 'lib', '../lib'; |
| 10 | use Scalar::Util qw/weaken/; |
| 11 | |
| 12 | use File::Basename 'dirname'; |
| 13 | use File::Spec::Functions 'catdir'; |
| 14 | |
| 15 | use_ok('KorAP::Document'); |
| 16 | |
| 17 | my $path = catdir(dirname(__FILE__), 'artificial'); |
| 18 | ok(my $doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document'); |
| 19 | is($doc->path, $path . '/', 'Path'); |
| 20 | ok($doc->parse, 'Parse document'); |
| 21 | |
| 22 | sub new_tokenizer { |
| 23 | my $x = $doc; |
| 24 | weaken $x; |
| 25 | return KorAP::Tokenizer->new( |
| 26 | path => $x->path, |
| 27 | doc => $x, |
| 28 | foundry => 'OpenNLP', |
| 29 | layer => 'Tokens', |
| 30 | name => 'tokens' |
| 31 | ) |
| 32 | }; |
| 33 | |
| 34 | is($doc->primary->data, |
| 35 | 'Zum letzten kulturellen Anlass lädt die Leitung des Schulheimes Hofbergli ein, '. |
| 36 | 'bevor der Betrieb Ende Schuljahr eingestellt wird.', 'Primary data'); |
| 37 | |
| 38 | is($doc->primary->data_length, 129, 'Primary data length'); |
| 39 | |
| 40 | is($doc->primary->data(0,3), 'Zum', 'Get primary data'); |
| 41 | |
| 42 | # Get tokens |
| 43 | use_ok('KorAP::Tokenizer'); |
| 44 | # Get tokenization |
| 45 | ok(my $tokens = KorAP::Tokenizer->new( |
| 46 | path => $doc->path, |
| 47 | doc => $doc, |
| 48 | foundry => 'OpenNLP', |
| 49 | layer => 'Tokens', |
| 50 | name => 'tokens' |
| 51 | ), 'New Tokenizer'); |
| 52 | ok($tokens->parse, 'Parse'); |
| 53 | |
| 54 | is($tokens->foundry, 'OpenNLP', 'Foundry'); |
| 55 | |
Nils Diewald | 7ec5153 | 2014-10-28 19:51:26 +0000 | [diff] [blame] | 56 | is($tokens->doc->text_sigle, 'ART_ABC.00001', 'Doc id'); |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 57 | is($tokens->should, 20, 'Should'); |
| 58 | is($tokens->have, 18, 'Have'); |
| 59 | is($tokens->name, 'tokens', 'Name'); |
| 60 | is($tokens->layer, 'Tokens', 'Layer'); |
| 61 | |
| 62 | is($tokens->stream->pos(0)->to_string, '[(0-3)s:Zum|i:zum|_0#0-3|-:tokens$<i>18]', 'Token is correct'); |
| 63 | is($tokens->stream->pos(1)->to_string, '[(4-11)s:letzten|i:letzten|_1#4-11]', 'Token is correct'); |
| 64 | |
| 65 | my $i = 2; |
| 66 | foreach ([12,23, 'kulturellen'], |
| 67 | [24,30, 'Anlass'], |
| 68 | [31,35, 'lädt'], |
| 69 | [36,39, 'die'], |
| 70 | [40,47, 'Leitung'], |
| 71 | [48,51, 'des'], |
| 72 | [52,63, 'Schulheimes'], |
| 73 | [64,73, 'Hofbergli'], |
| 74 | [74,77, 'ein'], |
| 75 | [79,84, 'bevor'], |
| 76 | [85,88, 'der'], |
| 77 | [89,96, 'Betrieb'], |
| 78 | [97,101, 'Ende'], |
| 79 | [102,111, 'Schuljahr'], |
| 80 | [112,123, 'eingestellt'], |
| 81 | [124,128, 'wird'] |
| 82 | ) { |
| 83 | is($tokens->stream->pos($i++)->to_string, |
| 84 | '[('.$_->[0].'-'.$_->[1].')'. |
| 85 | 's:'.$_->[2].'|i:'.lc($_->[2]).'|'. |
| 86 | '_'.($i-1).'#'.$_->[0].'-'.$_->[1].']', |
| 87 | 'Token is correct'); |
| 88 | }; |
| 89 | |
| 90 | ok(!$tokens->stream->pos($i++), 'No more tokens'); |
| 91 | |
| 92 | # Add OpenNLP/morpho |
| 93 | ok($tokens->add('OpenNLP', 'Morpho'), 'Add OpenNLP/Morpho'); |
| 94 | |
| 95 | $i = 0; |
| 96 | foreach (qw/APPRART ADJA ADJA NN VVFIN ART NN ART NN NE PTKVZ KOUS ART NN NN NN VVPP VAFIN/) { |
| 97 | like($tokens->stream->pos($i++)->to_string, |
| 98 | qr!\|opennlp/p:$_!, |
Nils Diewald | 21a3e1a | 2014-04-28 18:48:16 +0000 | [diff] [blame] | 99 | 'Annotation (OpenNLP/p) is correct: ' . $_ |
| 100 | ); |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 101 | }; |
| 102 | |
| 103 | # Add OpenNLP/sentences |
| 104 | ok($tokens->add('OpenNLP', 'Sentences'), 'Add OpenNLP/Sentences'); |
| 105 | |
Nils Diewald | f03c680 | 2014-07-21 16:39:44 +0000 | [diff] [blame] | 106 | is($tokens->stream->pos(0)->to_string, '[(0-3)s:Zum|i:zum|_0#0-3|-:tokens$<i>18|opennlp/p:APPRART|<>:opennlp/s:s#0-129$<i>17|-:opennlp/sentences$<i>1]', 'Correct sentence'); |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 107 | |
| 108 | |
| 109 | # New instantiation |
| 110 | ok($tokens = KorAP::Tokenizer->new( |
| 111 | path => $doc->path, |
| 112 | doc => $doc, |
| 113 | foundry => 'OpenNLP', |
| 114 | layer => 'Tokens', |
| 115 | name => 'tokens' |
| 116 | ), 'New Tokenizer'); |
| 117 | |
| 118 | ok($tokens->parse, 'Parse'); |
| 119 | |
| 120 | # Add OpenNLP/sentences |
| 121 | ok($tokens->add('Base', 'Sentences'), 'Add Base/Sentences'); |
| 122 | |
| 123 | # Add OpenNLP/sentences |
| 124 | ok($tokens->add('Base', 'Paragraphs'), 'Add Base/Paragraphs'); |
| 125 | |
| 126 | is($tokens->stream->pos(0)->to_string, |
Nils Diewald | f03c680 | 2014-07-21 16:39:44 +0000 | [diff] [blame] | 127 | '[(0-3)s:Zum|i:zum|_0#0-3|-:tokens$<i>18|<>:base/s:s#0-129$<i>17|<>:base/s:t#0-129$<i>17|-:base/sentences$<i>1|-:base/paragraphs$<i>0]', |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 128 | 'Correct base annotation'); |
| 129 | |
| 130 | |
| 131 | # New instantiation |
Nils Diewald | 21a3e1a | 2014-04-28 18:48:16 +0000 | [diff] [blame] | 132 | ok($tokens = new_tokenizer->parse, 'Parse'); |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 133 | |
| 134 | # Add CoreNLP/NamedEntities |
| 135 | ok($tokens->add('CoreNLP', 'NamedEntities', 'ne_dewac_175m_600'), 'Add CoreNLP/NamedEntities'); |
| 136 | ok($tokens->add('CoreNLP', 'NamedEntities', 'ne_hgc_175m_600'), 'Add CoreNLP/NamedEntities'); |
| 137 | |
| 138 | is($tokens->stream->pos(9)->to_string, |
| 139 | '[(64-73)s:Hofbergli|i:hofbergli|_9#64-73|corenlp/ne_dewac_175m_600:I-LOC|corenlp/ne_hgc_175m_600:I-LOC]', |
| 140 | 'Correct NamedEntities annotation'); |
| 141 | |
| 142 | |
| 143 | # New instantiation |
Nils Diewald | 21a3e1a | 2014-04-28 18:48:16 +0000 | [diff] [blame] | 144 | ok($tokens = new_tokenizer->parse, 'Parse'); |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 145 | |
| 146 | # Add CoreNLP/Morpho |
| 147 | ok($tokens->add('CoreNLP', 'Morpho'), 'Add CoreNLP/Morpho'); |
| 148 | |
| 149 | is($tokens->stream->pos(0)->to_string, |
| 150 | '[(0-3)s:Zum|i:zum|_0#0-3|-:tokens$<i>18|corenlp/p:APPRART]', |
| 151 | 'Correct corenlp annotation'); |
| 152 | |
| 153 | $i = 0; |
| 154 | foreach (qw/APPRART ADJ ADJA NN VVFIN ART NN ART NN NE PTKVZ KOUS ART NN NN NN VVPP VAFIN/) { |
| 155 | like($tokens->stream->pos($i++)->to_string, |
| 156 | qr!\|corenlp/p:$_!, |
Nils Diewald | 21a3e1a | 2014-04-28 18:48:16 +0000 | [diff] [blame] | 157 | 'Annotation (CoreNLP/p) is correct: '. $_); |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 158 | }; |
| 159 | |
| 160 | # Add CoreNLP/Sentences |
| 161 | ok($tokens->add('CoreNLP', 'Sentences'), 'Add CoreNLP/Sentences'); |
| 162 | |
| 163 | is($tokens->stream->pos(0)->to_string, |
Nils Diewald | f03c680 | 2014-07-21 16:39:44 +0000 | [diff] [blame] | 164 | '[(0-3)s:Zum|i:zum|_0#0-3|-:tokens$<i>18|corenlp/p:APPRART|<>:corenlp/s:s#0-129$<i>17|-:corenlp/sentences$<i>1]', |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 165 | 'Correct corenlp annotation'); |
| 166 | |
| 167 | |
| 168 | # New instantiation |
Nils Diewald | 21a3e1a | 2014-04-28 18:48:16 +0000 | [diff] [blame] | 169 | ok($tokens = new_tokenizer->parse, 'New Tokenizer'); |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 170 | |
| 171 | # Add CoreNLP/Sentences |
| 172 | ok($tokens->add('Connexor', 'Sentences'), 'Add Connexor/Sentences'); |
| 173 | |
| 174 | is($tokens->stream->pos(0)->to_string, |
Nils Diewald | f03c680 | 2014-07-21 16:39:44 +0000 | [diff] [blame] | 175 | '[(0-3)s:Zum|i:zum|_0#0-3|-:tokens$<i>18|<>:cnx/s:s#0-129$<i>17|-:cnx/sentences$<i>1]', |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 176 | 'Correct cnx annotation'); |
| 177 | |
Nils Diewald | 21a3e1a | 2014-04-28 18:48:16 +0000 | [diff] [blame] | 178 | # New instantiation |
| 179 | ok($tokens = new_tokenizer->parse, 'New Tokenizer'); |
| 180 | |
| 181 | # Add Connexor/Morpho |
| 182 | ok($tokens->add('Connexor', 'Morpho'), 'Add Connexor/Morpho'); |
| 183 | |
| 184 | $i = 0; |
| 185 | foreach (qw/! A A N V DET N DET N N NUM CS DET N N N V V/) { |
| 186 | if ($_ eq '!') { |
| 187 | $i++; |
| 188 | next; |
| 189 | }; |
| 190 | like($tokens->stream->pos($i++)->to_string, |
| 191 | qr!\|cnx/p:$_!, |
| 192 | 'Annotation (Connexor/p) is correct: ' . $_); |
| 193 | }; |
| 194 | |
| 195 | $i = 0; |
| 196 | foreach (qw/! ! ! ! IND:PRES ! ! ! ! Prop ! ! ! ! ! ! PCP:PERF IND:PRES/) { |
| 197 | if ($_ eq '!') { |
| 198 | $i++; |
| 199 | next; |
| 200 | }; |
| 201 | foreach my $f (split(':', $_)) { |
| 202 | like($tokens->stream->pos($i)->to_string, |
| 203 | qr!\|cnx/m:$f!, |
| 204 | 'Annotation (Connexor/m) is correct: '. $f); |
| 205 | }; |
| 206 | $i++; |
| 207 | }; |
| 208 | |
| 209 | # New instantiation |
| 210 | ok($tokens = new_tokenizer->parse, 'New Tokenizer'); |
| 211 | |
| 212 | # Add Connexor/Phrase |
| 213 | ok($tokens->add('Connexor', 'Phrase'), 'Add Connexor/Phrase'); |
| 214 | my $stream = $tokens->stream; |
| 215 | like($stream->pos(1)->to_string, qr!\|<>:cnx/c:np#4-30\$<i>4!, 'Annotation (Connexor/c) is correct'); |
| 216 | like($stream->pos(6)->to_string, qr!\|<>:cnx/c:np#40-47\$<i>7!, 'Annotation (Connexor/c) is correct'); |
| 217 | like($stream->pos(8)->to_string, qr!\|<>:cnx/c:np#52-73\$<i>10!, 'Annotation (Connexor/c) is correct'); |
| 218 | like($stream->pos(13)->to_string, qr!\|<>:cnx/c:np#89-111\$<i>16!, 'Annotation (Connexor/c) is correct'); |
| 219 | |
| 220 | # New instantiation |
| 221 | ok($tokens = new_tokenizer->parse, 'New Tokenizer'); |
| 222 | |
| 223 | # Add Connexor/Syntax |
| 224 | ok($tokens->add('Connexor', 'Syntax'), 'Add Connexor/Syntax'); |
| 225 | $stream = $tokens->stream; |
| 226 | |
| 227 | $i = 0; |
| 228 | foreach (qw/! @PREMOD @PREMOD @NH @MAIN @PREMOD @NH @PREMOD |
| 229 | @PREMOD @NH @NH @PREMARK @PREMOD @PREMOD @NH @NH @MAIN @AUX/) { |
| 230 | if ($_ eq '!') { |
| 231 | $i++; |
| 232 | next; |
| 233 | }; |
| 234 | like($tokens->stream->pos($i++)->to_string, |
| 235 | qr!\|cnx/syn:$_!, |
| 236 | 'Annotation (Connexor/syn) is correct: ' . $_); |
| 237 | }; |
| 238 | |
| 239 | # New instantiation |
| 240 | ok($tokens = new_tokenizer->parse, 'New Tokenizer'); |
| 241 | |
| 242 | # Add XIP/Sentences |
| 243 | ok($tokens->add('XIP', 'Sentences'), 'Add XIP/Sentences'); |
| 244 | |
Nils Diewald | f03c680 | 2014-07-21 16:39:44 +0000 | [diff] [blame] | 245 | is($tokens->stream->pos(0)->to_string, '[(0-3)s:Zum|i:zum|_0#0-3|-:tokens$<i>18|<>:xip/s:s#0-129$<i>17|-:xip/sentences$<i>1]', 'First sentence'); |
Nils Diewald | 21a3e1a | 2014-04-28 18:48:16 +0000 | [diff] [blame] | 246 | |
| 247 | # Add XIP/Morpho |
| 248 | ok($tokens->add('XIP', 'Morpho'), 'Add XIP/Morpho'); |
| 249 | $stream = $tokens->stream; |
| 250 | |
| 251 | $i = 0; |
| 252 | foreach (qw/PREP ADJ ADJ NOUN VERB DET NOUN DET NOUN NOUN PTCL CONJ DET NOUN NOUN NOUN VERB VERB/) { |
| 253 | if ($_ eq '!') { |
| 254 | $i++; |
| 255 | next; |
| 256 | }; |
| 257 | like($tokens->stream->pos($i++)->to_string, |
| 258 | qr!\|xip/p:$_!, |
| 259 | 'Annotation (xip/p) is correct: ' . $_); |
| 260 | }; |
| 261 | |
| 262 | $i = 0; |
| 263 | foreach ('zu', 'letzt', 'kulturell', 'Anlass', '=laden:laden', 'die', 'Leitung', 'der', '#schulen:#Heim:schulen#Heim', 'Hofbergli', 'ein', 'bevor', 'der', 'Betrieb', 'Ende', '#schulen:#Jahr:schulen#Jahr') { |
| 264 | if ($_ eq '!') { |
| 265 | $i++; |
| 266 | next; |
| 267 | }; |
| 268 | foreach my $f (split(':', $_)) { |
| 269 | like($tokens->stream->pos($i)->to_string, |
| 270 | qr!\|xip/l:$f!, |
| 271 | 'Annotation (xip/l) is correct: ' . $f); |
| 272 | }; |
| 273 | $i++; |
| 274 | }; |
| 275 | |
| 276 | # New instantiation |
| 277 | ok($tokens = new_tokenizer->parse, 'New Tokenizer'); |
| 278 | |
| 279 | # Add XIP/Sentences |
Nils Diewald | 47c3ef3 | 2014-04-30 19:13:17 +0000 | [diff] [blame] | 280 | ok($tokens->add('XIP', 'Dependency'), 'Add XIP/Dependency'); |
Nils Diewald | 21a3e1a | 2014-04-28 18:48:16 +0000 | [diff] [blame] | 281 | |
| 282 | $stream = $tokens->stream; |
| 283 | like($stream->pos(1)->to_string, qr!\|>:xip/d:NMOD\$<i>3!, 'Dependency fine'); |
| 284 | like($stream->pos(3)->to_string, qr!\|<:xip/d:NMOD\$<i>1!, 'Dependency fine'); |
| 285 | like($stream->pos(3)->to_string, qr!\|<:xip/d:NMOD\$<i>2!, 'Dependency fine'); |
| 286 | like($stream->pos(4)->to_string, qr!\|>xip/d:VMAIN\$<i>4!, 'Dependency fine'); |
| 287 | like($stream->pos(4)->to_string, qr!\|<:xip/d:SUBJ\$<i>6!, 'Dependency fine'); |
| 288 | like($stream->pos(4)->to_string, qr!\|<:xip/d:VPREF\$<i>10!, 'Dependency fine'); |
| 289 | like($stream->pos(5)->to_string, qr!\|>:xip/d:DETERM\$<i>6!, 'Dependency fine'); |
| 290 | like($stream->pos(6)->to_string, qr!\|<:xip/d:DETERM\$<i>5!, 'Dependency fine'); |
| 291 | like($stream->pos(6)->to_string, qr!\|>:xip/d:SUBJ\$<i>4!, 'Dependency fine'); |
| 292 | like($stream->pos(6)->to_string, qr!\|<:xip/d:NMOD\$<i>8!, 'Dependency fine'); |
| 293 | like($stream->pos(7)->to_string, qr!\|>:xip/d:DETERM\$<i>8!, 'Dependency fine'); |
| 294 | like($stream->pos(8)->to_string, qr!\|<:xip/d:DETERM\$<i>7!, 'Dependency fine'); |
| 295 | like($stream->pos(8)->to_string, qr!\|>:xip/d:NMOD\$<i>6!, 'Dependency fine'); |
| 296 | like($stream->pos(8)->to_string, qr!\|<:xip/d:NMOD\$<i>9!, 'Dependency fine'); |
| 297 | like($stream->pos(9)->to_string, qr!\|>:xip/d:NMOD\$<i>8!, 'Dependency fine'); |
| 298 | like($stream->pos(10)->to_string, qr!\|>:xip/d:VPREF\$<i>4!, 'Dependency fine'); |
| 299 | like($stream->pos(11)->to_string, qr!\|>:xip/d:CONNECT\$<i>16!, 'Dependency fine'); |
| 300 | like($stream->pos(12)->to_string, qr!\|>:xip/d:DETERM\$<i>13!, 'Dependency fine'); |
| 301 | like($stream->pos(13)->to_string, qr!\|<:xip/d:DETERM\$<i>12!, 'Dependency fine'); |
| 302 | like($stream->pos(13)->to_string, qr!\|>:xip/d:SUBJ\$<i>16!, 'Dependency fine'); |
| 303 | like($stream->pos(14)->to_string, qr!\|>:xip/d:OBJ\$<i>16!, 'Dependency fine'); |
| 304 | like($stream->pos(15)->to_string, qr!\|>:xip/d:OBJ\$<i>16!, 'Dependency fine'); |
| 305 | like($stream->pos(16)->to_string, qr!\|<:xip/d:CONNECT\$<i>11!, 'Dependency fine'); |
| 306 | like($stream->pos(16)->to_string, qr!\|<:xip/d:SUBJ\$<i>13!, 'Dependency fine'); |
| 307 | like($stream->pos(16)->to_string, qr!\|<:xip/d:OBJ\$<i>14!, 'Dependency fine'); |
| 308 | like($stream->pos(16)->to_string, qr!\|<:xip/d:OBJ\$<i>15!, 'Dependency fine'); |
| 309 | like($stream->pos(16)->to_string, qr!\|>:xip/d:AUXIL\$<i>17!, 'Dependency fine'); |
| 310 | like($stream->pos(16)->to_string, qr!\|>xip/d:VMAIN\$<i>16!, 'Dependency fine'); |
| 311 | like($stream->pos(16)->to_string, qr!\|<xip/d:VMAIN\$<i>16!, 'Dependency fine'); |
| 312 | like($stream->pos(17)->to_string, qr!\|<:xip/d:AUXIL\$<i>16!, 'Dependency fine'); |
| 313 | |
Nils Diewald | 47c3ef3 | 2014-04-30 19:13:17 +0000 | [diff] [blame] | 314 | # New instantiation |
| 315 | ok($tokens = new_tokenizer->parse, 'New Tokenizer'); |
| 316 | |
| 317 | # Add XIP/Sentences |
| 318 | ok($tokens->add('XIP', 'Constituency'), 'Add XIP/Constituency'); |
| 319 | |
| 320 | $stream = $tokens->stream; |
| 321 | like($stream->pos(0)->to_string, qr!\|<>:xip/c:TOP#0-129\$<i>17!, 'Constituency fine'); |
| 322 | like($stream->pos(0)->to_string, qr!\|<>:xip/c:MC#0-129\$<i>17<b>1!, 'Constituency fine'); |
| 323 | like($stream->pos(0)->to_string, qr!\|<>:xip/c:PP#0-30\$<i>4<b>2!, 'Constituency fine'); |
| 324 | like($stream->pos(0)->to_string, qr!\|<>:xip/c:PREP#0-3\$<i>1!, 'Constituency fine'); |
| 325 | |
| 326 | like($stream->pos(1)->to_string, qr!\|<>:xip/c:NP#4-30\$<i>4<b>3!, 'Constituency fine'); |
| 327 | like($stream->pos(1)->to_string, qr!\|<>:xip/c:NPA#4-30\$<i>4<b>4!, 'Constituency fine'); |
| 328 | like($stream->pos(1)->to_string, qr!\|<>:xip/c:AP#4-11\$<i>2<b>5!, 'Constituency fine'); |
| 329 | like($stream->pos(1)->to_string, qr!\|<>:xip/c:ADJ#4-11\$<i>2<b>6!, 'Constituency fine'); |
| 330 | |
| 331 | like($stream->pos(2)->to_string, qr!\|<>:xip/c:AP#12-23\$<i>3<b>5!, 'Constituency fine'); |
| 332 | like($stream->pos(2)->to_string, qr!\|<>:xip/c:ADJ#12-23\$<i>3<b>6!, 'Constituency fine'); |
| 333 | |
| 334 | like($stream->pos(3)->to_string, qr!\|<>:xip/c:NOUN#24-30\$<i>4<b>5!, 'Constituency fine'); |
| 335 | |
| 336 | like($stream->pos(4)->to_string, qr!\|<>:xip/c:VERB#31-35\$<i>5<b>2!, 'Constituency fine'); |
| 337 | |
| 338 | like($stream->pos(5)->to_string, qr!\|<>:xip/c:NP#36-47\$<i>7<b>2!, 'Constituency fine'); |
| 339 | like($stream->pos(5)->to_string, qr!\|<>:xip/c:DET#36-39\$<i>6<b>3!, 'Constituency fine'); |
| 340 | |
| 341 | like($stream->pos(6)->to_string, qr!\|<>:xip/c:NPA#40-47\$<i>7<b>3!, 'Constituency fine'); |
| 342 | like($stream->pos(6)->to_string, qr!\|<>:xip/c:NOUN#40-47\$<i>7<b>4!, 'Constituency fine'); |
| 343 | |
| 344 | like($stream->pos(7)->to_string, qr!\|<>:xip/c:NP#48-63\$<i>9<b>2!, 'Constituency fine'); |
| 345 | like($stream->pos(7)->to_string, qr!\|<>:xip/c:DET#48-51\$<i>8<b>3!, 'Constituency fine'); |
| 346 | |
| 347 | like($stream->pos(8)->to_string, qr!\|<>:xip/c:NPA#52-63\$<i>9<b>3!, 'Constituency fine'); |
| 348 | like($stream->pos(8)->to_string, qr!\|<>:xip/c:NOUN#52-63\$<i>9<b>4!, 'Constituency fine'); |
| 349 | |
| 350 | like($stream->pos(9)->to_string, qr!\|<>:xip/c:NP#64-73\$<i>10<b>2!, 'Constituency fine'); |
| 351 | like($stream->pos(9)->to_string, qr!\|<>:xip/c:NPA#64-73\$<i>10<b>3!, 'Constituency fine'); |
| 352 | like($stream->pos(9)->to_string, qr!\|<>:xip/c:NOUN#64-73\$<i>10<b>4!, 'Constituency fine'); |
| 353 | |
| 354 | like($stream->pos(10)->to_string, qr!\|<>:xip/c:PTCL#74-77\$<i>11<b>2!, 'Constituency fine'); |
| 355 | |
| 356 | like($stream->pos(11)->to_string, qr!\|<>:xip/c:SC#79-128\$<i>18!, 'Constituency fine'); |
| 357 | like($stream->pos(11)->to_string, qr!\|<>:xip/c:CONJ#79-84\$<i>12<b>1!, 'Constituency fine'); |
| 358 | |
| 359 | like($stream->pos(12)->to_string, qr!\|<>:xip/c:NP#85-96\$<i>14<b>1!, 'Constituency fine'); |
| 360 | like($stream->pos(12)->to_string, qr!\|<>:xip/c:DET#85-88\$<i>13<b>2!, 'Constituency fine'); |
| 361 | |
| 362 | |
| 363 | like($stream->pos(13)->to_string, qr!\|<>:xip/c:NPA#89-96\$<i>14<b>2!, 'Constituency fine'); |
| 364 | like($stream->pos(13)->to_string, qr!\|<>:xip/c:NOUN#89-96\$<i>14<b>3!, 'Constituency fine'); |
| 365 | |
| 366 | like($stream->pos(14)->to_string, qr!\|<>:xip/c:NP#97-101\$<i>15<b>1!, 'Constituency fine'); |
| 367 | like($stream->pos(14)->to_string, qr!\|<>:xip/c:NPA#97-101\$<i>15<b>2!, 'Constituency fine'); |
| 368 | like($stream->pos(14)->to_string, qr!\|<>:xip/c:NOUN#97-101\$<i>15<b>3!, 'Constituency fine'); |
| 369 | |
| 370 | like($stream->pos(15)->to_string, qr!\|<>:xip/c:NP#102-111\$<i>16<b>1!, 'Constituency fine'); |
| 371 | like($stream->pos(15)->to_string, qr!\|<>:xip/c:NPA#102-111\$<i>16<b>2!, 'Constituency fine'); |
| 372 | like($stream->pos(15)->to_string, qr!\|<>:xip/c:NOUN#102-111\$<i>16<b>3!, 'Constituency fine'); |
| 373 | |
| 374 | like($stream->pos(16)->to_string, qr!\|<>:xip/c:VERB#112-123\$<i>17<b>1!, 'Constituency fine'); |
| 375 | |
| 376 | like($stream->pos(17)->to_string, qr!\|<>:xip/c:VERB#124-128\$<i>18<b>1!, 'Constituency fine'); |
| 377 | |
| 378 | # diag $stream->to_string; |
| 379 | |
Nils Diewald | 21a3e1a | 2014-04-28 18:48:16 +0000 | [diff] [blame] | 380 | |
| 381 | # ADJA ADJA NN VVFIN ART NN ART NN NE PTKVZ KOUS ART NN NN NN VVPP VAFIN |
| 382 | done_testing; |
| 383 | __END__ |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 384 | |
| 385 | |
| 386 | # Todo: CoreNLP/Constituency! |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 387 | |
| 388 | |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 389 | |
| 390 | |
| 391 | |
| 392 | # Connexor |
| 393 | push(@layers, ['Connexor', 'Morpho']); |
| 394 | push(@layers, ['Connexor', 'Syntax']); |
| 395 | push(@layers, ['Connexor', 'Phrase']); |
| 396 | push(@layers, ['Connexor', 'Sentences']); |
| 397 | |
| 398 | # TreeTagger |
| 399 | push(@layers, ['TreeTagger', 'Morpho']); |
| 400 | push(@layers, ['TreeTagger', 'Sentences']); |
| 401 | |
| 402 | # Mate |
| 403 | # push(@layers, ['Mate', 'Morpho']); |
| 404 | push(@layers, ['Mate', 'Dependency']); |
| 405 | |
| 406 | # XIP |
| 407 | push(@layers, ['XIP', 'Morpho']); |
| 408 | push(@layers, ['XIP', 'Constituency']); |
| 409 | push(@layers, ['XIP', 'Dependency']); |
| 410 | push(@layers, ['XIP', 'Sentences']); |
| 411 | |
| 412 | |
Nils Diewald | 98767bb | 2014-04-25 20:31:19 +0000 | [diff] [blame] | 413 | __END__ |