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