Dr. James Freeman > Algorithm-LCSS-0.01 > Algorithm::LCSS

Download:
Algorithm-LCSS-0.01.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View Bugs
Report a bug
Module Version: 0.01   Source  

NAME ^

Algorithm::LCSS - Perl extension for getting the Longest Common Sub-Sequence

SYNOPSIS ^

    use Algorithm::LCSS qw( LCSS CSS CSS_Sorted );
    my $lcss_ary_ref = LCSS( \@SEQ1, \@SEQ2 );  # ref to array
    my $lcss_string  = LCSS( $STR1, $STR2 );    # string
    my $css_ary_ref = CSS( \@SEQ1, \@SEQ2 );    # ref to array of arrays
    my $css_str_ref = CSS( $STR1, $STR2 );      # ref to array of strings
    my $css_ary_ref = CSS_Sorted( \@SEQ1, \@SEQ2 );  # ref to array of arrays
    my $css_str_ref = CSS_Sorted( $STR1, $STR2 );    # ref to array of strings

DESCRIPTION ^

This module uses Algoritm::Diff to implement LCSS and is orders of magnitude faster than String::LCSS.

If you pass the methods array refs you get back array (ref) format data. If you pass strings you get a string or a ref to an array of strings.

METHODS ^

LCSS

Returns the longest common sub sequence. If there may be more than one (with exactly the same length) and it matters use CSS instead.

    my $lcss_ary_ref = LCSS( \@SEQ1, \@SEQ2 );  # ref to array
    my $lcss_string  = LCSS( $STR1, $STR2 );    # string

CSS

Returns all the common sub sequences, unsorted.

    my $css_ary_ref = CSS( \@SEQ1, \@SEQ2 );  # ref to array of arrays
    my $css_str_ref = CSS( $STR1, $STR2 );    # ref to array of strings

CSS_Sorted

Returns all the common sub strings, sorted from longest to shortest CSS.

    my $css_ary_ref = CSS_Sorted( \@SEQ1, \@SEQ2 );  # ref to array of arrays
    my $css_str_ref = CSS_Sorted( $STR1, $STR2 );    # ref to array of strings

EXPORT ^

None by default.

AUTHOR ^

Dr James Freeman <james.freeman@id3.org.uk>

SEE ALSO ^

perl.