4
# .aff -> Open Office afix file convertor; not tested!!!
6
# perl aff2oo.pl czech.aff
9
use open ':encoding(iso-8859-2)', ':std';
12
print "SET ISO8859-2\n";
16
if (/^wordchars\s+(.*)/ || /^stringchar\s+(.*)/) {
20
if ($chars=~/\[([^\]]*)\]\s+\[([^\]]*)\]/) {
23
while ($list1 ne '') {
24
if ($list1=~s/^(.)-(.)//) {
28
for ($c=$from; $c le $upto; $c++) {
31
$list1=$expand.$list1;
33
if ($list2=~s/^(.)-(.)//) {
37
for ($c=$from; $c le $upto; $c++) {
40
$list2=$expand.$list2;
42
while ($list1 =~ s/^(.)//) {
44
if ($list2 =~ s/^(.)//) {
52
$chars=~s/^(.)\s+\1/$1/;
53
$try.=join('', split(/\s+/, $chars));
62
} elsif (/^suffixes/) {
69
next if (!$affixtype);
70
if (/^flag (\*?)(.):/) {
73
print "$out $number\n";
78
$combined=($1 eq '')? 'N' : 'Y';
79
@OUT=("$affixtype $flag $combined");
85
#print "Line: `$_'\n";
86
if (/^([^\>]*)>(.*)/) {
89
#print "\$cond: `$cond'\n";
90
#print "\$rest: `$rest'\n";
95
#print "\$cond: `$cond'\n";
96
#print "\$rest: `$rest'\n";
97
if ($rest=~/-(.*),(.*)/) {
111
$add='0' if $add eq '-';
113
@cond = $cond =~ /\[.+?\]|./g;
114
die unless join('',@cond) eq $cond;
115
$rem_len = $rem eq '.' ? 0 : length($remove);
117
@i = ($rem_len .. $#cond) if $affixtype eq 'PFX';
118
@i = (0 .. ($#cond - $rem_len)) if $affixtype eq 'SFX';
119
#print ">>@i $cond\n";
121
($p, $s) = $cond[$i] =~ /^\[?(\^?)(.+?)\]?$/ or die;
122
$cond[$i] = '[' . $p . $s . uc $s . ']';
124
$cond = join('',@cond);
125
#print "<<@i $cond\n";
127
push(@OUT, "$affixtype $flag $remove $add $cond\n");
135
print "$out $number\n";