Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

TreebankAPI Interface Reference

AG Treebank API. More...

#include <agtree.idl>

List of all members.

Public Methods

AnnotationId tree_init_tree (const AnnotationType &type, const Id &id="AGTree")
 Create an empty tree, a tree with only one node. More...

bool tree_move_down (const AnnotationId &anno, const AnnotationType &type="syn", AnnotationId new_anno="")
 Move the given node down, creating a new node above it. More...

bool tree_move_up (const AnnotationId &anno)
 Move the given node up, deleting the parent node. More...

bool tree_promote_right (const AnnotationId &anno)
 Make the given node a right sibling of parent node. More...

bool tree_promote_left (const AnnotationId &anno)
 Make the given node a left sibling of parent node. More...

bool tree_demote_right (const AnnotationId &anno)
 Make the given node a rightmost child of the left sibling. More...

bool tree_demote_left (const AnnotationId &anno)
 Make the given node a leftmost child of the right sibling. More...

AnnotationId tree_first_tree (const AGId &agId)
 Find the first tree (root) in a given annotation graph. More...

AnnotationId tree_last_tree (const AGId &agId)
 Find the last tree (root) in a given annotation graph. More...

bool tree_move (const AnnotationId &x, const AnnotationId &y)
 Move a subtree under a certain node. More...

AnnotationId tree_insert_node_left (const AnnotationId &x, const AnnotationType &type="wrd", AnnotationId annoId="")
 Insert a new terminal node on the left. More...

AnnotationId tree_insert_node_right (const AnnotationId &x, const AnnotationType &type="wrd", AnnotationId annoId="")
 Insert a new terminal node on the right. More...

bool tree_delete_node_left (const AnnotationId &x)
 Delete a node on the left. More...

bool tree_delete_node_right (const AnnotationId &x)
 Delete a node on the left. More...

AnnotationId tree_root (AnnotationId x, int depth=1)
 Find the root node. More...

AnnotationId tree_parent (const AnnotationId &x)
 Find the parent node. More...

list<AnnotationIdstree_children (const AnnotationId &x)
 Find children. More...

AnnotationId tree_left (const AnnotationId &x)
 Find a left sibling. More...

AnnotationId tree_right (const AnnotationId &x)
 Find a right sibling. More...

list<AnnotationIdtree_path (AnnotationId x)
 Find a path from the root to the given node. More...

AnnotationId tree_common_ancestor (const AnnotationId &x, const AnnotationId &y)
 Find the nearest common ancestor of the two nodes. More...

AnnotationId tree_insert_node (const AnnotationId &x, const AnnotationId &y, const AnnotationType &type="syn", const AnnotationId &annoId="")
 Insert a non-terminal node. More...

bool tree_delete_node (const AnnotationId &x)
 Delete a non-terminal node. More...


Detailed Description

AG Treebank API.


Member Function Documentation

list< AnnotationIds > TreebankAPI::tree_children ( const AnnotationId & x )
 

Find children.

Parameters:
x   Id of an annotation (node) whose children will be searched.
Returns:
A list of children from the leftmost to the rightmost child.

AnnotationId TreebankAPI::tree_common_ancestor ( const AnnotationId & x,
const AnnotationId & y )
 

Find the nearest common ancestor of the two nodes.

Parameters:
x, y   Annotation (node) ids.
Returns:
Id of the nearest common ancestor of x and y.

bool TreebankAPI::tree_delete_node ( const AnnotationId & x )
 

Delete a non-terminal node.

Parameters:
x   Id of an annotation (node) to be deleted.
Returns:
true on success, false on fail.

bool TreebankAPI::tree_delete_node_left ( const AnnotationId & x )
 

Delete a node on the left.

Parameters:
x   Id of the annotation (node) whose left sibling is deleted. x must be a terminal node.
Returns:
true on success, false on fail.

bool TreebankAPI::tree_delete_node_right ( const AnnotationId & x )
 

Delete a node on the left.

Parameters:
x   Id of the annotation (node) whose right sibling is deleted. x must be a terminal node.
Returns:
true on success, false on fail.

bool TreebankAPI::tree_demote_left ( const AnnotationId & anno )
 

Make the given node a leftmost child of the right sibling.

Parameters:
anno   Id of the annotation (node) to be moved. The node must have a right sibling. Otherwise the operation fails.
Returns:
true on success, false on fail

bool TreebankAPI::tree_demote_right ( const AnnotationId & anno )
 

Make the given node a rightmost child of the left sibling.

Parameters:
anno   Id of the annotation (node) to be moved. The node must have a left sibling. Otherwise the operation fails.
Returns:
true on success, false on fail

AnnotationId TreebankAPI::tree_first_tree ( const AGId & agId )
 

Find the first tree (root) in a given annotation graph.

Parameters:
agId   Id of an annotation graph.
Returns:
The id of the root node of the first tree in the annotation graph.

AnnotationId TreebankAPI::tree_init_tree ( const AnnotationType & type,
const Id & id = "AGTree" )
 

Create an empty tree, a tree with only one node.

