Given the problem definition that you outlined I don't see any advantage in
using the Longest Common Subsequence to just splitting the string at word
boundaries. The advantage of the approach that I have suggested is that the
code is far simpler. However maybe you could ask Michael for his take on
this. Personally I'd rather have easier to understand algorithms which are
good enough rather than complex algorithms which can handle edge cases we
haven't thought of. In my opinion this is particularly true for this case
where a false positive Selenium test is a minor irritant, there would be
places for this approach I just don't believe that it is necessary in the
test suite.


On 4 June 2013 19:16, Somay Jain <notifications@github.com> wrote:

> In modules/tests/web2unittest.py:
>
> > +            for i in range(n):
> > +                for j in range(m):
> > +                    if el_value[i] == text[j]:
> > +                        if i!=0 and j!=0:
> > +                            hash[i][j] = hash[i-1][j-1] + 1;
> > +                        else:
> > +                            hash[i][j] = 1
> > +                        if matched_len < hash[i][j]:
> > +                            matched_len = hash[i][j]
> > +
> > +            # Save the maximum matched option in matched_option.
> > +            # matched_len is the maximum matching length for the current option.
> > +            if matched_option == None or matched_len > max_len:
> > +                matched_option = option
> > +                max_len = matched_len
> > +
>
> Yes, this is a good approach too.
>
> Or we can do a Longest Common Subsequence also, which is more refined than
> this approach.
> Refer this -
> http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
>
> I think this is a better approach.
>
> When comparing, it can jump some characters to find the max match.
>
> So, on comparing "Blankets - Australian Red Cross" and "Blankets - 123457
> - Australian Red Cross", it will give the result as "Blankets - Australian
> Red Cross"
>
> Also, "Blanket - Australian Red Cross" and "Blankets - 123457 - Australian
> Red Cross" will give "Blanket - Australian Red Cross". So, there is no
> strict word matches. It can match any SUBSEQUENCES of the given strings.
>
> Also, "Buckets - Australian Red Cross" and "Blankets - 123457 - Australian
> Red Cross" would give "Bkets - Australian Red Cross" which is shorter than
> match of "Blankets - Australian Red Cross" and "Blankets - 123457 -
> Australian Red Cross".
>
> The other cases will work as before.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/flavour/eden/pull/498/files#r4520817>
> .
>