[LON-CAPA-cvs] cvs: loncom /localize/localize checksimilar_1file.pl
bisitz
bisitz at source.lon-capa.org
Mon Jan 21 10:29:31 EST 2013
bisitz Mon Jan 21 15:29:31 2013 EDT
Modified files:
/loncom/localize/localize checksimilar_1file.pl
Log:
- Detect even more similarities by extending list of similar characters
(include improvements from checksimilar_2files.pl 1.4)
- Offer switch to include check for similar phrases, e.g. course/community, as done in checksimilar_2files.pl
Index: loncom/localize/localize/checksimilar_1file.pl
diff -u loncom/localize/localize/checksimilar_1file.pl:1.1 loncom/localize/localize/checksimilar_1file.pl:1.2
--- loncom/localize/localize/checksimilar_1file.pl:1.1 Tue Mar 9 15:16:26 2010
+++ loncom/localize/localize/checksimilar_1file.pl Mon Jan 21 15:29:30 2013
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# The LearningOnline Network with CAPA
-# $Id: checksimilar_1file.pl,v 1.1 2010/03/09 15:16:26 wenzelju Exp $
+# $Id: checksimilar_1file.pl,v 1.2 2013/01/21 15:29:30 bisitz Exp $
use strict;
use warnings;
@@ -9,6 +9,9 @@
#### Checks, if there are similar keys in the inputfile (for example de.pm)
####
+####--------Configuration--------####
+# Include check for similar phrases -> set to 1
+my $inclphrases = 0;
####--------Subroutines--------####
@@ -29,10 +32,18 @@
return %filecontent;
}
-sub similarities{
+sub similarities {
my $text = shift;
- $text =~ s/[.,\_\-?!:]//g;
-
+ $text =~ s/\[_\d\]//g; # translation parameters
+ $text =~ s/[.,\_\-?!: \/]//g; # punctuation
+ if ($inclphrases) {
+ $text =~ s/course/X002X/gi;
+ $text =~ s/community/X002X/gi;
+ $text =~ s/communities/X001X/gi;
+ $text =~ s/member/X003X/gi;
+ $text =~ s/student/X003X/gi;
+ $text =~ s/students/X003X/gi;
+ }
return $text;
}
More information about the LON-CAPA-cvs
mailing list