Parameters:
type   Type of the annotation (node) to be created.
id   Agset, ag or annotation id. It's an error to give an id of an existing annotation. If the specified ag already exists, new annotation will be attached to the last annotation in the ag. If objects (agset, ag, annotation) specified in the id don't exist, appropriate objects will be created.
Returns:
Id of created annotation (node) upon success.

AnnotationId TreebankAPI::tree_insert_node ( const AnnotationId & x,
const AnnotationId & y,
const AnnotationType & type = "syn",
const AnnotationId & annoId = "" )
 

Insert a non-terminal node.

Parameters:
x, y   Ids of annotations (nodes) which are children of a node. It's an error that y precedes x. A non-terminal will be added in the following way. x is moved down, creating a non-terminal x'. All nodes which are right siblings of x, and left siblings of y, including y, become the children of x'.
type   Type of newly created annotation (node).
annoId   Specifies the id of newly created annotation (node).

AnnotationId TreebankAPI::tree_insert_node_left ( const AnnotationId & x,
const AnnotationType & type = "wrd",
AnnotationId annoId = "" )
 

Insert a new terminal node on the left.

Parameters:
x   Id of the annotation (node) on the left of which the new node is inserted. x itself should be a terminal node.
type   Type of the new annotation (node).
annoId   Specifies the id of the new annotation (node).
Returns:
Id of the new annotation (node).

AnnotationId TreebankAPI::tree_insert_node_right ( const AnnotationId & x,
const AnnotationType & type = "wrd",
AnnotationId annoId = "" )
 

Insert a new terminal node on the right.

Parameters:
x   Id of the annotation (node) on the right of which the new node is inserted. x itself should be a terminal node.
type   Type of the new annotation (node).
annoId   Specifies the id of the new annotation (node).
Returns:
Id of the new annotation (node).

AnnotationId TreebankAPI::tree_last_tree ( const AGId & agId )
 

Find the last tree (root) in a given annotation graph.

Parameters:
agId   Id of an annotation graph.
Returns:
The id of the root node of the last tree in the annotation graph.

AnnotationId TreebankAPI::tree_left ( const AnnotationId & x )
 

Find a left sibling.

Parameters:
x   Id of an annotation (node) whose left sibling will be searched.
Returns:
Id of the left sibling.

bool TreebankAPI::tree_move ( const AnnotationId & x,
const AnnotationId & y )
 

Move a subtree under a certain node.

Parameters:
x   Id of the annotation (node) to be moved. Actually the subtree rooted at x is moved. x must be a leftmost or rightmost child, and can't be an only child.
y   x is moved under y. x should be able to reach under y by some promote and demote operations.
Returns:
true on success, false on fail

bool TreebankAPI::tree_move_down ( const AnnotationId & anno,
const AnnotationType & type = "syn",
AnnotationId new_anno = "" )
 

Move the given node down, creating a new node above it.

Parameters:
anno   Id of the annotation (node) to be moved.
type   Type of the newly created annotation (node).
new_anno   Specifies the id of created annotation.
Returns:
true on success, false on fail

bool TreebankAPI::tree_move_up ( const AnnotationId & anno )
 

Move the given node up, deleting the parent node.

Parameters:
anno   Id of the annotation (node) to be moved. The node must be an only child. Otherwise the operation fails.
Returns:
true on success, false on fail

AnnotationId TreebankAPI::tree_parent ( const AnnotationId & x )
 

Find the parent node.

Parameters:
x   Id of an annotation (node) whose parent will be searched.
Returns:
Id of the parent annotation (node).

list< AnnotationId > TreebankAPI::tree_path ( AnnotationId x )
 

Find a path from the root to the given node.

Parameters:
x   An annotation (node) id. The function finds the path from the root to x.
Returns:
A list of annotations (nodes) in the path from the root.

bool TreebankAPI::tree_promote_left ( const AnnotationId & anno )
 

Make the given node a left sibling of parent node.

Parameters:
anno   Id of the annotation (node) to be moved. The node must be the leftmost child, and it can't be an only child. Otherwise the operation fails.
Returns:
true on success, false on fail

bool TreebankAPI::tree_promote_right ( const AnnotationId & anno )
 

Make the given node a right sibling of parent node.

Parameters:
anno   Id of the annotation (node) to be moved. The node must be the rightmost child, and it can't be an only child. Otherwise the operation fails.
Returns:
true on success, false on fail

AnnotationId TreebankAPI::tree_right ( const AnnotationId & x )
 

Find a right sibling.

Parameters:
x   Id of an annotation (node) whose right sibling will be searched.
Returns:
Id of the right sibling.

AnnotationId TreebankAPI::tree_root ( AnnotationId x,
int depth = 1 )
 

Find the root node.

Parameters:
x   Id of an annotation (node). The root of the tree with x will be searched.
depth   A positive integer. Suppose a path from the root to x. Then the (depth+1)th node in the path will be returned. This is useful when the root of a sentence and the root of the tree are different.
Returns:
Id of the root annotation (node).


The documentation for this interface was generated from the following file:
Generated at Wed Jul 3 14:56:02 2002 for Annotation Graph API by doxygen1.2.7 written by Dimitri van Heesch, © 1997-2001