in reply to Re: makeing refering faster ?
in thread makeing refering faster ?

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re^3: makeing refering faster ?
by perldeveloper (Scribe) on Aug 16, 2004 at 15:23 UTC
    Well, I'm answering now... You'd need to change the code to place information about the words that bind the sentences among each other inside the @temp array. This means something like this:
    my %referencedSentences = (); foreach my $j (@{$words[$i]}) { if (($j ne "$j") || ($j ne "v")) { if (exists $sentences->{$j}) { %referencedSentences{%j} = $sentences->{$j}; } } } push (@temp, \%referencedSentences);
    So, to clarify, here is the logical structure of the @temp array:
    • @temp contains the sentence no. i at position 2 * i and a hash indexed by words that other sentences start with at position 2 * i + 1. Assume sentence my $sentence = $temp[2 * 10] and its hash my $hash = $temp[2 * 10 + 1]
    • The hash contains all words in the sentence that other sentences start with. You can get a list of these words like this: my @listOfWordsOtherSentencesStartWith = keys %{$hash}. Say a word (my $word) belongs to this list of words. Then, $hash->{$word} returns a reference to an array that contains the indices (starting from 0) of all sentences that start with word $word. So to get a list of these sentences, you'd write: my @listOfSentencesThatStartWithThisWord = @{$hash->{$word}}
    • To get a list of all sentences referenced by a sentence, you'd write something like
      my @list; foreach my $refToIndicesArray (values %{$hash}) { push (@list, @{$refToIndicesArray}); }
    I hope that answers your questions and good luck with your Perl project. Don't hesitate to ask again, though.