Tanl Linguistic Pipeline |
#include <State.h>
Public Member Functions | |
State (Sentence const &sentence, GlobalInfo *globalInfo) | |
Constructor. | |
State (State const &state) | |
bool | hasNext () |
State * | transition (Action action) |
Perform action represented by Action action . | |
State * | Shift () |
Perform a Shift action. | |
State * | Right (Action action) |
Perform a Right action. | |
State * | Left (Action action) |
Perform a Left action. | |
State * | right (Action action) |
Perform a far right action. | |
State * | left (char const *action) |
Perform a far left action. | |
State * | DepLink (Action action) |
Perform a link action. | |
State * | Extract () |
Perform an Extract action. | |
State * | Insert () |
Perform an Insert action. | |
State * | Pop () |
Perform a Pop action. | |
Sentence * | getSentence () |
void | showStatus () |
Public Attributes | |
Sentence | sentence |
the sentence parsed so far | |
TreeToken * | rootNode |
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 TreeToken * | copy (TreeToken *x) |
void | predicates (Features &preds, Action action=0) |
Collect features representing context. | |
Protected Attributes | |
SentenceInfo * | sentenceInfo |
int | verbCount |
Number of verbs so far. | |
Static Protected Attributes | |
static Tanl::Text::RegExp::Pattern | nonWordAscii |
Weird version of ispunct. |
Parser base state.
Parser::State::State | ( | Sentence const & | sentence, | |
GlobalInfo * | globalInfo | |||
) |
Constructor.
sentence | the sentence to be parsed. | |
globalInfo,global | parse information. |
References input, Tanl::Sentence::reverse(), rootNode, and stack.
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 | ( | ) |
bool Parser::State::hasNext | ( | ) |
Reimplemented in Parser::TrainState, and Parser::ParseState.
References input.
State * Parser::State::Insert | ( | ) |
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 | ( | ) |
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] |
State * Parser::State::transition | ( | Action | action | ) |
Perform action represented by Action action
.
Perform a parsing action.
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.
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().