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>
|
2008-12-13 16:12:54 +03:00
|
|
|
#include "WordsRange.h"
|
|
|
|
#include "TargetPhrase.h"
|
2008-12-15 15:52:38 +03:00
|
|
|
#include "ReorderingConstraint.h"
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2008-10-09 03:51:26 +04:00
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
|
2008-10-30 21:43:17 +03:00
|
|
|
class TranslationOption;
|
|
|
|
|
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 {
|
|
|
|
|
2011-02-24 16:14:42 +03:00
|
|
|
WordsRange range;
|
|
|
|
TargetPhrase targetPhrase;
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2011-02-24 16:14:42 +03:00
|
|
|
XmlOption(const WordsRange &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=">");
|
2010-04-08 21:16:10 +04:00
|
|
|
|
2013-05-29 21:16:15 +04:00
|
|
|
bool ProcessAndStripXMLTags(std::string &line, std::vector<XmlOption*> &res, ReorderingConstraint &reorderingConstraint, std::vector< size_t > &walls,
|
2013-07-18 20:00:44 +04:00
|
|
|
std::vector< std::pair<size_t, std::string> > &placeholders,
|
2013-07-24 21:06:46 +04:00
|
|
|
int offset,
|
2013-05-29 21:16:15 +04:00
|
|
|
const std::string& lbrackStr="<", const std::string& rbrackStr=">");
|
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
|
|
|
|