NAME

Treex::PML::FSFormat - Treex::PML class representing the file header of a FS file.

Treex::PML::FSFormat->new (array_ref_or_GLOB)

NOTE: Don't call this constructor directly, use Treex::PML::Factory->createFSFormat() instead!

Create a new FS format instance object by parsing a given input as a FS file header. If the argument is an ARRAY reference, each element is assumed to represent a single line.

Treex::PML::FSFormat->new (attributes_hash_ref?, ordered_names_list_ref?, unparsed_header?)

NOTE: Don't call this constructor directly, use Treex::PML::Factory->createFSFormat() instead!

Create a new FS format instance object and initialize it with the optional values.

Treex::PML::FSFormat->create (@header)

NOTE: Don't call this constructor directly, use Treex::PML::Factory->createFSFormat() instead!

Same as Treex::PML::FSFormat->new (\@header).

$format->clone

Duplicate FS format instance object.

$format->initialize (attributes_hash_ref?, ordered_names_list_ref?, unparsed_header?)

Initialize a new FS format instance with given values. See Treex::PML for more information about attribute hash, ordered names list and unparsed headers.

$format->addNewAttribute (type, colour, name, list)

Adds a new attribute definition to the Treex::PML::FSFormat. Type must be one of the letters [KPOVNWLH], colour one of characters [A-Z0-9]. If the type is L, the fourth parameter is a string containing a list of possible values separated by |.

$format->readFrom (source,output?)

Reads FS format instance definition from given source, optionally echoing the unparsed input on the given output. The obligatory argument source must be either a GLOB or list reference. Argument output is optional and if given, it must be a GLOB reference.

$format->toArray

Return FS declaration as an array of FS header declarations.

$format->writeTo (glob_ref)

Write FS declaration to a given file (file handle open for reading must be passed as a GLOB reference).

$format->sentord (), order(), value(), hide()

Return names of special attributes declared in FS format as @W, @N, @V, @H respectively.

$format->isHidden (node)

Return the lowest ancestor-or-self of the given node whose value of the FS attribute declared as @H is either 'hide' or 1. Return undef, if no such node exists.

$format->defs

Return a reference to the internally stored attribute hash.

$format->list

Return a reference to the internally stored attribute names list.

$format->unparsed

Return a reference to the internally stored unparsed FS header. Note, that this header must not correspond to the defs and attributes if any changes are made to the definitions or names at run-time by hand.

$format->renew_specials

Refresh special attribute hash.

$format->specials

Return a reference to a hash of attributes of special types. Keys of the hash are special attribute types and values are their names.

$format->attributes

Return a list of all attribute names (in the order given by FS instance declaration).

$format->atno (n)

Return the n'th attribute name (in the order given by FS instance declaration).

$format->atdef (attribute_name)

Return the definition string for the given attribute.

$format->count

Return the number of declared attributes.

$format->isList (attribute_name)

Return true if given attribute is assigned a list of all possible values.

$format->listValues (attribute_name)

Return the list of all possible values for the given attribute.

$format->color (attribute_name)

Return one of Shadow, Hilite and XHilite depending on the color assigned to the given attribute in the FS format instance.

$format->special (letter)

Return name of a special attribute declared in FS definition with a given letter. See also sentord() and similar.

$format->indexOf (attribute_name)

Return index of the given attribute (in the order given by FS instance declaration).

$format->exists (attribute_name)

Return true if an attribute of the given name exists.

$format->make_sentence (root_node,separator)

Return a string containing the content of value (special) attributes of the nodes of the given tree, separated by separator string, sorted by value of the (special) attribute sentord or (if sentord does not exist) by (special) attribute order.

$format->clone_node

Create a copy of the given node.

$format->clone_subtree

Create a deep copy of the given subtree.

SEE ALSO

Treex::PML, Treex::PML::Factory, Treex::PML::Document, Treex::PML::Schema

COPYRIGHT AND LICENSE

Copyright (C) 2006-2010 by Petr Pajas

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.