Tanl Linguistic Pipeline

Parser::State Class Reference
[Dependency Parser]

Parser base state. More...

#include <State.h>

Inheritance diagram for Parser::State:
Parser::ParseState Parser::TrainState

List of all members.

Public Member Functions

 State (Sentence const &sentence, GlobalInfo *globalInfo)
 Constructor.
 State (State const &state)
bool hasNext ()
Statetransition (Action action)
 Perform action represented by Action action.
StateShift ()
 Perform a Shift action.
StateRight (Action action)
 Perform a Right action.
StateLeft (Action action)
 Perform a Left action.
Stateright (Action action)
 Perform a far right action.
Stateleft (char const *action)
 Perform a far left action.
StateDepLink (Action action)
 Perform a link action.
StateExtract ()
 Perform an Extract action.
StateInsert ()
 Perform an Insert action.
StatePop ()
 Perform a Pop action.
SentencegetSentence ()
void showStatus ()

Public Attributes

Sentence sentence
 the sentence parsed so far
TreeTokenrootNode
 Dummy root node.
std::string splitFeature
 used to split SVMs
State const * previous
 The previous State in the derivation.
Action action
 The action that lead to this state.
std::vector< TreeToken * > input
 Stack from which input tokens are extracted.
std::vector< TreeToken * > stack
 Stack where analyzed tokens are accumulated.
std::vector< TreeToken * > extracted
 Stack where extracted tokens are accumulated.

Static Public Attributes

static Tanl::Text::RegExp::Pattern ispunct
 Pattern for detecting punctuation:.

Protected Member Functions

virtual TreeTokencopy (TreeToken *x)
void predicates (Features &preds, Action action=0)
 Collect features representing context.

Protected Attributes

SentenceInfosentenceInfo
int verbCount
 Number of verbs so far.

Static Protected Attributes

static Tanl::Text::RegExp::Pattern nonWordAscii
 Weird version of ispunct.

Detailed Description

Parser base state.


Constructor & Destructor Documentation

Parser::State::State ( Sentence const &  sentence,
GlobalInfo globalInfo 
)

Constructor.

Parameters:
sentence the sentence to be parsed.
globalInfo,global parse information.

References input, Tanl::Sentence::reverse(), rootNode, and stack.


Member Function Documentation

State * Parser::State::DepLink ( Action  action  )  [inline]

Perform a link action.

References action, input, Tanl::TreeToken::left, previous, Tanl::TreeToken::right, and stack.

Referenced by transition().

State * Parser::State::Extract (  ) 

Perform an Extract action.

References extracted, input, and stack.

Referenced by transition().

bool Parser::State::hasNext (  ) 
Returns:
whether this is a final state.

Reimplemented in Parser::TrainState, and Parser::ParseState.

References input.

State * Parser::State::Insert (  ) 

Perform an Insert action.

References extracted, and input.

Referenced by transition().

State * Parser::State::left ( char const *  action  )  [inline]

Perform a far left action.

References input, Tanl::TreeToken::right, and stack.

Referenced by transition().

State * Parser::State::Left ( Action  action  )  [inline]

Perform a Left action.

References input, Tanl::TreeToken::right, and stack.

Referenced by transition().

State * Parser::State::Pop (  ) 

Perform a Pop action.

References stack.

Referenced by transition().

State * Parser::State::right ( Action  action  )  [inline]

Perform a far right action.

References input, Tanl::TreeToken::left, and stack.

Referenced by transition().

State * Parser::State::Right ( Action  action  )  [inline]

Perform a Right action.

References input, Tanl::TreeToken::left, and stack.

Referenced by transition().

State * Parser::State::Shift (  )  [inline]

Perform a Shift action.

Parsing actions.

References input, and stack.

Referenced by transition().

State * Parser::State::transition ( Action  action  ) 

Perform action represented by Action action.

Perform a parsing action.

Returns:
next State, or NULL if action failed.

Actions can be: Left, Right, Shift, Left2, Right2, Left3, Right3, Extract, Insert. Left and Right operate on top of stack and next sentence token. Left2 and Right2 operate on second top of stack and next sentence token. Left3 and Right3 operate on third top of stack and next sentence token. Extract and Insert, move/restore token to/from extracted.

The reduce actions (Left/Right) are combined with the deprel to be assigned to the link created. If CompositeAction is false, instead, there are separate additional actions DepLeft and DepRight, used to assign the label to a link created with the preceding reduce action. DepLeft and DepRight are paired with the dependency label to be assigned.

Returns:
the new State after the transition.

Reimplemented in Parser::ParseState.

References DepLink(), Extract(), input, Insert(), left(), Left(), Pop(), right(), Right(), Shift(), and stack.

Referenced by Parser::EventStream::next(), and Parser::MlpParser::parse().


The documentation for this class 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.