Did you know ... | Search Documentation: |
Packs (add-ons) for SWI-Prolog |
Title: | Longest common subsequence |
---|---|
Rating: | Not rated. Create the first rating! |
Latest version: | 0.0.1 |
SHA1 sum: | e3c73b359af856e624d037d331f9b44b17cde1bc |
Author: | Michael Hendricks <michael@ndrix.org> |
Maintainer: | Michael Hendricks <michael@ndrix.org> |
Packager: | Michael Hendricks <michael@ndrix.org> |
Home page: | http://packs.ndrix.com/lcs/index.html |
Download URL: | http://packs.ndrix.com/lcs/lcs-0.0.1.tgz |
No reviews. Create the first review!.
Version | SHA1 | #Downloads | URL |
---|---|---|---|
0.0.1 | e3c73b359af856e624d037d331f9b44b17cde1bc | 46 | http://packs.ndrix.com/lcs/lcs-0.0.1.tgz |
:- 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.