2010-02-24 14:15:44 +03:00
|
|
|
#ifndef moses_XmlOption_h
|
|
|
|
#define moses_XmlOption_h
|
2008-06-11 14:52:57 +04:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2015-10-25 16:37:59 +03:00
|
|
|
#include "Range.h"
|
2008-12-13 16:12:54 +03:00
|
|
|
#include "TargetPhrase.h"
|
2015-11-03 22:36:43 +03:00
|
|
|
#include "parameters/AllOptions.h"
|
2008-10-09 03:51:26 +04:00
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
|
2008-10-30 21:43:17 +03:00
|
|
|
class TranslationOption;
|
2013-09-22 20:24:32 +04:00
|
|
|
class ReorderingConstraint;
|
2008-10-30 21:43:17 +03:00
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
/** This struct is used for storing XML force translation data for a given range in the sentence
|
|
|
|
*/
|
|
|
|
struct XmlOption {
|
|
|
|
|
2015-10-25 16:37:59 +03:00
|
|
|
Range range;
|
2011-02-24 16:14:42 +03:00
|
|
|
TargetPhrase targetPhrase;
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2015-10-25 16:37:59 +03:00
|
|
|
XmlOption(const Range &r, const TargetPhrase &tp)
|
2013-06-10 21:11:55 +04:00
|
|
|
: range(r), targetPhrase(tp) {
|
|
|
|
}
|
2008-06-11 14:52:57 +04:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2010-04-08 21:16:10 +04:00
|
|
|
std::string ParseXmlTagAttribute(const std::string& tag,const std::string& attributeName);
|
2011-11-16 14:22:29 +04:00
|
|
|
std::string TrimXml(const std::string& str, const std::string& lbrackStr="<", const std::string& rbrackStr=">") ;
|
|
|
|
bool isXmlTag(const std::string& tag, const std::string& lbrackStr="<", const std::string& rbrackStr=">");
|
|
|
|
std::vector<std::string> TokenizeXml(const std::string& str, const std::string& lbrackStr="<", const std::string& rbrackStr=">");
|
2015-11-12 03:00:40 +03:00
|
|
|
|
|
|
|
bool ProcessAndStripXMLTags(AllOptions const& opts,
|
2015-12-04 22:43:37 +03:00
|
|
|
std::string &line, std::vector<XmlOption const*> &res,
|
2015-12-11 03:00:33 +03:00
|
|
|
ReorderingConstraint &reorderingConstraint,
|
|
|
|
std::vector< size_t > &walls,
|
2015-12-10 06:17:36 +03:00
|
|
|
std::vector< std::pair<size_t, std::string> > &placeholders);
|
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2008-10-09 03:51:26 +04:00
|
|
|
}
|
|
|
|
|
2010-02-24 14:15:44 +03:00
|
|
|
#endif
|
2008-06-11 14:52:57 +04:00
|
|
|
|