Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Simple Keyword Generator

by RichardK (Vicar)
on Sep 12, 2012 at 23:44 UTC ( #993329=note: print w/ replies, xml ) Need Help??


in reply to Simple Keyword Generator

I wouldn't use search and replace to detect the stop word, it's doing much more work than you need and is going to get really slow as your stop word list increases.

If you store your words in a hash then it's easy and efficient to test if a word exists in the hash, so then you can do something like this

-- err not tested :)

my @words = qw/ and or not one two three/; my %stop; $stop{$_}++ for @words; ... for my $w (split /\s+/, $line) { next unless length($w) > 2; next if $stop{$w}; ... $keys{$w}++; }

update -- fix typos


Comment on Re: Simple Keyword Generator
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993329]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2015-07-04 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls