mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-28 14:32:38 +03:00
output rules
This commit is contained in:
parent
a31003a953
commit
7e3c8db565
@ -13,13 +13,16 @@ public:
|
||||
|
||||
Parameter()
|
||||
:maxSpan(10)
|
||||
,maxNonTerm(2)
|
||||
,sourceSyntax(false)
|
||||
,targetSyntax(false)
|
||||
|
||||
{}
|
||||
|
||||
virtual ~Parameter();
|
||||
|
||||
int maxSpan;
|
||||
int maxNonTerm;
|
||||
|
||||
bool sourceSyntax, targetSyntax;
|
||||
};
|
||||
|
||||
|
@ -49,7 +49,8 @@ bool Rule::CanExtend(const Parameter ¶ms) const
|
||||
}
|
||||
|
||||
void Rule::Fillout(const ConsistentPhrases &consistentPhrases,
|
||||
const AlignedSentence &alignedSentence)
|
||||
const AlignedSentence &alignedSentence,
|
||||
const Parameter ¶ms)
|
||||
{
|
||||
// if last word is a non-term, check to see if it overlaps with any other non-terms
|
||||
if (m_arcs.back()->IsNonTerm()) {
|
||||
@ -108,6 +109,11 @@ void Rule::Fillout(const ConsistentPhrases &consistentPhrases,
|
||||
}
|
||||
}
|
||||
|
||||
if (targetNonTerms.size() > params.maxNonTerm) {
|
||||
m_isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// targetNonTerms will be deleted element-by-element as it is used
|
||||
CreateTargetPhrase(alignedSentence.GetPhrase(Moses::Output),
|
||||
targetStart,
|
||||
|
@ -27,7 +27,8 @@ public:
|
||||
bool IsValid(const Parameter ¶ms) const;
|
||||
bool CanExtend(const Parameter ¶ms) const;
|
||||
void Fillout(const ConsistentPhrases &consistentPhrases,
|
||||
const AlignedSentence &alignedSentence);
|
||||
const AlignedSentence &alignedSentence,
|
||||
const Parameter ¶ms);
|
||||
|
||||
const LatticeArc &GetLastArc() const
|
||||
{ return *m_arcs.back(); }
|
||||
|
@ -44,7 +44,7 @@ void Rules::CreateRules(const Parameter ¶ms, const ConsistentPhrases &consis
|
||||
for (iterRules = todoRules.begin(); iterRules != todoRules.end(); ++iterRules) {
|
||||
Rule *rule = *iterRules;
|
||||
|
||||
rule->Fillout(consistentPhrases, m_alignedSentence);
|
||||
rule->Fillout(consistentPhrases, m_alignedSentence, params);
|
||||
Extend(*rule, params);
|
||||
|
||||
if (rule->IsValid(params)) {
|
||||
|
Loading…
Reference in New Issue
Block a user