Akron | 797e807 | 2020-02-13 07:59:40 +0100 | [diff] [blame] | 1 | use strict; |
| 2 | use warnings; |
| 3 | use File::Basename 'dirname'; |
| 4 | use File::Spec::Functions qw/catfile/; |
Peter Harders | 1c5ce15 | 2020-07-22 18:02:50 +0200 | [diff] [blame] | 5 | use Encode qw!encode_utf8 decode_utf8 encode!; |
Akron | 797e807 | 2020-02-13 07:59:40 +0100 | [diff] [blame] | 6 | |
| 7 | use Test::More; |
| 8 | use Test::Output; |
Peter Harders | 42e18a6 | 2020-07-21 02:43:26 +0200 | [diff] [blame] | 9 | |
| 10 | use FindBin; |
| 11 | BEGIN { |
| 12 | unshift @INC, "$FindBin::Bin/../lib"; |
| 13 | }; |
Peter Harders | 1c5ce15 | 2020-07-22 18:02:50 +0200 | [diff] [blame] | 14 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 15 | use Test::KorAP::XML::TEI qw!korap_tempfile i5_template test_tei2korapxml!; |
Peter Harders | 57c884e | 2020-07-16 01:28:52 +0200 | [diff] [blame] | 16 | |
Akron | 797e807 | 2020-02-13 07:59:40 +0100 | [diff] [blame] | 17 | my $f = dirname(__FILE__); |
| 18 | my $script = catfile($f, '..', 'script', 'tei2korapxml'); |
| 19 | ok(-f $script, 'Script found'); |
| 20 | |
Akron | d949e18 | 2020-02-14 12:23:57 +0100 | [diff] [blame] | 21 | stdout_like( |
Akron | 797e807 | 2020-02-13 07:59:40 +0100 | [diff] [blame] | 22 | sub { system('perl', $script, '--help') }, |
Akron | d949e18 | 2020-02-14 12:23:57 +0100 | [diff] [blame] | 23 | qr!This\s*program\s*is\s*usually\s*called\s*from\s*inside\s*another\s*script\.!, |
Akron | 797e807 | 2020-02-13 07:59:40 +0100 | [diff] [blame] | 24 | 'Help' |
| 25 | ); |
| 26 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 27 | |
Akron | d949e18 | 2020-02-14 12:23:57 +0100 | [diff] [blame] | 28 | stdout_like( |
| 29 | sub { system('perl', $script, '--version') }, |
| 30 | qr!tei2korapxml - v\d+?\.\d+?!, |
| 31 | 'Version' |
| 32 | ); |
| 33 | |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 34 | # Load example file |
| 35 | my $file = catfile($f, 'data', 'goe_sample.i5.xml'); |
Peter Harders | 57c884e | 2020-07-16 01:28:52 +0200 | [diff] [blame] | 36 | |
Akron | b364947 | 2020-09-29 08:24:46 +0200 | [diff] [blame] | 37 | subtest 'Debugging' => sub { |
| 38 | |
| 39 | my $t = test_tei2korapxml( |
| 40 | tmp => 'script_out', |
| 41 | file => $file, |
| 42 | param => '-ti', |
| 43 | env => 'KORAPXMLTEI_DEBUG=1' |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 44 | )->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
Akron | b364947 | 2020-09-29 08:24:46 +0200 | [diff] [blame] | 45 | ->stderr_like(qr!Debugging is activated!); |
| 46 | }; |
| 47 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 48 | subtest 'Basic processing' => sub { |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 49 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 50 | my $t = test_tei2korapxml( |
| 51 | tmp => 'script_out', |
| 52 | file => $file, |
| 53 | param => '-ti' |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 54 | )->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
Akron | b364947 | 2020-09-29 08:24:46 +0200 | [diff] [blame] | 55 | ->stderr_unlike(qr!Debugging is activated!); |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 56 | |
Akron | 6896608 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 57 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 58 | # Uncompress GOE/header.xml from zip file |
| 59 | $t->unzip_xml('GOE/header.xml') |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 60 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 61 | # TODO: check wrong encoding in header-files (compare with input document)! |
| 62 | ->text_is('korpusSigle', 'GOE', 'korpusSigle') |
| 63 | ->text_is('h\.title[type=main]', 'Goethes Werke', 'h.title') |
| 64 | ->text_is('h\.author', 'Goethe, Johann Wolfgang von', 'h.author') |
| 65 | ->text_is('pubDate[type=year]', '1982', 'pubDate'); |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 66 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 67 | # Uncompress GOE/AGA/header.xml from zip file |
| 68 | $t->unzip_xml('GOE/AGA/header.xml') |
| 69 | ->text_is('dokumentSigle', 'GOE/AGA', 'dokumentSigle') |
| 70 | ->text_is('d\.title', 'Goethe: Autobiographische Schriften II, (1817-1825, 1832)', 'd.title') |
| 71 | ->text_is('creatDate', '1820-1822', 'creatDate'); |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 72 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 73 | # Uncompress GOE/AGA/00000/header.xml from zip file |
| 74 | $t->unzip_xml('GOE/AGA/00000/header.xml') |
| 75 | ->text_is('textSigle', 'GOE/AGA.00000', 'textSigle') |
| 76 | ->text_is('analytic > h\.title[type=main]', 'Campagne in Frankreich', 'h.title'); |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 77 | |
| 78 | # Uncompress GOE/AGA/00000/data.xml from zip file |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 79 | $t->unzip_xml('GOE/AGA/00000/data.xml') |
| 80 | ->attr_is('raw_text', 'docid', 'GOE_AGA.00000', 'text id') |
Marc Kupietz | fd0e6a9 | 2020-09-09 18:07:29 +0200 | [diff] [blame] | 81 | ->text_like('raw_text > text', qr!^Campagne in Frankreich 1792.*?uns allein begl.*cke\.$!, 'text content') |
| 82 | ->text_like('raw_text > text', qr!unter dem Titel "Kriegstheater"!, 'text content'); |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 83 | |
Akron | 417ed2f | 2020-09-28 12:43:17 +0200 | [diff] [blame] | 84 | my $content = $t->get_content_of('GOE/AGA/00000/data.xml'); |
| 85 | like($content, qr!unter dem Titel "Kriegstheater"!, 'raw text content'); |
| 86 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 87 | $t->unzip_xml('GOE/AGA/00000/struct/structure.xml') |
Akron | c57625b | 2020-07-30 11:46:06 +0200 | [diff] [blame] | 88 | ->text_is('span[id=s3] *[name=type]', 'Autobiographie', 'text content') |
| 89 | ->text_is('#s3 *[name=type]', 'Autobiographie', 'text content') |
| 90 | ->attr_is('#s0','to','1266') |
| 91 | ->attr_is('#s0','l','1') |
| 92 | |
| 93 | ->attr_is('#s18','from','925') |
| 94 | ->attr_is('#s18','to','1266') |
| 95 | ->attr_is('#s18','l','5') |
| 96 | ->attr_is('#s18 > fs','type', 'struct') |
| 97 | ->attr_is('#s18 > fs > f','name','name') |
| 98 | ->text_is('#s18 > fs > f','poem') |
| 99 | |
| 100 | ->attr_is('#s19','from','925') |
| 101 | ->attr_is('#s19','to','1098') |
| 102 | ->attr_is('#s19','l','6') |
| 103 | ->attr_is('#s19 > fs','type','struct') |
| 104 | ->text_is('#s19 > fs > f[name=name]','lg') |
| 105 | ->text_is('#s19 > fs > f[name=attr] > fs[type=attr] >f[name=part]','u') |
| 106 | |
| 107 | ->attr_is('#s37','from','1229') |
| 108 | ->attr_is('#s37','to','1266') |
| 109 | ->attr_is('#s37','l','8') |
| 110 | ->attr_is('#s37 > fs','type','struct') |
| 111 | ->text_is('#s37 > fs > f[name=name]','s') |
| 112 | ->text_is('#s37 > fs > f[name=attr] > fs[type=attr] > f[name=type]','manual') |
| 113 | |
| 114 | ->attr_is('#s38','from','1266') |
| 115 | ->attr_is('#s38','to','1266') |
| 116 | ->attr_is('#s38','l','2') |
| 117 | ->attr_is('#s38 > fs','type','struct') |
| 118 | ->text_is('#s38 > fs > f[name=name]','back') |
Akron | f7084c4 | 2021-01-07 10:25:22 +0100 | [diff] [blame] | 119 | ->element_count_is('*', 196); |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 120 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 121 | $t->file_exists_not('GOE/AGA/00000/base/tokens.xml', 'External not generated'); |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 122 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 123 | # Uncompress GOE/AGA/00000/base/tokens_aggressive.xml from zip file |
| 124 | $t->unzip_xml('GOE/AGA/00000/base/tokens_aggressive.xml') |
| 125 | ->attr_is('spanList span:nth-child(1)', 'to', 8) |
| 126 | ->attr_is('spanList span#t_1', 'from', 9) |
| 127 | ->attr_is('spanList span#t_1', 'to', 11) |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 128 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 129 | ->attr_is('spanList span#t_67', 'from', 427) |
| 130 | ->attr_is('spanList span#t_67', 'to', 430) |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 131 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 132 | ->attr_is('spanList span#t_214', 'from', 1209) |
| 133 | ->attr_is('spanList span#t_214', 'to', 1212) |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 134 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 135 | ->element_count_is('spanList span', 227); |
Peter Harders | 57c884e | 2020-07-16 01:28:52 +0200 | [diff] [blame] | 136 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 137 | # Uncompress GOE/AGA/00000/base/tokens_conservative.xml from zip file |
| 138 | $t->unzip_xml('GOE/AGA/00000/base/tokens_conservative.xml') |
| 139 | ->attr_is('spanList span:nth-child(1)', 'to', 8) |
Akron | 2a60c53 | 2020-02-13 15:52:18 +0100 | [diff] [blame] | 140 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 141 | ->attr_is('spanList span#t_1', 'from', 9) |
| 142 | ->attr_is('spanList span#t_1', 'to', 11) |
Akron | 797e807 | 2020-02-13 07:59:40 +0100 | [diff] [blame] | 143 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 144 | ->attr_is('spanList span#t_67', 'from', 427) |
| 145 | ->attr_is('spanList span#t_67', 'to', 430) |
Akron | eac374d | 2020-07-07 09:00:44 +0200 | [diff] [blame] | 146 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 147 | ->attr_is('spanList span#t_214', 'from', 1209) |
| 148 | ->attr_is('spanList span#t_214', 'to', 1212) |
Akron | eac374d | 2020-07-07 09:00:44 +0200 | [diff] [blame] | 149 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 150 | ->element_count_is('spanList span', 227); |
| 151 | }; |
Akron | eac374d | 2020-07-07 09:00:44 +0200 | [diff] [blame] | 152 | |
Akron | eac374d | 2020-07-07 09:00:44 +0200 | [diff] [blame] | 153 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 154 | subtest 'Tokenize with external tokenizer' => sub { |
Akron | eac374d | 2020-07-07 09:00:44 +0200 | [diff] [blame] | 155 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 156 | my $cmd = catfile($f, 'cmd', 'tokenizer.pl'); |
Akron | eac374d | 2020-07-07 09:00:44 +0200 | [diff] [blame] | 157 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 158 | test_tei2korapxml( |
| 159 | file => $file, |
| 160 | param => "-tc='perl $cmd'", |
| 161 | tmp => 'script_out2' |
| 162 | ) |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 163 | ->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 164 | ->file_readable('GOE/AGA/00000/base/tokens.xml') |
Akron | eac374d | 2020-07-07 09:00:44 +0200 | [diff] [blame] | 165 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 166 | # Uncompress GOE/AGA/00000/base/tokens.xml from zip file |
| 167 | ->unzip_xml('GOE/AGA/00000/base/tokens.xml') |
| 168 | ->attr_is('spanList span:nth-child(1)', 'to', 8) |
| 169 | ->attr_is('spanList span#t_1', 'from', 9) |
| 170 | ->attr_is('spanList span#t_1', 'to', 11) |
| 171 | ->attr_is('spanList span#t_67', 'from', 427) |
| 172 | ->attr_is('spanList span#t_67', 'to', 430) |
| 173 | ->attr_is('spanList span#t_214', 'from', 1209) |
| 174 | ->attr_is('spanList span#t_214', 'to', 1212) |
| 175 | ->element_count_is('spanList span', 227); |
| 176 | }; |
Akron | eac374d | 2020-07-07 09:00:44 +0200 | [diff] [blame] | 177 | |
Akron | 91705d7 | 2021-02-19 10:59:45 +0100 | [diff] [blame] | 178 | subtest 'Tokenize with external tokenizer and defined folder' => sub { |
| 179 | |
| 180 | my $cmd = catfile($f, 'cmd', 'tokenizer.pl'); |
| 181 | |
| 182 | test_tei2korapxml( |
| 183 | file => $file, |
| 184 | param => "-tc='perl $cmd' --tokens-file=yadda", |
| 185 | tmp => 'script_out2' |
| 186 | ) |
| 187 | ->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
| 188 | ->file_exists_not('GOE/AGA/00000/base/tokens.xml') |
| 189 | ->file_readable('GOE/AGA/00000/base/yadda.xml') |
| 190 | ->unzip_xml('GOE/AGA/00000/base/yadda.xml') |
| 191 | ->attr_is('spanList span:nth-child(1)', 'to', 8) |
| 192 | ->attr_is('spanList span#t_1', 'from', 9) |
| 193 | ->attr_is('spanList span#t_1', 'to', 11) |
| 194 | ->attr_is('spanList span#t_67', 'from', 427) |
| 195 | ->attr_is('spanList span#t_67', 'to', 430) |
| 196 | ->attr_is('spanList span#t_214', 'from', 1209) |
| 197 | ->attr_is('spanList span#t_214', 'to', 1212) |
| 198 | ->element_count_is('spanList span', 227); |
| 199 | }; |
| 200 | |
Marc Kupietz | eed4cb1 | 2021-02-17 19:39:32 +0100 | [diff] [blame] | 201 | subtest 'Check KorAP tokenizer for infinite loop bug' => sub { |
| 202 | |
| 203 | my $file = catfile($f, 'data', 'korap_tokenizer_challenge.xml'); |
| 204 | |
| 205 | eval { |
| 206 | require KorAP::XML::TEI::Tokenizer::KorAP; |
| 207 | 1; |
| 208 | } or do { |
| 209 | plan skip_all => "KorAP::XML::TEI::Tokenizer::KorAP cannot be used"; |
| 210 | }; |
| 211 | |
| 212 | test_tei2korapxml( |
| 213 | file => $file, |
| 214 | param => "-tk -s", |
| 215 | tmp => 'script_bug_check' |
| 216 | ) |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 217 | ->stderr_like(qr!tei2korapxml:.*? text_id=WDD19_H0039\.87242!) |
Marc Kupietz | eed4cb1 | 2021-02-17 19:39:32 +0100 | [diff] [blame] | 218 | ->file_readable('WDD19/H0039/87242/struct/structure.xml'); |
| 219 | }; |
| 220 | |
Marc Kupietz | 985da0c | 2021-02-15 19:29:50 +0100 | [diff] [blame] | 221 | subtest 'Sentence split with KorAP tokenizer' => sub { |
| 222 | |
| 223 | eval { |
| 224 | require KorAP::XML::TEI::Tokenizer::KorAP; |
| 225 | 1; |
| 226 | } or do { |
| 227 | plan skip_all => "KorAP::XML::TEI::Tokenizer::KorAP cannot be used"; |
| 228 | }; |
| 229 | |
| 230 | test_tei2korapxml( |
| 231 | file => $file, |
| 232 | param => "-tk -s", |
| 233 | tmp => 'script_sentence_split' |
| 234 | ) |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 235 | ->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
Marc Kupietz | 985da0c | 2021-02-15 19:29:50 +0100 | [diff] [blame] | 236 | ->file_readable('GOE/AGA/00000/struct/structure.xml') |
| 237 | ->unzip_xml('GOE/AGA/00000/struct/structure.xml') |
| 238 | ->text_is('span#s25 fs f', 's') |
| 239 | ->attr_is('span#s25', 'l', -1) |
| 240 | ->attr_is('span#s25', 'to', 54) |
| 241 | ->text_is('span#s30 fs f', 's') |
| 242 | ->attr_is('span#s30', 'l', -1) |
| 243 | ->attr_is('span#s30', 'from', 1099) |
| 244 | ->attr_is('span#s30', 'to', 1266); |
| 245 | }; |
Akron | eac374d | 2020-07-07 09:00:44 +0200 | [diff] [blame] | 246 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 247 | subtest 'Test Tokenizations' => sub { |
Akron | eac374d | 2020-07-07 09:00:44 +0200 | [diff] [blame] | 248 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 249 | my $t = test_tei2korapxml( |
| 250 | file => catfile($f, 'data', 'text_with_blanks.i5.xml'), |
| 251 | tmp => 'script_out3', |
| 252 | param => '-ti' |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 253 | )->stderr_like(qr!tei2korapxml:.*? text_id=CORP_DOC.00001!); |
Akron | 8b511f9 | 2020-07-09 17:28:08 +0200 | [diff] [blame] | 254 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 255 | # ~ test conservative tokenization ~ |
| 256 | $t->unzip_xml('CORP/DOC/00001/base/tokens_conservative.xml') |
| 257 | ->attr_is('spanList span:nth-child(1)', 'to', 6) |
Akron | 8b511f9 | 2020-07-09 17:28:08 +0200 | [diff] [blame] | 258 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 259 | ->attr_is('spanList span#t_1', 'from', 7) |
| 260 | ->attr_is('spanList span#t_1', 'to', 9) |
Akron | 8b511f9 | 2020-07-09 17:28:08 +0200 | [diff] [blame] | 261 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 262 | ->attr_is('spanList span#t_3', 'from', 12) |
| 263 | ->attr_is('spanList span#t_3', 'to', 16) |
Akron | 8b511f9 | 2020-07-09 17:28:08 +0200 | [diff] [blame] | 264 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 265 | ->attr_is('spanList span#t_9', 'from', 36) |
| 266 | ->attr_is('spanList span#t_9', 'to', 37) |
Akron | 8b511f9 | 2020-07-09 17:28:08 +0200 | [diff] [blame] | 267 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 268 | ->attr_is('spanList span#t_13', 'from', 44) |
| 269 | ->attr_is('spanList span#t_13', 'to', 45) # " |
Akron | 8b511f9 | 2020-07-09 17:28:08 +0200 | [diff] [blame] | 270 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 271 | ->attr_is('spanList span#t_14', 'from', 45) # twenty-two |
| 272 | ->attr_is('spanList span#t_14', 'to', 55) |
Peter Harders | 42e18a6 | 2020-07-21 02:43:26 +0200 | [diff] [blame] | 273 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 274 | ->attr_is('spanList span#t_15', 'from', 55) # " |
| 275 | ->attr_is('spanList span#t_15', 'to', 56) |
Akron | 8b511f9 | 2020-07-09 17:28:08 +0200 | [diff] [blame] | 276 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 277 | ->attr_is('spanList span#t_19', 'from', 66) |
| 278 | ->attr_is('spanList span#t_19', 'to', 67) |
Peter Harders | b122717 | 2020-07-21 02:12:10 +0200 | [diff] [blame] | 279 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 280 | ->element_count_is('spanList span', 20); |
Peter Harders | 71f072b | 2020-07-15 14:15:01 +0200 | [diff] [blame] | 281 | |
Peter Harders | 71f072b | 2020-07-15 14:15:01 +0200 | [diff] [blame] | 282 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 283 | # ~ test aggressive tokenization ~ |
| 284 | $t->unzip_xml('CORP/DOC/00001/base/tokens_aggressive.xml') |
| 285 | ->attr_is('spanList span:nth-child(1)', 'to', 6) |
Peter Harders | 71f072b | 2020-07-15 14:15:01 +0200 | [diff] [blame] | 286 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 287 | ->attr_is('spanList span#t_1', 'from', 7) |
| 288 | ->attr_is('spanList span#t_1', 'to', 9) |
Peter Harders | 71f072b | 2020-07-15 14:15:01 +0200 | [diff] [blame] | 289 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 290 | ->attr_is('spanList span#t_3', 'from', 12) |
| 291 | ->attr_is('spanList span#t_3', 'to', 16) |
Peter Harders | 71f072b | 2020-07-15 14:15:01 +0200 | [diff] [blame] | 292 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 293 | ->attr_is('spanList span#t_9', 'from', 36) |
| 294 | ->attr_is('spanList span#t_9', 'to', 37) |
Peter Harders | 71f072b | 2020-07-15 14:15:01 +0200 | [diff] [blame] | 295 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 296 | ->attr_is('spanList span#t_13', 'from', 44) |
| 297 | ->attr_is('spanList span#t_13', 'to', 45) # " |
Peter Harders | 71f072b | 2020-07-15 14:15:01 +0200 | [diff] [blame] | 298 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 299 | ->attr_is('spanList span#t_14', 'from', 45) # twenty |
| 300 | ->attr_is('spanList span#t_14', 'to', 51) |
Peter Harders | 71f072b | 2020-07-15 14:15:01 +0200 | [diff] [blame] | 301 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 302 | ->attr_is('spanList span#t_15', 'from', 51) # - |
| 303 | ->attr_is('spanList span#t_15', 'to', 52) |
Peter Harders | 71f072b | 2020-07-15 14:15:01 +0200 | [diff] [blame] | 304 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 305 | ->attr_is('spanList span#t_16', 'from', 52) # two |
| 306 | ->attr_is('spanList span#t_16', 'to', 55) |
Peter Harders | 71f072b | 2020-07-15 14:15:01 +0200 | [diff] [blame] | 307 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 308 | ->attr_is('spanList span#t_17', 'from', 55) # " |
| 309 | ->attr_is('spanList span#t_17', 'to', 56) |
Peter Harders | 71f072b | 2020-07-15 14:15:01 +0200 | [diff] [blame] | 310 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 311 | ->attr_is('spanList span#t_21', 'from', 66) |
| 312 | ->attr_is('spanList span#t_21', 'to', 67) |
Peter Harders | 71f072b | 2020-07-15 14:15:01 +0200 | [diff] [blame] | 313 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 314 | ->element_count_is('spanList span', 22); |
| 315 | }; |
Peter Harders | 71f072b | 2020-07-15 14:15:01 +0200 | [diff] [blame] | 316 | |
| 317 | |
Peter Harders | 42e18a6 | 2020-07-21 02:43:26 +0200 | [diff] [blame] | 318 | subtest 'Check Tokenization Flags' => sub { |
| 319 | |
| 320 | # Get external tokenizer |
| 321 | my $f = dirname(__FILE__); |
| 322 | my $cmd = catfile($f, 'cmd', 'tokenizer.pl'); |
| 323 | |
| 324 | # Load example file |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 325 | test_tei2korapxml( |
| 326 | file => catfile($f, 'data', 'goe_sample.i5.xml'), |
| 327 | param => "-ti -tc 'perl $cmd'", |
| 328 | tmp => 'script_tokflags' |
| 329 | ) |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 330 | ->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 331 | ->file_exists('GOE/AGA/00000/base/tokens_aggressive.xml') |
| 332 | ->file_exists('GOE/AGA/00000/base/tokens_conservative.xml') |
| 333 | ->file_exists('GOE/AGA/00000/base/tokens.xml') |
| 334 | ; |
Peter Harders | 42e18a6 | 2020-07-21 02:43:26 +0200 | [diff] [blame] | 335 | }; |
| 336 | |
Peter Harders | 1c5ce15 | 2020-07-22 18:02:50 +0200 | [diff] [blame] | 337 | |
| 338 | subtest 'Test utf-8 handling' => sub { |
Peter Harders | 1c5ce15 | 2020-07-22 18:02:50 +0200 | [diff] [blame] | 339 | # Introduce invalid utf-8 characters |
| 340 | my $text_sigle; |
Akron | 54e363c | 2020-07-29 11:01:03 +0200 | [diff] [blame] | 341 | { |
| 342 | no warnings; |
| 343 | # $text_sigle printed to file, without encoding: Aþ¿¿¿¿¿A_Bþ¿¿¿¿¿B.Cþ¿¿¿¿¿C |
| 344 | # the utf8-sequence 'þ¿¿¿¿¿' encodes 32 bit of data (see 0x7FFF_FFFF in perlunicode) |
| 345 | $text_sigle = "A\x{FFFF_FFFF}A_B\x{FFFF_FFFF}B.C\x{FFFF_FFFF}C" |
| 346 | } |
| 347 | # If CHECK is 0, encoding and decoding replace any malformed character |
| 348 | # with a substitution character. |
Peter Harders | 1c5ce15 | 2020-07-22 18:02:50 +0200 | [diff] [blame] | 349 | # � = substitution character |
| 350 | my $text_sigle_lax = encode_utf8($text_sigle); |
| 351 | my $text_sigle_esc = encode('UTF-8', $text_sigle); |
| 352 | |
| 353 | is(length($text_sigle), 11); # A�A_B�B.C�C (char string => length(�) = 1) |
| 354 | is(length($text_sigle_lax), 29); # Aþ¿¿¿¿¿A_Bþ¿¿¿¿¿B.Cþ¿¿¿¿¿C (byte string) |
| 355 | is(length($text_sigle_esc), 17); # A�A_B�B.C�C (byte string => length(�) = 3) |
| 356 | |
Akron | 54e363c | 2020-07-29 11:01:03 +0200 | [diff] [blame] | 357 | |
| 358 | my $tpl; |
| 359 | { |
| 360 | no warnings; |
| 361 | $tpl = i5_template( |
| 362 | korpusSigle => "A\x{FFFF_FFFF}A", |
| 363 | dokumentSigle => "A\x{FFFF_FFFF}A_B\x{FFFF_FFFF}B", |
| 364 | text => "<p>d\x{FFFF_FFFF}d e\x{FFFF_FFFF}e f\x{FFFF_FFFF}f</p>", |
| 365 | textSigle => $text_sigle |
| 366 | ); |
| 367 | }; |
Peter Harders | 1c5ce15 | 2020-07-22 18:02:50 +0200 | [diff] [blame] | 368 | |
| 369 | my ($fh, $tplfile) = korap_tempfile('script_out4'); |
| 370 | binmode($fh); |
| 371 | print $fh encode_utf8($tpl); # => text_id=Aþ¿¿¿¿¿A_Bþ¿¿¿¿¿B.Cþ¿¿¿¿¿C |
| 372 | close($fh); |
| 373 | |
| 374 | my (undef, $outzip) = korap_tempfile('script_out5'); |
| 375 | |
Akron | 54e363c | 2020-07-29 11:01:03 +0200 | [diff] [blame] | 376 | # because output 'textid=...' goes to STDERR (see script/tei2korapxml) |
Akron | eaa9623 | 2020-10-15 17:06:15 +0200 | [diff] [blame] | 377 | binmode STDERR; |
Peter Harders | 1c5ce15 | 2020-07-22 18:02:50 +0200 | [diff] [blame] | 378 | |
| 379 | stderr_like( |
Akron | a2cb281 | 2021-10-30 10:29:08 +0200 | [diff] [blame] | 380 | sub { `cat '$tplfile' | perl '$script' -ti - > '$outzip'` }, |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 381 | qr!tei2korapxml:.*? text_id=$text_sigle_esc!, # see above: print $fh encode_utf8($tpl); |
Peter Harders | 1c5ce15 | 2020-07-22 18:02:50 +0200 | [diff] [blame] | 382 | ); |
| 383 | }; |
| 384 | |
Akron | e68ec0c | 2020-07-28 18:06:19 +0200 | [diff] [blame] | 385 | |
Akron | dd0be8f | 2021-02-18 19:29:41 +0100 | [diff] [blame] | 386 | subtest 'Check structure parsing with defined foundry and folder' => sub { |
| 387 | # Load example file |
| 388 | my $file = catfile($f, 'data', 'goe_sample.i5.xml'); |
| 389 | |
| 390 | my $t = test_tei2korapxml( |
| 391 | tmp => 'script_out', |
| 392 | file => $file, |
| 393 | param => '-ti --inline-structures=myfoundry#mystr' |
Akron | 91705d7 | 2021-02-19 10:59:45 +0100 | [diff] [blame] | 394 | )->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
Akron | dd0be8f | 2021-02-18 19:29:41 +0100 | [diff] [blame] | 395 | ->file_exists_not('GOE/AGA/00000/struct/structure.xml', 'Structure not generated') |
| 396 | ->unzip_xml('GOE/AGA/00000/myfoundry/mystr.xml') |
| 397 | ->text_is('span[id=s3] *[name=type]', 'Autobiographie', 'text content') |
| 398 | ->text_is('#s3 *[name=type]', 'Autobiographie', 'text content') |
| 399 | ->attr_is('#s0','to','1266') |
| 400 | ->attr_is('#s0','l','1') |
| 401 | ->attr_is('#s18','from','925') |
| 402 | ->attr_is('#s18','to','1266') |
| 403 | ->attr_is('#s18','l','5') |
| 404 | ; |
| 405 | |
| 406 | $t = test_tei2korapxml( |
| 407 | tmp => 'script_out', |
| 408 | file => $file, |
| 409 | param => '-ti --inline-structures=myfoundry' |
Akron | 91705d7 | 2021-02-19 10:59:45 +0100 | [diff] [blame] | 410 | )->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
Akron | dd0be8f | 2021-02-18 19:29:41 +0100 | [diff] [blame] | 411 | ->file_exists_not('GOE/AGA/00000/struct/structure.xml', 'Structure not generated') |
| 412 | ->unzip_xml('GOE/AGA/00000/myfoundry/structure.xml') |
| 413 | ->text_is('span[id=s3] *[name=type]', 'Autobiographie', 'text content') |
| 414 | ->text_is('#s3 *[name=type]', 'Autobiographie', 'text content') |
| 415 | ->attr_is('#s0','to','1266') |
| 416 | ->attr_is('#s0','l','1') |
| 417 | ->attr_is('#s18','from','925') |
| 418 | ->attr_is('#s18','to','1266') |
| 419 | ->attr_is('#s18','l','5') |
| 420 | ; |
| 421 | }; |
| 422 | |
Akron | 54c3ff1 | 2021-02-25 11:33:37 +0100 | [diff] [blame] | 423 | subtest 'Check structure parsing with skipped tags' => sub { |
| 424 | # Load example file |
| 425 | my $file = catfile($f, 'data', 'goe_sample.i5.xml'); |
| 426 | |
| 427 | my $t = test_tei2korapxml( |
| 428 | tmp => 'script_out', |
| 429 | file => $file, |
| 430 | param => '-ti' |
| 431 | )->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
| 432 | ->file_exists('GOE/AGA/00000/struct/structure.xml', 'Structure generated') |
| 433 | ->unzip_xml('GOE/AGA/00000/struct/structure.xml') |
| 434 | ->text_is('layer spanList span fs f', 'text') |
| 435 | ->text_is('#s5 fs f[name=name]','head') |
| 436 | ->text_is('#s6 fs f[name=name]','s') |
| 437 | ->text_is('#s7 fs f[name=name]','head') |
| 438 | ->text_is('#s8 fs f[name=name]','s') |
| 439 | ->text_is('#s9 fs f[name=name]','quote') |
| 440 | ->text_is('#s10 fs f[name=name]','s') |
| 441 | ; |
| 442 | |
| 443 | $t = test_tei2korapxml( |
| 444 | tmp => 'script_out', |
| 445 | file => $file, |
| 446 | param => '-ti --skip-inline-tags=head' |
| 447 | )->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
| 448 | ->file_exists('GOE/AGA/00000/struct/structure.xml', 'Structure generated') |
| 449 | ->unzip_xml('GOE/AGA/00000/struct/structure.xml') |
| 450 | ->text_is('layer spanList span fs f', 'text') |
| 451 | ->text_is('#s5 fs f[name=name]','s') |
| 452 | ->text_is('#s6 fs f[name=name]','s') |
| 453 | ->text_is('#s7 fs f[name=name]','quote') |
| 454 | ->text_is('#s8 fs f[name=name]','s') |
| 455 | ; |
| 456 | |
| 457 | $t = test_tei2korapxml( |
| 458 | tmp => 'script_out', |
| 459 | file => $file, |
| 460 | param => '-ti --skip-inline-tags=head,quote' |
| 461 | )->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
| 462 | ->file_exists('GOE/AGA/00000/struct/structure.xml', 'Structure generated') |
| 463 | ->unzip_xml('GOE/AGA/00000/struct/structure.xml') |
| 464 | ->text_is('layer spanList span fs f', 'text') |
| 465 | ->text_is('#s5 fs f[name=name]','s') |
| 466 | ->text_is('#s6 fs f[name=name]','s') |
| 467 | ->text_is('#s7 fs f[name=name]','s') |
| 468 | ; |
| 469 | }; |
| 470 | |
Akron | dd0be8f | 2021-02-18 19:29:41 +0100 | [diff] [blame] | 471 | |
Akron | 75d6314 | 2021-02-23 18:40:56 +0100 | [diff] [blame] | 472 | subtest 'Check parsing but skip inline tokens' => sub { |
| 473 | # Load example file |
| 474 | my $file = catfile($f, 'data', 'goe_sample.i5.xml'); |
| 475 | |
| 476 | my $t = test_tei2korapxml( |
| 477 | tmp => 'script_skip_inline_tokens_1', |
| 478 | file => $file, |
| 479 | param => '-ti --skip-inline-tokens' |
| 480 | )->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
| 481 | ->file_exists('GOE/AGA/00000/data.xml', 'Data exists') |
| 482 | ->file_exists('GOE/AGA/00000/struct/structure.xml', 'Structure generated') |
| 483 | ->file_exists_not('GOE/AGA/00000/tokens/morpho.xml', 'Morpho not generated') |
| 484 | ; |
| 485 | |
| 486 | $t = test_tei2korapxml( |
| 487 | tmp => 'script_skip_inline_tokens_2', |
| 488 | file => $file, |
| 489 | param => '-ti --skip-inline-tokens --inline-tokens=myfoundry#myfile' |
| 490 | )->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
| 491 | ->file_exists('GOE/AGA/00000/struct/structure.xml', 'Structure generated') |
| 492 | ->file_exists_not('GOE/AGA/00000/tokens/morpho.xml', 'Morpho not generated') |
| 493 | ->file_exists_not('GOE/AGA/00000/myfoundry/myfile.xml', 'Morpho not generated') |
| 494 | ; |
| 495 | }; |
| 496 | |
| 497 | |
Akron | e68ec0c | 2020-07-28 18:06:19 +0200 | [diff] [blame] | 498 | subtest 'Check Inline annotations' => sub { |
| 499 | |
| 500 | # Load example file |
| 501 | my $file = catfile($f, 'data', 'goe_sample_tagged.i5.xml'); |
| 502 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 503 | my $t = test_tei2korapxml( |
| 504 | file => $file, |
| 505 | env => 'KORAPXMLTEI_INLINE=1', |
Akron | b93fabb | 2023-01-13 12:05:44 +0100 | [diff] [blame] | 506 | tmp => 'script_tagged', |
| 507 | param => '--no-tokenizer' |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 508 | ) |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 509 | ->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
Akron | 692d17d | 2021-03-05 13:21:03 +0100 | [diff] [blame] | 510 | ->stderr_like(qr!KORAPXMLTEI_INLINE is deprecated!) |
Akron | e68ec0c | 2020-07-28 18:06:19 +0200 | [diff] [blame] | 511 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 512 | # Check zip using xml loy |
| 513 | ->unzip_xml('GOE/AGA/00000/tokens/morpho.xml') |
Akron | e68ec0c | 2020-07-28 18:06:19 +0200 | [diff] [blame] | 514 | |
Akron | 044bd92 | 2020-07-30 09:12:28 +0200 | [diff] [blame] | 515 | ->attr_is('layer', 'docid', 'GOE_AGA.00000') |
Akron | e68ec0c | 2020-07-28 18:06:19 +0200 | [diff] [blame] | 516 | ->attr_is('spanList span:nth-child(1)', 'id', 's0') |
| 517 | ->attr_is('spanList span:nth-child(1)', 'from', '75') |
| 518 | ->attr_is('spanList span:nth-child(1)', 'to', '81') |
| 519 | ->attr_is('spanList span:nth-child(1)', 'l', '7') |
| 520 | |
| 521 | ->attr_is('span#s0 > fs', 'type', 'lex') |
| 522 | ->attr_is('span#s0 > fs', 'xmlns', 'http://www.tei-c.org/ns/1.0') |
| 523 | ->attr_is('span#s0 > fs > f > fs > f:nth-child(1)', 'name', 'pos') |
| 524 | ->text_is('span#s0 > fs > f > fs > f:nth-child(1)', 'A') |
| 525 | ->attr_is('span#s0 > fs > f > fs > f:nth-child(2)', 'name', 'msd') |
| 526 | ->text_is('span#s0 > fs > f > fs > f:nth-child(2)', '@NH') |
| 527 | |
| 528 | ->attr_is('span#s25', 'from', '259') |
| 529 | ->attr_is('span#s25', 'to', '263') |
| 530 | ->attr_is('span#s25', 'l', '7') |
| 531 | ->attr_is('span#s25 > fs > f > fs > f:nth-child(1)', 'name', 'pos') |
| 532 | ->text_is('span#s25 > fs > f > fs > f:nth-child(1)', 'PRON') |
| 533 | ->attr_is('span#s25 > fs > f > fs > f:nth-child(2)', 'name', 'msd') |
| 534 | ->text_is('span#s25 > fs > f > fs > f:nth-child(2)', '@NH') |
| 535 | |
| 536 | ->attr_is('span#s58', 'from', '495') |
| 537 | ->attr_is('span#s58', 'to', '500') |
| 538 | ->attr_is('span#s58', 'l', '7') |
| 539 | ->attr_is('span#s58 > fs > f > fs > f:nth-child(1)', 'name', 'pos') |
| 540 | ->text_is('span#s58 > fs > f > fs > f:nth-child(1)', 'N') |
| 541 | ->attr_is('span#s58 > fs > f > fs > f:nth-child(2)', 'name', 'msd') |
| 542 | ->text_is('span#s58 > fs > f > fs > f:nth-child(2)', '@NH') |
| 543 | |
| 544 | ->attr_is('span#s119', 'from', '914') |
| 545 | ->attr_is('span#s119', 'to', '925') |
| 546 | ->attr_is('span#s119', 'l', '7') |
| 547 | ->attr_is('span#s119 > fs > f > fs > f:nth-child(1)', 'name', 'pos') |
| 548 | ->text_is('span#s119 > fs > f > fs > f:nth-child(1)', 'A') |
| 549 | ->attr_is('span#s119 > fs > f > fs > f:nth-child(2)', 'name', 'msd') |
| 550 | ->text_is('span#s119 > fs > f > fs > f:nth-child(2)', '@NH') |
| 551 | ->element_exists_not('span#s120') |
| 552 | ; |
| 553 | }; |
| 554 | |
Akron | 26a7152 | 2021-02-19 10:27:37 +0100 | [diff] [blame] | 555 | |
| 556 | subtest 'Check file structure with defined folder and filenames' => sub { |
| 557 | # Load example file |
| 558 | my $file = catfile($f, 'data', 'goe_sample.i5.xml'); |
| 559 | my $t = test_tei2korapxml( |
| 560 | tmp => 'script_out', |
| 561 | file => $file, |
| 562 | param => '-ti --base-foundry=root --data-file=primary --header-file=meta' |
Akron | 91705d7 | 2021-02-19 10:59:45 +0100 | [diff] [blame] | 563 | )->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
Akron | 26a7152 | 2021-02-19 10:27:37 +0100 | [diff] [blame] | 564 | ->file_exists_not('GOE/AGA/00000/header.xml', 'Header not there') |
| 565 | ->file_exists_not('GOE/AGA/header.xml', 'Header not there') |
| 566 | ->file_exists_not('GOE/header.xml', 'Header not there') |
| 567 | ->file_exists_not('GOE/AGA/00000/data.xml', 'Data not there') |
| 568 | ->file_exists_not('GOE/AGA/00000/base/tokens_conservative.xml', 'Tokens not there') |
| 569 | ->file_exists_not('GOE/AGA/00000/base/tokens_aggressive.xml', 'Tokens not there') |
| 570 | ->file_exists('GOE/AGA/00000/meta.xml', 'Header there') |
| 571 | ->file_exists('GOE/AGA/meta.xml', 'Header there') |
| 572 | ->file_exists('GOE/meta.xml', 'Header there') |
| 573 | ->file_exists('GOE/AGA/00000/primary.xml', 'Data there') |
| 574 | ->file_exists('GOE/AGA/00000/root/tokens_conservative.xml', 'Tokens there') |
| 575 | ->file_exists('GOE/AGA/00000/root/tokens_aggressive.xml', 'Tokens there') |
| 576 | ; |
| 577 | |
| 578 | $t->unzip_xml('GOE/AGA/00000/primary.xml') |
| 579 | ->content_like(qr/\Q"Kriegstheater"\E/) |
| 580 | ; |
| 581 | }; |
| 582 | |
Akron | 1a5271a | 2021-02-18 13:18:15 +0100 | [diff] [blame] | 583 | subtest 'Check Inline annotations with defined foundry and folder' => sub { |
| 584 | # Load example file |
| 585 | my $file = catfile($f, 'data', 'goe_sample_tagged.i5.xml'); |
| 586 | |
| 587 | my $t = test_tei2korapxml( |
| 588 | file => $file, |
Akron | 1a5271a | 2021-02-18 13:18:15 +0100 | [diff] [blame] | 589 | tmp => 'script_tagged', |
Akron | b93fabb | 2023-01-13 12:05:44 +0100 | [diff] [blame] | 590 | param => '--inline-tokens=myfoundry#myfile --skip-inline-token-annotations=0 --no-tokenizer' |
Akron | 1a5271a | 2021-02-18 13:18:15 +0100 | [diff] [blame] | 591 | ) |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 592 | ->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
Akron | 692d17d | 2021-03-05 13:21:03 +0100 | [diff] [blame] | 593 | ->stderr_unlike(qr!KORAPXMLTEI_INLINE is deprecated!) |
Akron | 1a5271a | 2021-02-18 13:18:15 +0100 | [diff] [blame] | 594 | |
| 595 | ->file_exists_not('GOE/AGA/00000/tokens/morpho.xml', 'Morpho not generated') |
| 596 | |
| 597 | # Check zip using xml loy |
| 598 | ->unzip_xml('GOE/AGA/00000/myfoundry/myfile.xml') |
| 599 | |
| 600 | ->attr_is('layer', 'docid', 'GOE_AGA.00000') |
| 601 | ->attr_is('spanList span:nth-child(1)', 'id', 's0') |
| 602 | ->attr_is('spanList span:nth-child(1)', 'from', '75') |
| 603 | ->attr_is('spanList span:nth-child(1)', 'to', '81') |
| 604 | ->attr_is('spanList span:nth-child(1)', 'l', '7') |
| 605 | ; |
| 606 | |
| 607 | $t = test_tei2korapxml( |
| 608 | file => $file, |
Akron | 1a5271a | 2021-02-18 13:18:15 +0100 | [diff] [blame] | 609 | tmp => 'script_tagged', |
Akron | b93fabb | 2023-01-13 12:05:44 +0100 | [diff] [blame] | 610 | param => '--inline-tokens=myfoundry --skip-inline-token-annotations=0 --no-tokenizer' |
Akron | 1a5271a | 2021-02-18 13:18:15 +0100 | [diff] [blame] | 611 | ) |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 612 | ->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
Akron | 1a5271a | 2021-02-18 13:18:15 +0100 | [diff] [blame] | 613 | |
| 614 | ->file_exists_not('GOE/AGA/00000/tokens/morpho.xml', 'Morpho not generated') |
| 615 | |
| 616 | # Check zip using xml loy |
| 617 | ->unzip_xml('GOE/AGA/00000/myfoundry/morpho.xml') |
| 618 | |
| 619 | ->attr_is('layer', 'docid', 'GOE_AGA.00000') |
| 620 | ->attr_is('spanList span:nth-child(1)', 'id', 's0') |
| 621 | ->attr_is('spanList span:nth-child(1)', 'from', '75') |
| 622 | ->attr_is('spanList span:nth-child(1)', 'to', '81') |
| 623 | ->attr_is('spanList span:nth-child(1)', 'l', '7') |
| 624 | ; |
| 625 | }; |
| 626 | |
Akron | 09e0b2c | 2020-07-28 15:57:01 +0200 | [diff] [blame] | 627 | subtest 'Check Inline annotations with untagged file' => sub { |
| 628 | |
| 629 | # Load example file |
| 630 | my $file = catfile($f, 'data', 'goe_sample.i5.xml'); |
| 631 | |
| 632 | my ($fh, $outzip) = korap_tempfile('script_untagged'); |
| 633 | |
| 634 | # Generate zip file (unportable!) |
| 635 | stderr_like( |
Akron | b93fabb | 2023-01-13 12:05:44 +0100 | [diff] [blame] | 636 | sub { `cat '$file' | perl '$script' --skip-token-inline-annotations=0 --no-tokenizer - > '$outzip'` }, |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 637 | qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!, |
Akron | 09e0b2c | 2020-07-28 15:57:01 +0200 | [diff] [blame] | 638 | 'Processing 1' |
| 639 | ); |
| 640 | |
| 641 | # TODO: there should be a better way to test this |
| 642 | stderr_unlike( |
Akron | b93fabb | 2023-01-13 12:05:44 +0100 | [diff] [blame] | 643 | sub { `cat '$file' | perl '$script' --skip-token-inline-annotations=0 --no-tokenizer - > '$outzip'` }, |
Akron | 09e0b2c | 2020-07-28 15:57:01 +0200 | [diff] [blame] | 644 | qr!.*undefined value.*!, |
| 645 | 'Processing 2' |
| 646 | ); |
| 647 | # |
| 648 | |
| 649 | ok(-e $outzip, "File $outzip exists"); |
| 650 | |
| 651 | my $zip = IO::Uncompress::Unzip->new( |
| 652 | $outzip, |
| 653 | Name => 'GOE/AGA/00000/tokens/morpho.xml' |
| 654 | ); |
| 655 | ok((not $zip), 'missing morpho.xml'); |
| 656 | |
| 657 | $zip = IO::Uncompress::Unzip->new( |
| 658 | $outzip, |
| 659 | Name => 'GOE/AGA/00000/struct/structure.xml' |
| 660 | ); |
| 661 | ok($zip, 'found structure.xml'); |
| 662 | }; |
Akron | e68ec0c | 2020-07-28 18:06:19 +0200 | [diff] [blame] | 663 | |
Akron | 3378dfd | 2020-08-01 15:01:36 +0200 | [diff] [blame] | 664 | |
Akron | eaa9623 | 2020-10-15 17:06:15 +0200 | [diff] [blame] | 665 | subtest 'Check input encoding' => sub { |
| 666 | |
| 667 | # Load example file |
| 668 | test_tei2korapxml( |
| 669 | file => catfile($f, 'data', 'goe_sample.i5.xml'), |
Akron | 692d17d | 2021-03-05 13:21:03 +0100 | [diff] [blame] | 670 | tmp => 'script_utf8_enc', |
Akron | b93fabb | 2023-01-13 12:05:44 +0100 | [diff] [blame] | 671 | param => '--skip-inline-token-annotations=0 --no-tokenizer', |
Akron | eaa9623 | 2020-10-15 17:06:15 +0200 | [diff] [blame] | 672 | ) |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 673 | ->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
Akron | eaa9623 | 2020-10-15 17:06:15 +0200 | [diff] [blame] | 674 | ->unzip_xml('GOE/AGA/00000/data.xml') |
| 675 | ->content_like(qr/\Q"Kriegstheater"\E/) |
| 676 | ->content_like(qr/\QTür'\E/) |
| 677 | ; |
| 678 | |
| 679 | test_tei2korapxml( |
| 680 | file => catfile($f, 'data', 'goe_sample.i5.iso.xml'), |
Akron | b93fabb | 2023-01-13 12:05:44 +0100 | [diff] [blame] | 681 | param => '--skip-inline-token-annotations=0 --no-tokenizer', |
Akron | eaa9623 | 2020-10-15 17:06:15 +0200 | [diff] [blame] | 682 | tmp => 'script_iso_enc' |
| 683 | ) |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 684 | ->stderr_like(qr!tei2korapxml:.*? text_id=GOE_AGA\.00000!) |
Akron | eaa9623 | 2020-10-15 17:06:15 +0200 | [diff] [blame] | 685 | ->unzip_xml('GOE/AGA/00000/data.xml') |
| 686 | ->content_like(qr/\Q"Kriegstheater"\E/) |
| 687 | ->content_like(qr/\QTür'\E/) |
| 688 | ; |
| 689 | }; |
| 690 | |
Marc Kupietz | 44b1f25 | 2020-11-26 16:31:40 +0100 | [diff] [blame] | 691 | subtest 'Check encoding with utf-8 sigle' => sub { |
| 692 | |
| 693 | # Load example file |
| 694 | my $file = catfile($f, 'data', 'wdd_sample.i5.xml'); |
| 695 | |
| 696 | my $t = test_tei2korapxml( |
| 697 | tmp => 'script_sigle', |
| 698 | file => $file, |
| 699 | param => "-ti" |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 700 | )->stderr_like(qr!tei2korapxml:.*? text_id=WDD19_ß0000\.10317!) |
Marc Kupietz | 44b1f25 | 2020-11-26 16:31:40 +0100 | [diff] [blame] | 701 | ->stderr_unlike(qr!Debugging is activated!); |
| 702 | |
| 703 | $t->unzip_xml('WDD19/ß0000/10317/header.xml') |
| 704 | ->text_is('idsHeader fileDesc titleStmt textSigle', 'WDD19/ß0000.10317'); |
| 705 | |
| 706 | $t->unzip_xml('WDD19/ß0000/10317/data.xml') |
| 707 | ->attr_is('raw_text', 'docid', 'WDD19_ß0000.10317'); |
| 708 | |
| 709 | $t->unzip_xml('WDD19/ß0000/10317/struct/structure.xml') |
| 710 | ->attr_is('layer', 'docid', 'WDD19_ß0000.10317'); |
| 711 | |
| 712 | $t->unzip_xml('WDD19/ß0000/10317/base/tokens_conservative.xml') |
| 713 | ->attr_is('layer', 'docid', 'WDD19_ß0000.10317'); |
| 714 | }; |
| 715 | |
Marc Kupietz | 8a954e5 | 2021-02-16 22:03:07 +0100 | [diff] [blame] | 716 | subtest 'Check entity replacement' => sub { |
| 717 | my $t = test_tei2korapxml( |
| 718 | file => catfile($f, 'data', 'text_with_entities.i5.xml'), |
| 719 | tmp => 'script_entity_replacement', |
| 720 | param => '-ti' |
Akron | 9157792 | 2021-02-19 10:32:54 +0100 | [diff] [blame] | 721 | )->stderr_like(qr!tei2korapxml:.*? text_id=CORP_DOC.00003!); |
Marc Kupietz | 8a954e5 | 2021-02-16 22:03:07 +0100 | [diff] [blame] | 722 | |
| 723 | $t->unzip_xml('CORP/DOC/00003/data.xml') |
| 724 | ->content_like(qr!üüü Aα≈„▒░▓█╗┐┌╔═─┬╦┴╩╝┘└╚│║┼╬┤╣╠├•ˇčˆ†‡ě€ƒ…‗ıι“„▄‹‘‚—–νœŒωΩ‰φπϖř”ρ›’‘šŠσ□■▪⊂˜™▀ŸžŽ!); |
| 725 | |
| 726 | $t->unzip_xml('CORP/DOC/00003/header.xml') |
| 727 | ->content_like(qr!üüü x α•α y!); |
| 728 | }; |
| 729 | |
Akron | 3378dfd | 2020-08-01 15:01:36 +0200 | [diff] [blame] | 730 | subtest 'Test Log' => sub { |
| 731 | test_tei2korapxml( |
| 732 | tmp => 'script_out', |
| 733 | file => $file, |
Akron | b93fabb | 2023-01-13 12:05:44 +0100 | [diff] [blame] | 734 | param => '-l=warn --no-tokenizer' |
Akron | 3378dfd | 2020-08-01 15:01:36 +0200 | [diff] [blame] | 735 | )->stderr_is(''); |
| 736 | }; |
| 737 | |
| 738 | |
Akron | 5986da3 | 2021-10-01 12:53:55 +0200 | [diff] [blame] | 739 | subtest 'Broken data testing' => sub { |
| 740 | my $file = catfile($f, 'data', 'wikipedia.txt'); |
| 741 | |
| 742 | my $t = test_tei2korapxml( |
| 743 | tmp => 'script_ginkgo', |
| 744 | file => $file, |
| 745 | param => '-ti', |
| 746 | env => 'KORAPXMLTEI_DEBUG=1' |
| 747 | )->stderr_like(qr!No opened zip file to close!) |
| 748 | ->stderr_like(qr!Debugging is activated!); |
| 749 | }; |
| 750 | |
Akron | 2520a34 | 2022-03-29 18:18:05 +0200 | [diff] [blame] | 751 | subtest 'Required version testing' => sub { |
| 752 | test_tei2korapxml( |
| 753 | tmp => 'script_out', |
| 754 | file => $file, |
| 755 | param => '-rv=2.2.2' |
| 756 | )->stderr_like(qr!^Required version 2\.2\.2 mismatches version!); |
| 757 | |
| 758 | test_tei2korapxml( |
| 759 | tmp => 'script_out', |
| 760 | file => $file, |
| 761 | param => '--required-version=2.2' |
| 762 | )->stderr_like(qr!^Required version 2\.2 mismatches version!); |
| 763 | |
| 764 | test_tei2korapxml( |
| 765 | tmp => 'script_out', |
| 766 | file => $file, |
Akron | b93fabb | 2023-01-13 12:05:44 +0100 | [diff] [blame] | 767 | param => '-rv=' . $KorAP::XML::TEI::Tokenizer::KorAP::VERSION . ' --no-tokenizer' |
Akron | 2520a34 | 2022-03-29 18:18:05 +0200 | [diff] [blame] | 768 | )->stderr_like(qr!GOE_AGA\.00000!); |
| 769 | |
| 770 | test_tei2korapxml( |
| 771 | tmp => 'script_out', |
| 772 | file => $file, |
Akron | b93fabb | 2023-01-13 12:05:44 +0100 | [diff] [blame] | 773 | param => '-rv= " ' . $KorAP::XML::TEI::Tokenizer::KorAP::VERSION . ' " --no-tokenizer' |
Akron | 2520a34 | 2022-03-29 18:18:05 +0200 | [diff] [blame] | 774 | )->stderr_like(qr!GOE_AGA\.00000!); |
| 775 | }; |
| 776 | |
Marc Kupietz | a671ae5 | 2022-12-22 16:28:14 +0100 | [diff] [blame] | 777 | subtest 'Standard TEI P5 testing' => sub { |
| 778 | |
| 779 | my $t = test_tei2korapxml( |
| 780 | file => catfile($f, 'data', 'icc_german_sample.p5.xml'), |
Akron | fcff734 | 2023-02-07 14:05:15 +0100 | [diff] [blame] | 781 | param => '--xmlid-to-textsigle \'ICC.German\.([^.]+\.[^.]+)\.(.+)@ICCGER/$1/$2\' -s -ti', |
Marc Kupietz | a671ae5 | 2022-12-22 16:28:14 +0100 | [diff] [blame] | 782 | tmp => 'script_utf8_enc' |
| 783 | )->stderr_like(qr!tei2korapxml:.*? text_id=ICCGER/DeReKo-WPD17\.S00-18619!); |
| 784 | |
| 785 | $t->unzip_xml('ICCGER/DeReKo-WPD17/E51-96136/data.xml') |
| 786 | ->content_like(qr/Recht auf persönliches Hab und Gut/); |
| 787 | |
| 788 | $t->unzip_xml('ICCGER/CCBY-LTE/MJB-00001/header.xml') |
| 789 | ->text_is('textClass > classCode[scheme=ICC]', 'Learned_Technology', 'classCode is correctly extracted'); |
| 790 | |
| 791 | }; |
Akron | 5986da3 | 2021-10-01 12:53:55 +0200 | [diff] [blame] | 792 | |
Akron | b93fabb | 2023-01-13 12:05:44 +0100 | [diff] [blame] | 793 | subtest 'Require tokenizer' => sub { |
| 794 | |
| 795 | my $t = test_tei2korapxml( |
| 796 | file => catfile($f, 'data', 'icc_german_sample.p5.xml'), |
| 797 | tmp => 'script_utf8_enc' |
| 798 | )->stderr_like(qr!No tokenizer chosen!); |
| 799 | }; |
| 800 | |
Akron | 72f4a88 | 2023-03-02 09:48:14 +0100 | [diff] [blame] | 801 | subtest 'Test handling of textSigle in text' => sub { |
| 802 | |
| 803 | my $t = test_tei2korapxml( |
| 804 | file => catfile($f, 'data', 'text_with_textsigle_in_text.i5.xml'), |
| 805 | tmp => 'script_out', |
| 806 | param => '-ti' |
| 807 | ) |
| 808 | ->stderr_like(qr!tei2korapxml:.*? text_id=CORP_DOC.00001!) |
| 809 | ->stderr_unlike(qr!line with closing text-body tag 'text' contains additional information!); |
| 810 | }; |
| 811 | |
Akron | ec50325 | 2023-04-24 18:03:17 +0200 | [diff] [blame] | 812 | subtest 'Handling of whitespace at linebreaks' => sub { |
| 813 | my $t = test_tei2korapxml( |
| 814 | file => catfile($f, 'data', 'stadigmer.p5.xml'), |
| 815 | tmp => 'script_out', |
| 816 | param => '-s -ti', |
| 817 | ) |
| 818 | ->stderr_like(qr!tei2korapxml:.*? text_id=NO_000\.00000!); |
| 819 | $t->unzip_xml('NO/000/00000/data.xml') |
| 820 | ->content_like(qr/har lurt/) |
| 821 | ->content_like(qr/etter at/) |
| 822 | ->content_like(qr/en stund/) |
| 823 | ->content_like(qr/skjønner med/) |
| 824 | ->content_like(qr/og det/) |
| 825 | ->content_like(qr/stadig mer/) |
| 826 | ->content_like(qr/sitt, og/) |
| 827 | ->content_like(qr/tenkt å bli/) |
| 828 | ->content_like(qr/er både/) |
| 829 | ; |
| 830 | }; |
| 831 | |
Akron | 132bdeb | 2024-06-06 14:28:56 +0200 | [diff] [blame] | 832 | subtest 'Write to output' => sub { |
| 833 | |
| 834 | my $temp_out = korap_tempfile('out'); |
| 835 | |
| 836 | my $t = test_tei2korapxml( |
| 837 | file => catfile($f, 'data', 'stadigmer.p5.xml'), |
| 838 | tmp => 'script_out', |
| 839 | param => '-s -ti -o "' . $temp_out . '"', |
| 840 | )->stderr_like(qr!tei2korapxml:.*? text_id=NO_000\.00000!) |
| 841 | ->stdout_is(''); |
| 842 | |
| 843 | my $content; |
| 844 | open(X, '<' . $temp_out); |
| 845 | binmode(X); |
| 846 | $content .= <X> while !eof(X); |
| 847 | close(X); |
| 848 | $t->{stdout} = $content; |
| 849 | |
| 850 | $t->unzip_xml('NO/000/00000/data.xml') |
| 851 | ->content_like(qr/har lurt/) |
| 852 | ->content_like(qr/etter at/) |
| 853 | ->content_like(qr/en stund/) |
| 854 | ->content_like(qr/skjønner med/) |
| 855 | ->content_like(qr/og det/) |
| 856 | ->content_like(qr/stadig mer/) |
| 857 | ->content_like(qr/sitt, og/) |
| 858 | ->content_like(qr/tenkt å bli/) |
| 859 | ->content_like(qr/er både/) |
| 860 | ; |
| 861 | |
| 862 | unlink $temp_out; |
| 863 | }; |
| 864 | |
Akron | 6b1f26b | 2024-09-19 11:35:32 +0200 | [diff] [blame^] | 865 | subtest 'Handling of dependency data (1)' => sub { |
| 866 | my $t = test_tei2korapxml( |
| 867 | file => catfile($f, 'data', 'SKU21.head.i5.xml'), |
| 868 | tmp => 'script_out', |
| 869 | param => '-s --no-tokenizer --inline-tokens=csc#morpho', |
| 870 | ) |
| 871 | ->stderr_like(qr!tei2korapxml:.*? text_id=SKU21_JAN\.00001!); |
| 872 | $t->unzip_xml('SKU21/JAN/00001/data.xml') |
| 873 | ->content_like(qr/cgICpWb AQNFU/) |
| 874 | ->content_like(qr/LhyS OLHV/) |
| 875 | ->content_like(qr/kdQVs hunIRQIN/) |
| 876 | ; |
| 877 | |
| 878 | $t->unzip_xml('SKU21/JAN/00001/csc/morpho.xml') |
| 879 | ->attr_is('spanList span:nth-child(2)', 'id', 's1') |
| 880 | ->attr_is('#s1', 'from', '5') |
| 881 | ->attr_is('#s1', 'to', '9') |
| 882 | ->text_is('#s1 fs f fs f[name="deprel"]', 'name') |
| 883 | ->text_is('#s1 fs f fs f[name="head"]', '3') |
| 884 | ->text_is('#s1 fs f fs f[name="lemma"]', 'kCXD') |
| 885 | ->text_is('#s1 fs f fs f[name="msd"]', 'SUBCAT_Prop|CASECHANGE_Up|OTHER_UNK') |
| 886 | ->text_is('#s1 fs f fs f[name="n"]', '2') |
| 887 | ->text_is('#s1 fs f fs f[name="pos"]', 'N') |
| 888 | ; |
| 889 | }; |
| 890 | |
| 891 | subtest 'Handling of dependency data (2)' => sub { |
| 892 | my $t = test_tei2korapxml( |
| 893 | file => catfile($f, 'data', 'SKU21.head.i5.xml'), |
| 894 | tmp => 'script_out', |
| 895 | param => '-s --no-tokenizer ' . |
| 896 | '--inline-tokens=csc#morpho ' . |
| 897 | '--inline-dependencies=!csc ' . |
| 898 | '--no-skip-inline-token-annotations', |
| 899 | ) |
| 900 | ->stderr_like(qr!tei2korapxml:.*? text_id=SKU21_JAN\.00001!) |
| 901 | ->stderr_like(qr!tei2korapxml:.*? text_id=SKU21_JAN\.00002!) |
| 902 | ->stderr_like(qr!tei2korapxml:.*? text_id=SKU21_JAN\.00003!) |
| 903 | ; |
| 904 | |
| 905 | $t->unzip_xml('SKU21/JAN/00001/data.xml') |
| 906 | ->content_like(qr/cgICpWb AQNFU/) |
| 907 | ->content_like(qr/LhyS OLHV/) |
| 908 | ->content_like(qr/kdQVs hunIRQIN/) |
| 909 | ; |
| 910 | |
| 911 | $t->unzip_xml('SKU21/JAN/00001/csc/morpho.xml') |
| 912 | ->attr_is('spanList span:nth-child(2)', 'id', 's1') |
| 913 | ->attr_is('#s1', 'from', '5') |
| 914 | ->attr_is('#s1', 'to', '9') |
| 915 | ->text_is('#s1 fs f fs f[name="lemma"]', 'kCXD') |
| 916 | ->text_is('#s1 fs f fs f[name="msd"]', 'SUBCAT_Prop|CASECHANGE_Up|OTHER_UNK') |
| 917 | ->text_is('#s1 fs f fs f[name="pos"]', 'N') |
| 918 | ->element_exists_not('#s1 fs f fs f[name="n"]') |
| 919 | ->element_exists_not('#s1 fs f fs f[name="deprel"]') |
| 920 | ->element_exists_not('#s1 fs f fs f[name="head"]') |
| 921 | ; |
| 922 | |
| 923 | $t->unzip_xml('SKU21/JAN/00001/csc/dependency.xml') |
| 924 | ->attr_is('spanList span:nth-child(2)', 'id', 's1_n2') |
| 925 | ->attr_is('#s1_n2', "from", "5") |
| 926 | ->attr_is('#s1_n2', "to", "9") |
| 927 | ->attr_is('#s1_n2 rel', "label", "name") |
| 928 | ->attr_is('#s1_n2 rel span', "from", '10') |
| 929 | ->attr_is('#s1_n2 rel span', "to", '15') |
| 930 | ; |
| 931 | |
| 932 | $t->unzip_xml('SKU21/JAN/00002/csc/dependency.xml') |
| 933 | ->attr_is('spanList span:nth-child(2)', 'id', 's1_n2') |
| 934 | ->attr_is('#s1_n2', "from", "4") |
| 935 | ->attr_is('#s1_n2', "to", "5") |
| 936 | ->attr_is('#s1_n2 rel', "label", "poss") |
| 937 | ->attr_is('#s1_n2 rel span', "from", '6') |
| 938 | ->attr_is('#s1_n2 rel span', "to", '12') |
| 939 | ; |
| 940 | }; |
| 941 | |
| 942 | |
Akron | 797e807 | 2020-02-13 07:59:40 +0100 | [diff] [blame] | 943 | done_testing; |