Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^2: help with comparing two arrays of phrases

by sdtej (Initiate)
on Oct 10, 2012 at 07:38 UTC ( #998167=note: print w/replies, xml ) Need Help??

in reply to Re: help with comparing two arrays of phrases
in thread help with comparing two arrays of phrases

Thanks, that sure solved the "Unmatched parenthesis in regex" problem. But I'm still not getting any output. As you can see from the sample input, the two phrases have more than one word which are the same..

  • Comment on Re^2: help with comparing two arrays of phrases

Replies are listed 'Best First'.
Re^3: help with comparing two arrays of phrases
by BrowserUk (Pope) on Oct 10, 2012 at 08:40 UTC

    You need to look closely at your code and consider carefully what you are doing. Your code in no way matches up with your description.

    1. You say you skip words less than 3 chars, but your code contains tests for <3 and <5, and the code path for >4 seems identical to that for 3 & 4.
    2. You split the first phrase into words, but not the second.

      And you then test if each word in the first phrase contains the whole of the second phrase.

    3. You have a whole bunch of else { next; } clauses.

      Do you realise that if you omitted those clauses, it would just loop to the next iteration anyway?

      So what is their purpose?

    The bottom line is, with the disparity between your written description and you code, and a bunch of redundant stuff in your code, I cannot work out what you are actually trying to achieve, so I cannot really suggest anything.

    First decide and write down what you actually want to do; then try to write code that matches that description; and then, if it doesn't do what you want, come back and ask again.

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    RIP Neil Armstrong

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://998167]
[hippo]: Hi

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2018-04-19 18:02 GMT
Find Nodes?
    Voting Booth?