mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-08 04:27:53 +03:00
typo
This commit is contained in:
parent
4b81964572
commit
34acd73d23
@ -14,7 +14,7 @@ using namespace std;
|
|||||||
|
|
||||||
namespace Moses2 {
|
namespace Moses2 {
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream &out, const TrellishNode &node)
|
std::ostream& operator<<(std::ostream &out, const TrellisNode &node)
|
||||||
{
|
{
|
||||||
out << "arcList=" << node.arcList->size() << " " << node.ind;
|
out << "arcList=" << node.arcList->size() << " " << node.ind;
|
||||||
return out;
|
return out;
|
||||||
@ -30,7 +30,7 @@ TrellisPath::TrellisPath(const Hypothesis *hypo, const ArcLists &arcLists)
|
|||||||
|
|
||||||
TrellisPath::TrellisPath(const TrellisPath &origPath,
|
TrellisPath::TrellisPath(const TrellisPath &origPath,
|
||||||
size_t edgeIndex,
|
size_t edgeIndex,
|
||||||
const TrellishNode &newNode,
|
const TrellisNode &newNode,
|
||||||
const ArcLists &arcLists,
|
const ArcLists &arcLists,
|
||||||
MemPool &pool,
|
MemPool &pool,
|
||||||
const System &system)
|
const System &system)
|
||||||
@ -53,7 +53,7 @@ TrellisPath::TrellisPath(const TrellisPath &origPath,
|
|||||||
while (prevHypo != NULL) {
|
while (prevHypo != NULL) {
|
||||||
const ArcList *arcList = arcLists.GetArcList(prevHypo);
|
const ArcList *arcList = arcLists.GetArcList(prevHypo);
|
||||||
assert(arcList);
|
assert(arcList);
|
||||||
TrellishNode node(*arcList, 0);
|
TrellisNode node(*arcList, 0);
|
||||||
nodes.push_back(node);
|
nodes.push_back(node);
|
||||||
|
|
||||||
prevHypo = prevHypo->GetPrevHypo();
|
prevHypo = prevHypo->GetPrevHypo();
|
||||||
@ -71,28 +71,11 @@ SCORE TrellisPath::GetFutureScore() const
|
|||||||
return m_scores->GetTotalScore();
|
return m_scores->GetTotalScore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrellisPath::AddNodes(const Hypothesis *hypo, const ArcLists &arcLists)
|
|
||||||
{
|
|
||||||
if (hypo) {
|
|
||||||
// add this hypo
|
|
||||||
//cerr << "hypo=" << hypo << " " << flush;
|
|
||||||
//cerr << *hypo << endl;
|
|
||||||
const ArcList *list = arcLists.GetArcList(hypo);
|
|
||||||
assert(list);
|
|
||||||
TrellishNode node(*list, 0);
|
|
||||||
nodes.push_back(node);
|
|
||||||
|
|
||||||
// add prev hypos
|
|
||||||
const Hypothesis *prev = hypo->GetPrevHypo();
|
|
||||||
AddNodes(prev, arcLists);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrellisPath::OutputToStream(std::ostream &out, const System &system) const
|
void TrellisPath::OutputToStream(std::ostream &out, const System &system) const
|
||||||
{
|
{
|
||||||
//cerr << "path=" << this << " " << nodes.size() << endl;
|
//cerr << "path=" << this << " " << nodes.size() << endl;
|
||||||
for (int i = nodes.size() - 1; i >= 0; --i) {
|
for (int i = nodes.size() - 1; i >= 0; --i) {
|
||||||
const TrellishNode &node = nodes[i];
|
const TrellisNode &node = nodes[i];
|
||||||
const Hypothesis *hypo = static_cast<const Hypothesis*>((*node.arcList)[node.ind]);
|
const Hypothesis *hypo = static_cast<const Hypothesis*>((*node.arcList)[node.ind]);
|
||||||
//cerr << "hypo=" << hypo << " " << *hypo << endl;
|
//cerr << "hypo=" << hypo << " " << *hypo << endl;
|
||||||
hypo->GetTargetPhrase().OutputToStream(out);
|
hypo->GetTargetPhrase().OutputToStream(out);
|
||||||
@ -115,7 +98,7 @@ void TrellisPath::CreateDeviantPaths(TrellisPaths &paths,
|
|||||||
|
|
||||||
//cerr << "prevEdgeChanged=" << prevEdgeChanged << endl;
|
//cerr << "prevEdgeChanged=" << prevEdgeChanged << endl;
|
||||||
for (size_t currEdge = prevEdgeChanged + 1 ; currEdge < sizePath ; currEdge++) {
|
for (size_t currEdge = prevEdgeChanged + 1 ; currEdge < sizePath ; currEdge++) {
|
||||||
TrellishNode newNode = nodes[currEdge];
|
TrellisNode newNode = nodes[currEdge];
|
||||||
assert(newNode.ind == 0);
|
assert(newNode.ind == 0);
|
||||||
const ArcList &arcList = *newNode.arcList;
|
const ArcList &arcList = *newNode.arcList;
|
||||||
|
|
||||||
@ -141,4 +124,21 @@ void TrellisPath::CalcScores(const Scores &origScores, MemPool &pool, const Syst
|
|||||||
m_scores = scores;
|
m_scores = scores;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrellisPath::AddNodes(const Hypothesis *hypo, const ArcLists &arcLists)
|
||||||
|
{
|
||||||
|
if (hypo) {
|
||||||
|
// add this hypo
|
||||||
|
//cerr << "hypo=" << hypo << " " << flush;
|
||||||
|
//cerr << *hypo << endl;
|
||||||
|
const ArcList *list = arcLists.GetArcList(hypo);
|
||||||
|
assert(list);
|
||||||
|
TrellisNode node(*list, 0);
|
||||||
|
nodes.push_back(node);
|
||||||
|
|
||||||
|
// add prev hypos
|
||||||
|
const Hypothesis *prev = hypo->GetPrevHypo();
|
||||||
|
AddNodes(prev, arcLists);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace Moses2 */
|
} /* namespace Moses2 */
|
||||||
|
@ -17,15 +17,15 @@ class Hypothesis;
|
|||||||
class System;
|
class System;
|
||||||
class TrellisPaths;
|
class TrellisPaths;
|
||||||
|
|
||||||
class TrellishNode
|
class TrellisNode
|
||||||
{
|
{
|
||||||
friend std::ostream& operator<<(std::ostream &, const TrellishNode &);
|
friend std::ostream& operator<<(std::ostream &, const TrellisNode &);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const ArcList *arcList;
|
const ArcList *arcList;
|
||||||
size_t ind;
|
size_t ind;
|
||||||
|
|
||||||
TrellishNode(const ArcList &varcList, size_t vind)
|
TrellisNode(const ArcList &varcList, size_t vind)
|
||||||
:arcList(&varcList)
|
:arcList(&varcList)
|
||||||
,ind(vind)
|
,ind(vind)
|
||||||
{}
|
{}
|
||||||
@ -33,7 +33,7 @@ public:
|
|||||||
|
|
||||||
class TrellisPath {
|
class TrellisPath {
|
||||||
public:
|
public:
|
||||||
std::vector<TrellishNode> nodes;
|
std::vector<TrellisNode> nodes;
|
||||||
int prevEdgeChanged;
|
int prevEdgeChanged;
|
||||||
|
|
||||||
/**< the last node that was wiggled to create this path
|
/**< the last node that was wiggled to create this path
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
TrellisPath(const TrellisPath &origPath,
|
TrellisPath(const TrellisPath &origPath,
|
||||||
size_t edgeIndex,
|
size_t edgeIndex,
|
||||||
const TrellishNode &newNode,
|
const TrellisNode &newNode,
|
||||||
const ArcLists &arcLists,
|
const ArcLists &arcLists,
|
||||||
MemPool &pool,
|
MemPool &pool,
|
||||||
const System &system);
|
const System &system);
|
||||||
|
@ -14,7 +14,7 @@ namespace Moses2 {
|
|||||||
|
|
||||||
struct CompareTrellisPathCollection {
|
struct CompareTrellisPathCollection {
|
||||||
bool operator()(const TrellisPath* pathA, const TrellisPath* pathB) const {
|
bool operator()(const TrellisPath* pathA, const TrellisPath* pathB) const {
|
||||||
return (pathA->GetFutureScore() > pathB->GetFutureScore());
|
return (pathA->GetFutureScore() < pathB->GetFutureScore());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user