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