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