in reply to Re^8: A better implementation of LCSS? (What should a Longest Common Substring function return?)
in thread A better implementation of LCSS?
What should an lcss() routine return?That is precisely the cause of my aforementioned ice cream headache. I agree that the answer depends on the specific requirements of the end user.
where to go from here?My original goal from about a week ago was to improve the existing CPAN String::LCSS module. There is no dispute that it has a bug; it returns the wrong answer for some reasonable pairs of input strings. For example, given the 2 input strings, "abc" and "abcd", it should return "abc" as the longest common substring. But it returns undef, meaning that it did not find a common substring. That is why I attached a patch for that module. Your brute code fixes that bug and the other undisputed bugs reported against it. This is the simple case where there is only one longest common substring.
The separate issue arises when there are multiple longest common substrings. I don't know what the behavior should be in this case. However, the module documentation should explicitly state the behavior in this case. All the related CPAN modules lack sufficient detail in their POD.
I still plan to forge ahead with the arduous process of contacting the author of String::LCSS to either upload something new or grant co-maintainership.
UPDATE: 2016 jan 1, I was grant co-maintainership, and I uploaded String::LCSS version 1.00 which fixes these bugs.
|
|---|