line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Convert::CEGH::Gematria; |
2
|
1
|
|
|
1
|
|
29859
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
3
|
1
|
|
|
1
|
|
855
|
use Regexp::Ethiopic qw(:forms setForm); |
|
1
|
|
|
|
|
44762
|
|
|
1
|
|
|
|
|
11
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
BEGIN |
6
|
|
|
|
|
|
|
{ |
7
|
1
|
|
|
1
|
|
373
|
use base qw( Exporter ); |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
81
|
|
8
|
1
|
|
|
1
|
|
5
|
use vars qw( $አበገደሀ $תיבפלא $ΑΛΦΑΒΕΤ %Gematria @EXPORT_OK $VERSION $use_halehame ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
212
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
2
|
@EXPORT_OK = qw( enumerate ); |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
3
|
$VERSION = "0.02"; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# Gematria Data: |
17
|
|
|
|
|
|
|
# |
18
|
1
|
|
|
|
|
1
|
$አበገደ = "አበገደሀወዘሐጠየከለመነሠዐፈጸቀረሰተኀፀጰፐኈ"; # ቈ 1,000 እ 10,000 |
19
|
1
|
|
|
|
|
2
|
$תיבפלא = "אבגדהוזחטיכלמנסעפצקרשתךםןףץ"; |
20
|
1
|
|
|
|
|
1
|
$ΑΛΦΑΒΕΤ = "ΑΒΓΔΕϚΖΗΘΙΚΛΜΝΞΟΠϘΡΣΤΥΦΧΨΩϠ"; # Ϛ/Ϝ |
21
|
1
|
|
|
|
|
2
|
$ሀለሐመ = "ሀለሐመሠረሰቀበተኀነአከወዐዘየደገጠጰጸፀፈፐ"; |
22
|
|
|
|
|
|
|
# $Coptic ="ΑΒΓΔΕϚΖΗϴΙΚΛΜΝΞΟΠ ΡCΤΥΦΧΨΩϢϤϦϨϪϬϮ"; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
7
|
%Gematria =( |
25
|
|
|
|
|
|
|
eth => $አበገደ, |
26
|
|
|
|
|
|
|
heb => $תיבפלא, |
27
|
|
|
|
|
|
|
ell => $ΑΛΦΑΒΕΤ, |
28
|
|
|
|
|
|
|
et => $አበገደ, |
29
|
|
|
|
|
|
|
he => $תיבפלא, |
30
|
|
|
|
|
|
|
el => $ΑΛΦΑΒΕΤ, |
31
|
|
|
|
|
|
|
et_halehame => $ሀለሐመ |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
185
|
$use_halehame = 0; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# |
39
|
|
|
|
|
|
|
# unfortunately the index function in Perl 5.8.0 is broken for some |
40
|
|
|
|
|
|
|
# Unicode sequences: http://rt.perl.org/rt2/Ticket/Display.html?id=22375 |
41
|
|
|
|
|
|
|
# |
42
|
|
|
|
|
|
|
sub _index |
43
|
|
|
|
|
|
|
{ |
44
|
10
|
|
|
10
|
|
19
|
my ( $haystack, $needle ) = @_; |
45
|
|
|
|
|
|
|
|
46
|
10
|
|
|
|
|
13
|
my $pos = my $found = 0; |
47
|
10
|
|
|
|
|
62
|
foreach (split (//, $haystack) ) { |
48
|
270
|
100
|
|
|
|
588
|
$found = 1 if ( /$needle/ ); |
49
|
270
|
100
|
|
|
|
449
|
$pos++ unless ( $found ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
10
|
|
|
|
|
39
|
$pos; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _simplify |
57
|
|
|
|
|
|
|
{ |
58
|
3
|
|
|
3
|
|
6
|
my ($string) = @_; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# |
61
|
|
|
|
|
|
|
# Allow mixed language Gematria: |
62
|
|
|
|
|
|
|
# |
63
|
3
|
100
|
|
|
|
53
|
if ( $string =~ /[$תיבפלא]/ ) { |
64
|
|
|
|
|
|
|
# |
65
|
|
|
|
|
|
|
# Remove what we don't know. |
66
|
|
|
|
|
|
|
# This also strips vowel markers |
67
|
|
|
|
|
|
|
# |
68
|
1
|
|
|
|
|
29
|
$string =~ s/[^$תיבפלא]//og; |
69
|
1
|
|
|
|
|
4
|
return ( $string, "heb" ); |
70
|
|
|
|
|
|
|
} |
71
|
2
|
100
|
|
|
|
33
|
if ( $string =~ /[$ΑΛΦΑΒΕΤ]/ ) { |
72
|
|
|
|
|
|
|
# |
73
|
|
|
|
|
|
|
# this probably doesn't work, test it |
74
|
|
|
|
|
|
|
# and replace with a tr later if it fails: |
75
|
|
|
|
|
|
|
# |
76
|
1
|
|
|
|
|
13
|
$string = uc($string); |
77
|
1
|
|
|
|
|
11774
|
$string =~ s/Ϝ/Ϛ/g; |
78
|
1
|
|
|
|
|
5
|
$string =~ s/Ϟ/Ϙ/g; |
79
|
1
|
|
|
|
|
7
|
return ( $string, "ell" ); |
80
|
|
|
|
|
|
|
} |
81
|
1
|
50
|
|
|
|
10
|
if ( $string =~ /\p{Ethiopic}/ ) { |
82
|
1
|
50
|
|
|
|
10
|
$string =~ s/(.)/($1 eq "ኈ" ) ? "ኈ" : setForm($1,$ግዕዝ)/eg; |
|
3
|
|
|
|
|
52
|
|
83
|
1
|
50
|
|
|
|
15
|
if ( $use_halehame ) { |
84
|
0
|
|
|
|
|
0
|
$string =~ s/(ኈ)/setForm($1,$ግዕዝ)/eg; |
|
0
|
|
|
|
|
0
|
|
85
|
0
|
|
|
|
|
0
|
return ( $string, "et_halehame" ); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
else { |
88
|
1
|
|
|
|
|
5
|
return ( $string, "eth" ); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub enumerate |
96
|
|
|
|
|
|
|
{ |
97
|
3
|
|
|
3
|
0
|
613
|
my ( @strings ) = @_; |
98
|
|
|
|
|
|
|
|
99
|
3
|
|
|
|
|
8
|
my ( @sums ) = (); |
100
|
3
|
|
|
|
|
6
|
foreach ( @strings ) { |
101
|
3
|
|
|
|
|
13
|
my ($string, $from) = _simplify ( $_ ); |
102
|
|
|
|
|
|
|
|
103
|
3
|
|
|
|
|
17
|
my @letters = split ( //, $string ); |
104
|
|
|
|
|
|
|
|
105
|
3
|
|
|
|
|
6
|
my $sum = 0; |
106
|
3
|
|
|
|
|
8
|
foreach my $letter (@letters) { |
107
|
10
|
|
|
|
|
30
|
my $pos = _index ( $Gematria{$from}, $letter ); |
108
|
|
|
|
|
|
|
# my $value = (1+(int $pos/10)+$pos%10)*10**(int $pos/10); |
109
|
|
|
|
|
|
|
# my $exp = int $pos/10; |
110
|
|
|
|
|
|
|
# my $power = 10**$exp; |
111
|
|
|
|
|
|
|
# print "$letter => $pos / $exp / $power / $value\n"; |
112
|
10
|
|
|
|
|
41
|
$sum += (1+(int $pos/10)+$pos%10)*10**(int $pos/10); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
3
|
|
|
|
|
13
|
push ( @sums, $sum ); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
3
|
50
|
|
|
|
25
|
( wantarray ) ? @sums : $sums[0] ; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
######################################################### |
123
|
|
|
|
|
|
|
# Do not change this, Do not put anything below this. |
124
|
|
|
|
|
|
|
# File must return "true" value at termination |
125
|
|
|
|
|
|
|
1; |
126
|
|
|
|
|
|
|
########################################################## |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
__END__ |