blib/lib/Lingua/AM/Abbreviate.pm

filter: Statementstmt 95.8% 23 / 24 Branchbran 70.0% 7 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod 0.0% 0 / 2 totaltotal 84.2% 32 / 38 CC 7 SCAR 14.0
CC
7
Cov
88%
Expand
4.1
Contract
4.0
CRAP 4.1
↑ Summary
1 package Lingua::AM::Abbreviate;
2 1 require 5.000;
3 1 require Exporter;
4  
5 1 @ISA = qw(Exporter);
6 1 @EXPORT = qw(
7 Contract
8 Expand
9 );
10 1 $VERSION = '0.01';
11  
12  
13 1 %AbbreviatedAmharic = (
14 'ት/ቤት' => 'ትምህርት ቤት',
15 'ጽ/ቤት' => 'ጽህፈት ቤት',
16 'ም/ቤት' => 'ምክር ቤት',
17 'መ/ቤት' => 'መሥሪያ ቤት',
18 'ፍ/ቤት' => 'ፍርድ ቤት',
19  
20 'ሠ/ፌዴሬሽን' => 'ሠራተኛ ፌዴሬሽን',
21  
22 'ቤ/ክ' => 'ቤተክርስትያን',
23 'ቤ/መ' => 'ቤተመንግስት',
24 'መ/ቅ' => 'መጸሐፍ ቅዱስ',
25  
26 'ም/' => 'ምክትል',
27 'ገ/' => 'ገብረ',
28 'ወ/' => 'ወልደ',
29 'ተ/' => 'ተክለ', # ወይም ተስፋ
30 'ኃ/' => 'ኃይለ',
31  
32 'ኮ/ል' => 'ኮለኔል',
33 'ጄ/ል' => 'ጄኔራል',
34 'ሻ/' => 'ሻምበል',
35  
36 'ወ/ሮ' => 'ወይዘሮ',
37 'ወ/ሪት' => 'ወይዘሪት',
38 'ሚ/ር' => 'ሚስተር',
39 'ሚ/ስ' => 'ሚስስ',
40 'ፕ/ር' => 'ፕሮፌሰር',
41  
42 'ፕ/ት' => 'ፕሬዚዳንት',
43 'ጠ/ሚ' => 'ጠቅላይ ሚኒስትር',
44 'ጠ/ሚኒስትር' => 'ጠቅላይ ሚኒስትር',
45 'ጠ/ሚ/ቢሮ' => 'ጠቅላይ ሚኒስትር ቢሮ',
46 'ሚ/ሩ' => 'ሚኒስትሩ',
47  
48 'ዓ/ም' => 'ዓመተ ምህረት',
49 'ዓ/ዓ' => 'ዓመተ ዓለም',
50 'አ/አ' => 'አዲስ አባባ',
51  
52 'ዶ/ር' => 'ዶክተር',
53 'ሆ/ል' => 'ሆስፒታል'
54 );
55  
56  
57 sub Expand
58 3 ▶{
Subroutine Expand: called CC=4 SCAR=14.1
Pod undocumented
59 3 local ($term) = $_[0];
60  
61 3 ▶ if ( $AbbreviatedAmharic{$term} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($AbbreviatedAmharic{$term}) { } 2 1 3
62 2 return ( $AbbreviatedAmharic{$term} );
63 } else {
64 1 $prefix = $term =~ s/^([ለበከየ])//;
65 1 ▶ if ( $AbbreviatedAmharic{$term} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($AbbreviatedAmharic{$term}) { } 0 1 1
66 0 return ( "$prefix$AbbreviatedAmharic{$term}" );
67 } else {
68 1 $term = $_[0];
69 1 ($prefix, $term) = split ( /\//, $term, 2 );
70 1 $prefix .= "/";
71 1 ▶ if ( $AbbreviatedAmharic{$prefix} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($AbbreviatedAmharic{$prefix}) 1 0 1
72 1 return ( "$AbbreviatedAmharic{$prefix}$term" );
73 }
74 }
75 }
76  
77
78 }
79  
80 sub Contract
81 1 ▶{
Subroutine Contract: called CC=4 SCAR=13.9
Pod undocumented
82 1 local ($term) = shift;
83  
84 1 foreach $key (keys %AbbreviatedAmharic) {
85 27 ▶ return ( $key ) if ( $AbbreviatedAmharic{$key} eq $term );
Branch: 1 branch
BranchTrueFalseTotal
if $AbbreviatedAmharic{$key} eq $term 0 27 27
86 # print "Contract: $AbbreviatedAmharic{$key} = $term\n";
87 27 ▶ if ( $term =~ /^$AbbreviatedAmharic{$key}/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($term =~ /^$AbbreviatedAmharic{$key}/) 1 26 27
88 1 $term =~ s/$AbbreviatedAmharic{$key}//;
89 1 return ( "$key$term" );
90 }
91 }
92 }
93  
94 #
95 # ma/bEt
96 # d/bEt
97 # me/`se/ma
98 # qe/ge/ma
99 # m/wana as in "m/wana SeHefi"
100 #########################################################
101 # Do not change this, Do not put anything below this.
102 # File must return "true" value at termination
103 1 1;
104 ##########################################################
105  
106  
107 __END__
↑ Summary