00001 #pragma once
00002
00003 #include <map>
00004 #include <memory>
00005 #include <set>
00006 #include <string>
00007 #include <vector>
00008
00009 #include "SyntaxNodeCollection.h"
00010 #include "SyntaxTree.h"
00011
00012 namespace MosesTraining {
00013 namespace Syntax {
00014
00023 class XmlTreeParser {
00024 public:
00026 std::auto_ptr<SyntaxTree> Parse(const std::string &, bool unescape=false);
00027
00029 const std::string &sentence() const { return sentence_; }
00030
00032 const std::vector<std::string> &words() const { return words_; }
00033
00035 const SyntaxNodeCollection &node_collection() const {
00036 return node_collection_;
00037 }
00038
00040 const std::set<std::string> &label_set() const { return label_set_; }
00041
00043 const std::map<std::string, int> &top_label_set() const {
00044 return top_label_set_;
00045 }
00046
00047 private:
00048 void AttachWords(const std::vector<std::string> &, SyntaxTree &);
00049
00050 std::string sentence_;
00051 SyntaxNodeCollection node_collection_;
00052 std::set<std::string> label_set_;
00053 std::map<std::string, int> top_label_set_;
00054 std::vector<std::string> words_;
00055 };
00056
00057 }
00058 }