blob: 55452a319360cd7e699d746d41d53d1b2f5f32bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#pragma once
#include "ChartTrellisNode.h"
#include "../../moses/src/ScoreComponentCollection.h"
#include "../../moses/src/Phrase.h"
namespace MosesChart
{
class Hypothesis;
class TrellisPathCollection;
class TrellisPath
{
friend std::ostream& operator<<(std::ostream&, const TrellisPath&);
protected:
// recursively point backwards
TrellisNode *m_finalNode;
const TrellisNode *m_prevNodeChanged;
const TrellisPath *m_prevPath;
Moses::ScoreComponentCollection m_scoreBreakdown;
float m_totalScore;
// deviate by 1 hypo
TrellisPath(const TrellisPath &origPath
, const TrellisNode &soughtNode
, const Hypothesis &replacementHypo
, Moses::ScoreComponentCollection &scoreChange);
void CreateDeviantPaths(TrellisPathCollection &pathColl, const TrellisNode &soughtNode) const;
const TrellisNode &GetFinalNode() const
{
assert (m_finalNode);
return *m_finalNode;
}
public:
TrellisPath(const Hypothesis *hypo);
~TrellisPath();
//! get score for this path throught trellis
inline float GetTotalScore() const
{ return m_totalScore; }
Moses::Phrase GetOutputPhrase() const;
/** returns detailed component scores */
inline const Moses::ScoreComponentCollection &GetScoreBreakdown() const
{
return m_scoreBreakdown;
}
void CreateDeviantPaths(TrellisPathCollection &pathColl) const;
};
}
|