blob: 3b3ef8d3a0256c622a284b8f66fbe02ed0ab6ed6 [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.
Akron6eff23b2018-09-24 10:31:20 +020030Minimum requirement for L<KorAP::XML::Krill> is Perl 5.16.
Akron5c71a852016-10-31 16:00:33 +010031In 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
Akroned9baf02019-01-22 17:03:25 +0100181=item B<--non-word-tokens|-nwt>
182
183Tokenize non-word tokens like word tokens (defined as matching
184C</[\d\w]/>). Useful to treat punctuations as tokens.
185
186 Defaults to unset.
187
Akron5c71a852016-10-31 16:00:33 +0100188=item B<--jobs|-j>
189
190Define the number of concurrent jobs in seperated forks
191for archive processing.
192Defaults to C<0> (everything runs in a single process).
Akronf73ffb62018-06-27 12:13:59 +0200193
194If C<sequential-extraction> is not set to false, this will
195also apply to extraction.
196
Akron821db3d2017-04-06 21:19:31 +0200197Pass -1, and the value will be set automatically to 5
198times the number of available cores.
Akron5c71a852016-10-31 16:00:33 +0100199This is I<experimental>.
200
Akronf73ffb62018-06-27 12:13:59 +0200201
202=item B<--sequential-extraction|-se>
203
204Flag to indicate, if the C<jobs> value also applies to extraction.
205Some systems may have problems with extracting multiple archives
206to the same folder at the same time.
207Can be flagged using C<--no-sequential-extraction> as well.
208Defaults to C<false>.
209
210
Akron5c71a852016-10-31 16:00:33 +0100211=item B<--meta|-m>
212
213Define the metadata parser to use. Defaults to C<I5>.
214Metadata parsers can be defined in the C<KorAP::XML::Meta> namespace.
215This is I<experimental>.
216
Akronf73ffb62018-06-27 12:13:59 +0200217
Akron5c71a852016-10-31 16:00:33 +0100218=item B<--pretty|-y>
219
220Pretty print JSON output. Defaults to C<false>.
221This is I<deprecated>.
222
Akronf73ffb62018-06-27 12:13:59 +0200223
Akron5c71a852016-10-31 16:00:33 +0100224=item B<--gzip|-z>
225
226Compress the output.
227Expects a defined C<output> file in single processing.
228
Akronf73ffb62018-06-27 12:13:59 +0200229
Akron5c71a852016-10-31 16:00:33 +0100230=item B<--cache|-c>
231
232File to mmap a cache (using L<Cache::FastMmap>).
233Defaults to C<korapxml2krill.cache> in the calling directory.
234
Akronf73ffb62018-06-27 12:13:59 +0200235
Akron5c71a852016-10-31 16:00:33 +0100236=item B<--cache-size|-cs>
237
238Size of the cache. Defaults to C<50m>.
239
Akronf73ffb62018-06-27 12:13:59 +0200240
Akron5c71a852016-10-31 16:00:33 +0100241=item B<--cache-init|-ci>
242
243Initialize cache file.
244Can be flagged using C<--no-cache-init> as well.
245Defaults to C<true>.
246
Akronf73ffb62018-06-27 12:13:59 +0200247
Akron5c71a852016-10-31 16:00:33 +0100248=item B<--cache-delete|-cd>
249
250Delete cache file after processing.
251Can be flagged using C<--no-cache-delete> as well.
252Defaults to C<true>.
253
Akronf73ffb62018-06-27 12:13:59 +0200254
Akron636aa112017-04-07 18:48:56 +0200255=item B<--config|-cfg>
256
257Configure the parameters of your call in a file
258of key-value pairs with whitespace separator
259
260 overwrite 1
261 token DeReKo#Structure
262 ...
263
264Supported parameters are:
Akron442c4e92017-04-10 23:41:31 +0200265C<overwrite>, C<gzip>, C<jobs>, C<input-base>,
Akron636aa112017-04-07 18:48:56 +0200266C<token>, C<log>, C<cache>, C<cache-size>, C<cache-delete>, C<meta>,
Akronf73ffb62018-06-27 12:13:59 +0200267C<output>,
268C<temp-extract>, C<sequential-extraction>,
269C<base-sentences>, C<base-paragraphs>,
270C<base-pagebreaks>,
271C<skip> (semicolon separated), C<sigle>
Akron636aa112017-04-07 18:48:56 +0200272(semicolon separated), C<anno> (semicolon separated).
273
Akronf73ffb62018-06-27 12:13:59 +0200274Configuration parameters will always be overwritten by
275passed parameters.
276
277
Akron81500102017-04-07 20:45:44 +0200278=item B<--temporary-extract|-te>
279
280Only valid for the C<archive> command.
281
282This will first extract all files into a
283directory and then will archive.
284If the directory is given as C<:temp:>,
285a temporary directory is used.
286This is especially useful to avoid
287massive unzipping and potential
288network latency.
Akron636aa112017-04-07 18:48:56 +0200289
Akronf73ffb62018-06-27 12:13:59 +0200290
Akron5c71a852016-10-31 16:00:33 +0100291=item B<--sigle|-sg>
292
293Extract the given texts.
294Can be set multiple times.
295I<Currently only supported on C<extract>.>
296Sigles have the structure C<Corpus>/C<Document>/C<Text>.
297In case the C<Text> path is omitted, the whole document will be extracted.
298On the document level, the postfix wildcard C<*> is supported.
299
Akronf73ffb62018-06-27 12:13:59 +0200300
Akron5c71a852016-10-31 16:00:33 +0100301=item B<--log|-l>
302
303The L<Log4perl> log level, defaults to C<ERROR>.
304
Akronf73ffb62018-06-27 12:13:59 +0200305
Akron5c71a852016-10-31 16:00:33 +0100306=item B<--help|-h>
307
308Print this document.
309
Akronf73ffb62018-06-27 12:13:59 +0200310
Akron5c71a852016-10-31 16:00:33 +0100311=item B<--version|-v>
312
313Print version information.
314
315=back
316
Akronf73ffb62018-06-27 12:13:59 +0200317
Akron5c71a852016-10-31 16:00:33 +0100318=head1 ANNOTATION SUPPORT
319
320L<KorAP::XML::Krill> has built-in importer for some annotation foundries and layers
321developed in the KorAP project that are part of the KorAP preprocessing pipeline.
322The base foundry with paragraphs, sentences, and the text element are mandatory for
323L<Krill|https://github.com/KorAP/Krill>.
324
Akron821db3d2017-04-06 21:19:31 +0200325 Base
326 #Paragraphs
327 #Sentences
Akron5c71a852016-10-31 16:00:33 +0100328
Akron821db3d2017-04-06 21:19:31 +0200329 Connexor
330 #Morpho
331 #Phrase
332 #Sentences
333 #Syntax
Akron5c71a852016-10-31 16:00:33 +0100334
Akron821db3d2017-04-06 21:19:31 +0200335 CoreNLP
336 #Constituency
337 #Morpho
338 #NamedEntities
339 #Sentences
Akron5c71a852016-10-31 16:00:33 +0100340
Akronf73ffb62018-06-27 12:13:59 +0200341 CMC
342 #Morpho
343
Akron821db3d2017-04-06 21:19:31 +0200344 DeReKo
345 #Structure
Akron5c71a852016-10-31 16:00:33 +0100346
Akron821db3d2017-04-06 21:19:31 +0200347 DRuKoLa
348 #Morpho
Akron5c71a852016-10-31 16:00:33 +0100349
Akron821db3d2017-04-06 21:19:31 +0200350 Glemm
351 #Morpho
Akron5c71a852016-10-31 16:00:33 +0100352
Akroned9baf02019-01-22 17:03:25 +0100353 HNC
354 #Morpho
355
Akronf73ffb62018-06-27 12:13:59 +0200356 LWC
357 #Dependency
358
Akron821db3d2017-04-06 21:19:31 +0200359 Malt
360 #Dependency
Akron5c71a852016-10-31 16:00:33 +0100361
Akron821db3d2017-04-06 21:19:31 +0200362 MarMoT
363 #Morpho
Akron5c71a852016-10-31 16:00:33 +0100364
Akron821db3d2017-04-06 21:19:31 +0200365 Mate
366 #Dependency
367 #Morpho
Akron5c71a852016-10-31 16:00:33 +0100368
Akron821db3d2017-04-06 21:19:31 +0200369 MDParser
370 #Dependency
Akron5c71a852016-10-31 16:00:33 +0100371
Akron821db3d2017-04-06 21:19:31 +0200372 OpenNLP
373 #Morpho
374 #Sentences
Akron5c71a852016-10-31 16:00:33 +0100375
Akron821db3d2017-04-06 21:19:31 +0200376 Sgbr
377 #Lemma
378 #Morpho
Akron5c71a852016-10-31 16:00:33 +0100379
Akron821db3d2017-04-06 21:19:31 +0200380 TreeTagger
381 #Morpho
382 #Sentences
Akron5c71a852016-10-31 16:00:33 +0100383
Akron821db3d2017-04-06 21:19:31 +0200384 XIP
385 #Constituency
386 #Morpho
387 #Sentences
Akron5c71a852016-10-31 16:00:33 +0100388
Akron5c71a852016-10-31 16:00:33 +0100389
390More importers are in preparation.
391New annotation importers can be defined in the C<KorAP::XML::Annotation> namespace.
392See the built-in annotation importers as examples.
Akronc13a1702016-03-15 19:33:14 +0100393
Akronf73ffb62018-06-27 12:13:59 +0200394
Akronc13a1702016-03-15 19:33:14 +0100395=head1 AVAILABILITY
396
397 https://github.com/KorAP/KorAP-XML-Krill
398
399
400=head1 COPYRIGHT AND LICENSE
401
Akroned9baf02019-01-22 17:03:25 +0100402Copyright (C) 2015-2019, L<IDS Mannheim|http://www.ids-mannheim.de/>
Akronc13a1702016-03-15 19:33:14 +0100403
Akron5c71a852016-10-31 16:00:33 +0100404Author: L<Nils Diewald|http://nils-diewald.de/>
Akron81500102017-04-07 20:45:44 +0200405
Akron5c71a852016-10-31 16:00:33 +0100406Contributor: Eliza Margaretha
407
408L<KorAP::XML::Krill> is developed as part of the L<KorAP|http://korap.ids-mannheim.de/>
Akronc13a1702016-03-15 19:33:14 +0100409Corpus Analysis Platform at the
410L<Institute for the German Language (IDS)|http://ids-mannheim.de/>,
411member of the
Akron5c71a852016-10-31 16:00:33 +0100412L<Leibniz-Gemeinschaft|http://www.leibniz-gemeinschaft.de/en/about-us/leibniz-competition/projekte-2011/2011-funding-line-2/>.
Akronc13a1702016-03-15 19:33:14 +0100413
Akron5c71a852016-10-31 16:00:33 +0100414This program is free software published under the
Akronc13a1702016-03-15 19:33:14 +0100415L<BSD-2 License|https://raw.githubusercontent.com/KorAP/KorAP-XML-Krill/master/LICENSE>.
416
417=cut