lib/Treex/Block/Write/Sentences.pm

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