File Coverage

blib/lib/Treex/Block/Read/Text.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 19 19 100.0


line stmt bran cond sub pod time code
1             package Treex::Block::Read::Text;
2             $Treex::Block::Read::Text::VERSION = '2.20210102';
3 2     2   626 use Moose;
  2         4  
  2         19  
4 2     2   15090 use Treex::Core::Common;
  2         4  
  2         25  
5             extends 'Treex::Block::Read::BaseTextReader';
6              
7             sub next_document {
8 2     2 1 7 my ($self) = @_;
9 2         13 my $text = $self->next_document_text();
10 2 100       12 return if !defined $text;
11              
12 1         18 my $document = $self->new_document();
13 1         40 my $zone = $document->create_zone( $self->language, $self->selector );
14 1         36 $zone->set_text($text);
15 1         4 return $document;
16             }
17              
18             1;
19              
20             __END__
21              
22             =pod
23              
24             =encoding utf-8
25              
26             =head1 NAME
27              
28             Treex::Block::Read::Text
29              
30             =head1 VERSION
31              
32             version 2.20210102
33              
34             =head1 DESCRIPTION
35              
36             Document reader for plain text format.
37             The text is stored to the L<document|Treex::Core::Document>'s attribute C<text>,
38             if you want to load a text in "on sentence per line" format to
39             L<bundles|Treex::Core::Bundle>, use L<Treex::Block::Read::Sentences> instead.
40              
41             =head1 ATTRIBUTES
42              
43             =over
44              
45             =item from
46              
47             space or comma separated list of filenames
48              
49             =back
50              
51             =head1 METHODS
52              
53             =over
54              
55             =item next_document
56              
57             Loads a document.
58              
59             =back
60              
61             =head1 AUTHOR
62              
63             Martin Popel
64              
65             =head1 COPYRIGHT AND LICENSE
66              
67             Copyright © 2011 by Institute of Formal and Applied Linguistics, Charles University in Prague
68              
69             This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.