version 1.5, 2013/01/22 17:18:05
|
version 1.6, 2013/01/24 13:52:21
|
Line 20 use open ':utf8';
|
Line 20 use open ':utf8';
|
sub read { |
sub read { |
# Read file into memory |
# Read file into memory |
my $file = shift; |
my $file = shift; |
open(IN,$file) or die; |
open(IN,$file) or die "Error: Could not open file: $file\n"; |
my %filecontent = (); |
my %filecontent = (); |
my $contents = join('',<IN>); |
my $contents = join('',<IN>); |
close(IN); |
close(IN); |
Line 28 sub read {
|
Line 28 sub read {
|
my %Lexicon = (); |
my %Lexicon = (); |
eval($contents.'; %filecontent=%Lexicon;'); |
eval($contents.'; %filecontent=%Lexicon;'); |
if ($@ ne "") { |
if ($@ ne "") { |
print "\nAn error occurred during the attempt to retrieve the translation hash.\n" |
die "\nAn error occurred during the attempt to retrieve the translation hash.\n" |
."Error: ".$@."\n"; |
."Error: ".$@."\n"; |
die; |
|
} |
} |
return %filecontent; |
return %filecontent; |
} |
} |
Line 62 sub similar_phrases {
|
Line 61 sub similar_phrases {
|
); |
); |
|
|
foreach my $word (keys %phrases) { |
foreach my $word (keys %phrases) { |
$text1 =~ s/$phrase/X$phrases{$word}X/gi; |
$text1 =~ s/$word/X$phrases{$word}X/gi; |
$text2 =~ s/$phrase/X$phrases{$word}X/gi; |
$text2 =~ s/$word/X$phrases{$word}X/gi; |
} |
} |
|
|
if (lc($text1) eq lc($text2)) { |
if (lc($text1) eq lc($text2)) { |
Line 77 sub similar_phrases {
|
Line 76 sub similar_phrases {
|
|
|
####--------Main Program--------#### |
####--------Main Program--------#### |
|
|
|
if (!$ARGV[0] or !$ARGV[1]) { |
|
die 'Error: Invalid files! Please specify two files which should be checked.'."\n"; |
|
} |
|
|
my $file1 = $ARGV[0]; # Old language.pm |
my $file1 = $ARGV[0]; # Old language.pm |
my $file2 = $ARGV[1]; # New Phrases |
my $file2 = $ARGV[1]; # New Phrases |
|
|