in reply to Re: How keep the count...
in thread How keep the count...

Thank you Monk
Maybe my question was not clear, What I need to know is how to keep track of those sentences where the offset was x (any 2, 3 ,etc) for example. Should I use hashes and how. Thanks again!

Replies are listed 'Best First'.
Re: Re: Re: How keep the count...
by Limbic~Region (Chancellor) on Mar 03, 2004 at 17:10 UTC
    Anonymous Monk,
    Your insistence on using a hash strengthens my feeling that this is a homework problem. While I do not mind homework problems nearly as much as other monks, if this is homework you should state:
    • That it is homework
    • What the specific requirements are
    • What you have tried so far
    • What you "think" may work but do not know how to code
    Now to answer your questions, there is no need to use a hash. you could change:
    # push @offsets, $_ - $first + 1; # to push @offesets, [ $line , $_ - $first + 1 ]; # and # print "$_\n" for @offsets; # to print "$_->[0] : $_->[1]\n" for @offsets;
    Cheers - L~R
      This is not a "homework", is a project in language generation. There are not specific requirements, we have to find ways to generate natural phrases, idioms, expressions etc. This was one of the ideas: train a large file and find those sentences where the co-occurrence of n words occur in n specific gap. Find the most frequent offset and retrieve the sentence to check in which context they appear. The insistence of hashes is dumb, I just wanted to prove my point... somebody that validate my idea that hash was the only solution..:-(
      Sorry that I did not provide more information before, I only wanted to keep it simple. Thanks