scalgos icon indicating copy to clipboard operation
scalgos copied to clipboard

editDistance bug?

Open zhaomingli007 opened this issue 7 years ago • 0 comments

https://github.com/pathikrit/scalgos/blob/9e99f73b4241f42cc40a1fd890e72dbeda2df54f/src/main/scala/com/github/pathikrit/scalgos/DynamicProgramming.scala#L146 When call editDistance(List("c"),List("b"),2,1,5), the expected cost should be 3 (one deletion + one addition). Now it returns 2.

Probably it can be modified as below?

    case (a, b) => (delete + f(a.tail, b)) min (insert + f(a.tail, a.head :: b)) min (replace + f(a.tail, b.tail))

zhaomingli007 avatar Jan 22 '19 07:01 zhaomingli007