mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
call legacy code for confusion network input with binary pt
This commit is contained in:
parent
e3982f9ea8
commit
01641bfeee
@ -7,6 +7,7 @@
|
||||
#include "DecodeStepTranslation.h"
|
||||
#include "FactorCollection.h"
|
||||
#include "FF/InputFeature.h"
|
||||
#include "TranslationModel/PhraseDictionaryTreeAdaptor.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -97,6 +98,10 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet
|
||||
} // for (iterPath = prevNodes.begin(); iterPath != prevNodes.end(); ++iterPath) {
|
||||
}
|
||||
}
|
||||
|
||||
// check whether we should be using the old code to supportbinary phrase-table.
|
||||
// eventually, we'll stop support the binary phrase-table and delete this legacy code
|
||||
CheckLegacy();
|
||||
}
|
||||
|
||||
InputPathList &TranslationOptionCollectionConfusionNet::GetInputPathList(size_t startPos, size_t endPos)
|
||||
@ -203,6 +208,20 @@ void TranslationOptionCollectionConfusionNet::CreateTranslationOptionsForRange(
|
||||
}
|
||||
}
|
||||
|
||||
void TranslationOptionCollectionConfusionNet::CheckLegacy()
|
||||
{
|
||||
const std::vector<PhraseDictionary*> &pts = StaticData::Instance().GetPhraseDictionaries();
|
||||
for (size_t i = 0; i < pts.size(); ++i) {
|
||||
const PhraseDictionary *phraseDictionary = pts[i];
|
||||
if (dynamic_cast<const PhraseDictionaryTreeAdaptor*>(phraseDictionary) != NULL) {
|
||||
m_useLegacy = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_useLegacy = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,9 +19,12 @@ public:
|
||||
typedef std::vector< std::vector<InputPathList> > TargetPhraseMatrix;
|
||||
|
||||
protected:
|
||||
bool m_useLegacy;
|
||||
|
||||
TargetPhraseMatrix m_targetPhrasesfromPt; /*< contains translation options */
|
||||
|
||||
InputPathList &GetInputPathList(size_t startPos, size_t endPos);
|
||||
void CheckLegacy();
|
||||
public:
|
||||
TranslationOptionCollectionConfusionNet(const ConfusionNet &source, size_t maxNoTransOptPerCoverage, float translationOptionThreshold);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user