Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "lcs"

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

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
0.0.1e3c73b359af856e624d037d331f9b44b17cde1bc45http://packs.ndrix.com/lcs/lcs-0.0.1.tgz

Synopsis

:- 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).

Description

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

author
- Michael Hendricks <michael@ndrix.org>
license
- BSD

Contents of pack "lcs"

Pack contains 3 files holding a total of 3.5K bytes.