line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Encode::Arabic::Franco; |
2
|
5
|
|
|
5
|
|
67959
|
use parent qw(Encode::Encoding); |
|
5
|
|
|
|
|
1137
|
|
|
5
|
|
|
|
|
18
|
|
3
|
5
|
|
|
5
|
|
37007
|
use strict; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
67
|
|
4
|
5
|
|
|
5
|
|
14
|
use warnings; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
78
|
|
5
|
5
|
|
|
5
|
|
19
|
use utf8; |
|
5
|
|
|
|
|
4
|
|
|
5
|
|
|
|
|
17
|
|
6
|
5
|
|
|
5
|
|
1965
|
use Lingua::AR::Tashkeel v0.004; |
|
5
|
|
|
|
|
933657
|
|
|
5
|
|
|
|
|
213
|
|
7
|
5
|
|
|
5
|
|
33
|
use Unicode::Normalize; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
227
|
|
8
|
5
|
|
|
5
|
|
19
|
use charnames ':full'; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
24
|
|
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
615
|
use Carp; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
764
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->Define(qw(Franco-Arabic Arabizy)); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# ABSTRACT: Does transliteration from chat Arabic |
15
|
|
|
|
|
|
|
our $VERSION = '0.008'; # VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub import { # imports Encode |
18
|
5
|
|
|
5
|
|
105
|
require Encode; |
19
|
5
|
50
|
|
|
|
84
|
push @Encode::ISA, 'Exporter' unless Encode->can('export_to_level'); |
20
|
5
|
|
|
|
|
511
|
Encode->export_to_level(1, @_); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub decode($$;$){ |
24
|
44
|
|
|
44
|
1
|
12209
|
my ($obj, $orig, $chk) = @_; |
25
|
|
|
|
|
|
|
|
26
|
44
|
|
|
|
|
107
|
my $str = NFC $orig; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Alefs |
29
|
44
|
|
|
|
|
4823
|
$str =~ s/\b[ae]l(?!e)(?=..)/ال\N{ARABIC SUKUN}/g; |
30
|
44
|
|
|
|
|
88
|
$str =~ s/(2|\b)e(?!e)/إ\N{ARABIC KASRA}/g; |
31
|
44
|
|
|
|
|
56
|
$str =~ s/e2a(?=h?\b)/\N{ARABIC KASRA}ئ\N{ARABIC FATHA}a/g; |
32
|
44
|
|
|
|
|
48
|
$str =~ s/e2(?=.\b)/\N{ARABIC KASRA}ئ\N{ARABIC SUKUN}/g; |
33
|
44
|
|
|
|
|
92
|
$str =~ s/\B2(?=e)\B/ئ\N{ARABIC KASRA}/g; |
34
|
44
|
|
|
|
|
53
|
$str =~ s/a2a(?=.\b)/ائ\N{ARABIC FATHA}/g; |
35
|
44
|
|
|
|
|
44
|
$str =~ s/a2e(?=.\b)/ائ\N{ARABIC KASRA}/g; |
36
|
44
|
|
|
|
|
40
|
$str =~ s/a2[ou](?=.\b)/ائ\N{ARABIC DAMMA}/g; |
37
|
|
|
|
|
|
|
#$str =~ s/a2\B/\N{ARABIC FATHA}أ/g; |
38
|
44
|
|
|
|
|
43
|
$str =~ s/o2o/ؤ\N{ARABIC DAMMA}/g; |
39
|
44
|
|
|
|
|
52
|
$str =~ s/o2/ؤ\N{ARABIC SUKUN}/g; |
40
|
44
|
|
|
|
|
135
|
$str =~ s/\b2?[ou]/أ\N{ARABIC DAMMA}/g; |
41
|
44
|
|
|
|
|
51
|
$str =~ s/\b2a/آ/g; |
42
|
44
|
|
|
|
|
142
|
$str =~ s/\ba|2a|\b2/أ\N{ARABIC FATHA}/g; |
43
|
44
|
|
|
|
|
66
|
$str =~ s/([^aoyei])2/$1ء/g; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Digraphs |
46
|
44
|
|
|
|
|
46
|
$str =~ s/3'/غ/g; |
47
|
44
|
|
|
|
|
34
|
$str =~ s/7'/خ/g; |
48
|
44
|
|
|
|
|
36
|
$str =~ s/kh/خ/g; |
49
|
44
|
|
|
|
|
39
|
$str =~ s/gh/غ/g; |
50
|
44
|
|
|
|
|
40
|
$str =~ s/sh/ش/g; |
51
|
44
|
|
|
|
|
46
|
$str =~ s/ah\b/ة/g; |
52
|
44
|
|
|
|
|
41
|
$str =~ s/ss/ص/g; |
53
|
44
|
|
|
|
|
45
|
$str =~ s/ee/\N{ARABIC KASRA}ي/g; |
54
|
44
|
|
|
|
|
40
|
$str =~ s/th/ث/g; |
55
|
44
|
|
|
|
|
42
|
$str =~ s/oo/\N{ARABIC DAMMA}و/g; |
56
|
44
|
|
|
|
|
71
|
$str =~ s/zz|6'/ظ/g; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Vowelize |
59
|
|
|
|
|
|
|
#$str =~ s/aأ|[aا]2/ائ\N{ARABIC FATHA}/g; |
60
|
44
|
|
|
|
|
42
|
$str =~ s/2\b/ء/g; |
61
|
44
|
|
|
|
|
139
|
$str =~ s/yأ/يئ/g; |
62
|
|
|
|
|
|
|
#print $str if $orig =~ / |
63
|
44
|
|
|
|
|
57
|
$str =~ s/(?=أ|)h\b/ة/g; |
64
|
44
|
|
|
|
|
79
|
$str =~ s/ءo|2و|ء(?=\N{ARABIC DAMMA}و)/ؤ/g; |
65
|
44
|
|
|
|
|
126
|
$str =~ s/aأ|[aا]2/\N{ARABIC FATHA}أ/g; |
66
|
44
|
|
|
|
|
43
|
$str =~ s/(?<=ائ\N{ARABIC FATHA})a//g; |
67
|
44
|
|
|
|
|
40
|
$str =~ s/e/\N{ARABIC KASRA}/g; |
68
|
44
|
|
|
|
|
42
|
$str =~ s/aإ/ائ\N{ARABIC KASRA}/g; |
69
|
44
|
|
|
|
|
39
|
$str =~ s/aإ/ائ\N{ARABIC KASRA}/g; |
70
|
|
|
|
|
|
|
#return $str if $orig =~ /22emah/; |
71
|
44
|
|
|
|
|
36
|
$str =~ s/(?<=أ\N{ARABIC FATHA})إ/ئ/g; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Fix Alefs |
75
|
44
|
|
|
|
|
35
|
$str =~ s/أإ/أئ\N{ARABIC KASRA}/g; |
76
|
|
|
|
|
|
|
#$str =~ s/(?=.)ائ(..)/أ$1/g; |
77
|
|
|
|
|
|
|
#$str =~ s/(?!a)ء/ئ/g; |
78
|
44
|
|
|
|
|
42
|
$str =~ s/ئ(?=\N{ARABIC DAMMA})/ؤ/g; |
79
|
44
|
|
|
|
|
42
|
$str =~ s/(?=ئَ)a//g; |
80
|
|
|
|
|
|
|
#$str =~ s/\b(.)ئ(..)\b/$1أ$2/g; |
81
|
|
|
|
|
|
|
#return $str if $orig =~ /ma2mn/; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
44
|
|
|
|
|
35
|
$str =~ s/'//g; |
85
|
|
|
|
|
|
|
|
86
|
44
|
|
|
|
|
150
|
$str =~ tr |
87
|
|
|
|
|
|
|
{ 3 4 5 6 7 8 9 } |
88
|
|
|
|
|
|
|
{ ع ش خ ط ح غ ق }; |
89
|
|
|
|
|
|
|
|
90
|
44
|
|
|
|
|
132
|
$str =~ tr |
91
|
|
|
|
|
|
|
{ a b c d e f g h i j k l m n o p q r s t u v w x y z } |
92
|
|
|
|
|
|
|
{ ا ب c د e ف ج ه ي ج ك ل م ن و پ ق ر س ت و ڤ و x ي ز }; |
93
|
|
|
|
|
|
|
|
94
|
44
|
|
|
|
|
80
|
$str =~ tr |
95
|
|
|
|
|
|
|
{ , ; ? } |
96
|
|
|
|
|
|
|
{ ، ؛ ؟ }; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
#$str =~ s/\w//ga; # strip untranslated characters |
99
|
|
|
|
|
|
|
|
100
|
44
|
|
|
|
|
110
|
$str = Lingua::AR::Tashkeel::prune($str); |
101
|
|
|
|
|
|
|
|
102
|
44
|
50
|
|
|
|
6168
|
$_[1] = '' if $chk; |
103
|
44
|
|
|
|
|
83
|
return $str; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
1; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
__END__ |