Algorithm::LCSS - Perl extension for getting the Longest Common Sub-Sequence
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
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.
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
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
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
None by default.
Dr James Freeman <james.freeman@id3.org.uk>
perl.
To install Algorithm::LCSS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Algorithm::LCSS
CPAN shell
perl -MCPAN -e shell install Algorithm::LCSS
For more information on module installation, please visit the detailed CPAN module installation guide.