| 1 | package Treex::Block::Write::Sentences; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | $Treex::Block::Write::Sentences::VERSION = '2.20151210'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Treex::Core::Common; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | extends 'Treex::Block::Write::BaseTextWriter'; | |||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | has '+language' => ( required => 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | has '+extension' => ( default => '.txt' ); | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | has join_resegmented => ( | |||||||||||||||||||||||||||||||||||||||||
| 12 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 13 | isa => 'Bool', | ||||||||||||||||||||||||||||||||||||||||||
| 14 | default => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 15 | documentation => 'Print the sentences re-segmented' | ||||||||||||||||||||||||||||||||||||||||||
| 16 | . ' by W2A::ResegmentSentences on one line.', | ||||||||||||||||||||||||||||||||||||||||||
| 17 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | sub process_zone { | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | my ( $self, $zone ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process_zone: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | my $bundle_id = $zone->get_bundle()->id; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | if ( $self->join_resegmented && $bundle_id =~ /_(\d+)of(\d+)$/ && $1 != $2 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->join_resegmented and $bundle_id =~ /_(\d+)of(\d+)$/ and $1 != $2
$self->join_resegmented and $bundle_id =~ /_(\d+)of(\d+)$/
MC/DC0%0/3
$self->join_resegmented and $bundle_id =~ /_(\d+)of(\d+)$/ and $1 != $2
$self->join_resegmented
$bundle_id =~ /_(\d+)of(\d+)$/
$1 != $2
Truth table0%0/4
A and B and C
A= $self->join_resegmentedB= $bundle_id =~ /_(\d+)of(\d+)$/C= $1 != $2
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | print { $self->_file_handle } $zone->sentence, " "; | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | print { $self->_file_handle } $zone->sentence, "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | __END__ | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | =pod | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | =encoding utf-8 | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | Treex::Block::Write::Sentences | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | version 2.20151210 | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | Document writer for plain text format, one sentence | ||||||||||||||||||||||||||||||||||||||||||
| 50 | (L<bundle|Treex::Core::Bundle>) per line. | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | =item encoding | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | Output encoding. C<utf8> by default. | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | =item join_resegmented | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | Print the sentences re-segmented | ||||||||||||||||||||||||||||||||||||||||||
| 64 | by L<Treex::Block::W2A::ResegmentSentences> on one line. | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | =item to | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | The name of the output file, STDOUT by default. | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | =item process_document | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | Saves the document. | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | Martin Popel | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | Copyright © 2011 by Institute of Formal and Applied Linguistics, Charles University in Prague | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||