line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: Hyphenate.pm,v 1.5 2002/07/23 17:45:23 engin Exp $ |
2
|
|
|
|
|
|
|
# Copyright © 2002 Engin Gunduz. All Rights Reserved. |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Lingua::TR::Hyphenate; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6482
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
7
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
1831
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require Exporter; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
15
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
16
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# This allows declaration use Lingua::TR::Hyphenate ':all'; |
19
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
20
|
|
|
|
|
|
|
# will save memory. |
21
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
) ] ); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our @EXPORT = qw( |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# An array and a hash for vowels. They will be used in |
33
|
|
|
|
|
|
|
# FSM implementation. |
34
|
|
|
|
|
|
|
my @sesliler=('a','â','e','ý','i','o','ö','u','ü', |
35
|
|
|
|
|
|
|
'A', 'E','I','Ý','O','Ö','U','Ü'); |
36
|
|
|
|
|
|
|
my %sesliler=('a'=>1,'â'=>1,'e'=>1,'ý'=>1,'i'=>1,'o'=>1,'ö'=>1,'u'=>1,'ü'=>1, |
37
|
|
|
|
|
|
|
'A'=>1, 'E'=>1,'I'=>1,'Ý'=>1,'O'=>1,'Ö'=>1,'U'=>1,'Ü'=>1); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# sub hyphenate takes a word to be hyphenated. |
42
|
|
|
|
|
|
|
# returns hyphenated word or syllable array, or |
43
|
|
|
|
|
|
|
# undef if the word can't be hyphenated. |
44
|
|
|
|
|
|
|
sub hyphenate{ |
45
|
3
|
|
|
3
|
0
|
226
|
my $string = shift; |
46
|
3
|
|
|
|
|
5
|
my $attr = shift; |
47
|
3
|
|
|
|
|
4
|
my $separator = '.'; # default separator |
48
|
3
|
100
|
|
|
|
10
|
if(ref $attr) { |
49
|
1
|
50
|
|
|
|
6
|
if(defined($attr->{Separator})){ |
50
|
1
|
|
|
|
|
2
|
$separator = $attr->{Separator}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
3
|
|
|
|
|
16
|
my @harfler= split('',$string); |
55
|
3
|
|
|
|
|
8
|
my @heceler = (); |
56
|
3
|
|
|
|
|
3
|
my $pos = 0; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Here is the implementation of the finite state machine |
59
|
3
|
|
|
|
|
5
|
my $state = 'STATE_NULL'; |
60
|
3
|
|
|
|
|
11
|
while($pos <= length($string)){ |
61
|
22
|
100
|
|
|
|
40
|
if($state eq 'STATE_NULL'){ |
62
|
3
|
50
|
|
|
|
9
|
if(defined($sesliler{$harfler[$pos]})){ |
63
|
0
|
|
|
|
|
0
|
$pos++; |
64
|
0
|
|
|
|
|
0
|
$state = 'STATE_V'; |
65
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
66
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-1]; |
67
|
0
|
|
|
|
|
0
|
last; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
}else{ |
70
|
3
|
|
|
|
|
5
|
$pos++; |
71
|
3
|
|
|
|
|
4
|
$state = 'STATE_C'; |
72
|
3
|
50
|
|
|
|
9
|
if($pos == length($string)){ |
73
|
|
|
|
|
|
|
#print STDERR "impos: $string\n"; |
74
|
0
|
|
|
|
|
0
|
return undef; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
3
|
|
|
|
|
9
|
next; |
78
|
|
|
|
|
|
|
} |
79
|
19
|
100
|
|
|
|
40
|
if($state eq 'STATE_C'){ |
80
|
3
|
100
|
|
|
|
8
|
if($sesliler{$harfler[$pos]}){ |
81
|
2
|
|
|
|
|
3
|
$pos++; |
82
|
2
|
|
|
|
|
4
|
$state = 'STATE_CV'; |
83
|
2
|
50
|
|
|
|
6
|
if($pos == length($string)){ |
84
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-2].$harfler[$pos-1]; |
85
|
0
|
|
|
|
|
0
|
last; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
}else{ |
88
|
1
|
|
|
|
|
2
|
$pos++; |
89
|
1
|
|
|
|
|
2
|
$state = 'STATE_CC'; |
90
|
1
|
50
|
|
|
|
3
|
if($pos == length($string)){ |
91
|
|
|
|
|
|
|
#print STDERR "impos: $string\n"; |
92
|
0
|
|
|
|
|
0
|
return undef; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
3
|
|
|
|
|
6
|
next; |
96
|
|
|
|
|
|
|
} |
97
|
16
|
100
|
|
|
|
29
|
if($state eq 'STATE_CC'){ |
98
|
1
|
50
|
|
|
|
4
|
if($sesliler{$harfler[$pos]}){ |
99
|
0
|
|
|
|
|
0
|
$pos++; |
100
|
0
|
|
|
|
|
0
|
$state = 'STATE_CCV'; |
101
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
102
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-3].$harfler[$pos-2].$harfler[$pos-1]; |
103
|
0
|
|
|
|
|
0
|
last; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
}else{ |
106
|
1
|
|
|
|
|
9
|
$pos++; |
107
|
|
|
|
|
|
|
#print STDERR "impos: $string\n"; |
108
|
1
|
|
|
|
|
4
|
return undef; |
109
|
|
|
|
|
|
|
} |
110
|
0
|
|
|
|
|
0
|
next; |
111
|
|
|
|
|
|
|
} |
112
|
15
|
50
|
|
|
|
41
|
if($state eq 'STATE_CCV'){ |
113
|
0
|
0
|
|
|
|
0
|
if($sesliler{$harfler[$pos]}){ |
114
|
0
|
|
|
|
|
0
|
$pos++; |
115
|
0
|
|
|
|
|
0
|
$state = 'STATE_V'; |
116
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-4].$harfler[$pos-3].$harfler[$pos-2]; |
117
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
118
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-1]; |
119
|
0
|
|
|
|
|
0
|
last; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
}else{ |
122
|
0
|
|
|
|
|
0
|
$pos++; |
123
|
0
|
|
|
|
|
0
|
$state = 'STATE_CCVC'; |
124
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
125
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-4].$harfler[$pos-3].$harfler[$pos-2].$harfler[$pos-1]; |
126
|
0
|
|
|
|
|
0
|
last; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
} |
129
|
0
|
|
|
|
|
0
|
next; |
130
|
|
|
|
|
|
|
} |
131
|
15
|
50
|
|
|
|
28
|
if($state eq 'STATE_CCVC'){ |
132
|
0
|
0
|
|
|
|
0
|
if($sesliler{$harfler[$pos]}){ |
133
|
0
|
|
|
|
|
0
|
$pos++; |
134
|
0
|
|
|
|
|
0
|
$state = 'STATE_CV'; |
135
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-5].$harfler[$pos-4].$harfler[$pos-3]; |
136
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
137
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-2].$harfler[$pos-1]; |
138
|
0
|
|
|
|
|
0
|
last; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
}else{ |
141
|
0
|
|
|
|
|
0
|
$pos++; |
142
|
0
|
|
|
|
|
0
|
$state = 'STATE_CCVCC'; |
143
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
144
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-5].$harfler[$pos-4].$harfler[$pos-3].$harfler[$pos-2].$harfler[$pos-1]; |
145
|
0
|
|
|
|
|
0
|
last; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
} |
148
|
0
|
|
|
|
|
0
|
next; |
149
|
|
|
|
|
|
|
} |
150
|
15
|
50
|
|
|
|
27
|
if($state eq 'STATE_CCVCC'){ |
151
|
0
|
0
|
|
|
|
0
|
if($sesliler{$harfler[$pos]}){ |
152
|
0
|
|
|
|
|
0
|
$pos++; |
153
|
0
|
|
|
|
|
0
|
$state = 'STATE_CV'; |
154
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-6].$harfler[$pos-5].$harfler[$pos-4].$harfler[$pos-3]; |
155
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
156
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-2].$harfler[$pos-1]; |
157
|
0
|
|
|
|
|
0
|
last; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
}else{ |
160
|
0
|
|
|
|
|
0
|
$pos++; |
161
|
0
|
|
|
|
|
0
|
$state = 'STATE_CCVCCC'; |
162
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
163
|
|
|
|
|
|
|
#print STDERR "impos: $string\n"; |
164
|
0
|
|
|
|
|
0
|
return undef; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
} |
167
|
0
|
|
|
|
|
0
|
next; |
168
|
|
|
|
|
|
|
} |
169
|
15
|
50
|
|
|
|
27
|
if($state eq 'STATE_CCVCCC'){ |
170
|
0
|
0
|
|
|
|
0
|
if($sesliler{$harfler[$pos]}){ |
171
|
0
|
|
|
|
|
0
|
$pos++; |
172
|
0
|
|
|
|
|
0
|
$state = 'STATE_CV'; |
173
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-7].$harfler[$pos-6].$harfler[$pos-5].$harfler[$pos-4].$harfler[$pos-3]; |
174
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
175
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-2].$harfler[$pos-1]; |
176
|
0
|
|
|
|
|
0
|
last; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
}else{ |
179
|
0
|
|
|
|
|
0
|
$pos++; |
180
|
0
|
|
|
|
|
0
|
$state = 'STATE_CC'; |
181
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-7].$harfler[$pos-6].$harfler[$pos-5].$harfler[$pos-4].$harfler[$pos-3]; |
182
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
183
|
|
|
|
|
|
|
#print STDERR "impos: $string\n"; |
184
|
0
|
|
|
|
|
0
|
return undef; |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
} |
187
|
0
|
|
|
|
|
0
|
next; |
188
|
|
|
|
|
|
|
} |
189
|
15
|
100
|
|
|
|
27
|
if($state eq 'STATE_CV'){ |
190
|
7
|
50
|
|
|
|
17
|
if($sesliler{$harfler[$pos]}){ |
191
|
0
|
|
|
|
|
0
|
$pos++; |
192
|
0
|
|
|
|
|
0
|
$state = 'STATE_V'; |
193
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-3].$harfler[$pos-2]; |
194
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
195
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-1]; |
196
|
0
|
|
|
|
|
0
|
last; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
}else{ |
199
|
7
|
|
|
|
|
8
|
$pos++; |
200
|
7
|
|
|
|
|
8
|
$state = 'STATE_CVC'; |
201
|
7
|
100
|
|
|
|
17
|
if($pos == length($string)){ |
202
|
1
|
|
|
|
|
4
|
push @heceler, $harfler[$pos-3].$harfler[$pos-2].$harfler[$pos-1]; |
203
|
1
|
|
|
|
|
2
|
last; |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
} |
206
|
6
|
|
|
|
|
15
|
next; |
207
|
|
|
|
|
|
|
} |
208
|
8
|
100
|
|
|
|
18
|
if($state eq 'STATE_CVC'){ |
209
|
|
|
|
|
|
|
#print STDERR "\$pos = $pos\n"; |
210
|
6
|
100
|
|
|
|
23
|
if($sesliler{$harfler[$pos]}){ |
211
|
4
|
|
|
|
|
6
|
$pos++; |
212
|
4
|
|
|
|
|
6
|
$state = 'STATE_CV'; |
213
|
4
|
|
|
|
|
12
|
push @heceler, $harfler[$pos-4].$harfler[$pos-3]; |
214
|
4
|
100
|
|
|
|
13
|
if($pos == length($string)){ |
215
|
1
|
|
|
|
|
4
|
push @heceler, $harfler[$pos-2].$harfler[$pos-1]; |
216
|
1
|
|
|
|
|
1
|
last; |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
}else{ |
219
|
2
|
|
|
|
|
3
|
$pos++; |
220
|
2
|
|
|
|
|
4
|
$state = 'STATE_CVCC'; |
221
|
2
|
50
|
|
|
|
7
|
if($pos == length($string)){ |
222
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-4].$harfler[$pos-3].$harfler[$pos-2].$harfler[$pos-1]; |
223
|
0
|
|
|
|
|
0
|
last; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
} |
226
|
5
|
|
|
|
|
12
|
next; |
227
|
|
|
|
|
|
|
} |
228
|
2
|
50
|
|
|
|
7
|
if($state eq 'STATE_CVCC'){ |
229
|
2
|
50
|
|
|
|
5
|
if($sesliler{$harfler[$pos]}){ |
230
|
2
|
|
|
|
|
4
|
$pos++; |
231
|
2
|
|
|
|
|
4
|
$state = 'STATE_CV'; |
232
|
2
|
|
|
|
|
8
|
push @heceler, $harfler[$pos-5].$harfler[$pos-4].$harfler[$pos-3]; |
233
|
2
|
50
|
|
|
|
6
|
if($pos == length($string)){ |
234
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-2].$harfler[$pos-1]; |
235
|
0
|
|
|
|
|
0
|
last; |
236
|
|
|
|
|
|
|
} |
237
|
|
|
|
|
|
|
}else{ |
238
|
0
|
|
|
|
|
0
|
$pos++; |
239
|
0
|
|
|
|
|
0
|
$state = 'STATE_CVCCC'; |
240
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
241
|
|
|
|
|
|
|
#print STDERR "impos: $string\n"; |
242
|
0
|
|
|
|
|
0
|
return undef; |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
} |
245
|
2
|
|
|
|
|
5
|
next; |
246
|
|
|
|
|
|
|
} |
247
|
0
|
0
|
|
|
|
0
|
if($state eq 'STATE_CVCCC'){ |
248
|
0
|
0
|
|
|
|
0
|
if($sesliler{$harfler[$pos]}){ |
249
|
0
|
|
|
|
|
0
|
$pos++; |
250
|
0
|
|
|
|
|
0
|
$state = 'STATE_CV'; |
251
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-6].$harfler[$pos-5].$harfler[$pos-4].$harfler[$pos-3]; |
252
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
253
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-2].$harfler[$pos-1]; |
254
|
0
|
|
|
|
|
0
|
last; |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
}else{ |
257
|
0
|
|
|
|
|
0
|
$pos++; |
258
|
|
|
|
|
|
|
#print STDERR "impos: $string\n"; |
259
|
0
|
|
|
|
|
0
|
return undef; |
260
|
|
|
|
|
|
|
} |
261
|
0
|
|
|
|
|
0
|
next; |
262
|
|
|
|
|
|
|
} |
263
|
0
|
0
|
|
|
|
0
|
if($state eq 'STATE_V'){ |
264
|
0
|
0
|
|
|
|
0
|
if($sesliler{$harfler[$pos]}){ |
265
|
0
|
|
|
|
|
0
|
$pos++; |
266
|
0
|
|
|
|
|
0
|
$state = 'STATE_V'; |
267
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-2]; |
268
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
269
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-1]; |
270
|
0
|
|
|
|
|
0
|
last; |
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
}else{ |
273
|
0
|
|
|
|
|
0
|
$pos++; |
274
|
0
|
|
|
|
|
0
|
$state = 'STATE_VC'; |
275
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
276
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-2].$harfler[$pos-1]; |
277
|
0
|
|
|
|
|
0
|
last; |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
} |
280
|
0
|
|
|
|
|
0
|
next; |
281
|
|
|
|
|
|
|
} |
282
|
0
|
0
|
|
|
|
0
|
if($state eq 'STATE_VC'){ |
283
|
0
|
0
|
|
|
|
0
|
if($sesliler{$harfler[$pos]}){ |
284
|
0
|
|
|
|
|
0
|
$pos++; |
285
|
0
|
|
|
|
|
0
|
$state = 'STATE_CV'; |
286
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-3]; |
287
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
288
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-2].$harfler[$pos-1]; |
289
|
0
|
|
|
|
|
0
|
last; |
290
|
|
|
|
|
|
|
} |
291
|
|
|
|
|
|
|
}else{ |
292
|
0
|
|
|
|
|
0
|
$pos++; |
293
|
0
|
|
|
|
|
0
|
$state = 'STATE_VCC'; |
294
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
295
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-3].$harfler[$pos-2].$harfler[$pos-1]; |
296
|
0
|
|
|
|
|
0
|
last; |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
} |
299
|
0
|
|
|
|
|
0
|
next; |
300
|
|
|
|
|
|
|
} |
301
|
0
|
0
|
|
|
|
0
|
if($state eq 'STATE_VCC'){ |
302
|
0
|
0
|
|
|
|
0
|
if($sesliler{$harfler[$pos]}){ |
303
|
0
|
|
|
|
|
0
|
$pos++; |
304
|
0
|
|
|
|
|
0
|
$state = 'STATE_CV'; |
305
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-4].$harfler[$pos-3]; |
306
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
307
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-2].$harfler[$pos-1]; |
308
|
0
|
|
|
|
|
0
|
last; |
309
|
|
|
|
|
|
|
} |
310
|
|
|
|
|
|
|
}else{ |
311
|
0
|
|
|
|
|
0
|
$pos++; |
312
|
0
|
|
|
|
|
0
|
$state = 'STATE_VCCC'; |
313
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
314
|
|
|
|
|
|
|
#print STDERR "impos: $string\n"; |
315
|
0
|
|
|
|
|
0
|
return undef; |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
} |
318
|
0
|
|
|
|
|
0
|
next; |
319
|
|
|
|
|
|
|
} |
320
|
0
|
0
|
|
|
|
0
|
if($state eq 'STATE_VCCC'){ |
321
|
0
|
0
|
|
|
|
0
|
if($sesliler{$harfler[$pos]}){ |
322
|
0
|
|
|
|
|
0
|
$pos++; |
323
|
0
|
|
|
|
|
0
|
$state = 'STATE_CV'; |
324
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-5].$harfler[$pos-4].$harfler[$pos-3]; |
325
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
326
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-2].$harfler[$pos-1]; |
327
|
0
|
|
|
|
|
0
|
last; |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
}else{ |
330
|
0
|
|
|
|
|
0
|
$pos++; |
331
|
0
|
|
|
|
|
0
|
$state = 'STATE_VCCCC'; |
332
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
333
|
|
|
|
|
|
|
#print STDERR "impos: $string\n"; |
334
|
0
|
|
|
|
|
0
|
return undef; |
335
|
|
|
|
|
|
|
} |
336
|
|
|
|
|
|
|
} |
337
|
0
|
|
|
|
|
0
|
next; |
338
|
|
|
|
|
|
|
} |
339
|
0
|
0
|
|
|
|
0
|
if($state eq 'STATE_VCCCC'){ |
340
|
0
|
0
|
|
|
|
0
|
if($sesliler{$harfler[$pos]}){ |
341
|
0
|
|
|
|
|
0
|
$pos++; |
342
|
0
|
|
|
|
|
0
|
$state = 'STATE_CCV'; |
343
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-6].$harfler[$pos-5].$harfler[$pos-4]; |
344
|
0
|
0
|
|
|
|
0
|
if($pos == length($string)){ |
345
|
0
|
|
|
|
|
0
|
push @heceler, $harfler[$pos-3].$harfler[$pos-2].$harfler[$pos-1]; |
346
|
0
|
|
|
|
|
0
|
last; |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
}else{ |
349
|
0
|
|
|
|
|
0
|
$pos++; |
350
|
|
|
|
|
|
|
#print STDERR "impos: $string\n"; |
351
|
0
|
|
|
|
|
0
|
return undef; |
352
|
|
|
|
|
|
|
} |
353
|
0
|
|
|
|
|
0
|
next; |
354
|
|
|
|
|
|
|
} |
355
|
|
|
|
|
|
|
} |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
# if we were called in list context, return the syllable list. |
358
|
|
|
|
|
|
|
# Otherwise, first convert to a string. |
359
|
2
|
100
|
|
|
|
29
|
if(wantarray){ |
360
|
|
|
|
|
|
|
|
361
|
1
|
|
|
|
|
8
|
return @heceler; |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
}else{ |
364
|
|
|
|
|
|
|
|
365
|
1
|
|
|
|
|
15
|
return join($separator,@heceler); |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
} |
368
|
|
|
|
|
|
|
} |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
1; |
371
|
|
|
|
|
|
|
__END__ |