NAME
Treex::Core::BundleZone - contains a sentence and its linguistic representations
VERSION
version 2.20160629
SYNOPSIS
use Treex::Core;
my $doc = Treex::Core->new;
my $bundle = $doc->create_bundle();
my $zone = $bundle->create_zone('en','reference');
$zone->set_sentence('John loves Mary.');
DESCRIPTION
Document zones allow Treex documents to contain more texts, typically parallel texts (translations), or corresponding texts from different sources (text to be translated, reference translation, test translation).
ATTRIBUTES
Treex::Core::BundleZone
instances have the following attributes:
- language
- selector
- sentence
The attributes can be accessed using semi-affordance accessors: getters have the same names as attributes, while setters start with set_
. For example, the attribute sentence
has a getter sentence()
and a setter set_sentence($sentence)
METHODS
Construction
Treex::Core::BundleZone
instances should not be created by the constructor, but should be created exclusively by calling one of the following methods of the embedding Treex::Core::Bundle instance:
- create_zone
- get_or_create_zone
Access to trees
There are four types of linguistic trees distinguished in Treex, each of them represented by one letter: a - analytical treex, t - tectogrammatical trees, p - phrase-structure trees, n - named entity trees. You can create trees by following methods:
- $zone->create_tree($layer);
- $zone->create_atree();
- $zone->create_ttree();
- $zone->create_ptree();
- $zone->create_ntree();
You can access trees by
- $zone->get_tree($layer);
- $zone->get_atree();
- $zone->get_ttree();
- $zone->get_ptree();
- $zone->get_ntree();
- $zone->get_all_trees();
Presence of a tree of a certain type can be detected by
- $zone->has_tree($layer);
- $zone->has_atree();
- $zone->has_ttree();
- $zone->has_ptree();
- $zone->has_ntree();
You can remove trees by
Access to embedding objects
- $bundle = $zone->get_bundle();
-
returns the Treex::Core::Bundle instance which the zone belongs to
- $doc = $zone->get_document();
-
returns the Treex::Core::Document instance which the zone belongs to
Other
- $zone1 = $zone0->copy($selector1);
-
creates a copy of the zone (currently copies only the a-tree) under the same language and a new selector
AUTHOR
Zdeněk Žabokrtský <zabokrtsky@ufal.mff.cuni.cz>
Martin Popel <popel@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.