line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- Mode: Perl -*- |
2
|
|
|
|
|
|
|
# Vorsilbe.pm -- |
3
|
|
|
|
|
|
|
# Author : Ulrich Pfeifer |
4
|
|
|
|
|
|
|
# Created On : Thu Feb 1 09:10:48 1996 |
5
|
|
|
|
|
|
|
# Last Modified By: Ulrich Pfeifer |
6
|
|
|
|
|
|
|
# Last Modified On: Sun Apr 3 11:44:42 2005 |
7
|
|
|
|
|
|
|
# Language : Perl |
8
|
|
|
|
|
|
|
# Update Count : 23 |
9
|
|
|
|
|
|
|
# Status : Unknown, Use with caution! |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package Text::German::Vorsilbe; |
12
|
|
|
|
|
|
|
# require Exporter; |
13
|
|
|
|
|
|
|
# @ISA = qw(Exporter); |
14
|
|
|
|
|
|
|
# @EXPORT = qw(%VORSILBE); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
{ |
17
|
|
|
|
|
|
|
local ($_); |
18
|
|
|
|
|
|
|
while () { |
19
|
|
|
|
|
|
|
chomp; |
20
|
|
|
|
|
|
|
($vorsilbe, $key) = split; |
21
|
|
|
|
|
|
|
$VORSILBE{$vorsilbe} = pack 'b*', $key; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
close DATA; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub vorsilben { |
27
|
0
|
|
|
0
|
0
|
0
|
my $word = shift; |
28
|
0
|
|
|
|
|
0
|
my @result; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
0
|
for $i (1 .. length($word)) { |
31
|
0
|
|
|
|
|
0
|
my $vorsilbe = substr($word,0,$i); |
32
|
0
|
0
|
|
|
|
0
|
if (defined $VORSILBE{$vorsilbe}) { |
33
|
0
|
|
|
|
|
0
|
push @result, $vorsilbe; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
0
|
|
|
|
|
0
|
@result; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub max_vorsilbe { |
40
|
28
|
|
|
28
|
0
|
33
|
my $word = shift; |
41
|
28
|
|
|
|
|
31
|
my $result = undef; |
42
|
|
|
|
|
|
|
|
43
|
28
|
|
|
|
|
59
|
for $i (1 .. length($word)) { |
44
|
300
|
|
|
|
|
384
|
my $vorsilbe = substr($word,0,$i); |
45
|
300
|
100
|
|
|
|
676
|
if (defined $VORSILBE{$vorsilbe}) { |
46
|
4
|
50
|
33
|
|
|
26
|
$result = $vorsilbe |
47
|
|
|
|
|
|
|
if !defined($result) || length($vorsilbe) > length($result); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
28
|
|
|
|
|
148
|
$result; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
# un ? |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__DATA__ |