00001 #ifndef moses_XmlOption_h 00002 #define moses_XmlOption_h 00003 00004 #include <vector> 00005 #include <string> 00006 #include "Range.h" 00007 #include "TargetPhrase.h" 00008 #include "parameters/AllOptions.h" 00009 namespace Moses 00010 { 00011 00012 class TranslationOption; 00013 class ReorderingConstraint; 00014 00017 struct XmlOption { 00018 00019 Range range; 00020 TargetPhrase targetPhrase; 00021 00022 XmlOption(const Range &r, const TargetPhrase &tp) 00023 : range(r), targetPhrase(tp) { 00024 } 00025 00026 }; 00027 00028 std::string ParseXmlTagAttribute(const std::string& tag,const std::string& attributeName); 00029 std::string TrimXml(const std::string& str, const std::string& lbrackStr="<", const std::string& rbrackStr=">") ; 00030 bool isXmlTag(const std::string& tag, const std::string& lbrackStr="<", const std::string& rbrackStr=">"); 00031 std::vector<std::string> TokenizeXml(const std::string& str, const std::string& lbrackStr="<", const std::string& rbrackStr=">"); 00032 00033 bool ProcessAndStripXMLTags(AllOptions const& opts, 00034 std::string &line, std::vector<XmlOption const*> &res, 00035 ReorderingConstraint &reorderingConstraint, 00036 std::vector< size_t > &walls, 00037 std::vector< std::pair<size_t, std::string> > &placeholders, 00038 InputType &input); 00039 00040 00041 } 00042 00043 #endif 00044