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
6f3b6fef6f
commit
be50bb3195
@ -9,6 +9,13 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
void PhrasePairRange::Debug(std::ostream &out) const
|
||||
{
|
||||
out << "[" << sourceTarget.first.first << "-" << sourceTarget.first.second << "]["
|
||||
<< sourceTarget.second.first << "-" << sourceTarget.second.second << "]";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
ConsistentPhrases::ConsistentPhrases() {
|
||||
// TODO Auto-generated constructor stub
|
||||
|
||||
@ -51,10 +58,15 @@ const ConsistentPhrase *ConsistentPhrases::Find(
|
||||
void ConsistentPhrases::Debug(std::ostream &out) const
|
||||
{
|
||||
out << "m_rangeToColl=" << m_rangeToColl.size()
|
||||
<< " m_coll=" << m_coll.size() <<endl;
|
||||
for (size_t i = 0; i < m_coll.size(); ++i) {
|
||||
const ConsistentPhrase &consistentPhrase = m_coll[i];
|
||||
consistentPhrase.Debug(out);
|
||||
<< " m_coll=" << m_coll.size() << endl;
|
||||
RangeToColl::const_iterator iter;
|
||||
for (iter = m_rangeToColl.begin(); iter != m_rangeToColl.end(); ++iter) {
|
||||
const PhrasePairRange &range = iter->first;
|
||||
const ConsistentPhrase *consistentPhrase = iter->second;
|
||||
range.Debug(out);
|
||||
out << "=";
|
||||
out << consistentPhrase;
|
||||
consistentPhrase->Debug(out);
|
||||
out << endl;
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,8 @@ struct PhrasePairRange
|
||||
|
||||
}
|
||||
|
||||
void Debug(std::ostream &out) const;
|
||||
|
||||
inline bool operator<(const PhrasePairRange &other) const {
|
||||
return sourceTarget < other.sourceTarget;
|
||||
}
|
||||
|
@ -65,6 +65,8 @@ void Rule::Fillout(const ConsistentPhrases &consistentPhrases,
|
||||
const ConsistentRange &targetRange = sourceRange->GetOtherRange();
|
||||
|
||||
if (lastTargetRange.Overlap(targetRange)) {
|
||||
cerr << "NOT VALID1";
|
||||
Debug(cerr);
|
||||
m_isValid = false;
|
||||
m_canExtend = false;
|
||||
return;
|
||||
@ -92,6 +94,8 @@ void Rule::Fillout(const ConsistentPhrases &consistentPhrases,
|
||||
|
||||
m_consistentPhrase = consistentPhrases.Find(sourceStart, sourceEnd, targetStart, targetEnd);
|
||||
if (m_consistentPhrase == NULL) {
|
||||
cerr << "NOT VALID2";
|
||||
Debug(cerr);
|
||||
m_isValid = false;
|
||||
return;
|
||||
}
|
||||
@ -110,6 +114,8 @@ void Rule::Fillout(const ConsistentPhrases &consistentPhrases,
|
||||
}
|
||||
|
||||
if (targetNonTerms.size() > params.maxNonTerm) {
|
||||
cerr << "NOT VALID3";
|
||||
Debug(cerr);
|
||||
m_isValid = false;
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user