mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-20 07:42:21 +03:00
this broke something, reverting..
Revert "fix LoadReferences() in StaticData and remove reference loading in mira's Main and Decoder"
This reverts commit 2ee9f47a5f
.
This commit is contained in:
parent
51b54e0d9d
commit
b263f14f63
@ -70,14 +70,14 @@ namespace Mira {
|
||||
: m_manager(NULL) {
|
||||
// force initialisation of the phrase dictionary (TODO: why?)
|
||||
const StaticData &staticData = StaticData::Instance();
|
||||
/*m_sentence = new Sentence(Input);
|
||||
m_sentence = new Sentence(Input);
|
||||
stringstream in("Initialising decoder..\n");
|
||||
const std::vector<FactorType> &inputFactorOrder = staticData.GetInputFactorOrder();
|
||||
m_sentence->Read(in,inputFactorOrder);*/
|
||||
m_sentence->Read(in,inputFactorOrder);
|
||||
|
||||
const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
|
||||
/*m_manager = new Manager(*m_sentence, staticData.GetSearchAlgorithm(), &system);
|
||||
m_manager->ProcessSentence();*/
|
||||
m_manager = new Manager(*m_sentence, staticData.GetSearchAlgorithm(), &system);
|
||||
m_manager->ProcessSentence();
|
||||
|
||||
// Add the bleu feature
|
||||
m_bleuScoreFeature = new BleuScoreFeature(scaleByInputLength, historySmoothing);
|
||||
@ -202,6 +202,10 @@ namespace Mira {
|
||||
m_bleuScoreFeature->UpdateHistory(words, sourceLengths, ref_ids, rank, epoch);
|
||||
}
|
||||
|
||||
void MosesDecoder::loadReferenceSentences(const vector<vector<string> >& refs) {
|
||||
m_bleuScoreFeature->LoadReferences(refs);
|
||||
}
|
||||
|
||||
void MosesDecoder::printBleuFeatureHistory(std::ostream& out) {
|
||||
m_bleuScoreFeature->PrintHistory(out);
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ class MosesDecoder {
|
||||
size_t getCurrentInputLength();
|
||||
void updateHistory(const std::vector<const Moses::Word*>& words);
|
||||
void updateHistory(const std::vector< std::vector< const Moses::Word*> >& words, std::vector<size_t>& sourceLengths, std::vector<size_t>& ref_ids, size_t rank, size_t epoch);
|
||||
void loadReferenceSentences(const std::vector<std::vector<std::string> >& refs);
|
||||
void printBleuFeatureHistory(std::ostream& out);
|
||||
void printReferenceLength(const std::vector<size_t>& ref_ids);
|
||||
Moses::ScoreComponentCollection getWeights();
|
||||
|
@ -321,6 +321,8 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
|
||||
decoder->loadReferenceSentences(referenceSentences);
|
||||
|
||||
#ifdef MPI_ENABLE
|
||||
mpi::broadcast(world, order, 0);
|
||||
#endif
|
||||
|
@ -1298,7 +1298,7 @@ bool StaticData::LoadDecodeGraphs()
|
||||
|
||||
bool StaticData::LoadReferences()
|
||||
{
|
||||
vector<string> bleuWeightStr = m_parameter->GetParam("weight-bl");
|
||||
vector<string> bleuWeightStr = m_parameter->GetParam("weight-b");
|
||||
vector<string> referenceFiles = m_parameter->GetParam("references");
|
||||
if ((!referenceFiles.size() && bleuWeightStr.size()) || (referenceFiles.size() && !bleuWeightStr.size())) {
|
||||
UserMessage::Add("You cannot use the bleu feature without references, and vice-versa");
|
||||
@ -1338,6 +1338,7 @@ bool StaticData::LoadReferences()
|
||||
}
|
||||
//Set the references in the bleu feature
|
||||
m_bleuScoreFeature->LoadReferences(references);
|
||||
m_bleuScoreFeature->SetCurrentReference(0); //TODO: Temporary, for testing
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user