Tanl Linguistic Pipeline

Tanl::TreeToken Struct Reference
[Dependency Parser]

Token with descendants. More...

#include <Token.h>

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 & form () const
std::string const * get (char const *key) const
std::string const * predicted (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 (int i=0) const
int linkHead (int h, int 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)
bool operator== (const TreeToken &other)
bool operator!= (const TreeToken &other)
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.
void printLeaves (std::ostream &os)
 print the leaves of the tree.

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.


Member Function Documentation

TreeToken * Tanl::TreeToken::ancestorCPos ( char const *  pos,
Sentence sent 
)
Returns:
ancestor node with given coarse POS pos.

References get().

TreeToken* Tanl::TreeToken::descendantCPos ( char const *  pos  )  [inline]
Returns:
descendant node with given coarse POS pos.

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.

References left, Parser::TokenPath::path, and right.

std::string const& Tanl::TreeToken::form (  )  const [inline]
Returns:
the form of the token.

References Tanl::Token::form.

std::string const* Tanl::TreeToken::get ( char const *  key  )  const [inline]
Returns:
the attribute for key key, or 0 if not present.

References Tanl::Token::get().

Referenced by ancestorCPos(), Parser::Parser::collectSentences(), descendantCPos(), and Tanl::TaggedSentenceReader::MoveNext().

std::string const* Tanl::TreeToken::predicted ( char const *  key  )  const [inline]
Returns:
the predicted attribute for key key, or 0 if not present.

References Tanl::Token::get().

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.

References Tanl::Token::set().

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

Add the attribute value associated to key key.

References Tanl::Token::set().

Referenced by Parser::Parser::collectSentences(), and Tanl::TaggedSentenceReader::MoveNext().

int Tanl::TreeToken::size (  )  [inline]
Returns:
the size of the subtree

References left, and right.

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


The documentation for this struct was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
 
Copyright © 2005-2011 G. Attardi. Generated on 4 Mar 2011 by doxygen 1.6.1.