| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# For Emacs: -*- mode:cperl; eval: (folding-mode 1); coding:utf-8 -*- |
|
2
|
|
|
|
|
|
|
package Lingua::YID::Word2Num; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: Word to number conversion in Yiddish |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
92793
|
use 5.16.0; |
|
|
1
|
|
|
|
|
4
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
13
|
|
|
7
|
1
|
|
|
1
|
|
20
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
56
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# {{{ use block |
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
481
|
use Export::Attrs; |
|
|
1
|
|
|
|
|
8644
|
|
|
|
1
|
|
|
|
|
7
|
|
|
12
|
1
|
|
|
1
|
|
1097
|
use Parse::RecDescent; |
|
|
1
|
|
|
|
|
32519
|
|
|
|
1
|
|
|
|
|
6
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# }}} |
|
15
|
|
|
|
|
|
|
# {{{ var block |
|
16
|
|
|
|
|
|
|
our $VERSION = '0.2603300'; |
|
17
|
|
|
|
|
|
|
my $parser = yid_numerals(); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# }}} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# {{{ w2n convert text to number |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub w2n :Export { |
|
24
|
5
|
|
100
|
5
|
1
|
197178
|
my $input = shift // return; |
|
25
|
|
|
|
|
|
|
|
|
26
|
4
|
|
|
|
|
46
|
return $parser->numeral($input); |
|
27
|
1
|
|
|
1
|
|
149
|
} |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
10
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# }}} |
|
30
|
|
|
|
|
|
|
# {{{ yid_numerals create parser for yiddish numerals |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub yid_numerals { |
|
33
|
1
|
|
|
1
|
1
|
6
|
return Parse::RecDescent->new(q{ |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
numeral: mega |
|
37
|
|
|
|
|
|
|
| kOhOd |
|
38
|
|
|
|
|
|
|
| { } |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
number: /דרײַצן/ { 13 } |
|
41
|
|
|
|
|
|
|
| /פערצן/ { 14 } |
|
42
|
|
|
|
|
|
|
| /פופצן/ { 15 } |
|
43
|
|
|
|
|
|
|
| /זעכצן/ { 16 } |
|
44
|
|
|
|
|
|
|
| /זיבעצן/ { 17 } |
|
45
|
|
|
|
|
|
|
| /אַכצן/ { 18 } |
|
46
|
|
|
|
|
|
|
| /נײַנצן/ { 19 } |
|
47
|
|
|
|
|
|
|
| /נול/ { 0 } |
|
48
|
|
|
|
|
|
|
| /אײנס?/ { 1 } |
|
49
|
|
|
|
|
|
|
| /צװײ/ { 2 } |
|
50
|
|
|
|
|
|
|
| /דרײַ/ { 3 } |
|
51
|
|
|
|
|
|
|
| /פֿיר/ { 4 } |
|
52
|
|
|
|
|
|
|
| /פֿינף/ { 5 } |
|
53
|
|
|
|
|
|
|
| /זעקס/ { 6 } |
|
54
|
|
|
|
|
|
|
| /זיבן/ { 7 } |
|
55
|
|
|
|
|
|
|
| /אכט/ { 8 } |
|
56
|
|
|
|
|
|
|
| /נײַן/ { 9 } |
|
57
|
|
|
|
|
|
|
| /צען/ { 10 } |
|
58
|
|
|
|
|
|
|
| /עלף/ { 11 } |
|
59
|
|
|
|
|
|
|
| /צוועלף/ { 12 } |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
tens: /צוואַנציק/ { 20 } |
|
62
|
|
|
|
|
|
|
| /דרײַסיק/ { 30 } |
|
63
|
|
|
|
|
|
|
| /פערציק/ { 40 } |
|
64
|
|
|
|
|
|
|
| /פופציק/ { 50 } |
|
65
|
|
|
|
|
|
|
| /זעכציק/ { 60 } |
|
66
|
|
|
|
|
|
|
| /זיבעציק/ { 70 } |
|
67
|
|
|
|
|
|
|
| /אַכציק/ { 80 } |
|
68
|
|
|
|
|
|
|
| /נײַנציק/ { 90 } |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
deca: /און/ deca { $item[2] } |
|
71
|
|
|
|
|
|
|
| number /און/ tens { $item[1] + $item[3] } |
|
72
|
|
|
|
|
|
|
| tens |
|
73
|
|
|
|
|
|
|
| number |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
hecto: number /הונדערט/ deca { $item[1] * 100 + $item[3] } |
|
76
|
|
|
|
|
|
|
| number /הונדערט/ { $item[1] * 100 } |
|
77
|
|
|
|
|
|
|
| /הונדערט/ { 100 } |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
hOd: hecto |
|
80
|
|
|
|
|
|
|
| deca |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
kilo: hOd /טויזנט/ hOd { $item[1] * 1000 + $item[3] } |
|
83
|
|
|
|
|
|
|
| hOd /טויזנט/ { $item[1] * 1000 } |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
kOhOd: kilo |
|
86
|
|
|
|
|
|
|
| hOd |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
mega: hOd /מיליאָן/ kOhOd { $item[1] * 1_000_000 + $item[3] } |
|
89
|
|
|
|
|
|
|
| hOd /מיליאָן/ { $item[1] * 1_000_000 } |
|
90
|
|
|
|
|
|
|
}); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# }}} |
|
94
|
|
|
|
|
|
|
# {{{ ordinal2cardinal convert ordinal text to cardinal text |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub ordinal2cardinal :Export { |
|
97
|
0
|
|
0
|
0
|
1
|
|
my $input = shift // return; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# Inverse of Yiddish ordinal morphology: restore cardinal from ordinal text. |
|
100
|
|
|
|
|
|
|
# Parser expects: אײנס (1), צװײ (2), דרײַ (3), זיבן (7), אכט (8) |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# Irregulars (standalone or as final element of compound) |
|
103
|
0
|
0
|
|
|
|
|
$input =~ s{ערשטער\z}{אײנס}xms and return $input; |
|
104
|
0
|
0
|
|
|
|
|
$input =~ s{צווייטער\z}{צװײ}xms and return $input; |
|
105
|
0
|
0
|
|
|
|
|
$input =~ s{דריטער\z}{דרײַ}xms and return $input; |
|
106
|
0
|
0
|
|
|
|
|
$input =~ s{זעקסטער\z}{זעקס}xms and return $input; # 6th: stem 's' consumed by -סטער |
|
107
|
0
|
0
|
|
|
|
|
$input =~ s{זיבעטער\z}{זיבן}xms and return $input; |
|
108
|
0
|
0
|
|
|
|
|
$input =~ s{אַכטער\z}{אכט}xms and return $input; |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# Teens: ordinal stem differs from parser expectation |
|
111
|
0
|
0
|
|
|
|
|
$input =~ s{פֿירצנטער\z}{פערצן}xms and return $input; # 14th: פֿירצן→פערצן for parser |
|
112
|
0
|
0
|
|
|
|
|
$input =~ s{דרײַצנטער\z}{דרײַצן}xms and return $input; # 13th |
|
113
|
0
|
0
|
|
|
|
|
$input =~ s{פֿינפצנטער\z}{פופצן}xms and return $input; # 15th: פֿינפצן→פופצן for parser |
|
114
|
0
|
0
|
|
|
|
|
$input =~ s{זעכצנטער\z}{זעכצן}xms and return $input; # 16th |
|
115
|
0
|
0
|
|
|
|
|
$input =~ s{זיבעצנטער\z}{זיבעצן}xms and return $input; # 17th |
|
116
|
0
|
0
|
|
|
|
|
$input =~ s{אכטצנטער\z}{אַכצן}xms and return $input; # 18th: אכטצן→אַכצן for parser |
|
117
|
0
|
0
|
|
|
|
|
$input =~ s{נײַנצנטער\z}{נײַנצן}xms and return $input; # 19th |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# Regular: strip סטער (20+) |
|
120
|
0
|
0
|
|
|
|
|
$input =~ s{סטער\z}{}xms and return $input; |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
# Regular: strip טער (4-19) |
|
123
|
0
|
0
|
|
|
|
|
$input =~ s{טער\z}{}xms and return $input; |
|
124
|
|
|
|
|
|
|
|
|
125
|
0
|
|
|
|
|
|
return; # not an ordinal |
|
126
|
1
|
|
|
1
|
|
640
|
} |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# }}} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
1; |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
__END__ |