Valid/Filter/Kana.pm

filter: Statementstmt 100% 40 / 40 Branchbran 91.6% 11 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 100% 9 / 9 totaltotal 98.6% 71 / 72 CC 7 SCAR 12.5
CC
7
Cov
98%
prohibit_foreign_kanas
7.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.5
« Valid/Rule.pm ↑ Summary Valid/Filter/Word.pm »
1 package Lingua::JA::Romaji::Valid::Filter::Kana;
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 230 ▶sub normalize_syllabic_n_m {
Subroutine normalize_syllabic_n_m: called CC=1 SCAR=0.0
Pod documented
9 230 my ($self, $kana_ref) = @_;
10  
11 230 $$kana_ref =~ s/^n([cdfghjklnrstvwyz])/$1/;
12 230 $$kana_ref =~ s/^m([bmp])/$1/;
13  
14 230 return 1;
15 }
16  
17 572 ▶sub normalize_syllabic_n {
Subroutine normalize_syllabic_n: called CC=1 SCAR=0.0
Pod documented
18 572 my ($self, $kana_ref) = @_;
19  
20 572 $$kana_ref =~ s/^n([bcdfghjklmnprstvwyz])/$1/;
21  
22 572 return 1;
23 }
24  
25 103 ▶sub normalize_syllabic_nn {
Subroutine normalize_syllabic_nn: called CC=1 SCAR=0.0
Pod documented
26 103 my ($self, $kana_ref) = @_;
27  
28 103 $$kana_ref =~ s/^nn([bcdfghjklmnprstvwyz])/$1/;
29  
30 103 return 1;
31 }
32  
33 103 ▶sub normalize_syllabic_m {
Subroutine normalize_syllabic_m: called CC=1 SCAR=0.0
Pod documented
34 103 my ($self, $kana_ref) = @_;
35  
36 103 $$kana_ref =~ s/^m([bmp])/$1/;
37  
38 103 return 1;
39 }
40  
41 544 ▶sub normalize_geminate_tch {
Subroutine normalize_geminate_tch: called CC=1 SCAR=0.0
Pod documented
42 544 my ($self, $kana_ref) = @_;
43  
44 544 $$kana_ref =~ s/^([bdfghjklprstvz])\1/$1/;
45 544 $$kana_ref =~ s/^tch/ch/;
46  
47 544 return 1;
48 }
49  
50 103 ▶sub normalize_geminate_cch {
Subroutine normalize_geminate_cch: called CC=1 SCAR=0.0
Pod documented
51 103 my ($self, $kana_ref) = @_;
52  
53 103 $$kana_ref =~ s/^tch/ch/;
54 103 $$kana_ref =~ s/^([bcdfghjklprstvz])\1/$1/;
55  
56 103 return 1;
57 }
58  
59 155 ▶sub normalize_geminate {
Subroutine normalize_geminate: called CC=1 SCAR=0.0
Pod documented
60 155 my ($self, $kana_ref) = @_;
61  
62 155 $$kana_ref =~ s/^([bcdfghjklprstvz])\1/$1/;
63  
64 155 return 1;
65 }
66  
67 38 ▶sub prohibit_foreign_kanas {
Subroutine prohibit_foreign_kanas: called CC=7 SCAR=19.5
Pod documented
68 38 my ($self, $kana_ref) = @_;
69  
70 38 ▶ return if $$kana_ref =~ /^v/;
Branch: 1 branch
BranchTrueFalseTotal
if $$kana_ref =~ /^v/ 1 37 38
71 37 ▶ return if $$kana_ref =~ /^[kg]w/;
Branch: 1 branch
BranchTrueFalseTotal
if $$kana_ref =~ /^[kg]w/ 1 36 37
72 36 ▶ return if $$kana_ref =~ /y[ie]$/;
Branch: 1 branch
BranchTrueFalseTotal
if $$kana_ref =~ /y[ie]$/ 1 35 36
73 35 ▶ return if $$kana_ref =~ /w[^a]$/;
Branch: 1 branch
BranchTrueFalseTotal
if $$kana_ref =~ /w[^a]$/ 0 35 35
74 35 ▶ return if $$kana_ref =~ /(?:f|ts)[^u]$/;
Branch: 1 branch
BranchTrueFalseTotal
if $$kana_ref =~ /(?:f|ts)[^u]$/ 1 34 35
75 34 ▶ return if $$kana_ref =~ /(?:j|ch|sh)e$/;
Branch: 1 branch
BranchTrueFalseTotal
if $$kana_ref =~ /(?:j|ch|sh)e$/ 3 31 34
76  
77 31 return 1;
78 }
79  
80 4 1;
81  
82 __END__
« Valid/Rule.pm ↑ Summary Valid/Filter/Word.pm »