diff options
author | Phil Williams <philip.williams@mac.com> | 2015-05-29 20:46:02 +0300 |
---|---|---|
committer | Phil Williams <philip.williams@mac.com> | 2015-05-29 20:46:02 +0300 |
commit | 2f735998ca8755263ec8dcc30303358988519091 (patch) | |
tree | 4cec8b463e85f5bcea86d786919a27b608c06fc0 /phrase-extract/relax-parse-main.cpp | |
parent | 5d8af9c2896d86785c5db2fd3a8029ae9b741e26 (diff) |
Rename MosesTraining::SyntaxTree to MosesTraining::SyntaxNodeCollection
This is the first step in a small-scale refactoring effort that will touch a
lot of the syntax-related code in moses/phrase-extract. The end goals are:
- a storage mechanism for general attribute/value pairs in XML-style
tree / lattice input. E.g. the "pcfg-score" and "semantic-role"
attributes in:
<tree label="PRP" pcfg-score="1.0" semantic-role="AGENT"> I </tree>
- consolidation of the various near-duplicate Tree / XmlTreeParser classes
that have accumulated over the years (my fault)
- general de-crufting
Diffstat (limited to 'phrase-extract/relax-parse-main.cpp')
-rw-r--r-- | phrase-extract/relax-parse-main.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/phrase-extract/relax-parse-main.cpp b/phrase-extract/relax-parse-main.cpp index 5c9daa7ae..5bca886bf 100644 --- a/phrase-extract/relax-parse-main.cpp +++ b/phrase-extract/relax-parse-main.cpp @@ -43,7 +43,7 @@ int main(int argc, char* argv[]) // process into syntax tree representation set< string > labelCollection; // set of labels, not used map< string, int > topLabelCollection; // count of top labels, not used - SyntaxTree tree; + SyntaxNodeCollection tree; ProcessAndStripXMLTags( inBufferString, tree, labelCollection, topLabelCollection, false ); const vector< string > inWords = util::tokenize( inBufferString ); @@ -105,7 +105,7 @@ void init(int argc, char* argv[]) } } -void store( SyntaxTree &tree, const vector< string > &words ) +void store( SyntaxNodeCollection &tree, const vector< string > &words ) { // output words for( size_t i=0; i<words.size(); i++ ) { @@ -126,7 +126,7 @@ void store( SyntaxTree &tree, const vector< string > &words ) cout << endl; } -void LeftBinarize( SyntaxTree &tree, ParentNodes &parents ) +void LeftBinarize( SyntaxNodeCollection &tree, ParentNodes &parents ) { for(ParentNodes::const_iterator p = parents.begin(); p != parents.end(); p++) { const SplitPoints &point = *p; @@ -143,7 +143,7 @@ void LeftBinarize( SyntaxTree &tree, ParentNodes &parents ) } } -void RightBinarize( SyntaxTree &tree, ParentNodes &parents ) +void RightBinarize( SyntaxNodeCollection &tree, ParentNodes &parents ) { for(ParentNodes::const_iterator p = parents.begin(); p != parents.end(); p++) { const SplitPoints &point = *p; @@ -161,11 +161,11 @@ void RightBinarize( SyntaxTree &tree, ParentNodes &parents ) } } -void SAMT( SyntaxTree &tree, ParentNodes &parents ) +void SAMT( SyntaxNodeCollection &tree, ParentNodes &parents ) { int numWords = tree.GetNumWords(); - SyntaxTree newTree; // to store new nodes + SyntaxNodeCollection newTree; // to store new nodes // look through parents to combine children for(ParentNodes::const_iterator p = parents.begin(); p != parents.end(); p++) { |