Lingua::Thesaurus::Storage - Role for thesaurus storage
This role specifies the interface for thesaurus storage classes.
Implementation for "search_terms" in Lingua::Thesaurus.
Implementation for "fetch_term" in Lingua::Thesaurus.
Implementation for "related" in Lingua::Thesaurus::Term.
Implementation for "rel_types" in Lingua::Thesaurus.
Implementation for "fetch_rel_type" in Lingua::Thesaurus.
Called by an IO class to initialize storage before a load operation.
$storage->do_transaction($coderef);
Will execute $coderef within a transaction. This is used by "load" in Lingua::Thesaurus::IO to store all terms and relations in a single step.
$coderef
my $term_id = $storage->store_term($term_string);
Stores a new term, and returns the unique storage id for this term. Depending on the implementation, an exception could be raised if several attempts are made to store the same $term_string.
$term_string
$storage->store_rel_type($rel_id, $description, $is_external);
Stores a new relation type.
$rel_id is a unique identifier string for this relation type (such as 'NT' or 'UF').
$rel_id
'NT'
'UF'
$description is an optional free text description
$description
$is_external is a boolean which tells whether related items will be other terms or external data.
$is_external
$storage->store_relation($term_id, $rel_id, $related, $is_external, $inverse_id);
Stores a relation, where
$term_id is the unique identifier for the first term in the relation
$term_id
$rel_id is the unique identifier for relation type
$related is an arrayref of items to relate to the term; if $is_external is true, these items can be any scalar; if $is_external is false, items should be identifiers of other terms.
$related
The storage should preserve the order of items in $related, i.e. the "related" method should return items in the same order.
$is_external is a boolean which tells what kind of items are related, as explained above
$inverse_id is the optional identifier of the inverse relation type; if non-null, relations will be stored in both directions.
$inverse_id
Will be called by IO classes after loading files. Storage implementations may use this to perform cleanup operations if needed.
To install Lingua::Thesaurus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::Thesaurus
CPAN shell
perl -MCPAN -e shell install Lingua::Thesaurus
For more information on module installation, please visit the detailed CPAN module installation guide.