blob: 8813bc484db740cfd873fd96d6dff04de325187c (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/*
* InputType.h
*
* Created on: 14 Dec 2015
* Author: hieu
*/
#pragma once
#include "PhraseBased/ReorderingConstraint.h"
#include "TypeDef.h"
namespace Moses2
{
class InputType
{
public:
//////////////////////////////////////////////////////////////////////////////
class XMLOption
{
public:
size_t startPos, phraseSize;
SCORE prob;
XMLOption(MemPool &pool, const std::string &nodeName, size_t vStartPos);
const char *GetNodeName() const {
return m_nodeName;
}
const char *GetTranslation() const {
return m_translation;
}
const char *GetEntity() const {
return m_entity;
}
void SetTranslation(MemPool &pool, const std::string &val);
void SetEntity(MemPool &pool, const std::string &val);
std::string Debug(const System &system) const;
public:
char *m_nodeName;
char *m_translation;
char *m_entity;
};
//////////////////////////////////////////////////////////////////////////////
InputType(MemPool &pool);
virtual ~InputType();
virtual void Init(const System &system, size_t size, int max_distortion);
ReorderingConstraint &GetReorderingConstraint() {
return m_reorderingConstraint;
}
const ReorderingConstraint &GetReorderingConstraint() const {
return m_reorderingConstraint;
}
const Vector<const XMLOption*> &GetXMLOptions() const {
return m_xmlOptions;
}
void AddXMLOption(const System &system, const XMLOption *xmlOption);
//! Returns true if there were any XML tags parsed that at least partially covered the range passed
bool XmlOverlap(size_t startPos, size_t endPos) const;
protected:
ReorderingConstraint m_reorderingConstraint; /**< limits on reordering specified either by "-mp" switch or xml tags */
Vector<const XMLOption*> m_xmlOptions;
Vector<bool> m_xmlCoverageMap;
};
} /* namespace Moses2 */
|