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