DeSR Dependency Parser

Tanl::TreeToken Struct Reference

Token with descendants. More...

#include <Token.h>

Collaboration diagram for Tanl::TreeToken:

Collaboration graph

List of all members.

Public Member Functions

 TreeToken (std::string &form, AttributeIndex *ai)
 TreeToken (int id, char const *form, AttributeIndex *attributeIndex=0)
 TreeToken (int id, std::string &form, Attributes &attributes, TokenLinks &links)
 TreeToken (int id, std::string &form, Attributes &attributes)
 TreeToken (int id, Token *token)
 TreeToken (TreeToken const &tok)
std::string const * get (char const *key) const
void set (char const *key, char const *value)
 Add the attribute value associated to key key.
void set (char const *key, std::string const &value)
 Add the attribute value associated to key key.
int linkHead (unsigned i=0) const
int linkHead (int h, unsigned i=0)
std::string const & linkLabel (unsigned i=0) const
std::string const & linkLabel (std::string &l, unsigned i=0)
std::string const & linkLabel (char const *l, unsigned i=0)
int size ()
TreeTokenfollow (Parser::TokenPath const &tp, Sentence &sentence)
 Get the token following the given path tp, through sentence sentence.
int leftmostDescendant ()
int rightmostDescendant ()
TreeTokenancestorCPos (char const *pos, Sentence &sent)
TreeTokendescendantCPos (char const *pos)
void print (std::ostream &os, int indent=0) const
 output token in default XML format
void printTab (std::ostream &os)
 output token in tab format
void printTab (std::ostream &os, Corpus const &corpus)
void printConll08 (std::ostream &os, Corpus const &corpus, std::vector< int > *preds=0)
 output in CoNLL 2008 format.

Public Attributes

Tokentoken
unsigned id
std::vector< TreeToken * > left
 list of left child tokens
std::vector< TreeToken * > right
 list of right child tokens


Detailed Description

Token with descendants.

Definition at line 348 of file Token.h.


Member Function Documentation

TreeToken * Tanl::TreeToken::ancestorCPos ( char const *  pos,
Sentence &  sent 
)

Returns:
ancestor node with given coarse POS pos.

Definition at line 129 of file Token.cpp.

TreeToken* Tanl::TreeToken::descendantCPos ( char const *  pos  )  [inline]

Returns:
descendant node with given coarse POS pos.

Definition at line 460 of file Token.h.

References descendantCPos(), get(), left, and right.

Referenced by descendantCPos().

TreeToken * Tanl::TreeToken::follow ( Parser::TokenPath const &  tp,
Sentence &  sentence 
)

Get the token following the given path tp, through sentence sentence.

Returns:
the token reached throught the path or 0 if not found.

Definition at line 141 of file Token.cpp.

std::string const* Tanl::TreeToken::get ( char const *  key  )  const [inline]

Returns:
the attribute computed for key key, or 0 if not present.

Definition at line 390 of file Token.h.

References Tanl::Token::attributes, and Tanl::Attributes::get().

Referenced by descendantCPos().

void Tanl::TreeToken::printConll08 ( std::ostream &  os,
Corpus const &  corpus,
std::vector< int > *  preds = 0 
)

output in CoNLL 2008 format.

Parameters:
preds contains the IDs of predicate tokens in sentence.

void Tanl::TreeToken::set ( char const *  key,
std::string const &  value 
) [inline]

Add the attribute value associated to key key.

Definition at line 401 of file Token.h.

References Tanl::Token::set().

void Tanl::TreeToken::set ( char const *  key,
char const *  value 
) [inline]

Add the attribute value associated to key key.

Definition at line 396 of file Token.h.

References Tanl::Token::set().

int Tanl::TreeToken::size (  )  [inline]

Returns:
the size of the subtree

Definition at line 422 of file Token.h.

References left, and right.

Referenced by Parser::ParseState::hasNext().


The documentation for this struct was generated from the following files:
 
Copyright © 2005-2007 G. Attardi. Generated on 13 Aug 2009 by doxygen 1.5.7.1.