DeSR Dependency Parser

Parser::State Class Reference

Parser base state. More...

#include <State.h>

Inheritance diagram for Parser::State:

Inheritance graph
Collaboration diagram for Parser::State:

Collaboration graph

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 ()
 Parsing actions.
StateRight (Action action)
StateLeft (Action action)
Stateright (Action action)
Stateleft (char const *action)
StateDepLink (Action action)
StateExtract ()
StateInsert ()
Sentence * getSentence ()
void showStatus ()

Public Attributes

Sentence sentence
 The current sentence.
TreeTokenrootNode
 Dummy root node.
std::string splitFeature
 used to split SVMs

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
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.
State const * previous
 The previous State in the derivation.
Action action
 The action that lead to this state.
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.

Definition at line 72 of file State.h.


Constructor & Destructor Documentation

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

Constructor.

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

Definition at line 124 of file State.cpp.

References input, rootNode, and stack.


Member Function Documentation

bool Parser::State::hasNext (  ) 

Returns:
whether this is a final state.

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

Definition at line 138 of file State.cpp.

References input.

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.

Definition at line 336 of file State.cpp.

References input, Shift(), and stack.

Referenced by Parser::EventStream::next(), and Parser::ParseState::transition().


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