Block/W2A/EN/NormalizeForms.pm

filter: Statementstmt 44.4% 12 / 27 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 36.9% 17 / 46 CC 5 SCAR 28.4
CC
5
Cov
32%
process_anode
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 17.1
« Block/W2A/EN/FixTokenization.pm ↑ Summary Block/W2A/EN/TagLinguaEn.pm »
1 package Treex::Block::W2A::EN::NormalizeForms;
2 BEGIN {
3 1 ▶ $Treex::Block::W2A::EN::NormalizeForms::VERSION = '0.06903_1';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 }
5 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Treex::Core::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 extends 'Treex::Core::Block';
9  
10 sub process_anode {
11 0 ▶ my ( $self, $anode ) = @_;
Subroutine process_anode: not called CC=5 SCAR=34.0
Pod documented
12  
13 0 my $form = $anode->form;
14  
15 0 ▶ if ( $form eq '"' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($form eq "\"") 0 0 0
16 0 my $previous_anode = $anode->get_prev_node();
17 0 ▶ if ( !$previous_anode || $previous_anode->form =~ /^[\(\[{<]$/ || !$previous_anode->no_space_after ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $previous_anode or $previous_anode->form =~ /^[\(\[{<]$/ or not $previous_anode->no_space_after) 0 0 0
Condition0%0/6
not $previous_anode or $previous_anode->form =~ /^[\(\[{<]$/ or not $previous_anode->no_space_after
l!l&&r!l&&!r
000
not $previous_anode or $previous_anode->form =~ /^[\(\[{<]$/
l!l&&r!l&&!r
000
MC/DC0%0/3
not $previous_anode or $previous_anode->form =~ /^[\(\[{<]$/ or not $previous_anode->no_space_after
not $previous_anode $previous_anode->form =~ /^[\(\[{<]$/ not $previous_anode->no_space_after
Truth table0%0/4
not(A) or B or not(C)
A= not $previous_anodeB= $previous_anode->form =~ /^[\(\[{<]$/C= not $previous_anode->no_space_after
ABCresult
1XX1
01X1
0011
0000
18 0 $form = '``';
19 }
20 }
21  
22 0 $form =~ s/’/'/g;
23 0 $form =~ s/"/''/g;
24 0 $form =~ s/“/``/g;
25 0 $form =~ s/”/''/g;
26 0 $form =~ s/«/``/g;
27 0 $form =~ s/»/''/g;
28 0 $form =~ s/—/--/g;
29  
30 0 $anode->set_form($form);
31  
32 0 return 1;
33 }
34  
35 1 1;
36  
37 __END__
38  
39 =encoding utf-8
40  
41 =head1 NAME
42  
43 Treex::Block::W2A::EN::NormalizeForms - normalize some wordforms
44  
45 =head1 VERSION
46  
47 version 0.06903_1
48  
49 =head1 DESCRIPTION
50  
51 Some forms are normalized, for example all the quotation marks
52 get the normalized form `` or ''.
53  
54 =head1 OVERRIDEN METHODS
55  
56 =head2 from C<Treex::Core::Block>
57  
58 =over 4
59  
60 =item process_anode
61  
62 =back
63  
64 =head1 AUTHOR
65  
66 David Mareček <marecek@ufal.mff.cuni.cz>
67  
68 =head1 COPYRIGHT AND LICENSE
69  
70 Copyright © 2010 - 2011 by Institute of Formal and Applied Linguistics, Charles University in Prague
71  
72 This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
« Block/W2A/EN/FixTokenization.pm ↑ Summary Block/W2A/EN/TagLinguaEn.pm »