[LON-CAPA-cvs] cvs: loncom /localize/localize checksimilar_2files.pl

bisitz bisitz@source.lon-capa.org
Tue, 03 Aug 2010 13:00:21 -0000


bisitz		Tue Aug  3 13:00:21 2010 EDT

  Modified files:              
    /loncom/localize/localize	checksimilar_2files.pl 
  Log:
  Optimized detection of similar phrases.
  
  
Index: loncom/localize/localize/checksimilar_2files.pl
diff -u loncom/localize/localize/checksimilar_2files.pl:1.1 loncom/localize/localize/checksimilar_2files.pl:1.2
--- loncom/localize/localize/checksimilar_2files.pl:1.1	Tue Mar  9 15:16:26 2010
+++ loncom/localize/localize/checksimilar_2files.pl	Tue Aug  3 13:00:21 2010
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 # The LearningOnline Network with CAPA
-# $Id: checksimilar_2files.pl,v 1.1 2010/03/09 15:16:26 wenzelju Exp $
+# $Id: checksimilar_2files.pl,v 1.2 2010/08/03 13:00:21 bisitz Exp $
 
 use strict;
 use warnings;
@@ -48,14 +48,14 @@
     my $text1 = shift;
     my $text2 = shift;
     
-    $text1 =~ s/courses//gi;
-    $text1 =~ s/communities//gi;    
-    $text1 =~ s/course//gi;
-    $text1 =~ s/community//gi;
-    $text2 =~ s/courses//gi;
-    $text2 =~ s/communities//gi;
-    $text2 =~ s/course//gi;
-    $text2 =~ s/community//gi;
+    $text1 =~ s/courses/X001X/gi;
+    $text1 =~ s/communities/X001X/gi;    
+    $text1 =~ s/course/X002X/gi;
+    $text1 =~ s/community/X002X/gi;
+    $text2 =~ s/courses/X001X/gi;
+    $text2 =~ s/communities/X001X/gi;
+    $text2 =~ s/course/X002X/gi;
+    $text2 =~ s/community/X002X/gi;
 
     if(lc($text1) eq lc($text2)) {
         return 1;