blob: 32af215eff276df239a6873cdbbd84c565ea858c [file] [log] [blame]
Akronc13a1702016-03-15 19:33:14 +01001=pod
2
3=encoding utf8
4
5=head1 NAME
6
Akron5c71a852016-10-31 16:00:33 +01007korapxml2krill - Merge KorapXML data and create Krill documents
Akronc13a1702016-03-15 19:33:14 +01008
9
10=head1 SYNOPSIS
11
Akron5c71a852016-10-31 16:00:33 +010012 korapxml2krill [archive|extract] --input <directory|archive> [options]
Akron2fd402b2016-10-27 21:26:48 +020013
Akronc13a1702016-03-15 19:33:14 +010014
15=head1 DESCRIPTION
16
Akron5c71a852016-10-31 16:00:33 +010017L<KorAP::XML::Krill> is a library to convert KorAP-XML documents to files
18compatible with the L<Krill|https://github.com/KorAP/Krill> indexer.
19The C<korapxml2krill> command line tool is a simple wrapper to the library.
Akronc13a1702016-03-15 19:33:14 +010020
21
Akron5c71a852016-10-31 16:00:33 +010022=head1 INSTALLATION
Akronc13a1702016-03-15 19:33:14 +010023
Akron5c71a852016-10-31 16:00:33 +010024The preferred way to install L<KorAP::XML::Krill> is to use L<cpanm|App::cpanminus>.
Akronc13a1702016-03-15 19:33:14 +010025
Akron5c71a852016-10-31 16:00:33 +010026 $ cpanm https://github.com/KorAP/KorAP-XML-Krill.git
Akronc13a1702016-03-15 19:33:14 +010027
Akron5c71a852016-10-31 16:00:33 +010028In case everything went well, the C<korapxml2krill> tool will
29be available on your command line immediately.
30Minimum requirement for L<KorAP::XML::Krill> is Perl 5.14.
31In addition to work with zip archives, the C<unzip> tool needs to be present.
Akronc13a1702016-03-15 19:33:14 +010032
Akron5c71a852016-10-31 16:00:33 +010033=head1 ARGUMENTS
Akronc13a1702016-03-15 19:33:14 +010034
Akron5c71a852016-10-31 16:00:33 +010035 $ korapxml2krill -z --input <directory> --output <filename>
36
37Without arguments, C<korapxml2krill> converts a directory of a single KorAP-XML document.
38It expects the input to point to the text level folder.
39
40=over 2
41
42=item B<archive>
43
Akronf73ffb62018-06-27 12:13:59 +020044 $ korapxml2krill archive -z --input <directory|archive> --output <directory|tar>
Akron5c71a852016-10-31 16:00:33 +010045
46Converts an archive of KorAP-XML documents. It expects a directory
47(pointing to the corpus level folder) or one or more zip files as input.
48
49=item B<extract>
50
51 $ korapxml2krill extract --input <archive> --output <directory> --sigle <SIGLE>
52
53Extracts KorAP-XML documents from a zip file.
54
Akron442c4e92017-04-10 23:41:31 +020055=item B<serial>
56
57 $ korapxml2krill serial -i <archive1> -i <archive2> -o <directory> -cfg <config-file>
58
59Convert archives sequentially. The inputs are not merged but treated
60as they are (so they may be premerged or globs).
61the C<--out> directory is treated as the base directory where subdirectories
Akronf73ffb62018-06-27 12:13:59 +020062are created based on the archive name. In case the C<--to-tar> flag is given,
63the output will be a tar file.
Akron442c4e92017-04-10 23:41:31 +020064
65
Akron5c71a852016-10-31 16:00:33 +010066=back
Akrona76d8352016-10-27 16:27:32 +020067
Akron7606afa2016-10-25 16:23:49 +020068
Akron5c71a852016-10-31 16:00:33 +010069=head1 OPTIONS
Akronc13a1702016-03-15 19:33:14 +010070
Akron5c71a852016-10-31 16:00:33 +010071=over 2
Akronc13a1702016-03-15 19:33:14 +010072
Akron5c71a852016-10-31 16:00:33 +010073=item B<--input|-i> <directory|zip file>
Akrona76d8352016-10-27 16:27:32 +020074
Akron5c71a852016-10-31 16:00:33 +010075Directory or zip file(s) of documents to convert.
Akronc13a1702016-03-15 19:33:14 +010076
Akron5c71a852016-10-31 16:00:33 +010077Without arguments, C<korapxml2krill> expects a folder of a single KorAP-XML
Akronf1a1de92016-11-02 17:32:12 +010078document, while C<archive> expects a KorAP-XML corpus folder or a zip
79file to batch process multiple files.
80C<extract> expects zip files only.
Akronc13a1702016-03-15 19:33:14 +010081
Akron5c71a852016-10-31 16:00:33 +010082C<archive> supports multiple input zip files with the constraint,
83that the first archive listed contains all primary data files
84and all meta data files.
Akrona76d8352016-10-27 16:27:32 +020085
Akron5c71a852016-10-31 16:00:33 +010086 -i file/news.zip -i file/news.malt.zip -i "#file/news.tt.zip"
Akronc13a1702016-03-15 19:33:14 +010087
Akron821db3d2017-04-06 21:19:31 +020088Input may also be defined using BSD glob wildcards.
89
90 -i 'file/news*.zip'
91
92The extended input array will be sorted in length order, so the shortest
93path needs to contain all primary data files and all meta data files.
94
Akron5c71a852016-10-31 16:00:33 +010095(The directory structure follows the base directory format,
96that may include a C<.> root folder.
97In this case further archives lacking a C<.> root folder
98need to be passed with a hash sign in front of the archive's name.
99This may require to quote the parameter.)
Akronc13a1702016-03-15 19:33:14 +0100100
Akron5c71a852016-10-31 16:00:33 +0100101To support zip files, a version of C<unzip> needs to be installed that is
102compatible with the archive file.
Akronc13a1702016-03-15 19:33:14 +0100103
Akron5c71a852016-10-31 16:00:33 +0100104B<The root folder switch using the hash sign is experimental and
105may vanish in future versions.>
Akronc13a1702016-03-15 19:33:14 +0100106
Akronf73ffb62018-06-27 12:13:59 +0200107
Akron442c4e92017-04-10 23:41:31 +0200108=item B<--input-base|-ib> <directory>
109
110The base directory for inputs.
111
112
Akron5c71a852016-10-31 16:00:33 +0100113=item B<--output|-o> <directory|file>
Akronc13a1702016-03-15 19:33:14 +0100114
Akron5c71a852016-10-31 16:00:33 +0100115Output folder for archive processing or
116document name for single output (optional),
117writes to C<STDOUT> by default
118(in case C<output> is not mandatory due to further options).
Akronc13a1702016-03-15 19:33:14 +0100119
Akron5c71a852016-10-31 16:00:33 +0100120=item B<--overwrite|-w>
Akronc13a1702016-03-15 19:33:14 +0100121
Akron5c71a852016-10-31 16:00:33 +0100122Overwrite files that already exist.
Akron7606afa2016-10-25 16:23:49 +0200123
Akronf73ffb62018-06-27 12:13:59 +0200124
Akron3741f8b2016-12-21 19:55:21 +0100125=item B<--token|-t> <foundry>#<file>
Akrona5920b12016-06-29 18:51:21 +0200126
Akron5c71a852016-10-31 16:00:33 +0100127Define the default tokenization by specifying
128the name of the foundry and optionally the name
129of the layer-file. Defaults to C<OpenNLP#tokens>.
Akronc13a1702016-03-15 19:33:14 +0100130
Akron3741f8b2016-12-21 19:55:21 +0100131
132=item B<--base-sentences|-bs> <foundry>#<layer>
133
134Define the layer for base sentences.
135If given, this will be used instead of using C<Base#Sentences>.
136Currently C<DeReKo#Structure> is the only additional layer supported.
137
138 Defaults to unset.
139
140
141=item B<--base-paragraphs|-bp> <foundry>#<layer>
142
143Define the layer for base paragraphs.
144If given, this will be used instead of using C<Base#Paragraphs>.
145Currently C<DeReKo#Structure> is the only additional layer supported.
146
147 Defaults to unset.
148
149
Akron821db3d2017-04-06 21:19:31 +0200150=item B<--base-pagebreaks|-bpb> <foundry>#<layer>
151
152Define the layer for base pagebreaks.
153Currently C<DeReKo#Structure> is the only layer supported.
154
155 Defaults to unset.
156
157
Akron5c71a852016-10-31 16:00:33 +0100158=item B<--skip|-s> <foundry>[#<layer>]
159
160Skip specific annotations by specifying the foundry
161(and optionally the layer with a C<#>-prefix),
162e.g. C<Mate> or C<Mate#Morpho>. Alternatively you can skip C<#ALL>.
163Can be set multiple times.
164
Akronf73ffb62018-06-27 12:13:59 +0200165
Akron5c71a852016-10-31 16:00:33 +0100166=item B<--anno|-a> <foundry>#<layer>
167
168Convert specific annotations by specifying the foundry
169(and optionally the layer with a C<#>-prefix),
170e.g. C<Mate> or C<Mate#Morpho>.
171Can be set multiple times.
172
Akronf73ffb62018-06-27 12:13:59 +0200173
Akron5c71a852016-10-31 16:00:33 +0100174=item B<--primary|-p>
175
176Output primary data or not. Defaults to C<true>.
177Can be flagged using C<--no-primary> as well.
178This is I<deprecated>.
179
Akronf73ffb62018-06-27 12:13:59 +0200180
Akron5c71a852016-10-31 16:00:33 +0100181=item B<--jobs|-j>
182
183Define the number of concurrent jobs in seperated forks
184for archive processing.
185Defaults to C<0> (everything runs in a single process).
Akronf73ffb62018-06-27 12:13:59 +0200186
187If C<sequential-extraction> is not set to false, this will
188also apply to extraction.
189
Akron821db3d2017-04-06 21:19:31 +0200190Pass -1, and the value will be set automatically to 5
191times the number of available cores.
Akron5c71a852016-10-31 16:00:33 +0100192This is I<experimental>.
193
Akronf73ffb62018-06-27 12:13:59 +0200194
195=item B<--sequential-extraction|-se>
196
197Flag to indicate, if the C<jobs> value also applies to extraction.
198Some systems may have problems with extracting multiple archives
199to the same folder at the same time.
200Can be flagged using C<--no-sequential-extraction> as well.
201Defaults to C<false>.
202
203
Akron5c71a852016-10-31 16:00:33 +0100204=item B<--meta|-m>
205
206Define the metadata parser to use. Defaults to C<I5>.
207Metadata parsers can be defined in the C<KorAP::XML::Meta> namespace.
208This is I<experimental>.
209
Akronf73ffb62018-06-27 12:13:59 +0200210
Akron5c71a852016-10-31 16:00:33 +0100211=item B<--pretty|-y>
212
213Pretty print JSON output. Defaults to C<false>.
214This is I<deprecated>.
215
Akronf73ffb62018-06-27 12:13:59 +0200216
Akron5c71a852016-10-31 16:00:33 +0100217=item B<--gzip|-z>
218
219Compress the output.
220Expects a defined C<output> file in single processing.
221
Akronf73ffb62018-06-27 12:13:59 +0200222
Akron5c71a852016-10-31 16:00:33 +0100223=item B<--cache|-c>
224
225File to mmap a cache (using L<Cache::FastMmap>).
226Defaults to C<korapxml2krill.cache> in the calling directory.
227
Akronf73ffb62018-06-27 12:13:59 +0200228
Akron5c71a852016-10-31 16:00:33 +0100229=item B<--cache-size|-cs>
230
231Size of the cache. Defaults to C<50m>.
232
Akronf73ffb62018-06-27 12:13:59 +0200233
Akron5c71a852016-10-31 16:00:33 +0100234=item B<--cache-init|-ci>
235
236Initialize cache file.
237Can be flagged using C<--no-cache-init> as well.
238Defaults to C<true>.
239
Akronf73ffb62018-06-27 12:13:59 +0200240
Akron5c71a852016-10-31 16:00:33 +0100241=item B<--cache-delete|-cd>
242
243Delete cache file after processing.
244Can be flagged using C<--no-cache-delete> as well.
245Defaults to C<true>.
246
Akronf73ffb62018-06-27 12:13:59 +0200247
Akron636aa112017-04-07 18:48:56 +0200248=item B<--config|-cfg>
249
250Configure the parameters of your call in a file
251of key-value pairs with whitespace separator
252
253 overwrite 1
254 token DeReKo#Structure
255 ...
256
257Supported parameters are:
Akron442c4e92017-04-10 23:41:31 +0200258C<overwrite>, C<gzip>, C<jobs>, C<input-base>,
Akron636aa112017-04-07 18:48:56 +0200259C<token>, C<log>, C<cache>, C<cache-size>, C<cache-delete>, C<meta>,
Akronf73ffb62018-06-27 12:13:59 +0200260C<output>,
261C<temp-extract>, C<sequential-extraction>,
262C<base-sentences>, C<base-paragraphs>,
263C<base-pagebreaks>,
264C<skip> (semicolon separated), C<sigle>
Akron636aa112017-04-07 18:48:56 +0200265(semicolon separated), C<anno> (semicolon separated).
266
Akronf73ffb62018-06-27 12:13:59 +0200267Configuration parameters will always be overwritten by
268passed parameters.
269
270
Akron81500102017-04-07 20:45:44 +0200271=item B<--temporary-extract|-te>
272
273Only valid for the C<archive> command.
274
275This will first extract all files into a
276directory and then will archive.
277If the directory is given as C<:temp:>,
278a temporary directory is used.
279This is especially useful to avoid
280massive unzipping and potential
281network latency.
Akron636aa112017-04-07 18:48:56 +0200282
Akronf73ffb62018-06-27 12:13:59 +0200283
Akron5c71a852016-10-31 16:00:33 +0100284=item B<--sigle|-sg>
285
286Extract the given texts.
287Can be set multiple times.
288I<Currently only supported on C<extract>.>
289Sigles have the structure C<Corpus>/C<Document>/C<Text>.
290In case the C<Text> path is omitted, the whole document will be extracted.
291On the document level, the postfix wildcard C<*> is supported.
292
Akronf73ffb62018-06-27 12:13:59 +0200293
Akron5c71a852016-10-31 16:00:33 +0100294=item B<--log|-l>
295
296The L<Log4perl> log level, defaults to C<ERROR>.
297
Akronf73ffb62018-06-27 12:13:59 +0200298
Akron5c71a852016-10-31 16:00:33 +0100299=item B<--help|-h>
300
301Print this document.
302
Akronf73ffb62018-06-27 12:13:59 +0200303
Akron5c71a852016-10-31 16:00:33 +0100304=item B<--version|-v>
305
306Print version information.
307
308=back
309
Akronf73ffb62018-06-27 12:13:59 +0200310
Akron5c71a852016-10-31 16:00:33 +0100311=head1 ANNOTATION SUPPORT
312
313L<KorAP::XML::Krill> has built-in importer for some annotation foundries and layers
314developed in the KorAP project that are part of the KorAP preprocessing pipeline.
315The base foundry with paragraphs, sentences, and the text element are mandatory for
316L<Krill|https://github.com/KorAP/Krill>.
317
Akron821db3d2017-04-06 21:19:31 +0200318 Base
319 #Paragraphs
320 #Sentences
Akron5c71a852016-10-31 16:00:33 +0100321
Akron821db3d2017-04-06 21:19:31 +0200322 Connexor
323 #Morpho
324 #Phrase
325 #Sentences
326 #Syntax
Akron5c71a852016-10-31 16:00:33 +0100327
Akron821db3d2017-04-06 21:19:31 +0200328 CoreNLP
329 #Constituency
330 #Morpho
331 #NamedEntities
332 #Sentences
Akron5c71a852016-10-31 16:00:33 +0100333
Akronf73ffb62018-06-27 12:13:59 +0200334 CMC
335 #Morpho
336
Akron821db3d2017-04-06 21:19:31 +0200337 DeReKo
338 #Structure
Akron5c71a852016-10-31 16:00:33 +0100339
Akron821db3d2017-04-06 21:19:31 +0200340 DRuKoLa
341 #Morpho
Akron5c71a852016-10-31 16:00:33 +0100342
Akron821db3d2017-04-06 21:19:31 +0200343 Glemm
344 #Morpho
Akron5c71a852016-10-31 16:00:33 +0100345
Akronf73ffb62018-06-27 12:13:59 +0200346 LWC
347 #Dependency
348
Akron821db3d2017-04-06 21:19:31 +0200349 Malt
350 #Dependency
Akron5c71a852016-10-31 16:00:33 +0100351
Akron821db3d2017-04-06 21:19:31 +0200352 MarMoT
353 #Morpho
Akron5c71a852016-10-31 16:00:33 +0100354
Akron821db3d2017-04-06 21:19:31 +0200355 Mate
356 #Dependency
357 #Morpho
Akron5c71a852016-10-31 16:00:33 +0100358
Akron821db3d2017-04-06 21:19:31 +0200359 MDParser
360 #Dependency
Akron5c71a852016-10-31 16:00:33 +0100361
Akron821db3d2017-04-06 21:19:31 +0200362 OpenNLP
363 #Morpho
364 #Sentences
Akron5c71a852016-10-31 16:00:33 +0100365
Akron821db3d2017-04-06 21:19:31 +0200366 Sgbr
367 #Lemma
368 #Morpho
Akron5c71a852016-10-31 16:00:33 +0100369
Akron821db3d2017-04-06 21:19:31 +0200370 TreeTagger
371 #Morpho
372 #Sentences
Akron5c71a852016-10-31 16:00:33 +0100373
Akron821db3d2017-04-06 21:19:31 +0200374 XIP
375 #Constituency
376 #Morpho
377 #Sentences
Akron5c71a852016-10-31 16:00:33 +0100378
Akron5c71a852016-10-31 16:00:33 +0100379
380More importers are in preparation.
381New annotation importers can be defined in the C<KorAP::XML::Annotation> namespace.
382See the built-in annotation importers as examples.
Akronc13a1702016-03-15 19:33:14 +0100383
Akronf73ffb62018-06-27 12:13:59 +0200384
Akronc13a1702016-03-15 19:33:14 +0100385=head1 AVAILABILITY
386
387 https://github.com/KorAP/KorAP-XML-Krill
388
389
390=head1 COPYRIGHT AND LICENSE
391
Akronf73ffb62018-06-27 12:13:59 +0200392Copyright (C) 2015-2018, L<IDS Mannheim|http://www.ids-mannheim.de/>
Akronc13a1702016-03-15 19:33:14 +0100393
Akron5c71a852016-10-31 16:00:33 +0100394Author: L<Nils Diewald|http://nils-diewald.de/>
Akron81500102017-04-07 20:45:44 +0200395
Akron5c71a852016-10-31 16:00:33 +0100396Contributor: Eliza Margaretha
397
398L<KorAP::XML::Krill> is developed as part of the L<KorAP|http://korap.ids-mannheim.de/>
Akronc13a1702016-03-15 19:33:14 +0100399Corpus Analysis Platform at the
400L<Institute for the German Language (IDS)|http://ids-mannheim.de/>,
401member of the
Akron5c71a852016-10-31 16:00:33 +0100402L<Leibniz-Gemeinschaft|http://www.leibniz-gemeinschaft.de/en/about-us/leibniz-competition/projekte-2011/2011-funding-line-2/>.
Akronc13a1702016-03-15 19:33:14 +0100403
Akron5c71a852016-10-31 16:00:33 +0100404This program is free software published under the
Akronc13a1702016-03-15 19:33:14 +0100405L<BSD-2 License|https://raw.githubusercontent.com/KorAP/KorAP-XML-Krill/master/LICENSE>.
406
407=cut