Edit distance implementation

Free Speech <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAJgtgWf+Qm8_rD_3GXMkM0Nfs+uLK7_sU8A-871KRt4_mn6qrg@mail.gmail.com>
It is interesting that this basic question does not seem to have a ready
answer yet according to Google. (swipl +edit +distance returned 0).

A naive implementation of edit distance using iterative deepening of depth
first search runs into combinatorial blowup. The text book solution is to
provide memoization by building a table of intermediate results, basically
recursion through:
 cost(i, j) = min(cost(i-1, j)+del, cost(i, j-1)+ins, cost(i-1, j-1)+sub)

So the question comes to how best to emulate this two dimensional array in
swipl. I am thinking of using arg/3 on an arbitrarily large term. This has
to be more efficient than dynamic predicates? Any suggestion?

Thanks in advance.
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.