|Did you know ...||Search Documentation:|
|Packs (add-ons) for SWI-Prolog|
|Title:||Longest common subsequence|
|Rating:||Not rated. Create the first rating!|
|Author:||Michael Hendricks <firstname.lastname@example.org>|
|Maintainer:||Michael Hendricks <email@example.com>|
|Packager:||Michael Hendricks <firstname.lastname@example.org>|
No reviews. Create the first review!.
:- use_module(library(lcs)). go :- lcs("1234", "12245334", "1234"), % assume vowels/3 awards 0.5 points to vowel matches % and 0 points to all other letters. lcs(vowels, "moose", "mouse", [0'o-0'o, 0'o-0'u, 0'e-0'e], 1.5).
Calculate a longest common subsequence for two lists. Two elements are considered common if they are equal.
One can also provide a meta-predicate to perform comparisons. This predicate calculates a similarity score for two elements. The subsequence with the highest total similarity is the LCS.
Source code available and pull requests accepted on GitHub: https://github.com/mndrix/lcs
Pack contains 3 files holding a total of 3.5K bytes.