Treex::Core::Document - representation of a text and its linguistic analyses in the Treex framework
A document consists of a sequence of bundles, mirroring a sequence of natural language sentences (typically, but not necessarily, originating from the same text). Attributes (attribute-value pairs) can be attached to a document as a whole.
Treex::Core::Document's instances have the following attributes:
Textual description of the file's content that is stored in the file.
The attributes can be accessed using semi-affordance accessors: getters have the same names as attributes,
while setters start with
path has a getter
path() and a setter
creates a new empty document object.
Treex::Core::Document instance from an already existing Treex::PML::Document instance
Treex::Core::Document instance from a .treex file
Document zones are instances of Treex::Core::DocZone, 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.
Returns the array of bundles contained in the document.
Creates a new empty bundle and appends it at the end of the document.
Creates a new empty bundle and inserts it in front of the existing bundle.
Creates a new empty bundle and inserts it after the existing bundle.
The node is added to the document's indexing table
id2node (it is done automatically in Treex::Core::Node::set_attr() if the attribute name is '
undef in the place of the second argument,
the entry for the given id is deleted from the hash.
Return the node which has the value
$id in its '
no matter to which tree and to which bundle in the given document the node belongs to.
It is prohibited in Treex for IDs to point outside of the current document. In rare cases where your data has such links, we recommend you to split the documents differently or hack it by dropping the problematic links.
true if the given
id is already present in the indexing table.
Return the array of all node identifiers indexed in the document.
Return all references leading to the given node id in a hash (keys are reference types, e.g. 'alignment', 'a/lex.rf' etc., values are arrays of nodes referencing this node).
Remove all references to the given node id (calls remove_reference() on each referencing node).
Loads document from
%opts using Treex::PML::Document::load()
Saves document to
$filename using Treex::PML::Document::save(),
or by the Storable module if the file's extension is .streex.gz.
Loading a document from the .streex (Storable) format.
full filename without the extension
Zdeněk Žabokrtský <email@example.com>
Martin Popel <firstname.lastname@example.org>
Ondřej Dušek <email@example.com>
Copyright © 2011-2012 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.