Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

perlmonkey2's scratchpad

by perlmonkey2 (Beadle)
on Sep 22, 2006 at 15:33 UTC ( #574393=scratchpad: print w/replies, xml ) Need Help??

sub getGrams{ my ($self,$sen,$maxSize) = @_; my @grams; $sen =~ s/[^\s\w\'\-\_]/ /g; my @words = split/\s+/,$sen; GRAM: for(my $i = 1; $i <= $maxSize-1; $i++){ for(my $x = 0; $x <= $#words+1; $x++){ my $gram = ''; for(my $y = $x; $y <= $x+$i; $y++){ if($y + $i > $#words+$i){next GRAM;} $gram .= " ".$words[$y]; } $gram =~ s/^ //; push(@grams, $gram); } } return @grams; }
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[Lady_Aleena]: It will leave me with 8 out of 138 modules that print something.
[atcroft]: Sounds like it will make display modifications a little easier when you are done, at least.

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2017-05-29 02:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?