line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Parse::Date::Month::ID; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2018-06-16'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.001'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
57038
|
use 5.010001; |
|
1
|
|
|
|
|
12
|
|
7
|
1
|
|
|
1
|
|
14
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
8
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
274
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require Exporter; |
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw(parse_date_month_id $Pat); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our %month_values = ( |
15
|
|
|
|
|
|
|
jan => 1, |
16
|
|
|
|
|
|
|
januari => 1, |
17
|
|
|
|
|
|
|
january => 1, |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
feb => 2, |
20
|
|
|
|
|
|
|
peb => 2, |
21
|
|
|
|
|
|
|
februari => 2, |
22
|
|
|
|
|
|
|
pebruari => 2, |
23
|
|
|
|
|
|
|
february => 2, |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
mar => 3, |
26
|
|
|
|
|
|
|
mrt => 3, |
27
|
|
|
|
|
|
|
maret => 3, |
28
|
|
|
|
|
|
|
march => 3, |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
apr => 4, |
31
|
|
|
|
|
|
|
april => 4, |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
mei => 5, |
34
|
|
|
|
|
|
|
may => 5, |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
jun => 6, |
37
|
|
|
|
|
|
|
juni => 6, |
38
|
|
|
|
|
|
|
june => 6, |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
jul => 7, |
41
|
|
|
|
|
|
|
juli => 7, |
42
|
|
|
|
|
|
|
july => 7, |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
agu => 8, |
45
|
|
|
|
|
|
|
aug => 8, |
46
|
|
|
|
|
|
|
agt => 8, |
47
|
|
|
|
|
|
|
agustus => 8, |
48
|
|
|
|
|
|
|
august => 8, |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sep => 9, |
51
|
|
|
|
|
|
|
sept => 9, |
52
|
|
|
|
|
|
|
september => 9, |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
okt => 10, |
55
|
|
|
|
|
|
|
oct => 10, |
56
|
|
|
|
|
|
|
oktober => 10, |
57
|
|
|
|
|
|
|
october => 10, |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
nov => 11, |
60
|
|
|
|
|
|
|
nop => 11, |
61
|
|
|
|
|
|
|
november => 11, |
62
|
|
|
|
|
|
|
nopember => 11, |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
des => 12, |
65
|
|
|
|
|
|
|
dec => 12, |
66
|
|
|
|
|
|
|
desember => 12, |
67
|
|
|
|
|
|
|
december => 12, |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
our $Pat = join("|", sort keys %month_values); $Pat = qr/(?:$Pat)/; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
our %SPEC; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$SPEC{parse_date_month_id} = { |
75
|
|
|
|
|
|
|
v => 1.1, |
76
|
|
|
|
|
|
|
summary => 'Parse month name from Indonesian text', |
77
|
|
|
|
|
|
|
description => <<'_', |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Returns undef when month name is unrecognized. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
_ |
82
|
|
|
|
|
|
|
args => { |
83
|
|
|
|
|
|
|
text => { |
84
|
|
|
|
|
|
|
summary => 'The input text that contains month name', |
85
|
|
|
|
|
|
|
schema => 'str*', |
86
|
|
|
|
|
|
|
pos => 0, |
87
|
|
|
|
|
|
|
req => 1, |
88
|
|
|
|
|
|
|
}, |
89
|
|
|
|
|
|
|
}, |
90
|
|
|
|
|
|
|
result_naked => 1, |
91
|
|
|
|
|
|
|
}; |
92
|
|
|
|
|
|
|
sub parse_date_month_id { |
93
|
3
|
|
|
3
|
1
|
94
|
my %args = @_; |
94
|
3
|
|
|
|
|
5
|
my $text = $args{text}; |
95
|
|
|
|
|
|
|
|
96
|
3
|
|
|
|
|
9
|
$text =~ s/^\s+//s; |
97
|
3
|
50
|
|
|
|
8
|
return undef unless length($text); |
98
|
|
|
|
|
|
|
|
99
|
3
|
|
|
|
|
15
|
$month_values{lc $text}; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
# ABSTRACT: Parse month name from Indonesian text |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
__END__ |