mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
change GetSystem() -> system
This commit is contained in:
parent
20a3977e8f
commit
900c1222d5
@ -100,7 +100,7 @@ void Distortion::EvaluateWhenApplied(const Manager &mgr,
|
||||
prev.first_gap);
|
||||
//cerr << "distortionScore=" << distortionScore << endl;
|
||||
|
||||
scores.PlusEquals(mgr.GetSystem(), *this, distortionScore);
|
||||
scores.PlusEquals(mgr.system, *this, distortionScore);
|
||||
|
||||
DistortionState_traditional &stateCast = static_cast<DistortionState_traditional&>(state);
|
||||
stateCast.Set(hypo.GetRange(), hypo.GetBitmap().GetFirstGapPos());
|
||||
|
@ -156,7 +156,7 @@ void KENLM::EvaluateWhenApplied(const Manager &mgr,
|
||||
{
|
||||
KenLMState &stateCast = static_cast<KenLMState&>(state);
|
||||
|
||||
const System &system = mgr.GetSystem();
|
||||
const System &system = mgr.system;
|
||||
|
||||
const lm::ngram::State &in_state = static_cast<const KenLMState&>(prevState).state;
|
||||
|
||||
|
@ -217,7 +217,7 @@ void LanguageModel::EvaluateWhenApplied(const Manager &mgr,
|
||||
}
|
||||
}
|
||||
|
||||
scores.PlusEquals(mgr.GetSystem(), *this, score);
|
||||
scores.PlusEquals(mgr.system, *this, score);
|
||||
|
||||
// return state
|
||||
//DebugContext(context);
|
||||
|
@ -41,10 +41,10 @@ Hypothesis::Hypothesis(Manager &mgr)
|
||||
{
|
||||
MemPool &pool = m_mgr.GetPool();
|
||||
|
||||
m_scores = new (pool.Allocate<Scores>()) Scores(pool, m_mgr.GetSystem().featureFunctions.GetNumScores());
|
||||
m_scores = new (pool.Allocate<Scores>()) Scores(pool, m_mgr.system.featureFunctions.GetNumScores());
|
||||
|
||||
// FF states
|
||||
const std::vector<const StatefulFeatureFunction*> &sfffs = m_mgr.GetSystem().featureFunctions.GetStatefulFeatureFunctions();
|
||||
const std::vector<const StatefulFeatureFunction*> &sfffs = m_mgr.system.featureFunctions.GetStatefulFeatureFunctions();
|
||||
size_t numStatefulFFs = sfffs.size();
|
||||
m_ffStates = (Moses::FFState **) pool.Allocate(sizeof(Moses::FFState*) * numStatefulFFs);
|
||||
|
||||
@ -69,7 +69,7 @@ void Hypothesis::Init(const TargetPhrase &tp,
|
||||
m_prevHypo = NULL;
|
||||
m_currTargetWordsRange = Moses::Range(NOT_FOUND, NOT_FOUND);
|
||||
|
||||
size_t numScores = m_mgr.GetSystem().featureFunctions.GetNumScores();
|
||||
size_t numScores = m_mgr.system.featureFunctions.GetNumScores();
|
||||
m_scores->Reset(numScores);
|
||||
}
|
||||
|
||||
@ -86,15 +86,15 @@ void Hypothesis::Init(const Hypothesis &prevHypo,
|
||||
prevHypo.m_currTargetWordsRange.GetEndPos()
|
||||
+ tp.GetSize());
|
||||
|
||||
size_t numScores = m_mgr.GetSystem().featureFunctions.GetNumScores();
|
||||
size_t numScores = m_mgr.system.featureFunctions.GetNumScores();
|
||||
m_scores->Reset(numScores);
|
||||
m_scores->PlusEquals(m_mgr.GetSystem(), prevHypo.GetScores());
|
||||
m_scores->PlusEquals(m_mgr.GetSystem(), GetTargetPhrase().GetScores());
|
||||
m_scores->PlusEquals(m_mgr.system, prevHypo.GetScores());
|
||||
m_scores->PlusEquals(m_mgr.system, GetTargetPhrase().GetScores());
|
||||
}
|
||||
|
||||
size_t Hypothesis::hash() const
|
||||
{
|
||||
size_t numStatefulFFs = m_mgr.GetSystem().featureFunctions.GetStatefulFeatureFunctions().size();
|
||||
size_t numStatefulFFs = m_mgr.system.featureFunctions.GetStatefulFeatureFunctions().size();
|
||||
size_t seed;
|
||||
|
||||
// coverage
|
||||
@ -112,7 +112,7 @@ size_t Hypothesis::hash() const
|
||||
|
||||
bool Hypothesis::operator==(const Hypothesis &other) const
|
||||
{
|
||||
size_t numStatefulFFs = m_mgr.GetSystem().featureFunctions.GetStatefulFeatureFunctions().size();
|
||||
size_t numStatefulFFs = m_mgr.system.featureFunctions.GetStatefulFeatureFunctions().size();
|
||||
// coverage
|
||||
if (m_sourceCompleted != other.m_sourceCompleted) {
|
||||
return false;
|
||||
@ -146,13 +146,13 @@ std::ostream& operator<<(std::ostream &out, const Hypothesis &obj)
|
||||
{
|
||||
obj.OutputToStream(out);
|
||||
out << " ";
|
||||
obj.GetScores().Debug(out, obj.m_mgr.GetSystem().featureFunctions);
|
||||
obj.GetScores().Debug(out, obj.m_mgr.system.featureFunctions);
|
||||
return out;
|
||||
}
|
||||
|
||||
void Hypothesis::EmptyHypothesisState(const PhraseImpl &input)
|
||||
{
|
||||
const std::vector<const StatefulFeatureFunction*> &sfffs = m_mgr.GetSystem().featureFunctions.GetStatefulFeatureFunctions();
|
||||
const std::vector<const StatefulFeatureFunction*> &sfffs = m_mgr.system.featureFunctions.GetStatefulFeatureFunctions();
|
||||
BOOST_FOREACH(const StatefulFeatureFunction *sfff, sfffs) {
|
||||
size_t statefulInd = sfff->GetStatefulInd();
|
||||
Moses::FFState *state = m_ffStates[statefulInd];
|
||||
@ -162,7 +162,7 @@ void Hypothesis::EmptyHypothesisState(const PhraseImpl &input)
|
||||
|
||||
void Hypothesis::EvaluateWhenApplied()
|
||||
{
|
||||
const std::vector<const StatefulFeatureFunction*> &sfffs = m_mgr.GetSystem().featureFunctions.GetStatefulFeatureFunctions();
|
||||
const std::vector<const StatefulFeatureFunction*> &sfffs = m_mgr.system.featureFunctions.GetStatefulFeatureFunctions();
|
||||
BOOST_FOREACH(const StatefulFeatureFunction *sfff, sfffs) {
|
||||
size_t statefulInd = sfff->GetStatefulInd();
|
||||
const Moses::FFState *prevState = m_prevHypo->GetState(statefulInd);
|
||||
|
@ -21,7 +21,7 @@ using namespace std;
|
||||
Manager::Manager(System &system, const std::string &inputStr)
|
||||
:m_pool(&system.GetManagerPool())
|
||||
,m_hypoRecycle(&system.GetHypoRecycle())
|
||||
,m_system(system)
|
||||
,system(system)
|
||||
,m_initRange(NOT_FOUND, NOT_FOUND)
|
||||
,m_initPhrase(system.GetManagerPool(), system, 0)
|
||||
{
|
||||
|
@ -24,6 +24,8 @@ class SearchNormal;
|
||||
|
||||
class Manager {
|
||||
public:
|
||||
const System &system;
|
||||
|
||||
Manager(System &system, const std::string &inputStr);
|
||||
virtual ~Manager();
|
||||
|
||||
@ -33,9 +35,6 @@ public:
|
||||
Recycler<Hypothesis*> &GetHypoRecycle() const
|
||||
{ return *m_hypoRecycle; }
|
||||
|
||||
const System &GetSystem() const
|
||||
{ return m_system; }
|
||||
|
||||
Moses::Bitmaps &GetBitmaps()
|
||||
{ return *m_bitmaps; }
|
||||
|
||||
@ -52,7 +51,6 @@ protected:
|
||||
mutable MemPool *m_pool;
|
||||
mutable Recycler<Hypothesis*> *m_hypoRecycle;
|
||||
|
||||
const System &m_system;
|
||||
PhraseImpl *m_input;
|
||||
InputPaths m_inputPaths;
|
||||
Moses::Bitmaps *m_bitmaps;
|
||||
|
@ -20,7 +20,7 @@ using namespace std;
|
||||
SearchNormal::SearchNormal(Manager &mgr, Stacks &stacks)
|
||||
:m_mgr(mgr)
|
||||
,m_stacks(stacks)
|
||||
,m_stackSize(mgr.GetSystem().stackSize)
|
||||
,m_stackSize(mgr.system.stackSize)
|
||||
{
|
||||
// TODO Auto-generated constructor stub
|
||||
|
||||
@ -66,10 +66,10 @@ void SearchNormal::Extend(const Hypothesis &hypo, const InputPath &path)
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_mgr.GetSystem().maxDistortion >= 0) {
|
||||
if (m_mgr.system.maxDistortion >= 0) {
|
||||
// distortion limit
|
||||
int distortion = ComputeDistortionDistance(hypoRange, pathRange);
|
||||
if (distortion > m_mgr.GetSystem().maxDistortion) {
|
||||
if (distortion > m_mgr.system.maxDistortion) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -122,7 +122,7 @@ void SearchNormal::Extend(const Hypothesis &hypo, const InputPath &path)
|
||||
Moses::Range bestNextExtension(hypoFirstGapPos, hypoFirstGapPos);
|
||||
|
||||
if (ComputeDistortionDistance(pathRange, bestNextExtension)
|
||||
> m_mgr.GetSystem().maxDistortion) {
|
||||
> m_mgr.system.maxDistortion) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -133,7 +133,8 @@ void SearchNormal::Extend(const Hypothesis &hypo, const InputPath &path)
|
||||
// extend this hypo
|
||||
const Moses::Bitmap &newBitmap = m_mgr.GetBitmaps().GetBitmap(bitmap, pathRange);
|
||||
|
||||
cerr << "DOING " << bitmap << " [" << pathRange.GetStartPos() << " " << pathRange.GetEndPos() << "]" << endl;
|
||||
cerr << "DOING " << bitmap << " [" << hypoRange.GetStartPos() << " " << hypoRange.GetEndPos() << "]"
|
||||
" [" << pathRange.GetStartPos() << " " << pathRange.GetEndPos() << "]" << endl;
|
||||
|
||||
const std::vector<TargetPhrases::shared_const_ptr> &tpsAllPt = path.targetPhrases;
|
||||
|
||||
|
@ -91,7 +91,7 @@ uint64_t ProbingPT::GetSourceProbingId(const Moses::Factor *factor) const
|
||||
TargetPhrases::shared_const_ptr ProbingPT::Lookup(const Manager &mgr, InputPath &inputPath) const
|
||||
{
|
||||
const Phrase &sourcePhrase = inputPath.subPhrase;
|
||||
TargetPhrases::shared_const_ptr ret = CreateTargetPhrase(mgr.GetPool(), mgr.GetSystem(), sourcePhrase);
|
||||
TargetPhrases::shared_const_ptr ret = CreateTargetPhrase(mgr.GetPool(), mgr.system, sourcePhrase);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ TargetPhrases::shared_const_ptr UnknownWordPenalty::Lookup(const Manager &mgr, I
|
||||
TargetPhrases *tps = new TargetPhrases();
|
||||
|
||||
MemPool &pool = mgr.GetPool();
|
||||
const System &system = mgr.GetSystem();
|
||||
const System &system = mgr.system;
|
||||
|
||||
TargetPhrase *target = new (pool.Allocate<TargetPhrase>()) TargetPhrase(pool, system, 1);
|
||||
Word &word = (*target)[0];
|
||||
@ -57,7 +57,7 @@ TargetPhrases::shared_const_ptr UnknownWordPenalty::Lookup(const Manager &mgr, I
|
||||
word[0] = factor;
|
||||
|
||||
Scores &scores = target->GetScores();
|
||||
scores.PlusEquals(mgr.GetSystem(), *this, -100);
|
||||
scores.PlusEquals(mgr.system, *this, -100);
|
||||
|
||||
MemPool &memPool = mgr.GetPool();
|
||||
system.featureFunctions.EvaluateInIsolation(memPool, system, source, *target);
|
||||
|
@ -253,7 +253,9 @@ ExpandAllHypotheses(const Hypothesis &hypothesis, size_t startPos, size_t endPos
|
||||
const Bitmap &sourceCompleted = hypothesis.GetWordsBitmap();
|
||||
float futureScore = m_transOptColl.GetFutureScore().CalcFutureScore2( sourceCompleted, startPos, endPos );
|
||||
|
||||
cerr << "DOING " << sourceCompleted << " [" << startPos << " " << endPos << "]" << endl;
|
||||
const Range &hypoRange = hypothesis.GetCurrSourceWordsRange();
|
||||
cerr << "DOING " << sourceCompleted << " [" << hypoRange.GetStartPos() << " " << hypoRange.GetEndPos() << "]"
|
||||
" [" << startPos << " " << endPos << "]" << endl;
|
||||
|
||||
if (m_options.search.UseEarlyDiscarding()) {
|
||||
// expected score is based on score of current hypothesis
|
||||
|
Loading…
Reference in New Issue
Block a user