#include <xml_tree_parser.h>
Public Member Functions | |
std::auto_ptr< SyntaxTree > | Parse (const std::string &, bool unescape=false) |
Parse a single sentence and return a SyntaxTree (with words attached). | |
const std::string & | sentence () const |
Get the sentence string (as returned by ProcessAndStripXMLTags). | |
const std::vector< std::string > & | words () const |
Get the sentence as a vector of words. | |
const SyntaxNodeCollection & | node_collection () const |
Get the node collection (as returned by ProcessAndStripXMLTags). | |
const std::set< std::string > & | label_set () const |
Get the label set (as returned by ProcessAndStripXMLTags). | |
const std::map< std::string, int > & | top_label_set () const |
Get the top label set (as returned by ProcessAndStripXMLTags). |
This is a thin wrapper around the ProcessAndStripXMLTags function. After calling Parse(), the output from the ProcessAndStripXMLTags call (the sentence, node collection, label set, and top label set) are available via accessors.
Definition at line 23 of file xml_tree_parser.h.
const std::set<std::string>& MosesTraining::Syntax::XmlTreeParser::label_set | ( | ) | const [inline] |
Get the label set (as returned by ProcessAndStripXMLTags).
Definition at line 40 of file xml_tree_parser.h.
Referenced by MosesTraining::Syntax::GHKM::ExtractGHKM::Main().
const SyntaxNodeCollection& MosesTraining::Syntax::XmlTreeParser::node_collection | ( | ) | const [inline] |
Get the node collection (as returned by ProcessAndStripXMLTags).
Definition at line 35 of file xml_tree_parser.h.
Referenced by MosesTraining::Syntax::GHKM::ExtractGHKM::Main().
std::auto_ptr< SyntaxTree > MosesTraining::Syntax::XmlTreeParser::Parse | ( | const std::string & | line, | |
bool | unescape = false | |||
) |
Parse a single sentence and return a SyntaxTree (with words attached).
Definition at line 18 of file xml_tree_parser.cc.
References MosesTraining::SyntaxNodeCollection::Clear(), MosesTraining::SyntaxNodeCollection::ExtractTree(), MosesTraining::XmlException::getMsg(), MosesTraining::ProcessAndStripXMLTags(), and util::tokenize().
Referenced by MosesTraining::Syntax::PCFG::PcfgScore::Main(), MosesTraining::Syntax::PCFG::PcfgExtract::Main(), and MosesTraining::Syntax::GHKM::ExtractGHKM::Main().
const std::string& MosesTraining::Syntax::XmlTreeParser::sentence | ( | ) | const [inline] |
Get the sentence string (as returned by ProcessAndStripXMLTags).
Definition at line 29 of file xml_tree_parser.h.
const std::map<std::string, int>& MosesTraining::Syntax::XmlTreeParser::top_label_set | ( | ) | const [inline] |
Get the top label set (as returned by ProcessAndStripXMLTags).
Definition at line 43 of file xml_tree_parser.h.
Referenced by MosesTraining::Syntax::GHKM::ExtractGHKM::Main().
const std::vector<std::string>& MosesTraining::Syntax::XmlTreeParser::words | ( | ) | const [inline] |
Get the sentence as a vector of words.
Definition at line 32 of file xml_tree_parser.h.
Referenced by MosesTraining::Syntax::GHKM::ExtractGHKM::Main().