mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 05:14:36 +03:00
don't allow rules with only non-terms on either source or target
This commit is contained in:
parent
73b14cee57
commit
32e6a72d5d
@ -172,6 +172,27 @@ void Rule::CreateSymbols(const Global &global, bool &isValid, const SentenceAlig
|
||||
//cerr << "m_target=" << m_target.GetSize() << ":" << m_target << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isValid) {
|
||||
isValid = false;
|
||||
for (size_t i = 0; i < m_source.GetSize(); ++i) {
|
||||
const Symbol &symbol = m_source.GetSymbol(i);
|
||||
if (symbol.IsTerminal()) {
|
||||
isValid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isValid) {
|
||||
isValid = false;
|
||||
for (size_t i = 0; i < m_target.GetSize(); ++i) {
|
||||
const Symbol &symbol = m_target.GetSymbol(i);
|
||||
if (symbol.IsTerminal()) {
|
||||
isValid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Rule::MoreDefaultNonTermThanTerm() const
|
||||
|
@ -32,5 +32,6 @@ public:
|
||||
, bool isSourceSyntax, bool isTargetSyntax);
|
||||
|
||||
int Compare(const Symbol &other) const;
|
||||
|
||||
bool IsTerminal() const
|
||||
{ return m_isTerminal; }
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user