Welcome to mirror list, hosted at ThFree Co, Russian Federation.

XmlOption.h « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: da3ee80447a079d7fae91cb8cf650ad542457cb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef moses_XmlOption_h
#define moses_XmlOption_h

#include <vector>
#include <string>
#include "Range.h"
#include "TargetPhrase.h"
#include "parameters/AllOptions.h"
namespace Moses
{

class TranslationOption;
class ReorderingConstraint;

/** This struct is used for storing XML force translation data for a given range in the sentence
 */
struct XmlOption {

  Range range;
  TargetPhrase targetPhrase;

  XmlOption(const Range &r, const TargetPhrase &tp)
    : range(r), targetPhrase(tp) {
  }

};

std::string ParseXmlTagAttribute(const std::string& tag,const std::string& attributeName);
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=">");

bool ProcessAndStripXMLTags(AllOptions const& opts,
                            std::string &line, std::vector<XmlOption const*> &res,
                            ReorderingConstraint &reorderingConstraint,
                            std::vector< size_t > &walls,
                            std::vector< std::pair<size_t, std::string> > &placeholders,
                            InputType &input);


}

#endif