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/; |
Akron | c11f798 | 2017-02-21 21:20:14 +0100 | [diff] [blame] | 10 | use POSIX qw/ceil/; |
Nils Diewald | 2db9ad0 | 2013-10-29 19:26:43 +0000 | [diff] [blame] | 11 | use Log::Log4perl; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 12 | use Pod::Usage; |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 13 | use Cache::FastMmap; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 14 | use Directory::Iterator; |
Akron | 93d620e | 2016-02-05 19:40:05 +0100 | [diff] [blame] | 15 | use KorAP::XML::Krill; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 16 | use KorAP::XML::Archive; |
Akron | 93d620e | 2016-02-05 19:40:05 +0100 | [diff] [blame] | 17 | use KorAP::XML::Tokenizer; |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 18 | use KorAP::XML::Batch::File; |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 19 | use Config::Simple; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 20 | use Parallel::ForkManager; |
Akron | c11f798 | 2017-02-21 21:20:14 +0100 | [diff] [blame] | 21 | use v5.10; |
| 22 | use Sys::Info; |
| 23 | use Sys::Info::Constants qw( :device_cpu ); |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 24 | use File::Glob ':bsd_glob'; |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 25 | use File::Temp qw/tempdir/; |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 26 | use File::Path qw(remove_tree make_path); |
| 27 | use Mojo::Collection 'c'; |
| 28 | use String::Random qw(random_string); |
Akron | 081639e | 2017-04-21 19:01:39 +0200 | [diff] [blame] | 29 | use IO::File; |
| 30 | use Archive::Tar::Builder; |
Akron | c11f798 | 2017-02-21 21:20:14 +0100 | [diff] [blame] | 31 | |
| 32 | # use KorAP::XML::ForkPool; |
Akron | 75ba57d | 2016-03-07 23:36:27 +0100 | [diff] [blame] | 33 | # TODO: use Parallel::Loops |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 34 | # TODO: make output files |
Akron | 93d620e | 2016-02-05 19:40:05 +0100 | [diff] [blame] | 35 | |
Akron | c11f798 | 2017-02-21 21:20:14 +0100 | [diff] [blame] | 36 | # TODO: Use KorAP::XML::ForkPool! |
| 37 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 38 | # CHANGES: |
| 39 | # ---------------------------------------------------------- |
| 40 | # 2013/11/25 |
| 41 | # - Initial release |
| 42 | # |
| 43 | # 2014/10/29 |
| 44 | # - Merges foundry data to create indexer friendly documents |
| 45 | # |
Akron | 93d620e | 2016-02-05 19:40:05 +0100 | [diff] [blame] | 46 | # 2016/02/04 |
| 47 | # - renamed to korapxml2krill |
| 48 | # - added Schreibgebrauch support |
Akron | 069bd71 | 2016-02-12 19:09:06 +0100 | [diff] [blame] | 49 | # |
| 50 | # 2016/02/12 |
| 51 | # - fixed foundry skipping |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 52 | # - Support overwrite in archive processing |
Akron | 150b29e | 2016-02-14 23:06:48 +0100 | [diff] [blame] | 53 | # |
| 54 | # 2016/02/14 |
| 55 | # - Added version information |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 56 | # - Added support for archive files |
| 57 | # |
| 58 | # 2016/02/15 |
| 59 | # - Fixed temporary directory bug |
| 60 | # - Improved skipping before unzipping |
| 61 | # - Added EXPERIMENTAL concurrency support |
| 62 | # |
| 63 | # 2016/02/23 |
| 64 | # - Merge korapxml2krill and korapxml2krill_dir |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 65 | # |
| 66 | # 2016/02/27 |
| 67 | # - Added extract function |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 68 | # |
| 69 | # 2016/03/17 |
| 70 | # - Added meta switch |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 71 | # |
| 72 | # 2016/03/18 |
| 73 | # - Added meta data caching |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 74 | # |
Akron | f3f0c94 | 2016-06-27 13:27:14 +0200 | [diff] [blame] | 75 | # 2016/06/27 |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 76 | # - Added multi archive support |
| 77 | # - Added prefix negation support |
Akron | f3f0c94 | 2016-06-27 13:27:14 +0200 | [diff] [blame] | 78 | # - Added Malt#Dependency support |
Akron | 8b99052 | 2016-07-06 16:45:57 +0200 | [diff] [blame] | 79 | # |
| 80 | # 2016/07/06 |
| 81 | # - Added MDParser#Dependency |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 82 | # |
| 83 | # 2016/10/15 |
Nils Diewald | 0e48977 | 2016-10-24 15:16:52 +0200 | [diff] [blame] | 84 | # - Fixed temporary path issue in script |
| 85 | # |
| 86 | # 2016/10/24 |
| 87 | # - Improved Windows support |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 88 | # |
Akron | b4bbec7 | 2016-10-26 20:21:02 +0200 | [diff] [blame] | 89 | # 2016/10/24 |
| 90 | # - Added support for document extraction |
| 91 | # |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 92 | # 2016/10/27 |
Akron | 2fd402b | 2016-10-27 21:26:48 +0200 | [diff] [blame] | 93 | # - Added wildcard support for document extraction |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 94 | # |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 95 | # 2016/12/21 |
| 96 | # - added support for base-sentences and base-tokenizations |
| 97 | # |
Akron | 4fa37c3 | 2017-01-20 14:43:10 +0100 | [diff] [blame] | 98 | # 2017/01/20 |
| 99 | # - added support for DRuKoLa annotations |
| 100 | # |
Akron | 41ac10b | 2017-02-08 22:47:25 +0100 | [diff] [blame] | 101 | # 2017/02/08 |
| 102 | # - added support for pagebreak annotations |
| 103 | # |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 104 | # 2017/04/06 |
| 105 | # - added support for wildcards in input |
| 106 | # |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 107 | # 2017/04/07 |
| 108 | # - support configuration option |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 109 | # - support for temporary extraction |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 110 | # |
Akron | 9ec8887 | 2017-04-12 16:29:06 +0200 | [diff] [blame] | 111 | # 2017/04/12 |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 112 | # - support serial processing |
| 113 | # - support input root |
Akron | 9ec8887 | 2017-04-12 16:29:06 +0200 | [diff] [blame] | 114 | # - introduced --sequential-extraction flag |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 115 | # ---------------------------------------------------------- |
Akron | 069bd71 | 2016-02-12 19:09:06 +0100 | [diff] [blame] | 116 | |
Akron | 9ec8887 | 2017-04-12 16:29:06 +0200 | [diff] [blame] | 117 | our $LAST_CHANGE = '2017/04/12'; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 118 | our $LOCAL = $FindBin::Bin; |
| 119 | our $VERSION_MSG = <<"VERSION"; |
| 120 | Version $KorAP::XML::Krill::VERSION - diewald\@ids-mannheim.de - $LAST_CHANGE |
| 121 | VERSION |
| 122 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 123 | # Prototypes |
| 124 | sub get_file_name_from_glob($); |
| 125 | sub get_file_name($); |
| 126 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 127 | # Parse comand |
| 128 | my $cmd; |
| 129 | our @ARGV; |
| 130 | if ($ARGV[0] && index($ARGV[0], '-') != 0) { |
| 131 | $cmd = shift @ARGV; |
Akron | 150b29e | 2016-02-14 23:06:48 +0100 | [diff] [blame] | 132 | }; |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 133 | my @keep_argv = @ARGV; |
Akron | 93d620e | 2016-02-05 19:40:05 +0100 | [diff] [blame] | 134 | |
Akron | 5f51d42 | 2016-08-16 16:26:43 +0200 | [diff] [blame] | 135 | my (@skip, @sigle, @anno, @input); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 136 | my $text; |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 137 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 138 | # Parse options from the command line |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 139 | GetOptions( |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 140 | 'input|i=s' => \@input, |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 141 | 'input-base|ib=s' => \(my $input_base), |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 142 | 'output|o=s' => \(my $output), |
| 143 | 'overwrite|w' => \(my $overwrite), |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 144 | 'meta|m=s' => \(my $meta), |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 145 | 'token|t=s' => \(my $token_base), |
| 146 | 'base-sentences|bs=s' => \(my $base_sentences), |
| 147 | 'base-paragraphs|bp=s' => \(my $base_paragraphs), |
| 148 | 'base-pagebreaks|bpb=s' => \(my $base_pagebreaks), |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 149 | 'gzip|z' => \(my $gzip), |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 150 | 'temporary-extract|te=s' => \(my $extract_dir), |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 151 | 'skip|s=s' => \@skip, |
| 152 | 'sigle|sg=s' => \@sigle, |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 153 | 'cache|c=s' => \(my $cache_file), |
| 154 | 'config|cfg=s' => \(my $cfg_file), |
| 155 | 'log|l=s' => \(my $log_level), |
Akron | 5f51d42 | 2016-08-16 16:26:43 +0200 | [diff] [blame] | 156 | 'anno|a=s' => \@anno, |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 157 | 'primary|p!' => \(my $primary), |
| 158 | 'pretty|y' => \(my $pretty), |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 159 | 'jobs|j=i' => \(my $jobs), |
Akron | 486f9ab | 2017-04-22 23:25:19 +0200 | [diff] [blame^] | 160 | 'to-tar' => \(my $to_tar), |
Akron | 9ec8887 | 2017-04-12 16:29:06 +0200 | [diff] [blame] | 161 | 'sequential-extraction|se' => \(my $sequential_extraction), |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 162 | 'cache-size|cs=s' => \(my $cache_size), |
| 163 | 'cache-delete|cd!' => \(my $cache_delete), |
| 164 | 'cache-init|ci!' => \(my $cache_init), |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 165 | 'help|h' => sub { |
| 166 | pod2usage( |
| 167 | -sections => 'NAME|SYNOPSIS|ARGUMENTS|OPTIONS', |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 168 | -verbose => 99, |
| 169 | -msg => $VERSION_MSG, |
| 170 | -output => '-' |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 171 | ); |
| 172 | }, |
| 173 | 'version|v' => sub { |
| 174 | pod2usage( |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 175 | -verbose => 0, |
| 176 | -msg => $VERSION_MSG, |
| 177 | -output => '-' |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 178 | ) |
| 179 | } |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 180 | ); |
| 181 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 182 | |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 183 | # Load from configuration |
| 184 | if ($cfg_file && -e $cfg_file) { |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 185 | my %config; |
| 186 | |
| 187 | Config::Simple->import_from($cfg_file, \%config); |
| 188 | |
| 189 | # Overwrite |
| 190 | if (!defined($overwrite) && defined $config{overwrite}) { |
| 191 | $overwrite = $config{overwrite}; |
| 192 | }; |
| 193 | |
| 194 | # Gzip |
| 195 | if (!defined($gzip) && defined $config{gzip}) { |
| 196 | $gzip = $config{gzip}; |
| 197 | }; |
| 198 | |
| 199 | # Jobs |
| 200 | if (!defined($jobs) && defined $config{jobs}) { |
| 201 | $jobs = $config{jobs}; |
| 202 | }; |
| 203 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 204 | # Input root base directory |
| 205 | if (!defined($input_base) && defined $config{'input-base'}) { |
| 206 | $input_base = $config{'input-base'}; |
| 207 | }; |
| 208 | |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 209 | # temporary-extract |
| 210 | if (!defined($extract_dir) && defined $config{'temporary-extract'}) { |
| 211 | $extract_dir = $config{'temporary-extract'}; |
| 212 | }; |
| 213 | |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 214 | # Token base |
| 215 | if (!defined($token_base) && defined $config{token}) { |
| 216 | $token_base = $config{token}; |
| 217 | }; |
| 218 | |
| 219 | # Cache file |
| 220 | if (!defined($cache_file) && defined $config{cache}) { |
| 221 | $cache_file = $config{cache}; |
| 222 | }; |
| 223 | |
| 224 | # Cache size |
| 225 | if (!defined($cache_size) && defined $config{'cache-size'}) { |
| 226 | $cache_size = $config{'cache-size'}; |
| 227 | }; |
| 228 | |
| 229 | # Cache delete |
| 230 | if (!defined($cache_delete) && defined $config{'cache-delete'}) { |
| 231 | $cache_delete = $config{'cache-delete'} ; |
| 232 | }; |
| 233 | |
| 234 | # Cache init |
| 235 | if (!(defined $cache_init) && defined $config{'cache-init'}) { |
| 236 | $cache_init = $config{'cache-init'} ; |
| 237 | }; |
| 238 | |
Akron | 9ec8887 | 2017-04-12 16:29:06 +0200 | [diff] [blame] | 239 | # Jobs for extraction |
| 240 | if (!(defined $sequential_extraction) && defined $config{'sequential-extraction'}) { |
| 241 | $sequential_extraction = $config{'sequential-extraction'} ; |
| 242 | }; |
| 243 | |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 244 | # Meta |
| 245 | if (!(defined $meta) && defined $config{'meta'}) { |
| 246 | $meta = $config{'meta'} ; |
| 247 | }; |
| 248 | |
| 249 | # Output |
| 250 | if (!(defined $output) && defined $config{'output'}) { |
| 251 | $output = $config{'output'} ; |
| 252 | }; |
| 253 | |
| 254 | # Base-sentences |
| 255 | if (!(defined $base_sentences) && defined $config{'base-sentences'}) { |
| 256 | $base_sentences = $config{'base-sentences'} ; |
| 257 | }; |
| 258 | |
| 259 | # Base-paragraphs |
| 260 | if (!(defined $base_paragraphs) && defined $config{'base-paragraphs'}) { |
| 261 | $base_paragraphs = $config{'base-paragraphs'} ; |
| 262 | }; |
| 263 | |
| 264 | # Base-pagebreaks |
| 265 | if (!(defined $base_pagebreaks) && defined $config{'base-pagebreaks'}) { |
| 266 | $base_pagebreaks = $config{'base-pagebreaks'} ; |
| 267 | }; |
| 268 | |
Akron | 081639e | 2017-04-21 19:01:39 +0200 | [diff] [blame] | 269 | # Write to tar |
| 270 | if (!(defined $to_tar) && defined $config{'to-tar'}) { |
| 271 | $to_tar = $config{'to-tar'} ; |
| 272 | }; |
| 273 | |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 274 | # Log |
| 275 | if (!(defined $log_level) && defined $config{'log'}) { |
| 276 | $log_level = $config{'log'} ; |
| 277 | }; |
| 278 | |
| 279 | # Skip |
| 280 | if (!scalar(@skip) && defined $config{'skip'}) { |
| 281 | @skip = split /\s*;\s*/, $config{'skip'} ; |
| 282 | }; |
| 283 | |
| 284 | # Sigle |
| 285 | if (!scalar(@sigle) && defined $config{'sigle'}) { |
| 286 | @sigle = split /\s*;\s*/, $config{'sigle'} ; |
| 287 | }; |
| 288 | |
| 289 | # Anno |
| 290 | if (!scalar(@anno) && defined $config{'anno'}) { |
| 291 | @anno = split /\s*;\s*/, $config{'anno'} ; |
| 292 | }; |
| 293 | }; |
| 294 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 295 | |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 296 | # Set default token base |
Akron | 9ec8887 | 2017-04-12 16:29:06 +0200 | [diff] [blame] | 297 | $token_base //= 'OpenNLP#tokens'; |
| 298 | $cache_file //= 'korapxml2krill.cache'; |
| 299 | $cache_size //= '50m'; |
| 300 | $jobs //= 0; |
| 301 | $cache_delete //= 1; |
| 302 | $cache_init //= 1; |
| 303 | $sequential_extraction //= 0; |
| 304 | $log_level //= 'ERROR'; |
| 305 | $base_sentences //= ''; |
| 306 | $base_paragraphs //= ''; |
| 307 | $base_pagebreaks //= ''; |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 308 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 309 | $base_sentences = lc $base_sentences; |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 310 | $base_paragraphs = lc $base_paragraphs; |
Akron | 636bd9c | 2017-02-09 17:13:00 +0100 | [diff] [blame] | 311 | $base_pagebreaks = lc $base_pagebreaks; |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 312 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 313 | |
| 314 | # Initialize log4perl object |
| 315 | Log::Log4perl->init({ |
| 316 | 'log4perl.rootLogger' => uc($log_level) . ', STDERR', |
| 317 | 'log4perl.appender.STDERR' => 'Log::Log4perl::Appender::ScreenColoredLevels', |
| 318 | 'log4perl.appender.STDERR.layout' => 'PatternLayout', |
| 319 | 'log4perl.appender.STDERR.layout.ConversionPattern' => '[%r] %F %L %c - %m%n' |
| 320 | }); |
| 321 | |
| 322 | my $log = Log::Log4perl->get_logger('main'); |
| 323 | |
| 324 | |
| 325 | print "Reading config from $cfg_file\n" if $cfg_file; |
| 326 | |
| 327 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 328 | my %ERROR_HASH = ( |
| 329 | -sections => 'NAME|SYNOPSIS|ARGUMENTS|OPTIONS', |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 330 | -verbose => 99, |
| 331 | -msg => $VERSION_MSG, |
| 332 | -output => '-', |
| 333 | -exit => 1 |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 334 | ); |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 335 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 336 | # Input has to be defined |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 337 | pod2usage(%ERROR_HASH) unless @input; |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 338 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 339 | # Gzip has no effect, if no output is given |
| 340 | pod2usage(%ERROR_HASH) if $gzip && !$output; |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 341 | |
Akron | c11f798 | 2017-02-21 21:20:14 +0100 | [diff] [blame] | 342 | |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 343 | if ($jobs eq '-1') { |
Akron | c11f798 | 2017-02-21 21:20:14 +0100 | [diff] [blame] | 344 | state $cores = Sys::Info->new->device('CPU')->count; |
| 345 | $jobs = ceil(5 * $cores); |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 346 | $log->info("Run using $jobs jobs on $cores cores"); |
Akron | c11f798 | 2017-02-21 21:20:14 +0100 | [diff] [blame] | 347 | }; |
| 348 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 349 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 350 | # Start serial processing |
| 351 | if ($cmd eq 'serial') { |
| 352 | |
Akron | 486f9ab | 2017-04-22 23:25:19 +0200 | [diff] [blame^] | 353 | if ($output && (!defined($to_tar)) && (!-e $output || !-d $output)) { |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 354 | print "Directory '$output' does not exist.\n\n"; |
| 355 | exit(0); |
| 356 | }; |
| 357 | |
| 358 | # Remove all inputs |
| 359 | my $remove_next = 0; |
| 360 | @keep_argv = @{c(@keep_argv)->grep( |
| 361 | sub { |
| 362 | # Input flag |
| 363 | if ($_ eq '-i' || $_ eq '--input' || $_ eq '--output' || $_ eq '-o') { |
| 364 | $remove_next = 1; |
| 365 | return 0; |
| 366 | } |
| 367 | |
| 368 | # input value |
| 369 | elsif ($remove_next) { |
| 370 | $remove_next = 0; |
| 371 | return 0; |
| 372 | }; |
| 373 | |
| 374 | # Pass parameter |
| 375 | return 1; |
| 376 | } |
| 377 | )->to_array}; |
| 378 | |
| 379 | |
| 380 | # Iterate over all inputs |
| 381 | foreach (@input) { |
| 382 | |
Akron | 081639e | 2017-04-21 19:01:39 +0200 | [diff] [blame] | 383 | # This will create a directory |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 384 | my $new_out = catdir($output, get_file_name_from_glob($_)); |
| 385 | |
Akron | 486f9ab | 2017-04-22 23:25:19 +0200 | [diff] [blame^] | 386 | # Create new path, in case the output is not meant to be tarred |
Akron | 081639e | 2017-04-21 19:01:39 +0200 | [diff] [blame] | 387 | unless ($to_tar) { |
| 388 | if (make_path($new_out) == 0 && !-d $new_out) { |
| 389 | $log->error("Can\'t create path $new_out"); |
| 390 | exit(0); |
| 391 | }; |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 392 | }; |
| 393 | |
| 394 | # Create archive command |
| 395 | my @archive_cmd = ($^X, $0, 'archive', @keep_argv, '-i', $_, '-o', $new_out); |
| 396 | print "Start serial processing of $_ to $new_out\n"; |
| 397 | |
| 398 | # Start archiving |
| 399 | system @archive_cmd; |
| 400 | }; |
| 401 | |
| 402 | exit(0); |
| 403 | }; |
| 404 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 405 | my %skip; |
| 406 | $skip{lc($_)} = 1 foreach @skip; |
| 407 | |
| 408 | my @layers; |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 409 | push(@layers, ['Base', 'Sentences']) unless $base_sentences; |
| 410 | push(@layers, ['Base', 'Paragraphs']) unless $base_paragraphs; |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 411 | |
| 412 | # Connexor |
| 413 | push(@layers, ['Connexor', 'Morpho']); |
| 414 | push(@layers, ['Connexor', 'Syntax']); |
| 415 | push(@layers, ['Connexor', 'Phrase']); |
| 416 | push(@layers, ['Connexor', 'Sentences']); |
| 417 | |
| 418 | # CoreNLP |
| 419 | push(@layers, ['CoreNLP', 'NamedEntities']); |
| 420 | push(@layers, ['CoreNLP', 'Sentences']); |
| 421 | push(@layers, ['CoreNLP', 'Morpho']); |
| 422 | push(@layers, ['CoreNLP', 'Constituency']); |
| 423 | |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 424 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 425 | # DeReKo |
Akron | 41ac10b | 2017-02-08 22:47:25 +0100 | [diff] [blame] | 426 | my @dereko_attr = (); |
| 427 | if ($base_sentences eq 'dereko#structure') { |
| 428 | push @dereko_attr, 'sentences'; |
| 429 | }; |
| 430 | if ($base_paragraphs eq 'dereko#structure') { |
| 431 | push @dereko_attr, 'paragraphs'; |
| 432 | }; |
Akron | 636bd9c | 2017-02-09 17:13:00 +0100 | [diff] [blame] | 433 | |
Akron | 41ac10b | 2017-02-08 22:47:25 +0100 | [diff] [blame] | 434 | if ($base_pagebreaks eq 'dereko#structure') { |
| 435 | push @dereko_attr, 'pagebreaks'; |
| 436 | }; |
| 437 | |
| 438 | if ($dereko_attr[0]) { |
| 439 | push(@layers, ['DeReKo', 'Structure', 'base-' . join('-', @dereko_attr)]); |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 440 | } |
| 441 | else { |
| 442 | push(@layers, ['DeReKo', 'Structure']); |
| 443 | }; |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 444 | |
| 445 | # Glemm |
| 446 | push(@layers, ['Glemm', 'Morpho']); |
| 447 | |
| 448 | # Malt |
| 449 | push(@layers, ['Malt', 'Dependency']); |
| 450 | |
| 451 | # MDParser |
| 452 | push(@layers, ['MDParser', 'Dependency']); |
| 453 | |
| 454 | # Mate |
| 455 | push(@layers, ['Mate', 'Morpho']); |
| 456 | push(@layers, ['Mate', 'Dependency']); |
| 457 | |
| 458 | # OpenNLP |
| 459 | push(@layers, ['OpenNLP', 'Morpho']); |
| 460 | push(@layers, ['OpenNLP', 'Sentences']); |
| 461 | |
| 462 | # Schreibgebrauch |
| 463 | push(@layers, ['Sgbr', 'Lemma']); |
| 464 | push(@layers, ['Sgbr', 'Morpho']); |
| 465 | |
| 466 | # TreeTagger |
| 467 | push(@layers, ['TreeTagger', 'Morpho']); |
| 468 | push(@layers, ['TreeTagger', 'Sentences']); |
| 469 | |
| 470 | # XIP |
| 471 | push(@layers, ['XIP', 'Morpho']); |
| 472 | push(@layers, ['XIP', 'Constituency']); |
| 473 | push(@layers, ['XIP', 'Sentences']); |
| 474 | push(@layers, ['XIP', 'Dependency']); |
| 475 | |
Akron | 4fa37c3 | 2017-01-20 14:43:10 +0100 | [diff] [blame] | 476 | # DRuKoLa |
| 477 | push(@layers, ['DRuKoLa', 'Morpho']); |
| 478 | |
Akron | 3bd942f | 2017-02-20 20:09:14 +0100 | [diff] [blame] | 479 | # Marmot |
| 480 | push(@layers, ['MarMoT', 'Morpho']); |
| 481 | |
Akron | 4fa37c3 | 2017-01-20 14:43:10 +0100 | [diff] [blame] | 482 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 483 | # Check filters |
| 484 | my @filtered_anno; |
| 485 | if ($skip{'#all'}) { |
| 486 | foreach (@anno) { |
| 487 | push @filtered_anno, [ split('#', $_) ]; |
| 488 | }; |
| 489 | } |
| 490 | |
| 491 | # Add all annotations that are not skipped |
| 492 | else { |
| 493 | # Add to index file - respect skipping |
| 494 | foreach my $info (@layers) { |
| 495 | # Skip if Foundry or Foundry#Layer should be skipped |
| 496 | unless ($skip{lc($info->[0])} || $skip{lc($info->[0]) . '#' . lc($info->[1])}) { |
| 497 | push @filtered_anno, $info; |
| 498 | }; |
| 499 | }; |
| 500 | }; |
| 501 | |
| 502 | # Get tokenization basis |
| 503 | my ($token_base_foundry, $token_base_layer) = split(/#/, $token_base) if ($token_base); |
| 504 | |
| 505 | # TODO: This should not be initialized for batch |
| 506 | my $cache = Cache::FastMmap->new( |
| 507 | share_file => $cache_file, |
| 508 | cache_size => $cache_size, |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 509 | init_file => $cache_init |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 510 | ); |
| 511 | |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 512 | # Create batch object |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 513 | my $batch_file = KorAP::XML::Batch::File->new( |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 514 | cache => $cache, |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 515 | meta_type => $meta, |
| 516 | overwrite => $overwrite, |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 517 | foundry => $token_base_foundry, |
| 518 | layer => $token_base_layer, |
| 519 | gzip => $gzip, |
| 520 | log => $log, |
| 521 | primary => $primary, |
| 522 | pretty => $pretty, |
| 523 | anno => \@filtered_anno |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 524 | ); |
| 525 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 526 | # Get file name based on path information |
| 527 | sub get_file_name ($) { |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 528 | my $i = $input[0]; |
Akron | 3ec4897 | 2016-08-17 23:24:52 +0200 | [diff] [blame] | 529 | if (-d $i) { |
| 530 | $i =~ s![^\/]+$!!; |
| 531 | }; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 532 | my $file = shift; |
Akron | 3ec4897 | 2016-08-17 23:24:52 +0200 | [diff] [blame] | 533 | |
| 534 | # Remove temp dir fragments |
Akron | 6255760 | 2016-06-27 14:10:13 +0200 | [diff] [blame] | 535 | $file =~ s!^/?tmp/[^/]+!!; |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 536 | $file =~ s/^?\/?$i//; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 537 | $file =~ tr/\//-/; |
| 538 | $file =~ s{^-+}{}; |
Akron | b4bbec7 | 2016-10-26 20:21:02 +0200 | [diff] [blame] | 539 | $file =~ s/^.*?-(.+?-.+?-.+?)$/$1/; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 540 | return $file; |
Nils Diewald | 59094f2 | 2014-11-05 18:20:50 +0000 | [diff] [blame] | 541 | }; |
| 542 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 543 | |
| 544 | sub get_file_name_from_glob ($) { |
| 545 | my $glob = shift; |
Akron | bd3adda | 2017-04-11 15:00:55 +0200 | [diff] [blame] | 546 | $glob =~ s![\\\/]!-!g; # Transform paths |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 547 | $glob =~ s/[\*\?]//g; # Remove arbitrary fills |
| 548 | $glob =~ s/[\{\}\[\]]/-/g; # Remove class and multiple brackets |
| 549 | $glob =~ s/\-\-+/-/g; # Remove sequences of binding characters |
| 550 | $glob =~ s/^-//; # Clean beginning |
| 551 | $glob =~ s/-$//; # Clean end |
Akron | 9ec8887 | 2017-04-12 16:29:06 +0200 | [diff] [blame] | 552 | $glob =~ s/\.zip$//; # Remove file extension |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 553 | return $glob; |
| 554 | }; |
| 555 | |
| 556 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 557 | # Convert sigle to path construct |
| 558 | s!^\s*([^_]+?)_([^\.]+?)\.(.+?)\s*$!$1/$2/$3! foreach @sigle; |
| 559 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 560 | if ($cmd) { |
Akron | 486f9ab | 2017-04-22 23:25:19 +0200 | [diff] [blame^] | 561 | if ($output && (!defined($to_tar)) && (!-e $output || !-d $output)) { |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 562 | print "Directory '$output' does not exist.\n\n"; |
| 563 | exit(0); |
| 564 | }; |
| 565 | }; |
| 566 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 567 | |
| 568 | # Glob and prefix files |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 569 | if (@input) { |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 570 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 571 | my @new_input = (); |
| 572 | |
| 573 | # Iterate over all inputs |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 574 | foreach my $wild_card (@input) { |
| 575 | |
| 576 | # Prefix with input root |
| 577 | $wild_card = $input_base ? catfile($input_base, $wild_card) : $wild_card; |
| 578 | |
| 579 | push (@new_input, bsd_glob($wild_card)); |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 580 | }; |
| 581 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 582 | # Sort files by length |
| 583 | @input = sort { length($a) <=> length($b) } @new_input; |
| 584 | |
| 585 | print 'Input is ' . join(', ', @input)."\n"; |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 586 | }; |
| 587 | |
| 588 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 589 | # Process a single file |
| 590 | unless ($cmd) { |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 591 | my $input = $input[0]; |
Nils Diewald | 59094f2 | 2014-11-05 18:20:50 +0000 | [diff] [blame] | 592 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 593 | BEGIN { |
| 594 | $main::TIME = Benchmark->new; |
| 595 | $main::LAST_STOP = Benchmark->new; |
| 596 | }; |
| 597 | |
| 598 | sub stop_time { |
| 599 | my $new = Benchmark->new; |
Akron | 5f51d42 | 2016-08-16 16:26:43 +0200 | [diff] [blame] | 600 | $log->info( |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 601 | 'The code took: '. |
Akron | 5f51d42 | 2016-08-16 16:26:43 +0200 | [diff] [blame] | 602 | timestr(timediff($new, $main::LAST_STOP)) . |
| 603 | ' (overall: ' . timestr(timediff($new, $main::TIME)) . ')' |
| 604 | ); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 605 | $main::LAST_STOP = $new; |
| 606 | }; |
| 607 | |
| 608 | # Create and parse new document |
| 609 | $input =~ s{([^/])$}{$1/}; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 610 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 611 | # Process file |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 612 | $batch_file->process($input, $output); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 613 | |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 614 | # Delete cache file |
| 615 | unlink($cache_file) if $cache_delete; |
| 616 | |
Akron | 5f51d42 | 2016-08-16 16:26:43 +0200 | [diff] [blame] | 617 | stop_time; |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 618 | exit(1); |
| 619 | }; |
| 620 | |
Nils Diewald | 59094f2 | 2014-11-05 18:20:50 +0000 | [diff] [blame] | 621 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 622 | # Extract XML files |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 623 | if ($cmd eq 'extract') { |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 624 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 625 | # Create new archive object |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 626 | if (-f($input[0]) && (my $archive = KorAP::XML::Archive->new($input[0]))) { |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 627 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 628 | # Check zip capabilities |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 629 | unless ($archive->test_unzip) { |
| 630 | print "Unzip is not installed or incompatible.\n\n"; |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 631 | exit(0); |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 632 | }; |
| 633 | |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 634 | # Add further annotation archived |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 635 | $archive->attach($_) foreach @input[1..$#input]; |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 636 | |
Akron | 651cb8d | 2016-08-16 21:44:49 +0200 | [diff] [blame] | 637 | my $prefix = 1; |
| 638 | |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 639 | # No sigles given |
| 640 | unless (@sigle) { |
| 641 | |
| 642 | # Get files |
| 643 | foreach ($archive->list_texts) { |
| 644 | |
| 645 | # Split path information |
Akron | 651cb8d | 2016-08-16 21:44:49 +0200 | [diff] [blame] | 646 | ($prefix, my ($corpus, $doc, $text)) = $archive->split_path($_); |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 647 | |
| 648 | # TODO: Make this OS independent |
| 649 | push @sigle, join '/', $corpus, $doc, $text; |
| 650 | }; |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 651 | } |
| 652 | |
| 653 | # Check sigle for doc sigles |
| 654 | else { |
| 655 | my @new_sigle; |
| 656 | |
| 657 | my $prefix_check = 0; |
| 658 | |
| 659 | # Iterate over all sigle |
| 660 | foreach (@sigle) { |
| 661 | |
| 662 | # Sigle is a doc sigle |
| 663 | if ($_ =~ m!^(?:\.[/\\])?[^/\\]+?[/\\][^/\\]+?$!) { |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 664 | |
Akron | 60a8caa | 2017-02-17 21:51:27 +0100 | [diff] [blame] | 665 | print "$_ ..."; |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 666 | # Check if a prefix is needed |
| 667 | unless ($prefix_check) { |
Akron | 60a8caa | 2017-02-17 21:51:27 +0100 | [diff] [blame] | 668 | |
| 669 | if ($prefix = $archive->check_prefix) { |
| 670 | print " with prefix ..."; |
| 671 | }; |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 672 | $prefix_check = 1; |
| 673 | }; |
| 674 | |
Akron | 60a8caa | 2017-02-17 21:51:27 +0100 | [diff] [blame] | 675 | print "\n"; |
| 676 | |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 677 | # TODO: Make this OS independent |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 678 | my $path = ($prefix ? './' : '') . $_; |
| 679 | |
| 680 | print '... ' . ( |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 681 | $archive->extract_doc( |
Akron | 9ec8887 | 2017-04-12 16:29:06 +0200 | [diff] [blame] | 682 | $path, $output, $sequential_extraction ? 1 : $jobs |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 683 | ) ? '' : 'not ' |
| 684 | ); |
| 685 | print "extracted.\n"; |
| 686 | } |
Akron | 60a8caa | 2017-02-17 21:51:27 +0100 | [diff] [blame] | 687 | |
| 688 | # Sigle is a text sigle |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 689 | else { |
| 690 | push @new_sigle, $_; |
Akron | 60a8caa | 2017-02-17 21:51:27 +0100 | [diff] [blame] | 691 | |
| 692 | unless ($prefix_check) { |
| 693 | |
| 694 | if ($prefix = $archive->check_prefix) { |
| 695 | print " with prefix ..."; |
| 696 | }; |
| 697 | $prefix_check = 1; |
| 698 | }; |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 699 | }; |
| 700 | }; |
| 701 | @sigle = @new_sigle; |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 702 | }; |
| 703 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 704 | # Iterate over all given sigles and extract |
| 705 | foreach (@sigle) { |
Akron | 60a8caa | 2017-02-17 21:51:27 +0100 | [diff] [blame] | 706 | |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 707 | print "$_ ...\n"; |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 708 | |
Akron | 03b24db | 2016-08-16 20:54:32 +0200 | [diff] [blame] | 709 | # TODO: Make this OS independent |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 710 | print '... ' . ( |
Akron | 60a8caa | 2017-02-17 21:51:27 +0100 | [diff] [blame] | 711 | |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 712 | $archive->extract_text( |
Akron | 651cb8d | 2016-08-16 21:44:49 +0200 | [diff] [blame] | 713 | ($prefix ? './' : '') . $_, $output |
| 714 | ) ? '' : 'not ' |
| 715 | ); |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 716 | print "extracted.\n"; |
| 717 | }; |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 718 | } |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 719 | |
| 720 | # Can't create archive object |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 721 | else { |
| 722 | $log->error('Unable to extract from primary archive ' . $input[0]); |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 723 | exit(1); |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 724 | }; |
| 725 | } |
| 726 | |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 727 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 728 | # Process an archive |
| 729 | elsif ($cmd eq 'archive') { |
Nils Diewald | 2db9ad0 | 2013-10-29 19:26:43 +0000 | [diff] [blame] | 730 | |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 731 | my $archive_output; |
| 732 | |
| 733 | # First extract, then archive |
| 734 | if (defined $extract_dir) { |
| 735 | |
| 736 | # Create new archive object |
| 737 | if (-f($input[0]) && (my $archive = KorAP::XML::Archive->new($input[0]))) { |
| 738 | |
| 739 | # Check zip capabilities |
| 740 | unless ($archive->test_unzip) { |
| 741 | print "Unzip is not installed or incompatible.\n\n"; |
| 742 | exit(0); |
| 743 | }; |
| 744 | |
| 745 | # Add further annotation archived |
| 746 | $archive->attach($_) foreach @input[1..$#input]; |
| 747 | |
| 748 | # Create a temporary directory |
| 749 | if ($extract_dir eq ':temp:') { |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 750 | $extract_dir = tempdir(CLEANUP => 0); |
| 751 | print "Temporarily extract to $extract_dir\n"; |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 752 | }; |
| 753 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 754 | # Add some random extra to avoid clashes with multiple archives |
| 755 | $extract_dir = catdir($extract_dir, random_string('cccccc')); |
| 756 | |
| 757 | # Extract to temprary directory |
Akron | 9ec8887 | 2017-04-12 16:29:06 +0200 | [diff] [blame] | 758 | if ($archive->extract_all($extract_dir, $sequential_extraction ? 1: $jobs)) { |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 759 | @input = ($extract_dir); |
| 760 | } |
| 761 | else { |
| 762 | $log->error('Unable to extract from primary archive ' . $input[0] . |
| 763 | ' to ' . $extract_dir); |
| 764 | exit(1); |
| 765 | }; |
| 766 | } |
| 767 | |
| 768 | # Can't create archive object |
| 769 | else { |
| 770 | $log->error('Unable to extract from primary archive ' . $input[0]); |
| 771 | exit(1); |
| 772 | }; |
| 773 | }; |
| 774 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 775 | # TODO: Support sigles |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 776 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 777 | # Zero means: everything runs in the parent process |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 778 | my $pool = Parallel::ForkManager->new($jobs); |
| 779 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 780 | my $count = 0; # Texts to process |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 781 | my $iter = 1; # Current text in process |
| 782 | |
| 783 | # Report on fork message |
| 784 | $pool->run_on_finish ( |
| 785 | sub { |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 786 | my ($pid, $code) = @_; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 787 | my $data = pop; |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 788 | |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 789 | print 'Convert ['. ($jobs > 0 ? "\$$pid:" : '') . |
Akron | 651cb8d | 2016-08-16 21:44:49 +0200 | [diff] [blame] | 790 | ($iter++) . "/$count]" . |
| 791 | ($code ? " $code" : '') . |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 792 | ' ' . $data->[0] . "\n"; |
| 793 | $data->[1] = undef if $data->[1]; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 794 | } |
| 795 | ); |
| 796 | |
| 797 | my $t; |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 798 | my $temp; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 799 | print "Reading data ...\n"; |
| 800 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 801 | # unless (Cache::FastMmap->new( |
| 802 | # share_file => $cache_file, |
| 803 | # cache_size => $cache_size, |
| 804 | # init_file => $cache_init |
| 805 | # )) { |
| 806 | # print "Unable to intialize cache '$cache_file'\n\n"; |
| 807 | # exit(1); |
| 808 | # }; |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 809 | |
Akron | 486f9ab | 2017-04-22 23:25:19 +0200 | [diff] [blame^] | 810 | my $tar_archive; |
| 811 | my $output_dir = $output; |
| 812 | |
| 813 | # Initialize tar archive |
| 814 | if ($to_tar) { |
| 815 | $tar_archive = Archive::Tar::Builder->new( |
| 816 | ignore_errors => 1 |
| 817 | ); |
| 818 | |
| 819 | # Set output name |
| 820 | my $tar_file = $output; |
| 821 | unless ($tar_file =~ /\.tar$/) { |
| 822 | $tar_file .= '.tar'; |
| 823 | }; |
| 824 | |
| 825 | # Initiate the tar file |
| 826 | print "Writing to file $tar_file\n"; |
| 827 | my $fh = IO::File->new($tar_file, 'w'); |
| 828 | $fh->binmode(1); |
| 829 | |
| 830 | # Set handle |
| 831 | $tar_archive->set_handle($fh); |
| 832 | |
| 833 | # Output to temporary directory |
| 834 | $output_dir = File::Temp->newdir; |
| 835 | }; |
| 836 | |
| 837 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 838 | # Input is a directory |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 839 | if (-d $input[0]) { |
| 840 | my $it = Directory::Iterator->new($input[0]); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 841 | my @dirs; |
| 842 | my $dir; |
| 843 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 844 | # Todo: Make a DO WHILE |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 845 | while (1) { |
| 846 | if (!$it->is_directory && ($dir = $it->get) && $dir =~ s{/data\.xml$}{}) { |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 847 | push @dirs, $dir; |
| 848 | $it->prune; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 849 | }; |
| 850 | last unless $it->next; |
| 851 | }; |
| 852 | |
| 853 | print "Start processing ...\n"; |
| 854 | $t = Benchmark->new; |
| 855 | $count = scalar @dirs; |
| 856 | |
| 857 | DIRECTORY_LOOP: |
| 858 | for (my $i = 0; $i < $count; $i++) { |
| 859 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 860 | my $filename = catfile( |
Akron | 081639e | 2017-04-21 19:01:39 +0200 | [diff] [blame] | 861 | $output_dir, |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 862 | get_file_name($dirs[$i]) . '.json' . ($gzip ? '.gz' : '') |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 863 | ); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 864 | |
| 865 | # Get the next fork |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 866 | $pool->start and next DIRECTORY_LOOP; |
Akron | 3ec4897 | 2016-08-17 23:24:52 +0200 | [diff] [blame] | 867 | |
Akron | 13d5662 | 2016-10-31 14:54:49 +0100 | [diff] [blame] | 868 | if (my $return = $batch_file->process($dirs[$i] => $filename)) { |
Akron | 081639e | 2017-04-21 19:01:39 +0200 | [diff] [blame] | 869 | |
| 870 | # Add to tar archive |
| 871 | if ($to_tar) { |
| 872 | $tar_archive->archive($filename); |
| 873 | unlink $filename; |
| 874 | }; |
Akron | 486f9ab | 2017-04-22 23:25:19 +0200 | [diff] [blame^] | 875 | |
| 876 | $pool->finish( |
| 877 | 0, |
| 878 | ["Processed " . $filename . ($return == -1 ? " - already existing" : '')] |
| 879 | ); |
Akron | 3ec4897 | 2016-08-17 23:24:52 +0200 | [diff] [blame] | 880 | } |
| 881 | else { |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 882 | $pool->finish(1, ["Unable to process " . $dirs[$i]]); |
Akron | 3ec4897 | 2016-08-17 23:24:52 +0200 | [diff] [blame] | 883 | }; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 884 | }; |
| 885 | } |
| 886 | |
| 887 | # Input is a file |
Akron | 29866ac | 2016-06-24 16:40:47 +0200 | [diff] [blame] | 888 | elsif (-f($input[0]) && (my $archive = KorAP::XML::Archive->new($input[0]))) { |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 889 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 890 | unless ($archive->test_unzip) { |
| 891 | print "Unzip is not installed or incompatible.\n\n"; |
| 892 | exit(1); |
| 893 | }; |
| 894 | |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 895 | # Add further annotation archived |
Akron | 2812ba2 | 2016-10-28 21:55:59 +0200 | [diff] [blame] | 896 | $archive->attach($_) foreach @input[1..$#input]; |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 897 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 898 | print "Start processing ...\n"; |
| 899 | $t = Benchmark->new; |
| 900 | my @dirs = $archive->list_texts; |
| 901 | $count = scalar @dirs; |
| 902 | |
| 903 | ARCHIVE_LOOP: |
| 904 | for (my $i = 0; $i < $count; $i++) { |
| 905 | |
| 906 | # Split path information |
| 907 | my ($prefix, $corpus, $doc, $text) = $archive->split_path($dirs[$i]); |
| 908 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 909 | my $filename = catfile( |
Akron | 486f9ab | 2017-04-22 23:25:19 +0200 | [diff] [blame^] | 910 | $output_dir, |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 911 | get_file_name( |
| 912 | catfile($corpus, $doc, $text) |
| 913 | . '.json' . ($gzip ? '.gz' : '') |
| 914 | ) |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 915 | ); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 916 | |
| 917 | # Get the next fork |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 918 | $pool->start and next ARCHIVE_LOOP; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 919 | |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 920 | # Create temporary file |
| 921 | $temp = File::Temp->newdir; |
| 922 | |
Akron | bdf434a | 2016-10-24 17:42:07 +0200 | [diff] [blame] | 923 | # TODO: Check if $filename exist at the beginning, |
| 924 | # because extraction can be horrible slow! |
| 925 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 926 | # Extract from archive |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 927 | if ($archive->extract_text($dirs[$i], $temp)) { |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 928 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 929 | # Create corpus directory |
| 930 | my $input = catdir("$temp", $corpus); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 931 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 932 | # Temporary directory |
| 933 | my $dir = catdir($input, $doc, $text); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 934 | |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 935 | # Write file |
Akron | 13d5662 | 2016-10-31 14:54:49 +0100 | [diff] [blame] | 936 | if (my $return = $batch_file->process($dir => $filename)) { |
Akron | 486f9ab | 2017-04-22 23:25:19 +0200 | [diff] [blame^] | 937 | |
| 938 | # Add to tar archive |
| 939 | if ($to_tar) { |
| 940 | $tar_archive->archive($filename); |
| 941 | unlink $filename; |
| 942 | }; |
| 943 | |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 944 | # Delete temporary file |
Akron | 13d5662 | 2016-10-31 14:54:49 +0100 | [diff] [blame] | 945 | $pool->finish( |
| 946 | 0, |
| 947 | ["Processed " . $filename . ($return == -1 ? " - already existing" : ''), $temp] |
| 948 | ); |
| 949 | #$pool->finish(0, ["Processed " . $filename, $temp]); |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 950 | } |
| 951 | else { |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 952 | # Delete temporary file |
| 953 | $pool->finish(1, ["Unable to process " . $dir, $temp]); |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 954 | }; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 955 | } |
Akron | 7d4cdd8 | 2016-08-17 21:39:45 +0200 | [diff] [blame] | 956 | |
| 957 | # Unable to extract |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 958 | else { |
Akron | 4c0cf31 | 2016-10-15 16:42:09 +0200 | [diff] [blame] | 959 | $pool->finish(1, ["Unable to extract " . $dirs[$i], $temp]); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 960 | }; |
| 961 | }; |
| 962 | } |
| 963 | |
| 964 | else { |
| 965 | print "Input is neither a directory nor an archive.\n\n"; |
| 966 | }; |
| 967 | |
| 968 | $pool->wait_all_children; |
| 969 | |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 970 | # Delete cache file |
| 971 | unlink($cache_file) if $cache_delete; |
| 972 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 973 | print timestr(timediff(Benchmark->new, $t))."\n"; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 974 | print "Done.\n"; |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 975 | }; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 976 | |
Nils Diewald | 2db9ad0 | 2013-10-29 19:26:43 +0000 | [diff] [blame] | 977 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 978 | # Cleanup temporary extraction directory |
| 979 | if ($extract_dir) { |
| 980 | my $objects = remove_tree($extract_dir, { safe => 1 }); |
| 981 | print "Removed directory $extract_dir with $objects objects.\n"; |
| 982 | }; |
| 983 | |
| 984 | |
| 985 | print "\n"; |
| 986 | |
Nils Diewald | 2db9ad0 | 2013-10-29 19:26:43 +0000 | [diff] [blame] | 987 | __END__ |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 988 | |
| 989 | =pod |
| 990 | |
| 991 | =encoding utf8 |
| 992 | |
| 993 | =head1 NAME |
| 994 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 995 | korapxml2krill - Merge KorapXML data and create Krill documents |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 996 | |
| 997 | |
| 998 | =head1 SYNOPSIS |
| 999 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 1000 | korapxml2krill [archive|extract] --input <directory|archive> [options] |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1001 | |
Akron | 2fd402b | 2016-10-27 21:26:48 +0200 | [diff] [blame] | 1002 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1003 | =head1 DESCRIPTION |
| 1004 | |
| 1005 | L<KorAP::XML::Krill> is a library to convert KorAP-XML documents to files |
| 1006 | compatible with the L<Krill|https://github.com/KorAP/Krill> indexer. |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 1007 | The C<korapxml2krill> command line tool is a simple wrapper to the library. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1008 | |
| 1009 | |
| 1010 | =head1 INSTALLATION |
| 1011 | |
| 1012 | The preferred way to install L<KorAP::XML::Krill> is to use L<cpanm|App::cpanminus>. |
| 1013 | |
Akron | af38698 | 2016-10-12 00:33:25 +0200 | [diff] [blame] | 1014 | $ cpanm https://github.com/KorAP/KorAP-XML-Krill.git |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1015 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1016 | In case everything went well, the C<korapxml2krill> tool will |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 1017 | be available on your command line immediately. |
Akron | 7438151 | 2016-10-14 11:56:22 +0200 | [diff] [blame] | 1018 | Minimum requirement for L<KorAP::XML::Krill> is Perl 5.14. |
Akron | a93d51b | 2016-10-24 20:27:48 +0200 | [diff] [blame] | 1019 | 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] | 1020 | |
| 1021 | =head1 ARGUMENTS |
| 1022 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 1023 | $ korapxml2krill -z --input <directory> --output <filename> |
| 1024 | |
| 1025 | Without arguments, C<korapxml2krill> converts a directory of a single KorAP-XML document. |
Akron | 2fd402b | 2016-10-27 21:26:48 +0200 | [diff] [blame] | 1026 | It expects the input to point to the text level folder. |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 1027 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1028 | =over 2 |
| 1029 | |
| 1030 | =item B<archive> |
| 1031 | |
Akron | 081639e | 2017-04-21 19:01:39 +0200 | [diff] [blame] | 1032 | $ korapxml2krill archive -z --input <directory|archive> --output <directory|tar> |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 1033 | |
Akron | 2fd402b | 2016-10-27 21:26:48 +0200 | [diff] [blame] | 1034 | Converts an archive of KorAP-XML documents. It expects a directory |
| 1035 | (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] | 1036 | |
| 1037 | =item B<extract> |
| 1038 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 1039 | $ korapxml2krill extract --input <archive> --output <directory> --sigle <SIGLE> |
| 1040 | |
| 1041 | Extracts KorAP-XML documents from a zip file. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1042 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 1043 | =item B<serial> |
| 1044 | |
| 1045 | $ korapxml2krill serial -i <archive1> -i <archive2> -o <directory> -cfg <config-file> |
| 1046 | |
| 1047 | Convert archives sequentially. The inputs are not merged but treated |
| 1048 | as they are (so they may be premerged or globs). |
| 1049 | the C<--out> directory is treated as the base directory where subdirectories |
Akron | 081639e | 2017-04-21 19:01:39 +0200 | [diff] [blame] | 1050 | are created based on the archive name. In case the C<--to-tar> flag is given, |
| 1051 | the output will be a tar file. |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 1052 | |
| 1053 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1054 | =back |
| 1055 | |
| 1056 | |
| 1057 | =head1 OPTIONS |
| 1058 | |
| 1059 | =over 2 |
| 1060 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 1061 | =item B<--input|-i> <directory|zip file> |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1062 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 1063 | Directory or zip file(s) of documents to convert. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1064 | |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 1065 | Without arguments, C<korapxml2krill> expects a folder of a single KorAP-XML |
Akron | f1a1de9 | 2016-11-02 17:32:12 +0100 | [diff] [blame] | 1066 | document, while C<archive> expects a KorAP-XML corpus folder or a zip |
| 1067 | file to batch process multiple files. |
| 1068 | C<extract> expects zip files only. |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 1069 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 1070 | C<archive> supports multiple input zip files with the constraint, |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 1071 | that the first archive listed contains all primary data files |
| 1072 | and all meta data files. |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 1073 | |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 1074 | -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] | 1075 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1076 | Input may also be defined using BSD glob wildcards. |
| 1077 | |
| 1078 | -i 'file/news*.zip' |
| 1079 | |
| 1080 | The extended input array will be sorted in length order, so the shortest |
| 1081 | path needs to contain all primary data files and all meta data files. |
| 1082 | |
Akron | 0c3e375 | 2016-06-28 15:55:53 +0200 | [diff] [blame] | 1083 | (The directory structure follows the base directory format, |
| 1084 | that may include a C<.> root folder. |
| 1085 | In this case further archives lacking a C<.> root folder |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 1086 | need to be passed with a hash sign in front of the archive's name. |
| 1087 | This may require to quote the parameter.) |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 1088 | |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 1089 | To support zip files, a version of C<unzip> needs to be installed that is |
| 1090 | compatible with the archive file. |
Akron | a93d51b | 2016-10-24 20:27:48 +0200 | [diff] [blame] | 1091 | |
Akron | 7606afa | 2016-10-25 16:23:49 +0200 | [diff] [blame] | 1092 | B<The root folder switch using the hash sign is experimental and |
| 1093 | may vanish in future versions.> |
Akron | 651cb8d | 2016-08-16 21:44:49 +0200 | [diff] [blame] | 1094 | |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 1095 | =item B<--input-base|-ib> <directory> |
| 1096 | |
| 1097 | The base directory for inputs. |
| 1098 | |
| 1099 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1100 | =item B<--output|-o> <directory|file> |
| 1101 | |
| 1102 | Output folder for archive processing or |
| 1103 | document name for single output (optional), |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 1104 | writes to C<STDOUT> by default |
| 1105 | (in case C<output> is not mandatory due to further options). |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1106 | |
| 1107 | =item B<--overwrite|-w> |
| 1108 | |
| 1109 | Overwrite files that already exist. |
| 1110 | |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 1111 | =item B<--token|-t> <foundry>#<file> |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1112 | |
| 1113 | Define the default tokenization by specifying |
| 1114 | the name of the foundry and optionally the name |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1115 | of the layer-file. Defaults to C<OpenNLP#tokens>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1116 | |
Akron | 3741f8b | 2016-12-21 19:55:21 +0100 | [diff] [blame] | 1117 | |
| 1118 | =item B<--base-sentences|-bs> <foundry>#<layer> |
| 1119 | |
| 1120 | Define the layer for base sentences. |
| 1121 | If given, this will be used instead of using C<Base#Sentences>. |
| 1122 | Currently C<DeReKo#Structure> is the only additional layer supported. |
| 1123 | |
| 1124 | Defaults to unset. |
| 1125 | |
| 1126 | |
| 1127 | =item B<--base-paragraphs|-bp> <foundry>#<layer> |
| 1128 | |
| 1129 | Define the layer for base paragraphs. |
| 1130 | If given, this will be used instead of using C<Base#Paragraphs>. |
| 1131 | Currently C<DeReKo#Structure> is the only additional layer supported. |
| 1132 | |
| 1133 | Defaults to unset. |
| 1134 | |
| 1135 | |
Akron | 41ac10b | 2017-02-08 22:47:25 +0100 | [diff] [blame] | 1136 | =item B<--base-pagebreaks|-bpb> <foundry>#<layer> |
| 1137 | |
| 1138 | Define the layer for base pagebreaks. |
| 1139 | Currently C<DeReKo#Structure> is the only layer supported. |
| 1140 | |
| 1141 | Defaults to unset. |
| 1142 | |
| 1143 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1144 | =item B<--skip|-s> <foundry>[#<layer>] |
| 1145 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 1146 | Skip specific annotations by specifying the foundry |
| 1147 | (and optionally the layer with a C<#>-prefix), |
| 1148 | 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] | 1149 | Can be set multiple times. |
| 1150 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1151 | =item B<--anno|-a> <foundry>#<layer> |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1152 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 1153 | Convert specific annotations by specifying the foundry |
| 1154 | (and optionally the layer with a C<#>-prefix), |
| 1155 | e.g. C<Mate> or C<Mate#Morpho>. |
| 1156 | Can be set multiple times. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1157 | |
| 1158 | =item B<--primary|-p> |
| 1159 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1160 | Output primary data or not. Defaults to C<true>. |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 1161 | Can be flagged using C<--no-primary> as well. |
| 1162 | This is I<deprecated>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1163 | |
| 1164 | =item B<--jobs|-j> |
| 1165 | |
| 1166 | Define the number of concurrent jobs in seperated forks |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 1167 | for archive processing. |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 1168 | Defaults to C<0> (everything runs in a single process). |
Akron | 9ec8887 | 2017-04-12 16:29:06 +0200 | [diff] [blame] | 1169 | |
| 1170 | If C<sequential-extraction> is not set to false, this will |
| 1171 | also apply to extraction. |
| 1172 | |
Akron | c11f798 | 2017-02-21 21:20:14 +0100 | [diff] [blame] | 1173 | Pass -1, and the value will be set automatically to 5 |
| 1174 | times the number of available cores. |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 1175 | This is I<experimental>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1176 | |
Akron | 9ec8887 | 2017-04-12 16:29:06 +0200 | [diff] [blame] | 1177 | =item B<--sequential-extraction|-se> |
| 1178 | |
| 1179 | Flag to indicate, if the C<jobs> value also applies to extraction. |
| 1180 | Some systems may have problems with extracting multiple archives |
| 1181 | to the same folder at the same time. |
| 1182 | Can be flagged using C<--no-sequential-extraction> as well. |
| 1183 | Defaults to C<false>. |
| 1184 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 1185 | =item B<--meta|-m> |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1186 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 1187 | Define the metadata parser to use. Defaults to C<I5>. |
| 1188 | Metadata parsers can be defined in the C<KorAP::XML::Meta> namespace. |
| 1189 | This is I<experimental>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1190 | |
| 1191 | =item B<--pretty|-y> |
| 1192 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1193 | Pretty print JSON output. Defaults to C<false>. |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 1194 | This is I<deprecated>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1195 | |
| 1196 | =item B<--gzip|-z> |
| 1197 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 1198 | Compress the output. |
| 1199 | Expects a defined C<output> file in single processing. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1200 | |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 1201 | =item B<--cache|-c> |
| 1202 | |
| 1203 | File to mmap a cache (using L<Cache::FastMmap>). |
| 1204 | Defaults to C<korapxml2krill.cache> in the calling directory. |
| 1205 | |
| 1206 | =item B<--cache-size|-cs> |
| 1207 | |
| 1208 | Size of the cache. Defaults to C<50m>. |
| 1209 | |
| 1210 | =item B<--cache-init|-ci> |
| 1211 | |
| 1212 | Initialize cache file. |
| 1213 | Can be flagged using C<--no-cache-init> as well. |
| 1214 | Defaults to C<true>. |
| 1215 | |
| 1216 | =item B<--cache-delete|-cd> |
| 1217 | |
| 1218 | Delete cache file after processing. |
| 1219 | Can be flagged using C<--no-cache-delete> as well. |
| 1220 | Defaults to C<true>. |
| 1221 | |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 1222 | =item B<--config|-cfg> |
| 1223 | |
| 1224 | Configure the parameters of your call in a file |
| 1225 | of key-value pairs with whitespace separator |
| 1226 | |
| 1227 | overwrite 1 |
| 1228 | token DeReKo#Structure |
| 1229 | ... |
| 1230 | |
| 1231 | Supported parameters are: |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 1232 | C<overwrite>, C<gzip>, C<jobs>, C<input-base>, |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 1233 | C<token>, C<log>, C<cache>, C<cache-size>, C<cache-delete>, C<meta>, |
Akron | 9ec8887 | 2017-04-12 16:29:06 +0200 | [diff] [blame] | 1234 | C<output>, |
| 1235 | C<temp-extract>, C<sequential-extraction>, |
| 1236 | C<base-sentences>, C<base-paragraphs>, |
| 1237 | C<base-pagebreaks>, |
| 1238 | C<skip> (semicolon separated), C<sigle> |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 1239 | (semicolon separated), C<anno> (semicolon separated). |
| 1240 | |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 1241 | =item B<--temporary-extract|-te> |
| 1242 | |
| 1243 | Only valid for the C<archive> command. |
| 1244 | |
| 1245 | This will first extract all files into a |
| 1246 | directory and then will archive. |
| 1247 | If the directory is given as C<:temp:>, |
| 1248 | a temporary directory is used. |
| 1249 | This is especially useful to avoid |
| 1250 | massive unzipping and potential |
| 1251 | network latency. |
Akron | 636aa11 | 2017-04-07 18:48:56 +0200 | [diff] [blame] | 1252 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 1253 | =item B<--sigle|-sg> |
| 1254 | |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 1255 | Extract the given texts. |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 1256 | Can be set multiple times. |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 1257 | I<Currently only supported on C<extract>.> |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 1258 | Sigles have the structure C<Corpus>/C<Document>/C<Text>. |
Akron | 2080758 | 2016-10-26 17:11:34 +0200 | [diff] [blame] | 1259 | 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] | 1260 | On the document level, the postfix wildcard C<*> is supported. |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 1261 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1262 | =item B<--log|-l> |
| 1263 | |
| 1264 | The L<Log4perl> log level, defaults to C<ERROR>. |
| 1265 | |
| 1266 | =item B<--help|-h> |
| 1267 | |
| 1268 | Print this document. |
| 1269 | |
| 1270 | =item B<--version|-v> |
| 1271 | |
| 1272 | Print version information. |
| 1273 | |
| 1274 | =back |
| 1275 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1276 | =head1 ANNOTATION SUPPORT |
| 1277 | |
| 1278 | L<KorAP::XML::Krill> has built-in importer for some annotation foundries and layers |
| 1279 | developed in the KorAP project that are part of the KorAP preprocessing pipeline. |
| 1280 | The base foundry with paragraphs, sentences, and the text element are mandatory for |
| 1281 | L<Krill|https://github.com/KorAP/Krill>. |
| 1282 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1283 | Base |
| 1284 | #Paragraphs |
| 1285 | #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1286 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1287 | Connexor |
| 1288 | #Morpho |
| 1289 | #Phrase |
| 1290 | #Sentences |
| 1291 | #Syntax |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1292 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1293 | CoreNLP |
| 1294 | #Constituency |
| 1295 | #Morpho |
| 1296 | #NamedEntities |
| 1297 | #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1298 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1299 | DeReKo |
| 1300 | #Structure |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1301 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1302 | DRuKoLa |
| 1303 | #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1304 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1305 | Glemm |
| 1306 | #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1307 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1308 | Malt |
| 1309 | #Dependency |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1310 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1311 | MarMoT |
| 1312 | #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1313 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1314 | Mate |
| 1315 | #Dependency |
| 1316 | #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1317 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1318 | MDParser |
| 1319 | #Dependency |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1320 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1321 | OpenNLP |
| 1322 | #Morpho |
| 1323 | #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1324 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1325 | Sgbr |
| 1326 | #Lemma |
| 1327 | #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1328 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1329 | TreeTagger |
| 1330 | #Morpho |
| 1331 | #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1332 | |
Akron | 821db3d | 2017-04-06 21:19:31 +0200 | [diff] [blame] | 1333 | XIP |
| 1334 | #Constituency |
| 1335 | #Morpho |
| 1336 | #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1337 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 1338 | |
| 1339 | More importers are in preparation. |
| 1340 | New annotation importers can be defined in the C<KorAP::XML::Annotation> namespace. |
| 1341 | See the built-in annotation importers as examples. |
| 1342 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1343 | =head1 AVAILABILITY |
| 1344 | |
| 1345 | https://github.com/KorAP/KorAP-XML-Krill |
| 1346 | |
| 1347 | |
| 1348 | =head1 COPYRIGHT AND LICENSE |
| 1349 | |
Akron | 3ec0a1c | 2017-01-18 14:41:55 +0100 | [diff] [blame] | 1350 | Copyright (C) 2015-2017, L<IDS Mannheim|http://www.ids-mannheim.de/> |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 1351 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1352 | Author: L<Nils Diewald|http://nils-diewald.de/> |
Akron | 8150010 | 2017-04-07 20:45:44 +0200 | [diff] [blame] | 1353 | |
Akron | a76d835 | 2016-10-27 16:27:32 +0200 | [diff] [blame] | 1354 | Contributor: Eliza Margaretha |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 1355 | |
| 1356 | L<KorAP::XML::Krill> is developed as part of the L<KorAP|http://korap.ids-mannheim.de/> |
| 1357 | Corpus Analysis Platform at the |
| 1358 | L<Institute for the German Language (IDS)|http://ids-mannheim.de/>, |
| 1359 | member of the |
| 1360 | L<Leibniz-Gemeinschaft|http://www.leibniz-gemeinschaft.de/en/about-us/leibniz-competition/projekte-2011/2011-funding-line-2/>. |
| 1361 | |
| 1362 | This program is free software published under the |
| 1363 | L<BSD-2 License|https://raw.githubusercontent.com/KorAP/KorAP-XML-Krill/master/LICENSE>. |
| 1364 | |
| 1365 | =cut |