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 | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 66 | # ---------------------------------------------------------- |
Akron | 069bd71 | 2016-02-12 19:09:06 +0100 | [diff] [blame] | 67 | |
Akron | 8b99052 | 2016-07-06 16:45:57 +0200 | [diff] [blame] | 68 | our $LAST_CHANGE = '2016/07/06'; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 69 | our $LOCAL = $FindBin::Bin; |
| 70 | our $VERSION_MSG = <<"VERSION"; |
| 71 | Version $KorAP::XML::Krill::VERSION - diewald\@ids-mannheim.de - $LAST_CHANGE |
| 72 | VERSION |
| 73 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 74 | # Parse comand |
| 75 | my $cmd; |
| 76 | our @ARGV; |
| 77 | if ($ARGV[0] && index($ARGV[0], '-') != 0) { |
| 78 | $cmd = shift @ARGV; |
Akron | 150b29e | 2016-02-14 23:06:48 +0100 | [diff] [blame] | 79 | }; |
Akron | 93d620e | 2016-02-05 19:40:05 +0100 | [diff] [blame] | 80 | |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 81 | my (@skip, @sigle, @input); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 82 | my $text; |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 83 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 84 | # Parse options from the command line |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 85 | GetOptions( |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 86 | 'input|i=s' => \@input, |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 87 | 'output|o=s' => \(my $output), |
| 88 | 'overwrite|w' => \(my $overwrite), |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 89 | 'meta|m=s' => \(my $meta), |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 90 | 'token|t=s' => \(my $token_base), |
| 91 | 'gzip|z' => \(my $gzip), |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 92 | 'skip|s=s' => \@skip, |
| 93 | 'sigle|sg=s' => \@sigle, |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 94 | 'cache|c=s' => \(my $cache_file = 'korapxml2krill.cache'), |
| 95 | 'cache-size|cs=s' => \(my $cache_size = '50m'), |
| 96 | 'cache-delete|cd!' => \(my $cache_delete = 1), |
| 97 | 'cache-init|ci!' => \(my $cache_init = 1), |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 98 | 'log|l=s' => \(my $log_level = 'ERROR'), |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 99 | 'anno|a=s' => \(my @anno), |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 100 | 'primary|p!' => \(my $primary), |
| 101 | 'pretty|y' => \(my $pretty), |
| 102 | 'jobs|j=i' => \(my $jobs = 0), |
| 103 | 'help|h' => sub { |
| 104 | pod2usage( |
| 105 | -sections => 'NAME|SYNOPSIS|ARGUMENTS|OPTIONS', |
| 106 | -verbose => 99, |
| 107 | -msg => $VERSION_MSG, |
| 108 | ); |
| 109 | }, |
| 110 | 'version|v' => sub { |
| 111 | pod2usage( |
| 112 | -verbose => 0, |
| 113 | -msg => $VERSION_MSG |
| 114 | ) |
| 115 | } |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 116 | ); |
| 117 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 118 | my %ERROR_HASH = ( |
| 119 | -sections => 'NAME|SYNOPSIS|ARGUMENTS|OPTIONS', |
| 120 | -verbose => 99, |
| 121 | -msg => $VERSION_MSG, |
| 122 | -exit => 1 |
| 123 | ); |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 124 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 125 | # Input has to be defined |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 126 | pod2usage(%ERROR_HASH) unless @input; |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 127 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 128 | # Gzip has no effect, if no output is given |
| 129 | pod2usage(%ERROR_HASH) if $gzip && !$output; |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 130 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 131 | # Initialize log4perl object |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 132 | Log::Log4perl->init({ |
| 133 | 'log4perl.rootLogger' => uc($log_level) . ', STDERR', |
| 134 | 'log4perl.appender.STDERR' => 'Log::Log4perl::Appender::ScreenColoredLevels', |
| 135 | 'log4perl.appender.STDERR.layout' => 'PatternLayout', |
| 136 | 'log4perl.appender.STDERR.layout.ConversionPattern' => '[%r] %F %L %c - %m%n' |
| 137 | }); |
| 138 | |
| 139 | my $log = Log::Log4perl->get_logger('main'); |
| 140 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 141 | my %skip; |
| 142 | $skip{lc($_)} = 1 foreach @skip; |
| 143 | |
| 144 | my @layers; |
| 145 | push(@layers, ['Base', 'Sentences']); |
| 146 | push(@layers, ['Base', 'Paragraphs']); |
| 147 | |
| 148 | # Connexor |
| 149 | push(@layers, ['Connexor', 'Morpho']); |
| 150 | push(@layers, ['Connexor', 'Syntax']); |
| 151 | push(@layers, ['Connexor', 'Phrase']); |
| 152 | push(@layers, ['Connexor', 'Sentences']); |
| 153 | |
| 154 | # CoreNLP |
| 155 | push(@layers, ['CoreNLP', 'NamedEntities']); |
| 156 | push(@layers, ['CoreNLP', 'Sentences']); |
| 157 | push(@layers, ['CoreNLP', 'Morpho']); |
| 158 | push(@layers, ['CoreNLP', 'Constituency']); |
| 159 | |
| 160 | # DeReKo |
| 161 | push(@layers, ['DeReKo', 'Structure']); |
| 162 | |
| 163 | # Glemm |
| 164 | push(@layers, ['Glemm', 'Morpho']); |
| 165 | |
| 166 | # Malt |
| 167 | push(@layers, ['Malt', 'Dependency']); |
| 168 | |
| 169 | # MDParser |
| 170 | push(@layers, ['MDParser', 'Dependency']); |
| 171 | |
| 172 | # Mate |
| 173 | push(@layers, ['Mate', 'Morpho']); |
| 174 | push(@layers, ['Mate', 'Dependency']); |
| 175 | |
| 176 | # OpenNLP |
| 177 | push(@layers, ['OpenNLP', 'Morpho']); |
| 178 | push(@layers, ['OpenNLP', 'Sentences']); |
| 179 | |
| 180 | # Schreibgebrauch |
| 181 | push(@layers, ['Sgbr', 'Lemma']); |
| 182 | push(@layers, ['Sgbr', 'Morpho']); |
| 183 | |
| 184 | # TreeTagger |
| 185 | push(@layers, ['TreeTagger', 'Morpho']); |
| 186 | push(@layers, ['TreeTagger', 'Sentences']); |
| 187 | |
| 188 | # XIP |
| 189 | push(@layers, ['XIP', 'Morpho']); |
| 190 | push(@layers, ['XIP', 'Constituency']); |
| 191 | push(@layers, ['XIP', 'Sentences']); |
| 192 | push(@layers, ['XIP', 'Dependency']); |
| 193 | |
| 194 | # Check filters |
| 195 | my @filtered_anno; |
| 196 | if ($skip{'#all'}) { |
| 197 | foreach (@anno) { |
| 198 | push @filtered_anno, [ split('#', $_) ]; |
| 199 | }; |
| 200 | } |
| 201 | |
| 202 | # Add all annotations that are not skipped |
| 203 | else { |
| 204 | # Add to index file - respect skipping |
| 205 | foreach my $info (@layers) { |
| 206 | # Skip if Foundry or Foundry#Layer should be skipped |
| 207 | unless ($skip{lc($info->[0])} || $skip{lc($info->[0]) . '#' . lc($info->[1])}) { |
| 208 | push @filtered_anno, $info; |
| 209 | }; |
| 210 | }; |
| 211 | }; |
| 212 | |
| 213 | # Get tokenization basis |
| 214 | my ($token_base_foundry, $token_base_layer) = split(/#/, $token_base) if ($token_base); |
| 215 | |
| 216 | # TODO: This should not be initialized for batch |
| 217 | my $cache = Cache::FastMmap->new( |
| 218 | share_file => $cache_file, |
| 219 | cache_size => $cache_size, |
| 220 | init_file => $cache_init |
| 221 | ); |
| 222 | |
| 223 | my $batch_file = KorAP::XML::Batch::File->new( |
| 224 | cache => $cache, |
| 225 | meta_type => $meta, |
| 226 | overwrite => $overwrite, |
| 227 | foundry => $token_base_foundry, |
| 228 | layer => $token_base_layer, |
| 229 | gzip => $gzip, |
| 230 | log => $log, |
| 231 | primary => $primary, |
| 232 | pretty => $pretty, |
| 233 | anno => \@filtered_anno |
| 234 | ); |
| 235 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 236 | |
| 237 | # Get file name based on path information |
| 238 | sub get_file_name ($) { |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 239 | my $i = $input[0]; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 240 | my $file = shift; |
Akron | 6255760 | 2016-06-27 14:10:13 +0200 | [diff] [blame] | 241 | $file =~ s!^/?tmp/[^/]+!!; |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 242 | $file =~ s/^?\/?$i//; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 243 | $file =~ tr/\//-/; |
| 244 | $file =~ s{^-+}{}; |
| 245 | return $file; |
Nils Diewald | 59094f2 | 2014-11-05 18:20:50 +0000 | [diff] [blame] | 246 | }; |
| 247 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 248 | |
| 249 | # Write file |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 250 | #sub write_file { |
| 251 | # my $anno = shift; |
| 252 | # my $file = get_file_name $anno; |
| 253 | # |
| 254 | # # TODO: This should be done directly with a data structure! KorAP::XML::Wrap |
| 255 | # |
| 256 | # my $call = 'perl ' . $LOCAL . '/korapxml2krill'; |
| 257 | # $call .= ' -i ' . $anno; |
| 258 | # $call .= ' -o ' . $output . '/' . $file . '.json'; |
| 259 | # $call .= '.gz -z' if $gzip; |
| 260 | # $call .= ' -m ' . $meta if $meta; |
| 261 | # $call .= ' -w' if $overwrite; |
| 262 | # $call .= ' -t ' . $token_base if $token_base; |
| 263 | # $call .= ' -l ' . $log_level if $log_level; |
| 264 | # $call .= ' -c ' . $cache_file; |
| 265 | # $call .= ' -cs ' . $cache_size; |
| 266 | # $call .= ' --no-cache-delete'; # Don't delete the cache |
| 267 | # $call .= ' --no-cache-init'; # Don't initialize the cache |
| 268 | # $call .= ' --no-primary ' if $primary; |
| 269 | # $call .= ' -y ' . $pretty if $pretty; |
| 270 | # $call .= ' -a ' . $_ foreach @anno; |
| 271 | # $call .= ' -s ' . $_ foreach @skip; |
| 272 | # system($call); |
| 273 | # return "$file"; |
| 274 | #}; |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 275 | |
Nils Diewald | 2db9ad0 | 2013-10-29 19:26:43 +0000 | [diff] [blame] | 276 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 277 | # Convert sigle to path construct |
| 278 | s!^\s*([^_]+?)_([^\.]+?)\.(.+?)\s*$!$1/$2/$3! foreach @sigle; |
| 279 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 280 | # Process a single file |
| 281 | unless ($cmd) { |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 282 | my $input = $input[0]; |
Nils Diewald | 59094f2 | 2014-11-05 18:20:50 +0000 | [diff] [blame] | 283 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 284 | BEGIN { |
| 285 | $main::TIME = Benchmark->new; |
| 286 | $main::LAST_STOP = Benchmark->new; |
| 287 | }; |
| 288 | |
| 289 | sub stop_time { |
| 290 | my $new = Benchmark->new; |
| 291 | $log->trace( |
| 292 | 'The code took: '. |
| 293 | timestr(timediff($new, $main::LAST_STOP)) . |
| 294 | ' (overall: ' . timestr(timediff($new, $main::TIME)) . ')' |
| 295 | ); |
| 296 | $main::LAST_STOP = $new; |
| 297 | }; |
| 298 | |
| 299 | # Create and parse new document |
| 300 | $input =~ s{([^/])$}{$1/}; |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 301 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 302 | $batch_file->process($input, $output); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 303 | |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 304 | # Delete cache file |
| 305 | unlink($cache_file) if $cache_delete; |
| 306 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 307 | # stop_time; |
Nils Diewald | 7364d1f | 2013-11-05 19:26:35 +0000 | [diff] [blame] | 308 | } |
Nils Diewald | 59094f2 | 2014-11-05 18:20:50 +0000 | [diff] [blame] | 309 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 310 | # Extract XML files |
| 311 | elsif ($cmd eq 'extract') { |
| 312 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 313 | warn '!!!!!!!!!!!!!------------> '; |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 314 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 315 | if ($output && (!-e $output || !-d $output)) { |
| 316 | print "Directory '$output' does not exist.\n\n"; |
| 317 | exit(0); |
| 318 | }; |
| 319 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 320 | |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 321 | # TODO: Support sigles and full archives |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 322 | |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 323 | if (-f($input[0]) && (my $archive = KorAP::XML::Archive->new($input[0]))) { |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 324 | |
| 325 | unless ($archive->test_unzip) { |
| 326 | print "Unzip is not installed or incompatible.\n\n"; |
| 327 | exit(1); |
| 328 | }; |
| 329 | |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 330 | # Add further annotation archived |
| 331 | $archive->attach($_) foreach @input; |
| 332 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 333 | # Iterate over all given sigles and extract |
| 334 | foreach (@sigle) { |
| 335 | print "$_ "; |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 336 | print '' . ($archive->extract('./' . $_, $output) ? '' : 'not '); |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 337 | print "extracted.\n"; |
| 338 | }; |
| 339 | |
| 340 | print "\n"; |
| 341 | exit(1); |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 342 | } |
| 343 | else { |
| 344 | $log->error('Unable to extract from primary archive ' . $input[0]); |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 345 | }; |
| 346 | } |
| 347 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 348 | # Process an archive |
| 349 | elsif ($cmd eq 'archive') { |
Nils Diewald | 2db9ad0 | 2013-10-29 19:26:43 +0000 | [diff] [blame] | 350 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 351 | warn '!!!!!!!!!!!!!------------> '; |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 352 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 353 | if ($output && (!-e $output || !-d $output)) { |
| 354 | print "Directory '$output' does not exist.\n\n"; |
| 355 | exit(0); |
| 356 | }; |
| 357 | |
| 358 | |
| 359 | # TODO: Support sigles |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 360 | |
| 361 | if ($output && (!-e $output || !-d $output)) { |
| 362 | print "Directory '$output' does not exist.\n\n"; |
| 363 | exit(0); |
| 364 | }; |
| 365 | |
| 366 | # Zero means: everything runs in the parent process |
| 367 | my $pool = Parallel::ForkManager->new($jobs); |
| 368 | |
| 369 | my $count = 0; # Texts to process |
| 370 | my $iter = 1; # Current text in process |
| 371 | |
| 372 | # Report on fork message |
| 373 | $pool->run_on_finish ( |
| 374 | sub { |
| 375 | my ($pid, $code) = shift; |
| 376 | my $data = pop; |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 377 | print 'Convert ['. ($jobs > 0 ? "\$$pid:" : '') . |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 378 | ($iter++) . "/$count]" . |
| 379 | ($code ? " $code" : '') . |
| 380 | " $$data\n"; |
| 381 | } |
| 382 | ); |
| 383 | |
| 384 | my $t; |
| 385 | print "Reading data ...\n"; |
| 386 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 387 | # unless (Cache::FastMmap->new( |
| 388 | # share_file => $cache_file, |
| 389 | # cache_size => $cache_size, |
| 390 | # init_file => $cache_init |
| 391 | # )) { |
| 392 | # print "Unable to intialize cache '$cache_file'\n\n"; |
| 393 | # exit(1); |
| 394 | # }; |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 395 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 396 | # Input is a directory |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 397 | if (-d $input[0]) { |
| 398 | my $it = Directory::Iterator->new($input[0]); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 399 | my @dirs; |
| 400 | my $dir; |
| 401 | |
| 402 | while (1) { |
| 403 | if (!$it->is_directory && ($dir = $it->get) && $dir =~ s{/data\.xml$}{}) { |
| 404 | push @dirs, $dir; |
| 405 | $it->prune; |
| 406 | }; |
| 407 | last unless $it->next; |
| 408 | }; |
| 409 | |
| 410 | print "Start processing ...\n"; |
| 411 | $t = Benchmark->new; |
| 412 | $count = scalar @dirs; |
| 413 | |
| 414 | DIRECTORY_LOOP: |
| 415 | for (my $i = 0; $i < $count; $i++) { |
| 416 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 417 | my $filename = catfile( |
| 418 | $output, |
| 419 | get_file_name($dirs[$i]) . '.json' . ($gzip ? '.gz' : '') |
| 420 | ); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 421 | |
| 422 | # Get the next fork |
| 423 | my $pid = $pool->start and next DIRECTORY_LOOP; |
| 424 | my $msg; |
| 425 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 426 | $msg = $batch_file->process($dirs[$i] => $filename); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 427 | $pool->finish(0, \$msg); |
| 428 | }; |
| 429 | } |
| 430 | |
| 431 | # Input is a file |
Akron | 29866ac | 2016-06-24 16:40:47 +0200 | [diff] [blame] | 432 | elsif (-f($input[0]) && (my $archive = KorAP::XML::Archive->new($input[0]))) { |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 433 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 434 | unless ($archive->test_unzip) { |
| 435 | print "Unzip is not installed or incompatible.\n\n"; |
| 436 | exit(1); |
| 437 | }; |
| 438 | |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 439 | # Add further annotation archived |
Akron | 29866ac | 2016-06-24 16:40:47 +0200 | [diff] [blame] | 440 | $archive->attach($_) foreach @input; |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 441 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 442 | print "Start processing ...\n"; |
| 443 | $t = Benchmark->new; |
| 444 | my @dirs = $archive->list_texts; |
| 445 | $count = scalar @dirs; |
| 446 | |
| 447 | ARCHIVE_LOOP: |
| 448 | for (my $i = 0; $i < $count; $i++) { |
| 449 | |
| 450 | # Split path information |
| 451 | my ($prefix, $corpus, $doc, $text) = $archive->split_path($dirs[$i]); |
| 452 | |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 453 | my $filename = catfile( |
| 454 | $output, |
| 455 | get_file_name( |
| 456 | catfile($corpus, $doc, $text) |
| 457 | . '.json' . ($gzip ? '.gz' : '') |
| 458 | ) |
| 459 | ); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 460 | |
| 461 | # Get the next fork |
| 462 | my $pid = $pool->start and next ARCHIVE_LOOP; |
| 463 | |
| 464 | # Create temporary file |
| 465 | my $temp = File::Temp->newdir; |
| 466 | |
| 467 | my $msg; |
| 468 | |
| 469 | # Extract from archive |
| 470 | if ($archive->extract($dirs[$i], $temp)) { |
| 471 | |
| 472 | # Create corpus directory |
Akron | 08385f6 | 2016-03-22 20:37:04 +0100 | [diff] [blame] | 473 | my $input = catdir("$temp", $corpus); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 474 | |
| 475 | # Temporary directory |
| 476 | my $dir = catdir($input, $doc, $text); |
| 477 | |
| 478 | # Write file |
Akron | e1dbc38 | 2016-07-08 22:24:52 +0200 | [diff] [blame] | 479 | $msg = $batch_file->process($dir => $output); |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 480 | |
| 481 | $temp = undef; |
| 482 | $pool->finish(0, \$msg); |
| 483 | } |
| 484 | else { |
| 485 | |
| 486 | $temp = undef; |
| 487 | $msg = "Unable to extract " . $dirs[$i] . "\n"; |
| 488 | $pool->finish(1, \$msg); |
| 489 | }; |
| 490 | }; |
| 491 | } |
| 492 | |
| 493 | else { |
| 494 | print "Input is neither a directory nor an archive.\n\n"; |
| 495 | }; |
| 496 | |
| 497 | $pool->wait_all_children; |
| 498 | |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 499 | # Delete cache file |
| 500 | unlink($cache_file) if $cache_delete; |
| 501 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 502 | print "Done.\n"; |
| 503 | print timestr(timediff(Benchmark->new, $t))."\n\n"; |
| 504 | } |
| 505 | |
| 506 | # Unknown command |
| 507 | else { |
| 508 | warn "Unknown command '$cmd'.\n\n"; |
| 509 | pod2usage(%ERROR_HASH); |
| 510 | } |
Nils Diewald | 2db9ad0 | 2013-10-29 19:26:43 +0000 | [diff] [blame] | 511 | |
| 512 | __END__ |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 513 | |
| 514 | =pod |
| 515 | |
| 516 | =encoding utf8 |
| 517 | |
| 518 | =head1 NAME |
| 519 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 520 | korapxml2krill - Merge KorapXML data and create Krill documents |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 521 | |
| 522 | |
| 523 | =head1 SYNOPSIS |
| 524 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 525 | $ korapxml2krill -z --input <directory> --output <filename> |
| 526 | $ korapxml2krill archive -z --input <directory> --output <directory> |
| 527 | $ korapxml2krill extract --input <directory> --output <filename> --sigle <SIGLE> |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 528 | |
| 529 | |
| 530 | =head1 DESCRIPTION |
| 531 | |
| 532 | L<KorAP::XML::Krill> is a library to convert KorAP-XML documents to files |
| 533 | compatible with the L<Krill|https://github.com/KorAP/Krill> indexer. |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 534 | The C<korapxml2krill> command line tool is a simple wrapper to the library. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 535 | |
| 536 | |
| 537 | =head1 INSTALLATION |
| 538 | |
| 539 | The preferred way to install L<KorAP::XML::Krill> is to use L<cpanm|App::cpanminus>. |
| 540 | |
| 541 | $ cpanm https://github.com/KorAP/KorAP-XML-Krill |
| 542 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 543 | In case everything went well, the C<korapxml2krill> tool will |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 544 | be available on your command line immediately. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 545 | |
| 546 | |
| 547 | =head1 ARGUMENTS |
| 548 | |
| 549 | =over 2 |
| 550 | |
| 551 | =item B<archive> |
| 552 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 553 | Process an archive as a Zip-file or a folder of KorAP-XML documents. |
| 554 | |
| 555 | =item B<extract> |
| 556 | |
| 557 | Extract KorAP-XML files from a Zip-file. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 558 | |
| 559 | =back |
| 560 | |
| 561 | |
| 562 | =head1 OPTIONS |
| 563 | |
| 564 | =over 2 |
| 565 | |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 566 | =item B<--input|-i> <directory|file|files> |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 567 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 568 | Directory or archive file of documents to convert. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 569 | |
Akron | 0c3e375 | 2016-06-28 15:55:53 +0200 | [diff] [blame] | 570 | Archiving supports multiple input archives with the constraint, |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 571 | that the first archive listed contains all primary data files |
| 572 | and all meta data files. |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 573 | |
| 574 | -i file/news.zip -i file/news.malt.zip -i #file/news.tt.zip |
| 575 | |
Akron | 0c3e375 | 2016-06-28 15:55:53 +0200 | [diff] [blame] | 576 | (The directory structure follows the base directory format, |
| 577 | that may include a C<.> root folder. |
| 578 | In this case further archives lacking a C<.> root folder |
| 579 | need to be passed with a hash sign in front of the archive's name.) |
Akron | 2cfe809 | 2016-06-24 17:48:49 +0200 | [diff] [blame] | 580 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 581 | =item B<--output|-o> <directory|file> |
| 582 | |
| 583 | Output folder for archive processing or |
| 584 | document name for single output (optional), |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 585 | writes to C<STDOUT> by default |
| 586 | (in case C<output> is not mandatory due to further options). |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 587 | |
| 588 | =item B<--overwrite|-w> |
| 589 | |
| 590 | Overwrite files that already exist. |
| 591 | |
| 592 | =item B<--token|-t> <foundry>[#<file>] |
| 593 | |
| 594 | Define the default tokenization by specifying |
| 595 | the name of the foundry and optionally the name |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 596 | of the layer-file. Defaults to C<OpenNLP#tokens>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 597 | |
| 598 | =item B<--skip|-s> <foundry>[#<layer>] |
| 599 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 600 | Skip specific annotations by specifying the foundry |
| 601 | (and optionally the layer with a C<#>-prefix), |
| 602 | 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] | 603 | Can be set multiple times. |
| 604 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 605 | =item B<--anno|-a> <foundry>#<layer> |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 606 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 607 | Convert specific annotations by specifying the foundry |
| 608 | (and optionally the layer with a C<#>-prefix), |
| 609 | e.g. C<Mate> or C<Mate#Morpho>. |
| 610 | Can be set multiple times. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 611 | |
| 612 | =item B<--primary|-p> |
| 613 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 614 | Output primary data or not. Defaults to C<true>. |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 615 | Can be flagged using C<--no-primary> as well. |
| 616 | This is I<deprecated>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 617 | |
| 618 | =item B<--jobs|-j> |
| 619 | |
| 620 | Define the number of concurrent jobs in seperated forks |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 621 | for archive processing. |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 622 | Defaults to C<0> (everything runs in a single process). |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 623 | This is I<experimental>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 624 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 625 | =item B<--meta|-m> |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 626 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 627 | Define the metadata parser to use. Defaults to C<I5>. |
| 628 | Metadata parsers can be defined in the C<KorAP::XML::Meta> namespace. |
| 629 | This is I<experimental>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 630 | |
| 631 | =item B<--pretty|-y> |
| 632 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 633 | Pretty print JSON output. Defaults to C<false>. |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 634 | This is I<deprecated>. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 635 | |
| 636 | =item B<--gzip|-z> |
| 637 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 638 | Compress the output. |
| 639 | Expects a defined C<output> file in single processing. |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 640 | |
Akron | 11c8030 | 2016-03-18 19:44:43 +0100 | [diff] [blame] | 641 | =item B<--cache|-c> |
| 642 | |
| 643 | File to mmap a cache (using L<Cache::FastMmap>). |
| 644 | Defaults to C<korapxml2krill.cache> in the calling directory. |
| 645 | |
| 646 | =item B<--cache-size|-cs> |
| 647 | |
| 648 | Size of the cache. Defaults to C<50m>. |
| 649 | |
| 650 | =item B<--cache-init|-ci> |
| 651 | |
| 652 | Initialize cache file. |
| 653 | Can be flagged using C<--no-cache-init> as well. |
| 654 | Defaults to C<true>. |
| 655 | |
| 656 | =item B<--cache-delete|-cd> |
| 657 | |
| 658 | Delete cache file after processing. |
| 659 | Can be flagged using C<--no-cache-delete> as well. |
| 660 | Defaults to C<true>. |
| 661 | |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 662 | =item B<--sigle|-sg> |
| 663 | |
| 664 | Extract the given text sigles. |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 665 | Can be set multiple times. |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 666 | I<Currently only supported on C<extract>.> |
Akron | b0c88db | 2016-06-29 16:33:18 +0200 | [diff] [blame] | 667 | Sigles have the structure C<Corpus>/C<Document>/C<Text>. |
Akron | e10ad32 | 2016-02-27 10:54:26 +0100 | [diff] [blame] | 668 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 669 | =item B<--log|-l> |
| 670 | |
| 671 | The L<Log4perl> log level, defaults to C<ERROR>. |
| 672 | |
| 673 | =item B<--help|-h> |
| 674 | |
| 675 | Print this document. |
| 676 | |
| 677 | =item B<--version|-v> |
| 678 | |
| 679 | Print version information. |
| 680 | |
| 681 | =back |
| 682 | |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 683 | =head1 ANNOTATION SUPPORT |
| 684 | |
| 685 | L<KorAP::XML::Krill> has built-in importer for some annotation foundries and layers |
| 686 | developed in the KorAP project that are part of the KorAP preprocessing pipeline. |
| 687 | The base foundry with paragraphs, sentences, and the text element are mandatory for |
| 688 | L<Krill|https://github.com/KorAP/Krill>. |
| 689 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 690 | =over 2 |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 691 | |
| 692 | =item B<Base> |
| 693 | |
| 694 | =over 4 |
| 695 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 696 | =item #Paragraphs |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 697 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 698 | =item #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 699 | |
| 700 | =back |
| 701 | |
| 702 | =item B<Connexor> |
| 703 | |
| 704 | =over 4 |
| 705 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 706 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 707 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 708 | =item #Phrase |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 709 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 710 | =item #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 711 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 712 | =item #Syntax |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 713 | |
| 714 | =back |
| 715 | |
| 716 | =item B<CoreNLP> |
| 717 | |
| 718 | =over 4 |
| 719 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 720 | =item #Constituency |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 721 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 722 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 723 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 724 | =item #NamedEntities |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 725 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 726 | =item #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 727 | |
| 728 | =back |
| 729 | |
| 730 | =item B<DeReKo> |
| 731 | |
| 732 | =over 4 |
| 733 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 734 | =item #Structure |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 735 | |
| 736 | =back |
| 737 | |
| 738 | =item B<Glemm> |
| 739 | |
| 740 | =over 4 |
| 741 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 742 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 743 | |
| 744 | =back |
| 745 | |
| 746 | =item B<Mate> |
| 747 | |
| 748 | =over 4 |
| 749 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 750 | =item #Dependency |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 751 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 752 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 753 | |
| 754 | =back |
| 755 | |
| 756 | =item B<OpenNLP> |
| 757 | |
| 758 | =over 4 |
| 759 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 760 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 761 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 762 | =item #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 763 | |
| 764 | =back |
| 765 | |
| 766 | =item B<Sgbr> |
| 767 | |
| 768 | =over 4 |
| 769 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 770 | =item #Lemma |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 771 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 772 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 773 | |
| 774 | =back |
| 775 | |
| 776 | =item B<TreeTagger> |
| 777 | |
| 778 | =over 4 |
| 779 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 780 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 781 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 782 | =item #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 783 | |
| 784 | =back |
| 785 | |
| 786 | =item B<XIP> |
| 787 | |
| 788 | =over 4 |
| 789 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 790 | =item #Constituency |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 791 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 792 | =item #Morpho |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 793 | |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 794 | =item #Sentences |
Akron | c13a170 | 2016-03-15 19:33:14 +0100 | [diff] [blame] | 795 | |
| 796 | =back |
| 797 | |
| 798 | =back |
| 799 | |
| 800 | More importers are in preparation. |
| 801 | New annotation importers can be defined in the C<KorAP::XML::Annotation> namespace. |
| 802 | See the built-in annotation importers as examples. |
| 803 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 804 | =head1 AVAILABILITY |
| 805 | |
| 806 | https://github.com/KorAP/KorAP-XML-Krill |
| 807 | |
| 808 | |
| 809 | =head1 COPYRIGHT AND LICENSE |
| 810 | |
| 811 | Copyright (C) 2015-2016, L<IDS Mannheim|http://www.ids-mannheim.de/> |
Akron | f7ad89e | 2016-03-16 18:22:47 +0100 | [diff] [blame] | 812 | |
Akron | 941c1a6 | 2016-02-23 17:41:41 +0100 | [diff] [blame] | 813 | Author: L<Nils Diewald|http://nils-diewald.de/> |
| 814 | |
| 815 | L<KorAP::XML::Krill> is developed as part of the L<KorAP|http://korap.ids-mannheim.de/> |
| 816 | Corpus Analysis Platform at the |
| 817 | L<Institute for the German Language (IDS)|http://ids-mannheim.de/>, |
| 818 | member of the |
| 819 | L<Leibniz-Gemeinschaft|http://www.leibniz-gemeinschaft.de/en/about-us/leibniz-competition/projekte-2011/2011-funding-line-2/>. |
| 820 | |
| 821 | This program is free software published under the |
| 822 | L<BSD-2 License|https://raw.githubusercontent.com/KorAP/KorAP-XML-Krill/master/LICENSE>. |
| 823 | |
| 824 | =cut |