mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 13:23:25 +03:00
rollback excluding translation options that have incompatible alignments for placeholders. This should be exclude at the training step
This commit is contained in:
parent
9e8402dedd
commit
0b23a0e327
@ -55,30 +55,8 @@ void InputPath::SetTargetPhrases(const PhraseDictionary &phraseDictionary
|
||||
, const TargetPhraseCollection *targetPhrases
|
||||
, const void *ptNode)
|
||||
{
|
||||
FactorType placeholderFactor = StaticData::Instance().GetPlaceholderFactor().first;
|
||||
if (targetPhrases == NULL || placeholderFactor == NOT_FOUND || m_placeholders.size() == 0) {
|
||||
// use all of the target phrase given
|
||||
std::pair<const TargetPhraseCollection*, const void*> value(targetPhrases, ptNode);
|
||||
m_targetPhrases[&phraseDictionary] = value;
|
||||
} else {
|
||||
// filter out target phrases with alignments that are not 1-to-1 with placeholder
|
||||
m_copiedSet.push_back(TargetPhraseCollection());
|
||||
TargetPhraseCollection &newTargetPhrases = m_copiedSet.back();
|
||||
std::pair<const TargetPhraseCollection*, const void*> value(&newTargetPhrases, ptNode);
|
||||
m_targetPhrases[&phraseDictionary] = value;
|
||||
|
||||
TargetPhraseCollection::const_iterator iter;
|
||||
for (iter = targetPhrases->begin(); iter != targetPhrases->end(); ++iter) {
|
||||
TargetPhrase *targetPhrase = new TargetPhrase(**iter);
|
||||
bool ok = SetPlaceholders(targetPhrase);
|
||||
|
||||
if (ok) {
|
||||
newTargetPhrases.Add(targetPhrase);
|
||||
} else {
|
||||
delete targetPhrase;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::pair<const TargetPhraseCollection*, const void*> value(targetPhrases, ptNode);
|
||||
m_targetPhrases[&phraseDictionary] = value;
|
||||
}
|
||||
|
||||
bool InputPath::SetPlaceholders(TargetPhrase *targetPhrase) const
|
||||
|
@ -34,10 +34,6 @@ protected:
|
||||
const ScoreComponentCollection *m_inputScore;
|
||||
std::map<const PhraseDictionary*, std::pair<const TargetPhraseCollection*, const void*> > m_targetPhrases;
|
||||
|
||||
// make a copy of the target phrase collection, rather than using the 1 given by the phrase dictionary
|
||||
// must clean up yourself.
|
||||
// used when pruning during placeholder processing
|
||||
std::vector<TargetPhraseCollection> m_copiedSet;
|
||||
std::vector<size_t> m_placeholders;
|
||||
|
||||
bool SetPlaceholders(TargetPhrase *targetPhrase) const;
|
||||
|
Loading…
Reference in New Issue
Block a user