find placeholders

This commit is contained in:
Hieu Hoang 2013-07-18 23:09:33 +01:00
parent 6088531dfe
commit ea02ef6b6e
2 changed files with 11 additions and 0 deletions

View File

@ -1,6 +1,8 @@
#include "InputPath.h"
#include "ScoreComponentCollection.h"
#include "TargetPhraseCollection.h"
#include "StaticData.h"
#include "TypeDef.h"
namespace Moses
{
@ -11,6 +13,14 @@ InputPath::InputPath(const Phrase &phrase, const WordsRange &range, const InputP
,m_range(range)
,m_inputScore(inputScore)
{
FactorType factorType = StaticData::Instance().GetPlaceholderFactor();
if (factorType != NOT_FOUND) {
for (size_t pos = 0; pos < m_phrase.size(); ++pos) {
if (m_phrase.GetFactor(pos, factorType)) {
m_placeholders.push_back(pos);
}
}
}
}
InputPath::~InputPath()

View File

@ -37,6 +37,7 @@ protected:
// must clean up yourself.
// used when pruning during placeholder processing
std::vector<TargetPhraseCollection> m_copiedSet;
std::vector<size_t> m_placeholders;
public:
explicit InputPath()