line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- Mode: Perl -*- |
2
|
|
|
|
|
|
|
# Endung.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 12:16:20 2005 |
7
|
|
|
|
|
|
|
# Language : Perl |
8
|
|
|
|
|
|
|
# Update Count : 45 |
9
|
|
|
|
|
|
|
# Status : Unknown, Use with caution! |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package Text::German::Endung; |
12
|
|
|
|
|
|
|
# require Exporter; |
13
|
|
|
|
|
|
|
# @ISA = qw(Exporter); |
14
|
|
|
|
|
|
|
# @EXPORT = qw(%ENDUNG); |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
13
|
use Text::German::Util; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
1299
|
|
17
|
|
|
|
|
|
|
{ |
18
|
|
|
|
|
|
|
local ($_); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
while () { |
21
|
|
|
|
|
|
|
chomp; |
22
|
|
|
|
|
|
|
my ($endung, $key) = split; |
23
|
|
|
|
|
|
|
my ($a,$b,$c,$d) = split ':', $key; # $c, $d nicht verwedet? |
24
|
|
|
|
|
|
|
my $B = Text::German::Util::bit_to_int($b); |
25
|
|
|
|
|
|
|
$ENDUNG{$endung} = [$a,$B,$c,$d]; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
close DATA; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub endungen { |
31
|
0
|
|
|
0
|
0
|
0
|
my $word = shift; |
32
|
0
|
|
|
|
|
0
|
my $class = wordclass($word); |
33
|
0
|
|
|
|
|
0
|
my @result; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
for $i (1 .. length($word)) { |
36
|
0
|
|
|
|
|
0
|
my $endung = substr($word, length($word)-$i,$i); |
37
|
0
|
0
|
0
|
|
|
0
|
if (defined $ENDUNG{$endung} && defined $ENDUNG{$endung}->[1] |
|
|
|
0
|
|
|
|
|
38
|
|
|
|
|
|
|
and ($ENDUNG{$endung}->[1] & $class)) { |
39
|
0
|
|
|
|
|
0
|
push @result, $endung; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
0
|
|
|
|
|
0
|
@result; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub max_endung { |
46
|
28
|
|
|
28
|
0
|
59
|
my $word = shift; |
47
|
28
|
|
|
|
|
80
|
my $class = wordclass($word); |
48
|
28
|
|
|
|
|
39
|
my $result = undef; |
49
|
|
|
|
|
|
|
|
50
|
28
|
|
|
|
|
54
|
for $i (1 .. length($word)) { |
51
|
290
|
|
|
|
|
421
|
my $endung = substr($word, length($word)-$i,$i); |
52
|
290
|
100
|
100
|
|
|
896
|
if (defined $ENDUNG{$endung} |
53
|
|
|
|
|
|
|
and ($ENDUNG{$endung}->[1] & $class)) { |
54
|
34
|
50
|
66
|
|
|
148
|
$result = $endung |
55
|
|
|
|
|
|
|
if !defined($result) || length($endung) > length($result); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
28
|
|
|
|
|
83
|
$result; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub wort_klasse { |
63
|
16
|
|
|
16
|
0
|
38
|
my $endung = shift; |
64
|
|
|
|
|
|
|
|
65
|
16
|
|
|
|
|
46
|
$ENDUNG{$endung}->[1]; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub regel { |
69
|
20
|
|
|
20
|
0
|
27
|
my $endung = shift; |
70
|
|
|
|
|
|
|
|
71
|
20
|
|
|
|
|
70
|
$ENDUNG{$endung}->[0]; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
# regel |
76
|
|
|
|
|
|
|
# wortklassen |
77
|
|
|
|
|
|
|
# nachfolgeregel |
78
|
|
|
|
|
|
|
__DATA__ |