Treex::Core::DocumentReader - interface for all document readers
version 0.07190
Document readers are a Treex concept how to load documents to be processed by Treex. The documents can be stored in files (in various formats) or read from STDIN or retrieved from a socket etc.
STDIN
These methods must be implemented in classes that consume this role.
Return next document (Treex::Core::Document).
Total number of documents that will be produced by this reader. If the number is unknown in advance, undef should be returned.
undef
Is the document that was most recently returned by $self-next_document()> supossed to be processed by this job? Job indices and document numbers are 1-based, so e.g. for jobs = 5, jobindex = 3 we want to load documents with numbers 3,8,13,18,... jobs = 5, jobindex = 5 we want to load documents with numbers 5,10,15,20,... i.e. those documents where (doc_number-1) % jobs == (jobindex-1).
$self-
jobs = 5, jobindex = 3
jobs = 5, jobindex = 5
(doc_number-1) % jobs == (jobindex-1)
Returns a next document which should be processed by this job. If jobindex is set, returns "modulo number of jobs". See is_current_document_for_this_job.
jobindex
is_current_document_for_this_job
Total number of documents that will be produiced by this reader for this job. It's computed based on number_of_documents, jobindex and jobs.
number_of_documents
jobs
Start reading again from the first document. This implementation just sets the attribute doc_number to zero. You can add additional behavior using the Moose after 'restart' construct.
doc_number
after 'restart'
Treex::Block::Read::Sentences Treex::Block::Read::Text Treex::Block::Read::Treex
Martin Popel <popel@ufal.mff.cuni.cz>
Copyright © 2011 by Institute of Formal and Applied Linguistics, Charles University in Prague
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Treex::Core, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Treex::Core
CPAN shell
perl -MCPAN -e shell install Treex::Core
For more information on module installation, please visit the detailed CPAN module installation guide.