diff options
author | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-12-10 06:17:36 +0300 |
---|---|---|
committer | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-12-10 06:17:36 +0300 |
commit | 831dc83778f4594375e9de6a4e2831a02b3e1314 (patch) | |
tree | fdeb1aa98f940a073d7d5e197ce58b67db0418d1 /moses/XmlOption.cpp | |
parent | 240b88c6834c9c94e8a6448a34dc4ad33bdf3fbd (diff) |
Code cleanup and refactoring.
Diffstat (limited to 'moses/XmlOption.cpp')
-rw-r--r-- | moses/XmlOption.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/moses/XmlOption.cpp b/moses/XmlOption.cpp index 342b08172..da1339b95 100644 --- a/moses/XmlOption.cpp +++ b/moses/XmlOption.cpp @@ -159,16 +159,19 @@ vector<string> TokenizeXml(const string& str, const std::string& lbrackStr, cons * \param rbrackStr xml tag's right bracket string, typically ">" */ bool -ProcessAndStripXMLTags(AllOptions const& opts, string &line, vector<XmlOption const*> &res, +ProcessAndStripXMLTags(AllOptions const& opts, string &line, + vector<XmlOption const*> &res, ReorderingConstraint &reorderingConstraint, vector< size_t > &walls, - std::vector< std::pair<size_t, std::string> > &placeholders, - int offset, const std::string& lbrackStr, - const std::string& rbrackStr) + std::vector< std::pair<size_t, std::string> > &placeholders) { //parse XML markup in translation line - const StaticData &staticData = StaticData::Instance(); + const std::string& lbrackStr = opts.input.xml_brackets.first; + const std::string& rbrackStr = opts.input.xml_brackets.second; + int offset = is_syntax(opts.search.algo) ? 1 : 0; + + // const StaticData &staticData = StaticData::Instance(); // hack. What pt should XML trans opt be assigned to? PhraseDictionary *firstPt = NULL; @@ -177,7 +180,6 @@ ProcessAndStripXMLTags(AllOptions const& opts, string &line, vector<XmlOption co } // no xml tag? we're done. -//if (line.find_first_of('<') == string::npos) { if (line.find(lbrackStr) == string::npos) { return true; } @@ -195,7 +197,6 @@ ProcessAndStripXMLTags(AllOptions const& opts, string &line, vector<XmlOption co size_t wordPos = 0; // position in sentence (in terms of number of words) const vector<FactorType> &outputFactorOrder = opts.output.factor_order; - // const string &factorDelimiter = staticData.GetFactorDelimiter(); // loop through the tokens for (size_t xmlTokenPos = 0 ; xmlTokenPos < xmlTokens.size() ; xmlTokenPos++) { @@ -459,7 +460,7 @@ ProcessAndStripXMLTags(AllOptions const& opts, string &line, vector<XmlOption co targetPhrase.CreateFromString(Output, outputFactorOrder,altTexts[i], NULL); // lhs - const UnknownLHSList &lhsList = staticData.GetUnknownLHS(); + const UnknownLHSList &lhsList = opts.syntax.unknown_lhs; // staticData.GetUnknownLHS(); if (!lhsList.empty()) { const Factor *factor = FactorCollection::Instance().AddFactor(lhsList[0].first, true); Word *targetLHS = new Word(true); |