line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
49504
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
45
|
|
2
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
83
|
|
3
|
|
|
|
|
|
|
package Lingua::AR::Regexp; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: Regular Expression character classes for Arabic |
6
|
|
|
|
|
|
|
our $VERSION = '0.001'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
590
|
use charnames ':full'; |
|
2
|
|
|
|
|
22137
|
|
|
2
|
|
|
|
|
9
|
|
9
|
2
|
|
|
2
|
|
1007
|
use Regexp::CharClasses::Helper; |
|
2
|
|
|
|
|
1224
|
|
|
2
|
|
|
|
|
46
|
|
10
|
2
|
|
|
2
|
|
9
|
use Carp; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
413
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=pod |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=encoding utf8 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Lingua::AR::Regexp - Regular Expression character classes for Arabic |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use Lingua::AR::Regexp; |
24
|
|
|
|
|
|
|
use utf8; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$_ = 'جزئ'; |
27
|
|
|
|
|
|
|
say 'Has a Hamza' if /\p{Lingua::AR::Regexp::IsHamza}/; |
28
|
|
|
|
|
|
|
say 'Hamza fixed' if s/(?<=\p{Lingua::AR::Regexp::IsSplitting})ئ/ء/g; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 METHODS AND ARGUMENTS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=over 4 |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=item IsHamza |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Check whether character is or has a Hamza (Including maddas) |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub IsHamza { |
43
|
2
|
|
|
2
|
1
|
736
|
return Regexp::CharClasses::Helper::fmt( |
44
|
|
|
|
|
|
|
'+'.__PACKAGE__.'::IsHamzaMark', |
45
|
|
|
|
|
|
|
'+'.__PACKAGE__.'::IsLetterWithHamza', |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item IsTashkeel |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Check whether character is Tashkeel (short vowels) |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub IsTashkeel { |
56
|
1
|
|
|
1
|
1
|
159967
|
return Regexp::CharClasses::Helper::fmt( |
57
|
|
|
|
|
|
|
'+utf8::Mn', |
58
|
|
|
|
|
|
|
'&utf8::InArabic', |
59
|
|
|
|
|
|
|
'-'.__PACKAGE__.'::IsHamzaMark' |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item IsHamzaMark |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Check whether character is a Non spacing mark (C<\p{Mn}>) Hamza (Including maddas) |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub IsHamzaMark { |
70
|
3
|
|
|
3
|
1
|
1080
|
return Regexp::CharClasses::Helper::fmt( |
71
|
|
|
|
|
|
|
'ARABIC HAMZA ABOVE', |
72
|
|
|
|
|
|
|
'ARABIC MADDAH ABOVE', |
73
|
|
|
|
|
|
|
'ARABIC HAMZA BELOW', |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item IsLetterWithHamza |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Check whether character has a Hamza (Including maddas) |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub IsLetterWithHamza { |
84
|
2
|
|
|
2
|
1
|
538
|
return Regexp::CharClasses::Helper::fmt( |
85
|
|
|
|
|
|
|
'ARABIC LETTER WAW WITH HAMZA ABOVE', |
86
|
|
|
|
|
|
|
'ARABIC LETTER ALEF WITH MADDA ABOVE', |
87
|
|
|
|
|
|
|
'ARABIC LETTER ALEF WITH HAMZA ABOVE', |
88
|
|
|
|
|
|
|
'ARABIC LETTER ALEF WITH HAMZA BELOW', |
89
|
|
|
|
|
|
|
'ARABIC LETTER ALEF', |
90
|
|
|
|
|
|
|
'ARABIC LETTER YEH WITH HAMZA ABOVE', |
91
|
|
|
|
|
|
|
'ARABIC LETTER HAMZA', |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item IsSplitting |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Matches characters that break the horizontal stroke of the word. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub IsSplitting { |
102
|
2
|
|
|
2
|
1
|
2338
|
my $str = Regexp::CharClasses::Helper::fmt( |
103
|
|
|
|
|
|
|
'ARABIC LETTER DAL', |
104
|
|
|
|
|
|
|
'ARABIC LETTER THAL', |
105
|
|
|
|
|
|
|
'ARABIC LETTER REH', |
106
|
|
|
|
|
|
|
'ARABIC LETTER ZAIN', |
107
|
|
|
|
|
|
|
'ARABIC LETTER WAW', |
108
|
|
|
|
|
|
|
'ARABIC LETTER SEEN', |
109
|
|
|
|
|
|
|
'ARABIC LETTER WAW WITH HAMZA ABOVE', |
110
|
|
|
|
|
|
|
'ARABIC LETTER ALEF WITH MADDA ABOVE', |
111
|
|
|
|
|
|
|
'ARABIC LETTER ALEF WITH HAMZA ABOVE', |
112
|
|
|
|
|
|
|
'ARABIC LETTER ALEF WITH HAMZA BELOW', |
113
|
|
|
|
|
|
|
'ARABIC LETTER ALEF', |
114
|
|
|
|
|
|
|
); |
115
|
2
|
|
|
|
|
9965
|
return $str; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
123
|
|
|
|
|
|
|
__END__ |