NAME
Treex::Core::Bundle - a set of equivalent sentences in the Treex framework
VERSION
version 0.08633_1
DESCRIPTION
A set of equivalent sentences (translations, or variants) and their linguistic representations in the Treex framework A bundle in Treex corresponds to one sentence or more sentences, typically translations or variants of each other, with all their linguistic representations. Each bundle is divided into zones (instances of Treex::Core::BundleZone), each of them containing exactly one sentence and its representations.
ATTRIBUTES
Each bundle has two attributes:
- id
-
identifier accessible by the getter method
id()
and by the setter methodset_id($id)
- document
-
the document (an instance of Treex::Core::Document) which this bundle belongs to; accessible only by the getter method
document()
METHODS
Construction
You cannot create a bundle by a constructor from scratch. You can create a bundle only within an existing documents, using the following methods of Treex::Core::Document:
- create_bundle
- new_bundle_before
- new_bundle_after
Access to zones
Bundle zones are instances of Treex::Core::BundleZone, parametrized by language code and possibly also by another free label called selector, whose purpose is to distinguish zones for the same language but from a different source.
- my $zone = $bundle->create_zone( $langcode, ?$selector, ?$params_rf );
-
If the third argument is {overwrite=>1}, then the newly created empty zone overwrites the previously existing one (if any). Fatal error appears if the zone to be created already exists and this switch is not used.
- my $zone = $bundle->get_zone( $langcode, ?$selector );
- my $zone = $bundle->get_or_create_zone( $langcode, ?$selector );
- my @zones = $bundle->get_all_zones();
Access to trees
Even if trees are not contained directly in bundle (there is the intermediate zone level), they can be accessed using the following shortcut methods:
- my $tree_root = $bundle->get_tree( $language, $layer, ?$selector);
- my $tree_root = $bundle->create_tree( $language, $layer, ?$selector );
- $bundle->has_tree( $language, $layer, ?$selector );
- my @tree_roots = $bundle->get_all_trees();
Other
- $bundle->remove_zone( $language, $selector );
-
delete all zone's trees and remove the zone from the bundle
- my $position = $bundle->get_position();
-
position of the bundle within the document (number, starting from 0)
AUTHOR
Zdeněk Žabokrtský <zabokrtsky@ufal.mff.cuni.cz>
COPYRIGHT AND LICENSE
Copyright © 2011 by Institute of Formal and Applied Linguistics, Charles University in Prague
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.