| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# For Emacs: -*- mode:cperl; eval: (folding-mode 1); coding:utf-8 -*- |
|
2
|
|
|
|
|
|
|
package Lingua::SOM::Word2Num; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: Word to number conversion in Somali |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
153044
|
use 5.16.0; |
|
|
1
|
|
|
|
|
4
|
|
|
6
|
1
|
|
|
1
|
|
8
|
use utf8; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
14
|
|
|
7
|
1
|
|
|
1
|
|
34
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
75
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# {{{ use block |
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
690
|
use Export::Attrs; |
|
|
1
|
|
|
|
|
12996
|
|
|
|
1
|
|
|
|
|
9
|
|
|
12
|
1
|
|
|
1
|
|
1462
|
use Parse::RecDescent; |
|
|
1
|
|
|
|
|
58674
|
|
|
|
1
|
|
|
|
|
12
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# }}} |
|
15
|
|
|
|
|
|
|
# {{{ var block |
|
16
|
|
|
|
|
|
|
our $VERSION = '0.2603300'; |
|
17
|
|
|
|
|
|
|
my $parser = som_numerals(); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# }}} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# {{{ w2n convert text to number |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub w2n :Export { |
|
24
|
2
|
|
100
|
2
|
1
|
205642
|
my $input = shift // return; |
|
25
|
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
3
|
$input =~ s/\s+/ /g; |
|
27
|
1
|
|
|
|
|
4
|
$input =~ s/^\s+|\s+$//g; |
|
28
|
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
29
|
return $parser->numeral($input); |
|
30
|
1
|
|
|
1
|
|
233
|
} |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
10
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# }}} |
|
33
|
|
|
|
|
|
|
# {{{ som_numerals create parser for somali numerals |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub som_numerals { |
|
36
|
1
|
|
|
1
|
1
|
5
|
return Parse::RecDescent->new(q{ |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
numeral: mega |
|
40
|
|
|
|
|
|
|
| kOhOd |
|
41
|
|
|
|
|
|
|
| { } |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
number: 'eber' { 0 } |
|
44
|
|
|
|
|
|
|
| /k[oó]w/ { 1 } |
|
45
|
|
|
|
|
|
|
| /koób/ { 1 } |
|
46
|
|
|
|
|
|
|
| /l[aá]ba/ { 2 } |
|
47
|
|
|
|
|
|
|
| /lab[aá]/ { 2 } |
|
48
|
|
|
|
|
|
|
| /s[aá]ddex/ { 3 } |
|
49
|
|
|
|
|
|
|
| /[aá]far/ { 4 } |
|
50
|
|
|
|
|
|
|
| /sh[aá]n/ { 5 } |
|
51
|
|
|
|
|
|
|
| /l[ií]x/ { 6 } |
|
52
|
|
|
|
|
|
|
| /toddob[aá]/ { 7 } |
|
53
|
|
|
|
|
|
|
| /sidd[eé][eé]d/ { 8 } |
|
54
|
|
|
|
|
|
|
| /saga[aá]l/ { 9 } |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
tens: /laba[aá]tan/ { 20 } |
|
57
|
|
|
|
|
|
|
| /s[oó]ddon/ { 30 } |
|
58
|
|
|
|
|
|
|
| /af[aá]rtan/ { 40 } |
|
59
|
|
|
|
|
|
|
| /k[oó]nton/ { 50 } |
|
60
|
|
|
|
|
|
|
| /l[ií]xdan/ { 60 } |
|
61
|
|
|
|
|
|
|
| /toddoba[aá]tan/ { 70 } |
|
62
|
|
|
|
|
|
|
| /sidde[eé]tan/ { 80 } |
|
63
|
|
|
|
|
|
|
| /saga[aá]shan/ { 90 } |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
deca: number 'iyo' tens { $item[1] + $item[3] } |
|
66
|
|
|
|
|
|
|
| number 'iyo' 'toban' { $item[1] + 10 } |
|
67
|
|
|
|
|
|
|
| tens |
|
68
|
|
|
|
|
|
|
| 'toban' { 10 } |
|
69
|
|
|
|
|
|
|
| number |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
hecto: number /boq[oó]l/ 'iyo' deca { $item[1] * 100 + $item[4] } |
|
72
|
|
|
|
|
|
|
| number /boq[oó]l/ { $item[1] * 100 } |
|
73
|
|
|
|
|
|
|
| /boq[oó]l/ 'iyo' deca { 100 + $item[3] } |
|
74
|
|
|
|
|
|
|
| /boq[oó]l/ { 100 } |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
hOd: hecto |
|
77
|
|
|
|
|
|
|
| deca |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
kilo: hOd /k[uú]n/ 'iyo' hOd { $item[1] * 1000 + $item[4] } |
|
80
|
|
|
|
|
|
|
| hOd /k[uú]n/ { $item[1] * 1000 } |
|
81
|
|
|
|
|
|
|
| /k[uú]n/ 'iyo' hOd { 1000 + $item[3] } |
|
82
|
|
|
|
|
|
|
| /k[uú]n/ { 1000 } |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
kOhOd: kilo |
|
85
|
|
|
|
|
|
|
| hOd |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
mega: hOd /maly[uú]un/ 'iyo' kOhOd { $item[1] * 1_000_000 + $item[4] } |
|
88
|
|
|
|
|
|
|
| hOd /maly[uú]un/ { $item[1] * 1_000_000 } |
|
89
|
|
|
|
|
|
|
| /maly[uú]un/ 'iyo' kOhOd { 1_000_000 + $item[3] } |
|
90
|
|
|
|
|
|
|
| /maly[uú]un/ { 1_000_000 } |
|
91
|
|
|
|
|
|
|
}); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# }}} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__END__ |