GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TREE::SUFFIX (3)

.ds Aq ’

NAME

Tree::Suffix - Perl interface to the libstree library.

CONTENTS

SYNOPSIS



    use Tree::Suffix;

    $tree = Tree::Suffix->new;
    $tree = Tree::Suffix->new(@strings);

    $bool = $tree->allow_duplicates($bool);

    $count = $tree->insert(@strings);
    $count = $tree->remove(@strings);

    $count = $tree->find($string);
    $count = $tree->match($string);
    $count = $tree->search($string);
    @pos = $tree->find($string);
    @pos = $tree->match($string);
    @pos = $tree->search($string);

    $string = $tree->string($id);
    $string = $tree->string($id, $start ,$end);

    @lcs = $tree->lcs;
    @lcs = $tree->lcs($min_len, $max_len);
    @lcs = $tree->longest_common_substrings;

    @lrs = $tree->lrs;
    @lrs = $tree->lrs($min_len, $max_len);
    @lrs = $tree->longest_repeated_substrings;

    $count = $tree->strings;
    @pos = $tree->strings;

    $count = $tree->nodes;

    $tree->clear;
    $tree->dump;



DESCRIPTION

The Tree::Suffix module provides an interface to the C library libstree, which implements generic suffix trees.

NOTICE: as libstree has outstanding bugs and has long been abandoned, this distribution is not being maintained.

METHODS

$tree = Tree::Suffix-><B>newB>
$tree = Tree::Suffix-><B>newB>(@strings) Creates a new Tree::Suffix object. The constructor will accept a list of strings to be inserted into the tree.
$tree-><B>allow_duplicatesB>($bool) Determines whether duplicate strings are permitted in the tree. By default, duplicates are allowed. Note, this must be called before strings are inserted for it to have an effect. Returns the value of the flag.
$tree-><B>insertB>(@strings) Inserts the list of strings into the tree, excluding duplicates if they are not allowed. Returns the number of successfull insertions.
$tree-><B>removeB>(@strings) Remove the list of strings from the tree, including duplicates if they are allowed. Returns the number of successful removals.
$tree-><B>findB>($string)
$tree-><B>matchB>($string)
$tree-><B>searchB>($string) In scalar context, returns the number of occurrences of the substring in the tree. In list context, returns the positions of all occurrences of the given string as a list of array references in the form [string_index, start, end].
$tree-><B>stringB>($string_index)
$tree-><B>stringB>($string_index, $start)
$tree-><B>stringB>($string_index, $start, $end) Returns the string at index_id. The start and end positions may be specified to return a substring.
$tree-><B>lcsB>
$tree-><B>lcsB>($min_len, $max_len)
$tree-><B>longest_common_substringsB> Returns a list of the longest common substrings. The minimum and maximum length of the considered substrings may be specified.
$tree-><B>lrsB>
$tree-><B>lrsB>($min_len, $max_len)
$tree-><B>longest_repeated_substringsB> Returns a list of the longest repeated substrings. The minimum and maximum length of the considered substrings may be specified.
$tree-><B>stringsB> In scalar context, returns the total number of strings in the tree. In list context, returns the list of string indexes.
$tree-><B>nodesB> Returns the total number of nodes in the tree.
$tree-><B>clearB> Removes all strings from the tree.
$tree-><B>dumpB> Prints a representation of the tree to STDOUT.

EXAMPLE

To find the longest palindrome of a string:



    use Tree::Suffix;
    $str   = mississippi;
    $tree  = Tree::Suffix->new($str, scalar reverse $str);
    ($pal) = $tree->lcs;
    print "Longest palindrome: $pal\n";



This would print:



    Longest palindrome: ississi



SEE ALSO

libstree <http://www.icir.org/christian/libstree/>

SuffixTree

<http://en.wikipedia.org/wiki/Suffix_tree>

NOTES

A memory leak will be exhibited if you are using a version of libstree < .4.2.

REQUESTS AND BUGS

When reporting a bug, first verify that you can successfully run the tests in the libstree distribution.

Please report any bugs or feature requests to <http://rt.cpan.org/Public/Bug/Report.html?Queue=Tree-Suffix>. I will be notified, and then you’ll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.



    perldoc Tree::Suffix



You can also look for information at:
o GitHub Source Repository

<http://github.com/gray/tree-suffix>

o AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/Tree-Suffix>

o CPAN Ratings

<http://cpanratings.perl.org/d/Tree-Suffix>

o RT: CPAN’s request tracker

<http://rt.cpan.org/Public/Dist/Display.html?Dist=Tree-Suffix>

o Search CPAN

<http://search.cpan.org/dist/Tree-Suffix>

COPYRIGHT AND LICENSE

Copyright (C) 2006-2009 gray <gray at cpan.org>, all rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

gray, <gray at cpan.org>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TREE::SUFFIX (3) 2015-03-04

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.