diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2013-09-19 18:33:21 +0400 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2013-09-19 18:33:21 +0400 |
commit | ffbfcb5577efbff5825519739464128811e9d490 (patch) | |
tree | 876f6a81f9ce93558580594ef8b0eb1b06309b5f /moses/InputPath.cpp | |
parent | 98bb4fa1c72517efd64da416ecb493c9f92dc487 (diff) |
placeholders work in pb decoder. God i'm bored
Diffstat (limited to 'moses/InputPath.cpp')
-rw-r--r-- | moses/InputPath.cpp | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/moses/InputPath.cpp b/moses/InputPath.cpp index eb27e41f6..3a3d3381b 100644 --- a/moses/InputPath.cpp +++ b/moses/InputPath.cpp @@ -20,14 +20,6 @@ InputPath::InputPath(const Phrase &phrase, const NonTerminalSet &sourceNonTerms, { //cerr << "phrase=" << phrase << " m_inputScore=" << *m_inputScore << endl; - FactorType placeholderFactor = StaticData::Instance().GetPlaceholderFactor().first; - if (placeholderFactor != NOT_FOUND) { - for (size_t pos = 0; pos < m_phrase.GetSize(); ++pos) { - if (m_phrase.GetFactor(pos, placeholderFactor)) { - m_placeholders.push_back(pos); - } - } - } } InputPath::~InputPath() @@ -63,26 +55,6 @@ void InputPath::SetTargetPhrases(const PhraseDictionary &phraseDictionary m_targetPhrases[&phraseDictionary] = value; } -bool InputPath::SetPlaceholders(TargetPhrase *targetPhrase) const -{ - FactorType sourcePlaceholderFactor = StaticData::Instance().GetPlaceholderFactor().first; - FactorType targetPlaceholderFactor = StaticData::Instance().GetPlaceholderFactor().second; - - const AlignmentInfo &alignments = targetPhrase->GetAlignTerm(); - for (size_t i = 0; i < m_placeholders.size(); ++i) { - size_t sourcePos = m_placeholders[i]; - set<size_t> targetPos = alignments.GetAlignmentsForSource(sourcePos); - if (targetPos.size() == 1) { - const Word &sourceWord = m_phrase.GetWord(sourcePos); - Word &targetWord = targetPhrase->GetWord(*targetPos.begin()); - targetWord[targetPlaceholderFactor] = sourceWord[sourcePlaceholderFactor]; - } else { - return false; - } - } - return true; -} - const Word &InputPath::GetLastWord() const { size_t len = m_phrase.GetSize(); |