#!/usr/bin/perl -w use strict; # Written by Stanislav Shalunov, 2001-11, http://www.internet2.edu/~shalunov/ my %dict; while (<>) { m/^(.*?):(.*)$/ or next; # Split. my ($lhs, $rhs) = ($1, $2); $lhs =~ /[^a-z \,]/i and next; # Wacky stuff in LHS -> abb., etc... $lhs =~ /^(\w+)/ or next; # Canonical form. my $word = $1; $rhs =~ s/\s+/ /g; # Squeeze whitespace. $rhs =~ s/;?\s*$//; $rhs =~ s/^\s+//; my @words = ($lhs =~ /(\w+)/g); shift @words; unless (defined $dict{$word}) { $dict{$word} = $rhs; $dict{$_} = "see $word" for @words; } else { $dict{$word} .= " -OR- $rhs"; } } for (sort keys %dict) { my $rhs = $dict{$_}; print "$_ => Latin: $rhs\n"; warn "rhs too long for $_: ".length $rhs."\n" if length $rhs > 400; }