Ita2heb/LettersSeq/IT.pm

filter: Statementstmt 100% 62 / 62 Branchbran 100% 8 / 8 Conditioncond 83.3% 35 / 42 MC/DCmcdc 68.4% 13 / 19 Subroutinesub 100% 18 / 18 Podpod 100% 9 / 9 totaltotal 91.7% 145 / 158 CC 20 SCAR 12.3
CC
20
Cov
94%
should_add_alef
7.0
does_v_require_bet
4.8
closed_syllable
4.0
CRAP 3.4
↑ Summary Ita2heb/LettersSeq/IT/ToHeb.pm »
1 package Lingua::IT::Ita2heb::LettersSeq::IT;
2  
3 11 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 11 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 11 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 11 extends(
12 'Lingua::IT::Ita2heb::LettersSeq'
13 );
14  
15 11 has geminated => (
16 isa => 'Bool',
17 is => 'ro',
18 traits => ['Bool'],
19 default => 0,
20 handles =>
21 {
22 '_set_geminated' => 'set',
23 'unset_geminated' => 'unset',
24 },
25 );
26  
27 11 has should_add_geresh => (
28 isa => 'Bool',
29 is => 'ro',
30 default => 0,
31 traits => ['Bool'],
32 handles =>
33 {
34 _set_add_geresh => 'set',
35 unset_add_geresh => 'unset',
36 },
37 );
38  
39 11 with( 'Lingua::IT::Ita2heb::Role::Constants' );
40  
41 11 our $VERSION = '0.01';
42  
43 11 Readonly my $NO_CLOSED_PAST_THIS => 3;
44  
45 67 ▶sub closed_syllable {
Subroutine closed_syllable: called CC=4 SCAR=13.9
Pod documented
46 67 my ($self) = @_;
47  
48 67 ▶ if ($self->_count - 1 - $self->idx() < $NO_CLOSED_PAST_THIS) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_count - 1 - $self->idx < $NO_CLOSED_PAST_THIS) 41 26 67
49 41 return 0;
50 }
51  
52 26 for my $offset (1, 2) {
53 50 ▶ if ($self->_letter($self->idx+$offset) ~~ @{$self->all_latin_vowels}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_letter($self->idx + $offset) ~~ \@{$self->all_latin_vowels;}) 7 43 50
54 7 return 0;
55 }
56 }
57  
58 19 return 1;
59  
60 }
61  
62 650 ▶sub _is_current_a_vowel {
Subroutine _is_current_a_vowel: called CC=1 SCAR=0.0
63 650 my ($seq) = @_;
64  
65 650 return $seq->current ~~ @{$seq->all_latin_vowels};
66 }
67  
68 sub should_add_alef
69 404 ▶{
Subroutine should_add_alef: called CC=7 SCAR=19.5
Pod documented
70 404 my ($self) = @_;
71  
72 return
73 (
74 $self->_is_current_a_vowel
75 and ($self->at_start or $self->wrote_vowel)
76 404 ▶ and not ( $self->current ~~ @{$self->types_of_i}
Condition88%16/18
$self->_is_current_a_vowel && ($self->at_start || $self->wrote_vowel) && !($self->current ~~ \@{$self->types_of_i;} && $self->match_vowel_after && ($self->match_before([$self->all_latin_vowels]) || $self->at_start))
!ll&&!rl&&r
369233
$self->_is_current_a_vowel and $self->at_start || $self->wrote_vowel
!ll&&!rl&&r
20916035
$self->at_start or $self->wrote_vowel
l!l&&r!l&&!r
314160
$self->current ~~ \@{$self->types_of_i;} && $self->match_vowel_after && ($self->match_before([$self->all_latin_vowels]) || $self->at_start)
!ll&&!rl&&r
3302
$self->current ~~ \@{$self->types_of_i;} and $self->match_vowel_after
!ll&&!rl&&r
2762
$self->match_before([$self->all_latin_vowels]) or $self->at_start
l!l&&r!l&&!r
110
MC/DC71%5/7
$self->_is_current_a_vowel && ($self->at_start || $self->wrote_vowel) && !($self->current ~~ \@{$self->types_of_i;} && $self->match_vowel_after && ($self->match_before([$self->all_latin_vowels]) || $self->at_start))
$self->_is_current_a_vowel $self->at_start $self->wrote_vowel $self->current ~~ \@{$self->types_of_i;} $self->match_vowel_after $self->match_before([$self->all_latin_vowels]) $self->at_start
Truth table66%8/12
A and B or C && not(D and E && F or G)
A= $self->_is_current_a_vowelB= $self->at_startC= $self->wrote_vowelD= $self->current ~~ \@{$self->types_of_i;}E= $self->match_vowel_afterF= $self->match_before([$self->all_latin_vowels])G= $self->at_start
ABCDEFGresult
0XXXXXX0
100XXXX0
11X111X0
11X11010
101111X0
10111010
11X0XXX1
11X10XX1
11X11001
1010XXX1
10110XX1
10111001
77 and $self->match_vowel_after
78 and ($self->match_before([$self->all_latin_vowels])
79 or $self->at_start))
80 );
81 }
82  
83 sub _test_for_geminated
84 404 ▶{
Subroutine _test_for_geminated: called CC=4 SCAR=13.9
85 404 my ($seq) = @_;
86  
87 return
88 (
89 404 ▶ $seq->after_start
Condition100%9/9
$seq->after_start && $seq->before_end && !$seq->_is_current_a_vowel && $seq->curr_lett_eq_next
!ll&&!rl&&r
26511722
$seq->after_start and $seq->before_end and not $seq->_is_current_a_vowel
!ll&&!rl&&r
158107139
$seq->after_start and $seq->before_end
!ll&&!rl&&r
9563246
MC/DC100%4/4
$seq->after_start && $seq->before_end && !$seq->_is_current_a_vowel && $seq->curr_lett_eq_next
$seq->after_start $seq->before_end not $seq->_is_current_a_vowel $seq->curr_lett_eq_next
Truth table100%5/5
A and B and not(C) && D
A= $seq->after_startB= $seq->before_endC= not $seq->_is_current_a_vowelD= $seq->curr_lett_eq_next
ABCDresult
0XXX0
10XX0
110X0
11100
11111
90 and $seq->before_end
91 # TODO : extract this clause.
92 and not $seq->_is_current_a_vowel
93 and $seq->curr_lett_eq_next
94 );
95 }
96  
97 404 ▶sub try_geminated {
Subroutine try_geminated: called CC=2 SCAR=6.9
Pod documented
98 404 my ($seq) = @_;
99  
100 404 my $verdict = $seq->_test_for_geminated;
101  
102 404 ▶ if ($verdict)
Branch: 1 branch
BranchTrueFalseTotal
if ($verdict) 22 382 404
103 {
104 22 $seq->_set_geminated;
105 }
106  
107 404 return $verdict;
108 }
109  
110 77 ▶sub match_cg_mod_after {
Subroutine match_cg_mod_after: called CC=1 SCAR=0.0
Pod documented
111 77 my ($seq, $prefix) = @_;
112  
113 77 return $seq->match_after([@$prefix, $seq->cg_modifier]);
114 }
115  
116 38 ▶sub _match_optional_cg {
Subroutine _match_optional_cg: called CC=2 SCAR=7.1
117 38 my ($seq, $prefix) = @_;
118  
119 38 ▶ return ($seq->match_cg_mod_after([]) or $seq->match_cg_mod_after($prefix));
Condition66%2/3
$seq->match_cg_mod_after([]) || $seq->match_cg_mod_after($prefix)
l!l&&r!l&&!r
16022
MC/DC50%1/2
$seq->match_cg_mod_after([]) || $seq->match_cg_mod_after($prefix)
$seq->match_cg_mod_after([]) $seq->match_cg_mod_after($prefix)
Truth table66%2/3
A || B
A= $seq->match_cg_mod_after([])B= $seq->match_cg_mod_after($prefix)
ABresult
1X1
011
000
120 }
121  
122 38 ▶sub set_optional_cg_geresh {
Subroutine set_optional_cg_geresh: called CC=2 SCAR=6.9
Pod documented
123 38 my $seq = shift;
124
125 38 my $verdict = $seq->_match_optional_cg(@_);
126  
127 38 ▶ if ($verdict) {
Branch: 1 branch
BranchTrueFalseTotal
if ($verdict) 16 22 38
128 16 $seq->_set_add_geresh;
129 }
130  
131 38 return $verdict;
132 }
133  
134 373 ▶sub should_add_sheva {
Subroutine should_add_sheva: called CC=2 SCAR=6.9
Pod documented
135 373 my ($seq) = @_;
136  
137 return
138 (
139 (!$seq->curr_lett_eq_next)
140 and
141 (List::MoreUtils::none
142 517 ▶ { $seq->safe_match_places(@{$_}) }
Subroutine __ANON__: called CC=1 SCAR=0.0
143 373 ▶ @{$seq->sheva_specs()},
Condition100%3/3
!$seq->curr_lett_eq_next && &List::MoreUtils::none(sub { $seq->safe_match_places(@{$_;}); } , @{$seq->sheva_specs;})
!ll&&!rl&&r
9526315
MC/DC100%2/2
!$seq->curr_lett_eq_next && &List::MoreUtils::none(sub { $seq->safe_match_places(@{$_;}); } , @{$seq->sheva_specs;})
!$seq->curr_lett_eq_next &List::MoreUtils::none(sub { $seq->safe_match_places(@{$_;}); } , @{$seq->sheva_specs;})
Truth table100%3/3
not(A) && B
A= !$seq->curr_lett_eq_nextB= &List::MoreUtils::none(sub { $seq->safe_match_places(@{$_;}); } , @{$seq->sheva_specs;})
ABresult
0X0
100
111
144 )
145 );
146 }
147  
148 361 ▶sub match_vowel_before {
Subroutine match_vowel_before: called CC=1 SCAR=0.0
Pod documented
149 361 my ($seq) = @_;
150  
151 361 return $seq->match_before([$seq->all_latin_vowels]);
152 }
153  
154  
155 54 ▶sub match_vowel_after {
Subroutine match_vowel_after: called CC=1 SCAR=0.0
Pod documented
156 54 my ($seq) = @_;
157  
158 54 return $seq->match_after([$seq->all_latin_vowels]);
159 }
160  
161 11 ▶sub does_v_require_bet {
Subroutine does_v_require_bet: called CC=4 SCAR=15.6
Pod documented
162 11 my ($seq) = @_;
163  
164 return (
165 11 ▶ $seq->after_start
Condition55%5/9
$seq->after_start && ($seq->match_before([$seq->requires_bet_for_v]) || $seq->match_after([$seq->requires_bet_for_v]) || $seq->at_end)
!ll&&!rl&&r
506
$seq->match_before([$seq->requires_bet_for_v]) or $seq->match_after([$seq->requires_bet_for_v]) or $seq->at_end
l!l&&r!l&&!r
600
$seq->match_before([$seq->requires_bet_for_v]) or $seq->match_after([$seq->requires_bet_for_v])
l!l&&r!l&&!r
510
MC/DC25%1/4
$seq->after_start && ($seq->match_before([$seq->requires_bet_for_v]) || $seq->match_after([$seq->requires_bet_for_v]) || $seq->at_end)
$seq->after_start $seq->match_before([$seq->requires_bet_for_v]) $seq->match_after([$seq->requires_bet_for_v]) $seq->at_end
Truth table60%3/5
A && B or C or D
A= $seq->after_startB= $seq->match_before([$seq->requires_bet_for_v])C= $seq->match_after([$seq->requires_bet_for_v])D= $seq->at_end
ABCDresult
0XXX0
10000
11XX1
101X1
10011
166 and
167 ($seq->match_before([$seq->requires_bet_for_v])
168 or $seq->match_after([$seq->requires_bet_for_v])
169 or $seq->at_end)
170 );
171 }
172  
173 11 1; # End of Lingua::IT::Ita2heb::LettersSeq::IT
174  
175 __END__
↑ Summary Ita2heb/LettersSeq/IT/ToHeb.pm »