| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition0%0/6
not $previous_anode or $previous_anode->form =~ /^[\(\[{<]$/ or not $previous_anode->no_space_after
not $previous_anode or $previous_anode->form =~ /^[\(\[{<]$/
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
| |||||||||||||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||||||||||||