Nils Diewald | 2db9ad0 | 2013-10-29 19:26:43 +0000 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 4 | use FindBin; |
| 5 | BEGIN { unshift @INC, "$FindBin::Bin/../lib" }; |
| 6 | use File::Spec::Functions qw/catfile catdir/; |
| 7 | use Getopt::Long qw/GetOptions :config no_auto_abbrev/; |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 8 | use Benchmark qw/:hireswallclock/; |
| 9 | use IO::Compress::Gzip qw/$GzipError/; |
Nils Diewald | 2db9ad0 | 2013-10-29 19:26:43 +0000 | [diff] [blame] | 10 | use Log::Log4perl; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 11 | use Pod::Usage; |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 12 | use Cache::FastMmap; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 13 | use Directory::Iterator; |
Akron | 93d620e | 2016-02-05 19:40:05 +0100 | [diff] [blame] | 14 | use KorAP::XML::Krill; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 15 | use KorAP::XML::Archive; |
Akron | 93d620e | 2016-02-05 19:40:05 +0100 | [diff] [blame] | 16 | use KorAP::XML::Tokenizer; |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 17 | use KorAP::XML::Batch::File; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 18 | use Parallel::ForkManager; |
Akron | 75ba57d | 2016-03-07 23:36:27 +0100 | [diff] [blame] | 19 | # TODO: use Parallel::Loops |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 20 | # TODO: make output files |
Akron | 93d620e | 2016-02-05 19:40:05 +0100 | [diff] [blame] | 21 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 22 | # CHANGES: |
| 23 | # ---------------------------------------------------------- |
| 24 | # 2013/11/25 |
| 25 | # - Initial release |
| 26 | # |
| 27 | # 2014/10/29 |
| 28 | # - Merges foundry data to create indexer friendly documents |
| 29 | # |
Akron | 93d620e | 2016-02-05 19:40:05 +0100 | [diff] [blame] | 30 | # 2016/02/04 |
| 31 | # - renamed to korapxml2krill |
| 32 | # - added Schreibgebrauch support |
Akron | 069bd71 | 2016-02-12 19:09:06 +0100 | [diff] [blame] | 33 | # |
| 34 | # 2016/02/12 |
| 35 | # - fixed foundry skipping |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 36 | # - Support overwrite in archive processing |
Akron | 150b29e | 2016-02-14 23:06:48 +0100 | [diff] [blame] | 37 | # |
| 38 | # 2016/02/14 |
| 39 | # - Added version information |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 40 | # - Added support for archive files |
| 41 | # |
| 42 | # 2016/02/15 |
| 43 | # - Fixed temporary directory bug |
| 44 | # - Improved skipping before unzipping |
| 45 | # - Added EXPERIMENTAL concurrency support |
| 46 | # |
| 47 | # 2016/02/23 |
| 48 | # - Merge korapxml2krill and korapxml2krill_dir |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 49 | # |
| 50 | # 2016/02/27 |
| 51 | # - Added extract function |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 52 | # |
| 53 | # 2016/03/17 |
| 54 | # - Added meta switch |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 55 | # |
| 56 | # 2016/03/18 |
| 57 | # - Added meta data caching |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 58 | # |
Akron | f3f0c94 | 2016-06-27 13:27:14 +0200 | [diff] [blame] | 59 | # 2016/06/27 |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 60 | # - Added multi archive support |
| 61 | # - Added prefix negation support |
Akron | f3f0c94 | 2016-06-27 13:27:14 +0200 | [diff] [blame] | 62 | # - Added Malt#Dependency support |
Akron | 8b99052 | 2016-07-06 16:45:57 +0200 | [diff] [blame] | 63 | # |
| 64 | # 2016/07/06 |
| 65 | # - Added MDParser#Dependency |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 66 | # |
| 67 | # 2016/10/15 |
Nils Diewald | 0e48977 | 2016-10-24 15:16:52 +0200 | [diff] [blame] | 68 | # - Fixed temporary path issue in script |
| 69 | # |
| 70 | # 2016/10/24 |
| 71 | # - Improved Windows support |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 72 | # |
Akron | b4bbec7 | 2016-10-26 20:21:02 +0200 | [diff] [blame] | 73 | # 2016/10/24 |
| 74 | # - Added support for document extraction |
| 75 | # |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 76 | # 2016/10/27 |
Akron | 2fd402b | 2016-10-27 21:26:48 +0200 | [diff] [blame] | 77 | # - Added wildcard support for document extraction |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 78 | # |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 79 | # 2016/12/21 |
| 80 | # - added support for base-sentences and base-tokenizations |
| 81 | # |
Akron | 4fa37c3 | 2017-01-20 14:43:10 +0100 | [diff] [blame] | 82 | # 2017/01/20 |
| 83 | # - added support for DRuKoLa annotations |
| 84 | # |
Akron | 41ac10b | 2017-02-08 22:47:25 +0100 | [diff] [blame] | 85 | # 2017/02/08 |
| 86 | # - added support for pagebreak annotations |
| 87 | # |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 88 | # ---------------------------------------------------------- |
Akron | 069bd71 | 2016-02-12 19:09:06 +0100 | [diff] [blame] | 89 | |
Akron | 41ac10b | 2017-02-08 22:47:25 +0100 | [diff] [blame] | 90 | our $LAST_CHANGE = '2017/02/08'; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 91 | our $LOCAL = $FindBin::Bin; |
| 92 | our $VERSION_MSG = <<"VERSION"; |
| 93 | Version $KorAP::XML::Krill::VERSION - diewald\@ids-mannheim.de - $LAST_CHANGE |
| 94 | VERSION |
| 95 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 96 | # Parse comand |
| 97 | my $cmd; |
| 98 | our @ARGV; |
| 99 | if ($ARGV[0] && index($ARGV[0], '-') != 0) { |
| 100 | $cmd = shift @ARGV; |
Akron | 150b29e | 2016-02-14 23:06:48 +0100 | [diff] [blame] | 101 | }; |
Akron | 93d620e | 2016-02-05 19:40:05 +0100 | [diff] [blame] | 102 | |
Akron | 5f51d42 | 2016-08-16 16:26:43 +0200 | [diff] [blame] | 103 | my (@skip, @sigle, @anno, @input); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 104 | my $text; |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 105 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 106 | # Parse options from the command line |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 107 | GetOptions( |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 108 | 'input|i=s' => \@input, |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 109 | 'output|o=s' => \(my $output), |
| 110 | 'overwrite|w' => \(my $overwrite), |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 111 | 'meta|m=s' => \(my $meta), |
Akron | af38698 | 2016-10-12 00:33:25 +0200 | [diff] [blame] | 112 | 'token|t=s' => \(my $token_base = 'OpenNLP#tokens'), |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 113 | 'base-sentences|bs=s' => \(my $base_sentences = ''), |
| 114 | 'base-paragraphs|bp=s' => \(my $base_paragraphs = ''), |
Akron | 41ac10b | 2017-02-08 22:47:25 +0100 | [diff] [blame] | 115 | 'base-pagebreaks|bpb=s' => \(my $base_pagebreaks = ''), |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 116 | 'gzip|z' => \(my $gzip), |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 117 | 'skip|s=s' => \@skip, |
| 118 | 'sigle|sg=s' => \@sigle, |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 119 | 'cache|c=s' => \(my $cache_file = 'korapxml2krill.cache'), |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 120 | 'log|l=s' => \(my $log_level = 'ERROR'), |
Akron | 5f51d42 | 2016-08-16 16:26:43 +0200 | [diff] [blame] | 121 | 'anno|a=s' => \@anno, |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 122 | 'primary|p!' => \(my $primary), |
| 123 | 'pretty|y' => \(my $pretty), |
| 124 | 'jobs|j=i' => \(my $jobs = 0), |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 125 | 'cache-size|cs=s' => \(my $cache_size = '50m'), |
| 126 | 'cache-delete|cd!' => \(my $cache_delete = 1), |
| 127 | 'cache-init|ci!' => \(my $cache_init = 1), |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 128 | 'help|h' => sub { |
| 129 | pod2usage( |
| 130 | -sections => 'NAME|SYNOPSIS|ARGUMENTS|OPTIONS', |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 131 | -verbose => 99, |
| 132 | -msg => $VERSION_MSG, |
| 133 | -output => '-' |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 134 | ); |
| 135 | }, |
| 136 | 'version|v' => sub { |
| 137 | pod2usage( |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 138 | -verbose => 0, |
| 139 | -msg => $VERSION_MSG, |
| 140 | -output => '-' |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 141 | ) |
| 142 | } |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 143 | ); |
| 144 | |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 145 | $base_sentences = lc $base_sentences; |
| 146 | $base_paragraphs = lc $base_paragraphs; |
Akron | 636bd9c | 2017-02-09 17:13:00 +0100 | [diff] [blame^] | 147 | $base_pagebreaks = lc $base_pagebreaks; |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 148 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 149 | my %ERROR_HASH = ( |
| 150 | -sections => 'NAME|SYNOPSIS|ARGUMENTS|OPTIONS', |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 151 | -verbose => 99, |
| 152 | -msg => $VERSION_MSG, |
| 153 | -output => '-', |
| 154 | -exit => 1 |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 155 | ); |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 156 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 157 | # Input has to be defined |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 158 | pod2usage(%ERROR_HASH) unless @input; |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 159 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 160 | # Gzip has no effect, if no output is given |
| 161 | pod2usage(%ERROR_HASH) if $gzip && !$output; |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 162 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 163 | # Initialize log4perl object |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 164 | Log::Log4perl->init({ |
| 165 | 'log4perl.rootLogger' => uc($log_level) . ', STDERR', |
| 166 | 'log4perl.appender.STDERR' => 'Log::Log4perl::Appender::ScreenColoredLevels', |
| 167 | 'log4perl.appender.STDERR.layout' => 'PatternLayout', |
| 168 | 'log4perl.appender.STDERR.layout.ConversionPattern' => '[%r] %F %L %c - %m%n' |
| 169 | }); |
| 170 | |
| 171 | my $log = Log::Log4perl->get_logger('main'); |
| 172 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 173 | my %skip; |
| 174 | $skip{lc($_)} = 1 foreach @skip; |
| 175 | |
| 176 | my @layers; |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 177 | push(@layers, ['Base', 'Sentences']) unless $base_sentences; |
| 178 | push(@layers, ['Base', 'Paragraphs']) unless $base_paragraphs; |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 179 | |
| 180 | # Connexor |
| 181 | push(@layers, ['Connexor', 'Morpho']); |
| 182 | push(@layers, ['Connexor', 'Syntax']); |
| 183 | push(@layers, ['Connexor', 'Phrase']); |
| 184 | push(@layers, ['Connexor', 'Sentences']); |
| 185 | |
| 186 | # CoreNLP |
| 187 | push(@layers, ['CoreNLP', 'NamedEntities']); |
| 188 | push(@layers, ['CoreNLP', 'Sentences']); |
| 189 | push(@layers, ['CoreNLP', 'Morpho']); |
| 190 | push(@layers, ['CoreNLP', 'Constituency']); |
| 191 | |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 192 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 193 | # DeReKo |
Akron | 41ac10b | 2017-02-08 22:47:25 +0100 | [diff] [blame] | 194 | my @dereko_attr = (); |
| 195 | if ($base_sentences eq 'dereko#structure') { |
| 196 | push @dereko_attr, 'sentences'; |
| 197 | }; |
| 198 | if ($base_paragraphs eq 'dereko#structure') { |
| 199 | push @dereko_attr, 'paragraphs'; |
| 200 | }; |
Akron | 636bd9c | 2017-02-09 17:13:00 +0100 | [diff] [blame^] | 201 | |
Akron | 41ac10b | 2017-02-08 22:47:25 +0100 | [diff] [blame] | 202 | if ($base_pagebreaks eq 'dereko#structure') { |
| 203 | push @dereko_attr, 'pagebreaks'; |
| 204 | }; |
| 205 | |
| 206 | if ($dereko_attr[0]) { |
| 207 | push(@layers, ['DeReKo', 'Structure', 'base-' . join('-', @dereko_attr)]); |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 208 | } |
| 209 | else { |
| 210 | push(@layers, ['DeReKo', 'Structure']); |
| 211 | }; |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 212 | |
| 213 | # Glemm |
| 214 | push(@layers, ['Glemm', 'Morpho']); |
| 215 | |
| 216 | # Malt |
| 217 | push(@layers, ['Malt', 'Dependency']); |
| 218 | |
| 219 | # MDParser |
| 220 | push(@layers, ['MDParser', 'Dependency']); |
| 221 | |
| 222 | # Mate |
| 223 | push(@layers, ['Mate', 'Morpho']); |
| 224 | push(@layers, ['Mate', 'Dependency']); |
| 225 | |
| 226 | # OpenNLP |
| 227 | push(@layers, ['OpenNLP', 'Morpho']); |
| 228 | push(@layers, ['OpenNLP', 'Sentences']); |
| 229 | |
| 230 | # Schreibgebrauch |
| 231 | push(@layers, ['Sgbr', 'Lemma']); |
| 232 | push(@layers, ['Sgbr', 'Morpho']); |
| 233 | |
| 234 | # TreeTagger |
| 235 | push(@layers, ['TreeTagger', 'Morpho']); |
| 236 | push(@layers, ['TreeTagger', 'Sentences']); |
| 237 | |
| 238 | # XIP |
| 239 | push(@layers, ['XIP', 'Morpho']); |
| 240 | push(@layers, ['XIP', 'Constituency']); |
| 241 | push(@layers, ['XIP', 'Sentences']); |
| 242 | push(@layers, ['XIP', 'Dependency']); |
| 243 | |
Akron | 4fa37c3 | 2017-01-20 14:43:10 +0100 | [diff] [blame] | 244 | # DRuKoLa |
| 245 | push(@layers, ['DRuKoLa', 'Morpho']); |
| 246 | |
| 247 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 248 | # Check filters |
| 249 | my @filtered_anno; |
| 250 | if ($skip{'#all'}) { |
| 251 | foreach (@anno) { |
| 252 | push @filtered_anno, [ split('#', $_) ]; |
| 253 | }; |
| 254 | } |
| 255 | |
| 256 | # Add all annotations that are not skipped |
| 257 | else { |
| 258 | # Add to index file - respect skipping |
| 259 | foreach my $info (@layers) { |
| 260 | # Skip if Foundry or Foundry#Layer should be skipped |
| 261 | unless ($skip{lc($info->[0])} || $skip{lc($info->[0]) . '#' . lc($info->[1])}) { |
| 262 | push @filtered_anno, $info; |
| 263 | }; |
| 264 | }; |
| 265 | }; |
| 266 | |
| 267 | # Get tokenization basis |
| 268 | my ($token_base_foundry, $token_base_layer) = split(/#/, $token_base) if ($token_base); |
| 269 | |
| 270 | # TODO: This should not be initialized for batch |
| 271 | my $cache = Cache::FastMmap->new( |
| 272 | share_file => $cache_file, |
| 273 | cache_size => $cache_size, |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 274 | init_file => $cache_init |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 275 | ); |
| 276 | |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 277 | # Create batch object |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 278 | my $batch_file = KorAP::XML::Batch::File->new( |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 279 | cache => $cache, |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 280 | meta_type => $meta, |
| 281 | overwrite => $overwrite, |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 282 | foundry => $token_base_foundry, |
| 283 | layer => $token_base_layer, |
| 284 | gzip => $gzip, |
| 285 | log => $log, |
| 286 | primary => $primary, |
| 287 | pretty => $pretty, |
| 288 | anno => \@filtered_anno |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 289 | ); |
| 290 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 291 | |
| 292 | # Get file name based on path information |
| 293 | sub get_file_name ($) { |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 294 | my $i = $input[0]; |
Akron | 3ec4897 | 2016-08-17 23:24:52 +0200 | [diff] [blame] | 295 | if (-d $i) { |
| 296 | $i =~ s![^\/]+$!!; |
| 297 | }; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 298 | my $file = shift; |
Akron | 3ec4897 | 2016-08-17 23:24:52 +0200 | [diff] [blame] | 299 | |
| 300 | # Remove temp dir fragments |
Akron | 6255760 | 2016-06-27 14:10:13 +0200 | [diff] [blame] | 301 | $file =~ s!^/?tmp/[^/]+!!; |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 302 | $file =~ s/^?\/?$i//; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 303 | $file =~ tr/\//-/; |
| 304 | $file =~ s{^-+}{}; |
Akron | b4bbec7 | 2016-10-26 20:21:02 +0200 | [diff] [blame] | 305 | $file =~ s/^.*?-(.+?-.+?-.+?)$/$1/; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 306 | return $file; |
Nils Diewald | 59094f2 | 2014-11-05 18:20:50 +0000 | [diff] [blame] | 307 | }; |
| 308 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 309 | # Convert sigle to path construct |
| 310 | s!^\s*([^_]+?)_([^\.]+?)\.(.+?)\s*$!$1/$2/$3! foreach @sigle; |
| 311 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 312 | if ($cmd) { |
| 313 | if ($output && (!-e $output || !-d $output)) { |
| 314 | print "Directory '$output' does not exist.\n\n"; |
| 315 | exit(0); |
| 316 | }; |
| 317 | }; |
| 318 | |
| 319 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 320 | # Process a single file |
| 321 | unless ($cmd) { |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 322 | my $input = $input[0]; |
Nils Diewald | 59094f2 | 2014-11-05 18:20:50 +0000 | [diff] [blame] | 323 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 324 | BEGIN { |
| 325 | $main::TIME = Benchmark->new; |
| 326 | $main::LAST_STOP = Benchmark->new; |
| 327 | }; |
| 328 | |
| 329 | sub stop_time { |
| 330 | my $new = Benchmark->new; |
Akron | 5f51d42 | 2016-08-16 16:26:43 +0200 | [diff] [blame] | 331 | $log->info( |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 332 | 'The code took: '. |
Akron | 5f51d42 | 2016-08-16 16:26:43 +0200 | [diff] [blame] | 333 | timestr(timediff($new, $main::LAST_STOP)) . |
| 334 | ' (overall: ' . timestr(timediff($new, $main::TIME)) . ')' |
| 335 | ); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 336 | $main::LAST_STOP = $new; |
| 337 | }; |
| 338 | |
| 339 | # Create and parse new document |
| 340 | $input =~ s{([^/])$}{$1/}; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 341 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 342 | # Process file |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 343 | $batch_file->process($input, $output); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 344 | |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 345 | # Delete cache file |
| 346 | unlink($cache_file) if $cache_delete; |
| 347 | |
Akron | 5f51d42 | 2016-08-16 16:26:43 +0200 | [diff] [blame] | 348 | stop_time; |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 349 | } |
Nils Diewald | 59094f2 | 2014-11-05 18:20:50 +0000 | [diff] [blame] | 350 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 351 | # Extract XML files |
| 352 | elsif ($cmd eq 'extract') { |
| 353 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 354 | # Create new archive object |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 355 | if (-f($input[0]) && (my $archive = KorAP::XML::Archive->new($input[0]))) { |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 356 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 357 | # Check zip capabilities |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 358 | unless ($archive->test_unzip) { |
| 359 | print "Unzip is not installed or incompatible.\n\n"; |
| 360 | exit(1); |
| 361 | }; |
| 362 | |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 363 | # Add further annotation archived |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 364 | $archive->attach($_) foreach @input[1..$#input]; |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 365 | |
Akron | 651cb8d | 2016-08-16 21:44:49 +0200 | [diff] [blame] | 366 | my $prefix = 1; |
| 367 | |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 368 | # No sigles given |
| 369 | unless (@sigle) { |
| 370 | |
| 371 | # Get files |
| 372 | foreach ($archive->list_texts) { |
| 373 | |
| 374 | # Split path information |
Akron | 651cb8d | 2016-08-16 21:44:49 +0200 | [diff] [blame] | 375 | ($prefix, my ($corpus, $doc, $text)) = $archive->split_path($_); |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 376 | |
| 377 | # TODO: Make this OS independent |
| 378 | push @sigle, join '/', $corpus, $doc, $text; |
| 379 | }; |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 380 | } |
| 381 | |
| 382 | # Check sigle for doc sigles |
| 383 | else { |
| 384 | my @new_sigle; |
| 385 | |
| 386 | my $prefix_check = 0; |
| 387 | |
| 388 | # Iterate over all sigle |
| 389 | foreach (@sigle) { |
| 390 | |
| 391 | # Sigle is a doc sigle |
| 392 | if ($_ =~ m!^(?:\.[/\\])?[^/\\]+?[/\\][^/\\]+?$!) { |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 393 | |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 394 | print "$_ ...\n"; |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 395 | # Check if a prefix is needed |
| 396 | unless ($prefix_check) { |
| 397 | $prefix = $archive->check_prefix; |
| 398 | $prefix_check = 1; |
| 399 | }; |
| 400 | |
| 401 | # TODO: Make this OS independent |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 402 | my $path = ($prefix ? './' : '') . $_; |
| 403 | |
| 404 | print '... ' . ( |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 405 | $archive->extract_doc( |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 406 | $path, $output, $jobs |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 407 | ) ? '' : 'not ' |
| 408 | ); |
| 409 | print "extracted.\n"; |
| 410 | } |
| 411 | else { |
| 412 | push @new_sigle, $_; |
| 413 | }; |
| 414 | }; |
| 415 | @sigle = @new_sigle; |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 416 | }; |
| 417 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 418 | # Iterate over all given sigles and extract |
| 419 | foreach (@sigle) { |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 420 | print "$_ ...\n"; |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 421 | |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 422 | # TODO: Make this OS independent |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 423 | print '... ' . ( |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 424 | $archive->extract_text( |
Akron | 651cb8d | 2016-08-16 21:44:49 +0200 | [diff] [blame] | 425 | ($prefix ? './' : '') . $_, $output |
| 426 | ) ? '' : 'not ' |
| 427 | ); |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 428 | print "extracted.\n"; |
| 429 | }; |
| 430 | |
| 431 | print "\n"; |
| 432 | exit(1); |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 433 | } |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 434 | |
| 435 | # Can't create archive object |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 436 | else { |
| 437 | $log->error('Unable to extract from primary archive ' . $input[0]); |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 438 | }; |
| 439 | } |
| 440 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 441 | # Process an archive |
| 442 | elsif ($cmd eq 'archive') { |
Nils Diewald | 2db9ad0 | 2013-10-29 19:26:43 +0000 | [diff] [blame] | 443 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 444 | # TODO: Support sigles |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 445 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 446 | # Zero means: everything runs in the parent process |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 447 | my $pool = Parallel::ForkManager->new($jobs); |
| 448 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 449 | my $count = 0; # Texts to process |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 450 | my $iter = 1; # Current text in process |
| 451 | |
| 452 | # Report on fork message |
| 453 | $pool->run_on_finish ( |
| 454 | sub { |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 455 | my ($pid, $code) = @_; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 456 | my $data = pop; |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 457 | |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 458 | print 'Convert ['. ($jobs > 0 ? "\$$pid:" : '') . |
Akron | 651cb8d | 2016-08-16 21:44:49 +0200 | [diff] [blame] | 459 | ($iter++) . "/$count]" . |
| 460 | ($code ? " $code" : '') . |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 461 | ' ' . $data->[0] . "\n"; |
| 462 | $data->[1] = undef if $data->[1]; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 463 | } |
| 464 | ); |
| 465 | |
| 466 | my $t; |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 467 | my $temp; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 468 | print "Reading data ...\n"; |
| 469 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 470 | # unless (Cache::FastMmap->new( |
| 471 | # share_file => $cache_file, |
| 472 | # cache_size => $cache_size, |
| 473 | # init_file => $cache_init |
| 474 | # )) { |
| 475 | # print "Unable to intialize cache '$cache_file'\n\n"; |
| 476 | # exit(1); |
| 477 | # }; |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 478 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 479 | # Input is a directory |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 480 | if (-d $input[0]) { |
| 481 | my $it = Directory::Iterator->new($input[0]); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 482 | my @dirs; |
| 483 | my $dir; |
| 484 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 485 | # Todo: Make a DO WHILE |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 486 | while (1) { |
| 487 | if (!$it->is_directory && ($dir = $it->get) && $dir =~ s{/data\.xml$}{}) { |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 488 | push @dirs, $dir; |
| 489 | $it->prune; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 490 | }; |
| 491 | last unless $it->next; |
| 492 | }; |
| 493 | |
| 494 | print "Start processing ...\n"; |
| 495 | $t = Benchmark->new; |
| 496 | $count = scalar @dirs; |
| 497 | |
| 498 | DIRECTORY_LOOP: |
| 499 | for (my $i = 0; $i < $count; $i++) { |
| 500 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 501 | my $filename = catfile( |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 502 | $output, |
| 503 | get_file_name($dirs[$i]) . '.json' . ($gzip ? '.gz' : '') |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 504 | ); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 505 | |
| 506 | # Get the next fork |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 507 | $pool->start and next DIRECTORY_LOOP; |
Akron | 3ec4897 | 2016-08-17 23:24:52 +0200 | [diff] [blame] | 508 | |
Akron | 13d5662 | 2016-10-31 14:54:49 +0100 | [diff] [blame] | 509 | if (my $return = $batch_file->process($dirs[$i] => $filename)) { |
| 510 | $pool->finish( |
| 511 | 0, |
| 512 | ["Processed " . $filename . ($return == -1 ? " - already existing" : '')] |
| 513 | ); |
Akron | 3ec4897 | 2016-08-17 23:24:52 +0200 | [diff] [blame] | 514 | } |
| 515 | else { |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 516 | $pool->finish(1, ["Unable to process " . $dirs[$i]]); |
Akron | 3ec4897 | 2016-08-17 23:24:52 +0200 | [diff] [blame] | 517 | }; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 518 | }; |
| 519 | } |
| 520 | |
| 521 | # Input is a file |
Akron | 29866ac | 2016-06-24 16:40:47 +0200 | [diff] [blame] | 522 | elsif (-f($input[0]) && (my $archive = KorAP::XML::Archive->new($input[0]))) { |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 523 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 524 | unless ($archive->test_unzip) { |
| 525 | print "Unzip is not installed or incompatible.\n\n"; |
| 526 | exit(1); |
| 527 | }; |
| 528 | |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 529 | # Add further annotation archived |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 530 | $archive->attach($_) foreach @input[1..$#input]; |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 531 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 532 | print "Start processing ...\n"; |
| 533 | $t = Benchmark->new; |
| 534 | my @dirs = $archive->list_texts; |
| 535 | $count = scalar @dirs; |
| 536 | |
| 537 | ARCHIVE_LOOP: |
| 538 | for (my $i = 0; $i < $count; $i++) { |
| 539 | |
| 540 | # Split path information |
| 541 | my ($prefix, $corpus, $doc, $text) = $archive->split_path($dirs[$i]); |
| 542 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 543 | my $filename = catfile( |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 544 | $output, |
| 545 | get_file_name( |
| 546 | catfile($corpus, $doc, $text) |
| 547 | . '.json' . ($gzip ? '.gz' : '') |
| 548 | ) |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 549 | ); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 550 | |
| 551 | # Get the next fork |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 552 | $pool->start and next ARCHIVE_LOOP; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 553 | |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 554 | # Create temporary file |
| 555 | $temp = File::Temp->newdir; |
| 556 | |
Akron | bdf434a | 2016-10-24 17:42:07 +0200 | [diff] [blame] | 557 | # TODO: Check if $filename exist at the beginning, |
| 558 | # because extraction can be horrible slow! |
| 559 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 560 | # Extract from archive |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 561 | if ($archive->extract_text($dirs[$i], $temp)) { |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 562 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 563 | # Create corpus directory |
| 564 | my $input = catdir("$temp", $corpus); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 565 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 566 | # Temporary directory |
| 567 | my $dir = catdir($input, $doc, $text); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 568 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 569 | # Write file |
Akron | 13d5662 | 2016-10-31 14:54:49 +0100 | [diff] [blame] | 570 | if (my $return = $batch_file->process($dir => $filename)) { |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 571 | # Delete temporary file |
Akron | 13d5662 | 2016-10-31 14:54:49 +0100 | [diff] [blame] | 572 | $pool->finish( |
| 573 | 0, |
| 574 | ["Processed " . $filename . ($return == -1 ? " - already existing" : ''), $temp] |
| 575 | ); |
| 576 | #$pool->finish(0, ["Processed " . $filename, $temp]); |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 577 | } |
| 578 | else { |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 579 | # Delete temporary file |
| 580 | $pool->finish(1, ["Unable to process " . $dir, $temp]); |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 581 | }; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 582 | } |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 583 | |
| 584 | # Unable to extract |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 585 | else { |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 586 | $pool->finish(1, ["Unable to extract " . $dirs[$i], $temp]); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 587 | }; |
| 588 | }; |
| 589 | } |
| 590 | |
| 591 | else { |
| 592 | print "Input is neither a directory nor an archive.\n\n"; |
| 593 | }; |
| 594 | |
| 595 | $pool->wait_all_children; |
| 596 | |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 597 | # Delete cache file |
| 598 | unlink($cache_file) if $cache_delete; |
| 599 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 600 | print "Done.\n"; |
| 601 | print timestr(timediff(Benchmark->new, $t))."\n\n"; |
| 602 | } |
| 603 | |
| 604 | # Unknown command |
| 605 | else { |
| 606 | warn "Unknown command '$cmd'.\n\n"; |
| 607 | pod2usage(%ERROR_HASH); |
| 608 | } |
Nils Diewald | 2db9ad0 | 2013-10-29 19:26:43 +0000 | [diff] [blame] | 609 | |
| 610 | __END__ |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 611 | |
| 612 | =pod |
| 613 | |
| 614 | =encoding utf8 |
| 615 | |
| 616 | =head1 NAME |
| 617 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 618 | korapxml2krill - Merge KorapXML data and create Krill documents |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 619 | |
| 620 | |
| 621 | =head1 SYNOPSIS |
| 622 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 623 | korapxml2krill [archive|extract] --input <directory|archive> [options] |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 624 | |
Akron | 2fd402b | 2016-10-27 21:26:48 +0200 | [diff] [blame] | 625 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 626 | =head1 DESCRIPTION |
| 627 | |
| 628 | L<KorAP::XML::Krill> is a library to convert KorAP-XML documents to files |
| 629 | compatible with the L<Krill|https://github.com/KorAP/Krill> indexer. |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 630 | The C<korapxml2krill> command line tool is a simple wrapper to the library. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 631 | |
| 632 | |
| 633 | =head1 INSTALLATION |
| 634 | |
| 635 | The preferred way to install L<KorAP::XML::Krill> is to use L<cpanm|App::cpanminus>. |
| 636 | |
Akron | af38698 | 2016-10-12 00:33:25 +0200 | [diff] [blame] | 637 | $ cpanm https://github.com/KorAP/KorAP-XML-Krill.git |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 638 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 639 | In case everything went well, the C<korapxml2krill> tool will |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 640 | be available on your command line immediately. |
Akron | 7438151 | 2016-10-14 11:56:22 +0200 | [diff] [blame] | 641 | Minimum requirement for L<KorAP::XML::Krill> is Perl 5.14. |
Akron | a93d51b | 2016-10-24 20:27:48 +0200 | [diff] [blame] | 642 | In addition to work with zip archives, the C<unzip> tool needs to be present. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 643 | |
| 644 | =head1 ARGUMENTS |
| 645 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 646 | $ korapxml2krill -z --input <directory> --output <filename> |
| 647 | |
| 648 | Without arguments, C<korapxml2krill> converts a directory of a single KorAP-XML document. |
Akron | 2fd402b | 2016-10-27 21:26:48 +0200 | [diff] [blame] | 649 | It expects the input to point to the text level folder. |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 650 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 651 | =over 2 |
| 652 | |
| 653 | =item B<archive> |
| 654 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 655 | $ korapxml2krill archive -z --input <directory|archive> --output <directory> |
| 656 | |
Akron | 2fd402b | 2016-10-27 21:26:48 +0200 | [diff] [blame] | 657 | Converts an archive of KorAP-XML documents. It expects a directory |
| 658 | (pointing to the corpus level folder) or one or more zip files as input. |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 659 | |
| 660 | =item B<extract> |
| 661 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 662 | $ korapxml2krill extract --input <archive> --output <directory> --sigle <SIGLE> |
| 663 | |
| 664 | Extracts KorAP-XML documents from a zip file. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 665 | |
| 666 | =back |
| 667 | |
| 668 | |
| 669 | =head1 OPTIONS |
| 670 | |
| 671 | =over 2 |
| 672 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 673 | =item B<--input|-i> <directory|zip file> |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 674 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 675 | Directory or zip file(s) of documents to convert. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 676 | |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 677 | Without arguments, C<korapxml2krill> expects a folder of a single KorAP-XML |
Akron | f1a1de9 | 2016-11-02 17:32:12 +0100 | [diff] [blame] | 678 | document, while C<archive> expects a KorAP-XML corpus folder or a zip |
| 679 | file to batch process multiple files. |
| 680 | C<extract> expects zip files only. |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 681 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 682 | C<archive> supports multiple input zip files with the constraint, |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 683 | that the first archive listed contains all primary data files |
| 684 | and all meta data files. |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 685 | |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 686 | -i file/news.zip -i file/news.malt.zip -i "#file/news.tt.zip" |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 687 | |
Akron | 0c3e375 | 2016-06-28 15:55:53 +0200 | [diff] [blame] | 688 | (The directory structure follows the base directory format, |
| 689 | that may include a C<.> root folder. |
| 690 | In this case further archives lacking a C<.> root folder |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 691 | need to be passed with a hash sign in front of the archive's name. |
| 692 | This may require to quote the parameter.) |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 693 | |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 694 | To support zip files, a version of C<unzip> needs to be installed that is |
| 695 | compatible with the archive file. |
Akron | a93d51b | 2016-10-24 20:27:48 +0200 | [diff] [blame] | 696 | |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 697 | B<The root folder switch using the hash sign is experimental and |
| 698 | may vanish in future versions.> |
Akron | 651cb8d | 2016-08-16 21:44:49 +0200 | [diff] [blame] | 699 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 700 | =item B<--output|-o> <directory|file> |
| 701 | |
| 702 | Output folder for archive processing or |
| 703 | document name for single output (optional), |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 704 | writes to C<STDOUT> by default |
| 705 | (in case C<output> is not mandatory due to further options). |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 706 | |
| 707 | =item B<--overwrite|-w> |
| 708 | |
| 709 | Overwrite files that already exist. |
| 710 | |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 711 | =item B<--token|-t> <foundry>#<file> |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 712 | |
| 713 | Define the default tokenization by specifying |
| 714 | the name of the foundry and optionally the name |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 715 | of the layer-file. Defaults to C<OpenNLP#tokens>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 716 | |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 717 | |
| 718 | =item B<--base-sentences|-bs> <foundry>#<layer> |
| 719 | |
| 720 | Define the layer for base sentences. |
| 721 | If given, this will be used instead of using C<Base#Sentences>. |
| 722 | Currently C<DeReKo#Structure> is the only additional layer supported. |
| 723 | |
| 724 | Defaults to unset. |
| 725 | |
| 726 | |
| 727 | =item B<--base-paragraphs|-bp> <foundry>#<layer> |
| 728 | |
| 729 | Define the layer for base paragraphs. |
| 730 | If given, this will be used instead of using C<Base#Paragraphs>. |
| 731 | Currently C<DeReKo#Structure> is the only additional layer supported. |
| 732 | |
| 733 | Defaults to unset. |
| 734 | |
| 735 | |
Akron | 41ac10b | 2017-02-08 22:47:25 +0100 | [diff] [blame] | 736 | =item B<--base-pagebreaks|-bpb> <foundry>#<layer> |
| 737 | |
| 738 | Define the layer for base pagebreaks. |
| 739 | Currently C<DeReKo#Structure> is the only layer supported. |
| 740 | |
| 741 | Defaults to unset. |
| 742 | |
| 743 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 744 | =item B<--skip|-s> <foundry>[#<layer>] |
| 745 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 746 | Skip specific annotations by specifying the foundry |
| 747 | (and optionally the layer with a C<#>-prefix), |
| 748 | e.g. C<Mate> or C<Mate#Morpho>. Alternatively you can skip C<#ALL>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 749 | Can be set multiple times. |
| 750 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 751 | =item B<--anno|-a> <foundry>#<layer> |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 752 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 753 | Convert specific annotations by specifying the foundry |
| 754 | (and optionally the layer with a C<#>-prefix), |
| 755 | e.g. C<Mate> or C<Mate#Morpho>. |
| 756 | Can be set multiple times. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 757 | |
| 758 | =item B<--primary|-p> |
| 759 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 760 | Output primary data or not. Defaults to C<true>. |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 761 | Can be flagged using C<--no-primary> as well. |
| 762 | This is I<deprecated>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 763 | |
| 764 | =item B<--jobs|-j> |
| 765 | |
| 766 | Define the number of concurrent jobs in seperated forks |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 767 | for archive processing. |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 768 | Defaults to C<0> (everything runs in a single process). |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 769 | This is I<experimental>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 770 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 771 | =item B<--meta|-m> |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 772 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 773 | Define the metadata parser to use. Defaults to C<I5>. |
| 774 | Metadata parsers can be defined in the C<KorAP::XML::Meta> namespace. |
| 775 | This is I<experimental>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 776 | |
| 777 | =item B<--pretty|-y> |
| 778 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 779 | Pretty print JSON output. Defaults to C<false>. |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 780 | This is I<deprecated>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 781 | |
| 782 | =item B<--gzip|-z> |
| 783 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 784 | Compress the output. |
| 785 | Expects a defined C<output> file in single processing. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 786 | |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 787 | =item B<--cache|-c> |
| 788 | |
| 789 | File to mmap a cache (using L<Cache::FastMmap>). |
| 790 | Defaults to C<korapxml2krill.cache> in the calling directory. |
| 791 | |
| 792 | =item B<--cache-size|-cs> |
| 793 | |
| 794 | Size of the cache. Defaults to C<50m>. |
| 795 | |
| 796 | =item B<--cache-init|-ci> |
| 797 | |
| 798 | Initialize cache file. |
| 799 | Can be flagged using C<--no-cache-init> as well. |
| 800 | Defaults to C<true>. |
| 801 | |
| 802 | =item B<--cache-delete|-cd> |
| 803 | |
| 804 | Delete cache file after processing. |
| 805 | Can be flagged using C<--no-cache-delete> as well. |
| 806 | Defaults to C<true>. |
| 807 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 808 | =item B<--sigle|-sg> |
| 809 | |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 810 | Extract the given texts. |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 811 | Can be set multiple times. |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 812 | I<Currently only supported on C<extract>.> |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 813 | Sigles have the structure C<Corpus>/C<Document>/C<Text>. |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 814 | In case the C<Text> path is omitted, the whole document will be extracted. |
Akron | 2fd402b | 2016-10-27 21:26:48 +0200 | [diff] [blame] | 815 | On the document level, the postfix wildcard C<*> is supported. |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 816 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 817 | =item B<--log|-l> |
| 818 | |
| 819 | The L<Log4perl> log level, defaults to C<ERROR>. |
| 820 | |
| 821 | =item B<--help|-h> |
| 822 | |
| 823 | Print this document. |
| 824 | |
| 825 | =item B<--version|-v> |
| 826 | |
| 827 | Print version information. |
| 828 | |
| 829 | =back |
| 830 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 831 | =head1 ANNOTATION SUPPORT |
| 832 | |
| 833 | L<KorAP::XML::Krill> has built-in importer for some annotation foundries and layers |
| 834 | developed in the KorAP project that are part of the KorAP preprocessing pipeline. |
| 835 | The base foundry with paragraphs, sentences, and the text element are mandatory for |
| 836 | L<Krill|https://github.com/KorAP/Krill>. |
| 837 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 838 | =over 2 |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 839 | |
| 840 | =item B<Base> |
| 841 | |
| 842 | =over 4 |
| 843 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 844 | =item #Paragraphs |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 845 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 846 | =item #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 847 | |
| 848 | =back |
| 849 | |
| 850 | =item B<Connexor> |
| 851 | |
| 852 | =over 4 |
| 853 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 854 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 855 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 856 | =item #Phrase |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 857 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 858 | =item #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 859 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 860 | =item #Syntax |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 861 | |
| 862 | =back |
| 863 | |
| 864 | =item B<CoreNLP> |
| 865 | |
| 866 | =over 4 |
| 867 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 868 | =item #Constituency |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 869 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 870 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 871 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 872 | =item #NamedEntities |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 873 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 874 | =item #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 875 | |
| 876 | =back |
| 877 | |
| 878 | =item B<DeReKo> |
| 879 | |
| 880 | =over 4 |
| 881 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 882 | =item #Structure |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 883 | |
| 884 | =back |
| 885 | |
| 886 | =item B<Glemm> |
| 887 | |
| 888 | =over 4 |
| 889 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 890 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 891 | |
| 892 | =back |
| 893 | |
| 894 | =item B<Mate> |
| 895 | |
| 896 | =over 4 |
| 897 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 898 | =item #Dependency |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 899 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 900 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 901 | |
| 902 | =back |
| 903 | |
| 904 | =item B<OpenNLP> |
| 905 | |
| 906 | =over 4 |
| 907 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 908 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 909 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 910 | =item #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 911 | |
| 912 | =back |
| 913 | |
| 914 | =item B<Sgbr> |
| 915 | |
| 916 | =over 4 |
| 917 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 918 | =item #Lemma |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 919 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 920 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 921 | |
| 922 | =back |
| 923 | |
Akron | 4fa37c3 | 2017-01-20 14:43:10 +0100 | [diff] [blame] | 924 | =item B<DRuKoLa> |
| 925 | |
| 926 | =over 4 |
| 927 | |
| 928 | =item #Morpho |
| 929 | |
| 930 | =back |
| 931 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 932 | =item B<TreeTagger> |
| 933 | |
| 934 | =over 4 |
| 935 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 936 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 937 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 938 | =item #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 939 | |
| 940 | =back |
| 941 | |
| 942 | =item B<XIP> |
| 943 | |
| 944 | =over 4 |
| 945 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 946 | =item #Constituency |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 947 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 948 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 949 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 950 | =item #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 951 | |
| 952 | =back |
| 953 | |
| 954 | =back |
| 955 | |
| 956 | More importers are in preparation. |
| 957 | New annotation importers can be defined in the C<KorAP::XML::Annotation> namespace. |
| 958 | See the built-in annotation importers as examples. |
| 959 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 960 | =head1 AVAILABILITY |
| 961 | |
| 962 | https://github.com/KorAP/KorAP-XML-Krill |
| 963 | |
| 964 | |
| 965 | =head1 COPYRIGHT AND LICENSE |
| 966 | |
Akron | 3ec0a1c | 2017-01-18 14:41:55 +0100 | [diff] [blame] | 967 | Copyright (C) 2015-2017, L<IDS Mannheim|http://www.ids-mannheim.de/> |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 968 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 969 | Author: L<Nils Diewald|http://nils-diewald.de/> |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 970 | Contributor: Eliza Margaretha |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 971 | |
| 972 | L<KorAP::XML::Krill> is developed as part of the L<KorAP|http://korap.ids-mannheim.de/> |
| 973 | Corpus Analysis Platform at the |
| 974 | L<Institute for the German Language (IDS)|http://ids-mannheim.de/>, |
| 975 | member of the |
| 976 | L<Leibniz-Gemeinschaft|http://www.leibniz-gemeinschaft.de/en/about-us/leibniz-competition/projekte-2011/2011-funding-line-2/>. |
| 977 | |
| 978 | This program is free software published under the |
| 979 | L<BSD-2 License|https://raw.githubusercontent.com/KorAP/KorAP-XML-Krill/master/LICENSE>. |
| 980 | |
| 981 | =cut |