Valid/Filter/Word.pm

filter: Statementstmt 100% 27 / 27 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 100% 8 / 8 totaltotal 100% 49 / 49 CC 3 SCAR 2.9
CC
3
Cov
100%
prohibit_initial_n
2.0
prohibit_initial_wo
2.0
BEGIN
1.0
CRAP 1.3
« Valid/Filter/Kana.pm ↑ Summary Valid/Rule/Hepburn.pm »
1 package Lingua::JA::Romaji::Valid::Filter::Word;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 308 ▶sub new { bless {}, shift }
Subroutine new: called CC=1 SCAR=0.0
Pod documented
7  
8 271 ▶sub normalize_n_with_apostrophe {
Subroutine normalize_n_with_apostrophe: called CC=1 SCAR=0.0
Pod documented
9 271 my ($self, $word_ref) = @_;
10  
11 271 $$word_ref =~ s/n\\?'([aeiouy])/n$1/g;
12  
13 271 return 1;
14 }
15  
16 68 ▶sub normalize_n_with_hyphen {
Subroutine normalize_n_with_hyphen: called CC=1 SCAR=0.0
Pod documented
17 68 my ($self, $word_ref) = @_;
18  
19 68 $$word_ref =~ s/n\\?[\-]([aeiouy])/n$1/g;
20  
21 68 return 1;
22 }
23  
24 34 ▶sub normalize_oh {
Subroutine normalize_oh: called CC=1 SCAR=0.0
Pod documented
25 34 my ($self, $word_ref) = @_;
26  
27 # strictly speaking, this may be wrong (eg. o-hira, not oh-ira)
28 # but both cases should be valid in the end.
29 34 $$word_ref =~ s/oh/o/g;
30  
31 34 return 1;
32 }
33  
34 34 ▶sub normalize_long_vowel_with_h {
Subroutine normalize_long_vowel_with_h: called CC=1 SCAR=0.0
Pod documented
35 34 my ($self, $word_ref) = @_;
36  
37 # strictly speaking, this may be wrong (eg. o-hira, not oh-ira)
38 # but both cases should be valid in the end.
39 34 $$word_ref =~ s/([aeiou])h/$1/g;
40  
41 34 return 1;
42 }
43  
44 34 ▶sub normalize_long_vowel_with_symbols {
Subroutine normalize_long_vowel_with_symbols: called CC=1 SCAR=0.0
Pod documented
45 34 my ($self, $word_ref) = @_;
46  
47 # strictly speaking, this may be wrong (eg. o-hira, not oh-ira)
48 # but both cases should be valid in the end.
49 34 $$word_ref =~ s/([aeiou])\\?[_\-^]/$1/g;
50  
51 34 return 1;
52 }
53  
54 26 ▶sub prohibit_initial_n {
Subroutine prohibit_initial_n: called CC=2 SCAR=6.9
Pod documented
55 26 my ($self, $word_ref) = @_;
56  
57 26 ▶ return ( $$word_ref =~ /^n(?:[^aeiouy])/ ) ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$$word_ref =~ /^n(?:[^aeiouy])/ ? : 1 25 26
58 }
59  
60 25 ▶sub prohibit_initial_wo {
Subroutine prohibit_initial_wo: called CC=2 SCAR=6.9
Pod documented
61 25 my ($self, $word_ref) = @_;
62  
63 25 ▶ return ( $$word_ref =~ /^wo/ ) ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$$word_ref =~ /^wo/ ? : 1 24 25
64 }
65  
66 4 1;
67  
68 __END__
« Valid/Filter/Kana.pm ↑ Summary Valid/Rule/Hepburn.pm »