Rechercher une page de manuel
TAG.3pm
Langue: en
Version: 2004-08-24 (mandriva - 01/05/08)
Section: 3 (Bibliothèques de fonctions)
NAME
TAG - Perl-style objects to represent Tree Adjoining Grammars [TAG]SYNOPSIS
use TAG; # Basic parsing use TAG::XML::Parser; $parser = TAG::XML::Parser->new (); $document = $parser->parsefile( 'filename' ); # Creating new objects $document = TAG::Document->new(); $tree = TAG::Tree->new( name => 'w0tn1pn2', family => 'tn1pn2' ); $node = TAG::Node->new( cat => 'NP', id => 'NP_0', type => 'subst' ); # Accessing TAG objects $trees = $tree->{Trees}; $tree = $tree->{Trees}{'tn1pn2'}{'w0tn1pn2'}; $tree_name = $tree->{'name'};
DESCRIPTION
TAG uses Grove to implement a tree-based object model for representing Tree Adjoining Grammars [TAG]. Following the XTAG description, such a grammar provides elementary trees grouped into families, lemma entries, and lexicon entries.How To Create a Grove
There are several ways for TAGs to come into being, they can be read from a file or string using a parser, or they can be created by your Perl code using the `"new()"' methods of TAG.
The most common way to build a TAG::Document object is using a parser, for instance TAG::XML::Parser, which is an instance of XML::Parser.
Using TAGs
The properties provided by parsers are available directly using Perl's normal syntax for accessing hashes and arrays. For example, to get the name of a tree:
$tree_name = $tree->{'name'};
The following is the minimal set of objects and their properties that you are likely to get from all parsers:
TAG::Document
- families
- An hash containing the families TAG::Family indexed by family names.
- trees
- An hash containing the elementary trees TAG::Tree indexed by tree names.
- lemma
- An hash of hash containing the lemma TAG::Lemma indexed by name and category.
- lexicon
- An hash containing the lexicon entries TAG::Lexicon indexed by the lexical form.
- desc
- An arrayref of descriptions (TAG::Desc).
TAG::Family
The Family objects represent families
- name
- A string, the name of the family
- trees
- An array ref of tree names
- desc
- An arrayref of descriptions (TAG::Desc).
TAG::Tree
The Tree objects represent trees.
- name
- A string, the name of the tree
- family
- An array ref of strings, the name of the families the tree belongs to.
- type
- A string in 'initial' and 'auxiliary'
- root
- A TAG::Node, root node of the tree
- desc
- An arrayref of descriptions (TAG::Desc).
TAG::Node
A node in a Tree object.
- id
- A string, the id of the node
- cat
- A string, the syntactic category of the node
- type
- A string in 'std', 'subst', 'foot', 'lex', or 'anchor' denoting the type of the node.
- adj
- A string in 'yes', 'no', or 'strict' denoting adjoining conditions on the node.
- lex
- A string, the lexical value of the node of type 'lex'
- top
- Empty or a TAG::Feature object, representing the 'top' argument of the node
- bot
- Empty or a TAG::Feature object, representing the 'bot' argument of the node
- child
- An array of TAG::Node objects, the child of the node
TAG::Lemma
A lemma entry:
- name
- A string, the name of the lemma
- cat
- A string, the syntactic category of the lemma
- anchors
- An array of TAG::Anchor objects that indicate which trees may be anchored by the lemma.
- desc
- An arrayref of descriptions (TAG::Desc).
TAG::Lexicon
A lexicon entry:
- lex
- A string, the lexical form of the entry
- lemma
- An arrayref of TAG::LemmaRef objects that indicate which lemma are possible for this lexical entry.
- desc
- An arrayref of descriptions (TAG::Desc).
TAG::LemmaRef
A reference to a lemma entry TAG::Lemma in a lexicon entry:
- name
- A string, the name of the lemma
- cat
- A string, the syntactic category of the lemma
- feature
- A TAG::Feature object, denoting additional constraints on the lemma.
TAG::Anchor
A possible anchoring for a lemma entry (TAG::Lemma):
- family
- An arrayref of strings, denoting the anchoring families
- coanchors
- An arrayref of TAG::Coanchor constraints
- Equations
- An arrayref of TAG::Equation constraints
TAG::Coanchor
A constraint of co-anchoring in a TAG::Anchor object, stipulating that some node should yield some lexical value.
- node_id
- A string, denoting the node upon which the constraint holds
- lex
- An arrayref of TAG::Lex objects, denoting a disjunction of possible lexical values for the node.
TAG::Lex
A lexical value (in a TAG::Coanchor object):
- text
- A string, denoting the lexical value
TAG::Equation
An equation in a TAG::Anchor object that should hold on the 'top' or 'bot' argument of a node.
- node_id
- A string, denoting the node upon which the equation should hold.
- type
- A string in 'top' or 'bot', denoting the argument of the node upon which the equation should hold.
- feature
- A TAG::Feature object, representing the constraints
TAG::Feature
A set of (feature,value), used in TAG::Equation, TAG::Node, and TAG::LemmaRef objects:
- f
- A 'feature' indexed hashref of TAG:Comp objects
TAG::Comp
To hold a value
- name
- String, the name of the component
- id
- String (possibly empty), for multiple occurrences (variables).
- value
- Array ref of values, represented by TAG::Val, TAG::Plus, or TAG::Minus objects
TAG::Val
A standard value in a TAG::Feature object:
- Text
- The value
TAG::Link
** DEPRECATED ** see attribute id of TAG::Comp
TAG::Plus
A '+' value in a TAG::Feature object. No properties.
TAG::Minus
A '-' value in a TAG::Feature object. No properties.
TAG::Desc
A description option that can be attached to a document, a family, a tree, a lemma, or a lexicon entry.
- text
- A string, the content of the description
METHODS
TAG by itself only provides one method, new(), for creating new TAG objects. There are Data::Grove extension modules that give additional methods for working with TAG objects and new extensions can be created as needed.- $obj = TAG::OBJECT->new( [PROPERTIES] )
- `"new"' creates a new TAG object with the type OBJECT, and with the initial PROPERTIES. PROPERTIES may be given as either a list of key-value pairs, a hash, or a TAG object to copy. OBJECT may be any of the objects listed above.
WRITING EXTENSIONS
The class `"TAG"' is the superclass of all classes in the XML::TAG module. `"TAG"' is a subclass of `"Data::Grove"'.If you create an extension and you want to add a method to all TAG objects, then create that method in the TAG package.
AUTHOR
Eric de la Clergerie, Eric.De_La_Clergerie@inria.frSEE ALSO
Grove (3) TAG::XML::Parser (3) TAG::LP (3) TAG::RCG (3)Extensible Markup Language (XML) <http://www.w3c.org/XML>
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre