#include <SyntaxNodeCollection.h>
Public Member Functions | |
SyntaxNodeCollection () | |
~SyntaxNodeCollection () | |
SyntaxNode * | AddNode (int startPos, int endPos, const std::string &label) |
Construct and insert a new SyntaxNode. | |
bool | HasNode (int startPos, int endPos) const |
Return true iff there are one or more SyntaxNodes with the given span. | |
const std::vector< SyntaxNode * > & | GetNodes (int startPos, int endPos) const |
Lookup the SyntaxNodes for a given span. | |
bool | HasNodeStartingAtPosition (int startPos) const |
const std::vector< SyntaxNode * > & | GetNodesByStartPosition (int startPos) const |
bool | HasNodeEndingAtPosition (int endPos) const |
const std::vector< SyntaxNode * > & | GetNodesByEndPosition (int endPos) const |
const std::vector< SyntaxNode * > & | GetAllNodes () |
Get a vector of pointers to all SyntaxNodes (unordered). | |
std::size_t | GetNumWords () const |
Get the number of words (defined as 1 + the max end pos of any node). | |
void | Clear () |
Clear the container (this deletes the SyntaxNodes). | |
std::auto_ptr< SyntaxTree > | ExtractTree () |
Extract a SyntaxTree (assuming the collection's nodes constitute a tree). |
Definition at line 37 of file SyntaxNodeCollection.h.
MosesTraining::SyntaxNodeCollection::SyntaxNodeCollection | ( | ) | [inline] |
Definition at line 40 of file SyntaxNodeCollection.h.
MosesTraining::SyntaxNodeCollection::~SyntaxNodeCollection | ( | ) |
Definition at line 29 of file SyntaxNodeCollection.cpp.
References Clear().
SyntaxNode * MosesTraining::SyntaxNodeCollection::AddNode | ( | int | startPos, | |
int | endPos, | |||
const std::string & | label | |||
) |
Construct and insert a new SyntaxNode.
Definition at line 44 of file SyntaxNodeCollection.cpp.
Referenced by LeftBinarize(), MosesTraining::ProcessAndStripXMLTags(), RightBinarize(), and SAMT().
void MosesTraining::SyntaxNodeCollection::Clear | ( | ) |
Clear the container (this deletes the SyntaxNodes).
Definition at line 34 of file SyntaxNodeCollection.cpp.
Referenced by MosesTraining::Syntax::XmlTreeParser::Parse(), and ~SyntaxNodeCollection().
std::auto_ptr< SyntaxTree > MosesTraining::SyntaxNodeCollection::ExtractTree | ( | ) |
Extract a SyntaxTree (assuming the collection's nodes constitute a tree).
Definition at line 105 of file SyntaxNodeCollection.cpp.
References MosesTraining::Syntax::Tree< T >::children(), MosesTraining::SyntaxNode::end, MosesTraining::Syntax::Tree< T >::parent(), MosesTraining::SyntaxNode::start, and MosesTraining::Syntax::Tree< T >::value().
Referenced by MosesTraining::Syntax::XmlTreeParser::Parse().
const std::vector< SyntaxNode* >& MosesTraining::SyntaxNodeCollection::GetAllNodes | ( | ) | [inline] |
Get a vector of pointers to all SyntaxNodes (unordered).
Definition at line 59 of file SyntaxNodeCollection.h.
Referenced by SAMT(), and store().
const std::vector< SyntaxNode * > & MosesTraining::SyntaxNodeCollection::GetNodes | ( | int | startPos, | |
int | endPos | |||
) | const |
Lookup the SyntaxNodes for a given span.
Definition at line 61 of file SyntaxNodeCollection.cpp.
Referenced by collectWordLabelCounts(), HasNode(), LeftBinarize(), MosesTraining::ProcessAndStripXMLTags(), RightBinarize(), and SAMT().
const std::vector< SyntaxNode * > & MosesTraining::SyntaxNodeCollection::GetNodesByEndPosition | ( | int | endPos | ) | const |
Definition at line 95 of file SyntaxNodeCollection.cpp.
Referenced by HasNodeEndingAtPosition().
const std::vector< SyntaxNode * > & MosesTraining::SyntaxNodeCollection::GetNodesByStartPosition | ( | int | startPos | ) | const |
Definition at line 80 of file SyntaxNodeCollection.cpp.
Referenced by HasNodeStartingAtPosition().
std::size_t MosesTraining::SyntaxNodeCollection::GetNumWords | ( | ) | const [inline] |
Get the number of words (defined as 1 + the max end pos of any node).
Definition at line 64 of file SyntaxNodeCollection.h.
Referenced by determineSplitPoints(), and SAMT().
bool MosesTraining::SyntaxNodeCollection::HasNode | ( | int | startPos, | |
int | endPos | |||
) | const |
Return true iff there are one or more SyntaxNodes with the given span.
Definition at line 56 of file SyntaxNodeCollection.cpp.
References GetNodes().
Referenced by determineSplitPoints(), and SAMT().
bool MosesTraining::SyntaxNodeCollection::HasNodeEndingAtPosition | ( | int | endPos | ) | const |
Definition at line 90 of file SyntaxNodeCollection.cpp.
References GetNodesByEndPosition().
bool MosesTraining::SyntaxNodeCollection::HasNodeStartingAtPosition | ( | int | startPos | ) | const |
Definition at line 75 of file SyntaxNodeCollection.cpp.
References GetNodesByStartPosition().