| 1 | package Catmandu::ALTOXML; | ||
| 2 | use Catmandu::Sane; | ||
| 3 | |||
| 4 | our $VERSION = "0.01"; | ||
| 5 | |||
| 6 | =encoding utf8 | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Catmandu::ALTOXML - tools to work with ALTOXML documents | ||
| 11 | |||
| 12 | =begin markdown | ||
| 13 | |||
| 14 | # STATUS | ||
| 15 | |||
| 16 | [](https://travis-ci.org/LibreCat/Catmandu-ALTOXML) | ||
| 17 | [](https://coveralls.io/r/LibreCat/Catmandu-ALTOXML) | ||
| 18 | [](http://cpants.cpanauthors.org/dist/Catmandu-ALTOXML) | ||
| 19 | |||
| 20 | =end markdown | ||
| 21 | |||
| 22 | =head1 SYNOPSIS | ||
| 23 | |||
| 24 | #From the command line | ||
| 25 | |||
| 26 | #Extract OCR data, treating each line as a record | ||
| 27 | |||
| 28 | $ catmandu convert ALTOXML --file input.xml to YAML | ||
| 29 | |||
| 30 | #In a script | ||
| 31 | |||
| 32 | use Catmandu::Sane; | ||
| 33 | |||
| 34 | use Catmandu::Importer::ALTOXML; | ||
| 35 | |||
| 36 | my $importer = Catmandu::Importer::ALTOXML->new( file => "/tmp/input.xml" ); | ||
| 37 | |||
| 38 | $importer->each(sub{ | ||
| 39 | |||
| 40 | my $record = $_[0]; | ||
| 41 | #.. | ||
| 42 | |||
| 43 | }); | ||
| 44 | |||
| 45 | =head1 EXAMPLE OUTPUT IN YAML | ||
| 46 | |||
| 47 | --- | ||
| 48 | block: 5 | ||
| 49 | block_h: 63 | ||
| 50 | block_w: 114 | ||
| 51 | block_x: 2294 | ||
| 52 | block_y: 2713 | ||
| 53 | h: 38 | ||
| 54 | page: 1 | ||
| 55 | page_h: 3316 | ||
| 56 | page_w: 2904 | ||
| 57 | page_x: ~ | ||
| 58 | page_y: ~ | ||
| 59 | text: '1' | ||
| 60 | w: 17 | ||
| 61 | x: 2349 | ||
| 62 | y: 2717 | ||
| 63 | ... | ||
| 64 | |||
| 65 | =head1 INSTALLATION | ||
| 66 | |||
| 67 | In order to install this package you need the following system packages installed | ||
| 68 | |||
| 69 | =over | ||
| 70 | |||
| 71 | =item Centos | ||
| 72 | |||
| 73 | * perl-devel | ||
| 74 | |||
| 75 | * make | ||
| 76 | |||
| 77 | * gcc | ||
| 78 | |||
| 79 | * gcc-c++ | ||
| 80 | |||
| 81 | * libyaml-devel | ||
| 82 | |||
| 83 | * libxml2 version 2.6.21 or higher. Reason: the module XML::LibXML::Reader uses the libxml2 pull parser to read xml documents incrementally. | ||
| 84 | |||
| 85 | =back | ||
| 86 | |||
| 87 | =head1 AUTHORS | ||
| 88 | |||
| 89 | Nicolas Franck C<< <nicolas.franck at ugent.be> >> | ||
| 90 | |||
| 91 | =head1 SEE ALSO | ||
| 92 | |||
| 93 | L<Catmandu::Importer::ALTOXML>, L<XML::LibXML::Reader>, L<Catmandu>, L<Catmandu::Importer> | ||
| 94 | |||
| 95 | =head1 LICENSE AND COPYRIGHT | ||
| 96 | |||
| 97 | This program is free software; you can redistribute it and/or modify it | ||
| 98 | under the terms of either: the GNU General Public License as published | ||
| 99 | by the Free Software Foundation; or the Artistic License. | ||
| 100 | |||
| 101 | See L<http://dev.perl.org/licenses/> for more information. | ||
| 102 | |||
| 103 | =cut | ||
| 104 | |||
| 105 | 1; |