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/SyntaxTree.h | |
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/SyntaxTree.h')
-rw-r--r-- | phrase-extract/SyntaxTree.h | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/phrase-extract/SyntaxTree.h b/phrase-extract/SyntaxTree.h index 6ffb5da34..649a6197b 100644 --- a/phrase-extract/SyntaxTree.h +++ b/phrase-extract/SyntaxTree.h @@ -1,6 +1,3 @@ -// $Id: SyntaxTree.h 1960 2008-12-15 12:52:38Z phkoehn $ -// vim:tabstop=2 - /*********************************************************************** Moses - factored phrase-based language decoder Copyright (C) 2009 University of Edinburgh @@ -20,12 +17,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ***********************************************************************/ - #pragma once -#include <string> -#include <vector> + #include <map> #include <sstream> +#include <string> +#include <vector> namespace MosesTraining { @@ -79,7 +76,7 @@ public: typedef std::vector< int > SplitPoints; typedef std::vector< SplitPoints > ParentNodes; -class SyntaxTree +class SyntaxNodeCollection { protected: std::vector< SyntaxNode* > m_nodes; @@ -93,14 +90,12 @@ protected: int m_size; std::vector< SyntaxNode* > m_emptyNode; - friend std::ostream& operator<<(std::ostream&, const SyntaxTree&); - public: - SyntaxTree() + SyntaxNodeCollection() : m_top(0) // m_top doesn't get set unless ConnectNodes is called. , m_size(0) {} - ~SyntaxTree(); + ~SyntaxNodeCollection(); SyntaxNode *AddNode( int startPos, int endPos, std::string label ); @@ -119,10 +114,6 @@ public: } void ConnectNodes(); void Clear(); - std::string ToString() const; }; -std::ostream& operator<<(std::ostream&, const SyntaxTree&); - -} - +} // namespace MosesTraining |