Diff for /loncom/localize/localize/checksimilar_2files.pl between versions 1.5 and 1.8

version 1.5, 2013/01/22 17:18:05 version 1.8, 2013/12/20 14:27:54
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;
 }  }
   
 sub similar_chars {  sub similar_chars {
     my $text = shift;      my $text = shift;
       $text =~ s/<\/*\w+ *\/*>//g; # HTML tags
     $text =~ s/\[_\d\]//g; # translation parameters      $text =~ s/\[_\d\]//g; # translation parameters
     $text =~ s/[.,\_\-?!: \/]//g; # punctuation      $text =~ s/[.,\_\-?!: \/\(\)]//g; # punctuation
     return $text;      return $text;
 }  }
   
Line 62  sub similar_phrases { Line 62  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 77  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
   

Removed from v.1.5  
changed lines
  Added in v.1.8


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>