Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^3: Finding Combinations of Pairs

by andye (Curate)
on Jan 14, 2009 at 23:14 UTC ( #736408=note: print w/ replies, xml ) Need Help??

in reply to Re^2: Finding Combinations of Pairs
in thread Finding Combinations of Pairs

BTW - and being serious now - you don't actually need to combine them into a single value.

If you do something like:

instead of
$h->{"$word1 $word2"}++
in the centre of the loops, then you end up with a useful tree-like structure, which gives you a quick index of, for each word, how many times each other word appears in combination with it.

Try it and use Data::Dumper to print the output, and you'll see what I mean.

Although I appreciate that may not be what the homework called for. <grin>

Best wishes, andy.

Comment on Re^3: Finding Combinations of Pairs
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2015-11-27 12:05 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (727 votes), past polls