version 1.4, 2013/01/10 18:07:52
|
version 1.5, 2013/01/22 17:18:05
|
Line 49 sub similar_phrases {
|
Line 49 sub similar_phrases {
|
my $text1 = shift; |
my $text1 = shift; |
my $text2 = shift; |
my $text2 = shift; |
|
|
$text1 =~ s/courses/X001X/gi; |
my %phrases = ( |
$text1 =~ s/communities/X001X/gi; |
'courses' => 1, |
$text1 =~ s/course/X002X/gi; |
'communities' => 1, |
$text1 =~ s/community/X002X/gi; |
'course' => 2, |
$text1 =~ s/member/X003X/gi; |
'community' => 2, |
$text1 =~ s/student/X003X/gi; |
'member' => 3, |
$text1 =~ s/students/X003X/gi; |
'student' => 3, |
|
'students' => 3, |
|
'construction'=> 4, |
|
'authoring' => 4, |
|
); |
|
|
$text2 =~ s/courses/X001X/gi; |
foreach my $word (keys %phrases) { |
$text2 =~ s/communities/X001X/gi; |
$text1 =~ s/$phrase/X$phrases{$word}X/gi; |
$text2 =~ s/course/X002X/gi; |
$text2 =~ s/$phrase/X$phrases{$word}X/gi; |
$text2 =~ s/community/X002X/gi; |
} |
$text2 =~ s/member/X003X/gi; |
|
$text2 =~ s/student/X003X/gi; |
|
$text2 =~ s/students/X003X/gi; |
|
|
|
if (lc($text1) eq lc($text2)) { |
if (lc($text1) eq lc($text2)) { |
return 1; |
return 1; |