File Coverage

blib/lib/Treex/Block/Write/Text.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package Treex::Block::Write::Text;
2             $Treex::Block::Write::Text::VERSION = '2.20210102';
3 1     1   522 use Moose;
  1         2  
  1         7  
4 1     1   7047 use Treex::Core::Common;
  1         2  
  1         11  
5             extends 'Treex::Block::Write::BaseTextWriter';
6              
7             has '+extension' => ( default => '.txt' );
8              
9             override '_do_process_document' => sub {
10             my ( $self, $doc ) = @_;
11              
12             foreach my $doczone ($self->get_selected_zones($doc->get_all_zones())){
13             print { $self->_file_handle } $doczone->text;
14             }
15             return;
16             };
17              
18             1;
19              
20             __END__
21              
22             =pod
23              
24             =encoding utf-8
25              
26             =head1 NAME
27              
28             Treex::Block::Write::Text
29              
30             =head1 VERSION
31              
32             version 2.20210102
33              
34             =head1 DESCRIPTION
35              
36             Document writer for plain text format.
37             The text is taken from the document's attribute C<text>,
38             if you want to save the sentences stored in L<bundles|Treex::Core::Bundle>,
39             use L<Treex::Block::Write::Sentences>.
40              
41              
42             =head1 ATTRIBUTES
43              
44             =over
45              
46             =item to
47              
48             space or comma separated list of filenames, or C<-> for STDOUT
49              
50              
51             =back
52              
53             =head1 METHODS
54              
55             =over
56              
57             =item process_document
58              
59             Saves the document.
60              
61             =back
62              
63             =head1 AUTHOR
64              
65             Martin Popel <popel@ufal.mff.cuni.cz>
66              
67             =head1 COPYRIGHT AND LICENSE
68              
69             Copyright © 2011-2012 by Institute of Formal and Applied Linguistics, Charles University in Prague
70              
71             This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.