in reply to Scoping Problem? - 'Use of uninititiated value...'
After this, the intent seems to be to generate a list of possible next words in which each word appears as many times as it follows these two words in the original text. I think this is the main bug, and the loop should read like this:@feed = @keysout[0,1]; ... while($cyc_count2 <= $keysout){ my $w1 = $feed[0]; my $w2 = $feed[1]; #no $nw needed! ...
This way, for each word that ever followed these two (according to the hash), that word is added the same number of times it was seen in this context in the original text.for my $word ( keys %{ $hash{ $w1 }{ $w2 }{ words } } ){ push @wordsList, ($word) x $hash{ $w1 }{ $w2 }{ words }{ $word }; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Scoping Problem? - 'Use of uninititiated value...'
by chinamox (Scribe) on Nov 06, 2006 at 01:52 UTC |