Created
August 20, 2009 16:52
-
-
Save anonymous/171194 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub _filterKeywords { | |
my $self = shift; | |
my $keywords = shift; | |
$keywords = WebGUI::HTML::filter($keywords, "all"); | |
# split into 'words'. Ideographic characters are treated | |
# as distinct words. Everything else is space delimted | |
my @words = split /\s*|(\p{Ideographic})/, $text; | |
# remove punctuation characters at the start and end of each word. | |
my @filteredWords = (); | |
WORD: for my $word ( @words ) { | |
next WORD unless defined $word | |
&& $word ne ''; | |
$word =~ s/\A\p{isPunct}//; | |
$word =~ s/\p{isPunct}\z//; | |
push @filteredWords, $word; | |
} | |
$keywords = join q{ }, @words; | |
return $keywords; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment