mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-29 06:52:34 +03:00
it runs
This commit is contained in:
parent
ede6ff7585
commit
63f0f1b348
@ -38,3 +38,9 @@ std::string ConsistentPhrase::Debug() const
|
||||
|
||||
return out.str();
|
||||
}
|
||||
|
||||
void ConsistentPhrase::Output(std::ostream &out) const
|
||||
{
|
||||
out << "[X][X]";
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ public:
|
||||
bool operator<(const ConsistentPhrase &other) const;
|
||||
|
||||
std::string Debug() const;
|
||||
void Output(std::ostream &out) const;
|
||||
|
||||
};
|
||||
|
||||
|
@ -64,6 +64,7 @@ int main(int argc, char** argv)
|
||||
rules.CreateRules();
|
||||
cerr << rules.Debug();
|
||||
|
||||
rules.Output(cout);
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,14 +28,8 @@ Rule::Rule(const Rule ©, const ConsistentPhrase &cp)
|
||||
,m_canRecurse(true)
|
||||
,m_nonterms(copy.m_nonterms)
|
||||
{
|
||||
cerr << © << "-->" << this << " ";
|
||||
cerr << "Extending " << m_consistentPhrase.Debug();
|
||||
cerr << " with " << cp.Debug();
|
||||
|
||||
m_nonterms.push_back(&cp);
|
||||
CreateSource();
|
||||
|
||||
cerr << " rule:" << Debug() << endl;
|
||||
}
|
||||
|
||||
Rule::~Rule() {
|
||||
@ -121,3 +115,14 @@ std::string Rule::Debug() const
|
||||
|
||||
return out.str();
|
||||
}
|
||||
|
||||
void Rule::Output(std::ostream &out) const
|
||||
{
|
||||
// source
|
||||
for (size_t i = 0; i < m_source.size(); ++i) {
|
||||
const RuleSymbol &symbol = *m_source[i];
|
||||
symbol.Output(out);
|
||||
out << " ";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
int GetNextSourcePosForNonTerm() const;
|
||||
|
||||
std::string Debug() const;
|
||||
void Output(std::ostream &out) const;
|
||||
|
||||
protected:
|
||||
const ConsistentPhrase &m_consistentPhrase;
|
||||
|
@ -17,6 +17,7 @@ public:
|
||||
virtual ~RuleSymbol();
|
||||
|
||||
virtual std::string Debug() const = 0;
|
||||
virtual void Output(std::ostream &out) const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -66,7 +66,7 @@ void Rules::Extend(const Rule &rule)
|
||||
continue;
|
||||
}
|
||||
|
||||
const ConsistentPhrases::Coll cps = allCPS.GetColl(sourceStart, sourceEnd);
|
||||
const ConsistentPhrases::Coll &cps = allCPS.GetColl(sourceStart, sourceEnd);
|
||||
Extend(rule, cps);
|
||||
}
|
||||
}
|
||||
@ -109,3 +109,13 @@ std::string Rules::Debug() const
|
||||
|
||||
return out.str();
|
||||
}
|
||||
|
||||
void Rules::Output(std::ostream &out) const
|
||||
{
|
||||
std::set<Rule*>::const_iterator iter;
|
||||
for (iter = m_keepRules.begin(); iter != m_keepRules.end(); ++iter) {
|
||||
const Rule &rule = **iter;
|
||||
rule.Output(out);
|
||||
out << endl;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ public:
|
||||
void CreateRules();
|
||||
|
||||
std::string Debug() const;
|
||||
void Output(std::ostream &out) const;
|
||||
|
||||
protected:
|
||||
const AlignedSentence &m_alignedSentence;
|
||||
|
Loading…
Reference in New Issue
Block a user