Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: statistics of a large text

by toolic (Bishop)
on Jan 26, 2011 at 14:09 UTC ( [id://884351]=note: print w/replies, xml ) Need Help??


in reply to statistics of a large text

This is no way addresses your question about optimization, but you could take advantage of Slices to reduce some of your code. For example, replace:
my $cgram = join " ", $unigrams[$i], $unigrams[$i+1], $unigrams[$i+2], +$unigrams[$i+3],$unigrams[$i+4];
with:
my $cgram = "@unigrams[ $i .. $i + 4]";
The double quotes around the array slice also insert a single space between array elements ($").

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-23 19:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found