|
|
I have an array with over 100 terms (example: house, dog,...)
I also have another array with 5 text (example: the dog lives in the house) Each place in the array has some text simillar to the example.
Now I'm trying to get all the values from the array with 100 terms, and look inside the other array with the text to see how many text has the terms. since the array has only 5 text the maximum value for the terms is 5. So 1 term can be in 5 text or 4 text or 3 text or 2 text or 1 text or 0 text.
here is the code that I have that is trying to do this. But the problem is that I alway get 5.
[code]
for ($counter = 0; $counter <= $#terms; $counter++){
$nDocs = 0;
for ($count = 0; $count <= $#doc; $count++){
@docTemp = split(/\s+/, $doc[$count]);
###################################
# STORE THE DOCUMENTS INTO A HASH #
###################################
for my $word (@docTemp){
$docHash{$word}++;
}
if (exists $docHash{$terms[$counter]}){
$nDocs++;
}
}
print $terms[$counter], " ", $nDocs, "\n";
}
[/code]
|
|
|
|
Run that code with the ptkdb debugger, that should help you narrow the problem down.
|
|
|
|
|
|
|
|