// $Id$ #include "PhraseDictionaryTreeAdaptor.h" #include #include #include "PhraseDictionaryTree.h" #include "Phrase.h" #include "FactorCollection.h" #include "InputFileStream.h" #include "InputType.h" #include "ConfusionNet.h" #include "Sentence.h" #include "StaticData.h" #include "UniqueObject.h" #include "PDTAimp.h" #include "UserMessage.h" /************************************************************* function definitions of the interface class virtually everything is forwarded to the implementation class *************************************************************/ PhraseDictionaryTreeAdaptor:: PhraseDictionaryTreeAdaptor(size_t numScoreComponent,unsigned numInputScores) : MyBase(numScoreComponent),imp(new PDTAimp(this,numInputScores)) {} PhraseDictionaryTreeAdaptor::~PhraseDictionaryTreeAdaptor() { imp->CleanUp(); delete imp; } void PhraseDictionaryTreeAdaptor::CleanUp() { imp->CleanUp(); MyBase::CleanUp(); } void PhraseDictionaryTreeAdaptor::InitializeForInput(InputType const& source) { // caching only required for confusion net if(ConfusionNet const* cn=dynamic_cast(&source)) imp->CacheSource(*cn); //else if(Sentence const* s=dynamic_cast(&source)) // following removed by phi, not helpful // imp->CacheSource(ConfusionNet(*s)); } bool PhraseDictionaryTreeAdaptor::Load(const std::vector &input , const std::vector &output , const std::string &filePath , const std::vector &weight , size_t tableLimit , const LMList &languageModels , float weightWP ) { FactorCollection &factorCollection = FactorCollection::Instance(); if(m_numScoreComponent!=weight.size()) { stringstream strme; strme << "ERROR: mismatch of number of scaling factors: "<