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) {
|
: m_manager(NULL) {
|
||||||
// force initialisation of the phrase dictionary (TODO: why?)
|
// force initialisation of the phrase dictionary (TODO: why?)
|
||||||
const StaticData &staticData = StaticData::Instance();
|
const StaticData &staticData = StaticData::Instance();
|
||||||
/*m_sentence = new Sentence(Input);
|
m_sentence = new Sentence(Input);
|
||||||
stringstream in("Initialising decoder..\n");
|
stringstream in("Initialising decoder..\n");
|
||||||
const std::vector<FactorType> &inputFactorOrder = staticData.GetInputFactorOrder();
|
const std::vector<FactorType> &inputFactorOrder = staticData.GetInputFactorOrder();
|
||||||
m_sentence->Read(in,inputFactorOrder);*/
|
m_sentence->Read(in,inputFactorOrder);
|
||||||
|
|
||||||
const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
|
const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT);
|
||||||
/*m_manager = new Manager(*m_sentence, staticData.GetSearchAlgorithm(), &system);
|
m_manager = new Manager(*m_sentence, staticData.GetSearchAlgorithm(), &system);
|
||||||
m_manager->ProcessSentence();*/
|
m_manager->ProcessSentence();
|
||||||
|
|
||||||
// Add the bleu feature
|
// Add the bleu feature
|
||||||
m_bleuScoreFeature = new BleuScoreFeature(scaleByInputLength, historySmoothing);
|
m_bleuScoreFeature = new BleuScoreFeature(scaleByInputLength, historySmoothing);
|
||||||
@ -202,6 +202,10 @@ namespace Mira {
|
|||||||
m_bleuScoreFeature->UpdateHistory(words, sourceLengths, ref_ids, rank, epoch);
|
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) {
|
void MosesDecoder::printBleuFeatureHistory(std::ostream& out) {
|
||||||
m_bleuScoreFeature->PrintHistory(out);
|
m_bleuScoreFeature->PrintHistory(out);
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ class MosesDecoder {
|
|||||||
size_t getCurrentInputLength();
|
size_t getCurrentInputLength();
|
||||||
void updateHistory(const std::vector<const Moses::Word*>& words);
|
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 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 printBleuFeatureHistory(std::ostream& out);
|
||||||
void printReferenceLength(const std::vector<size_t>& ref_ids);
|
void printReferenceLength(const std::vector<size_t>& ref_ids);
|
||||||
Moses::ScoreComponentCollection getWeights();
|
Moses::ScoreComponentCollection getWeights();
|
||||||
|
@ -321,6 +321,8 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
decoder->loadReferenceSentences(referenceSentences);
|
||||||
|
|
||||||
#ifdef MPI_ENABLE
|
#ifdef MPI_ENABLE
|
||||||
mpi::broadcast(world, order, 0);
|
mpi::broadcast(world, order, 0);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1298,7 +1298,7 @@ bool StaticData::LoadDecodeGraphs()
|
|||||||
|
|
||||||
bool StaticData::LoadReferences()
|
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");
|
vector<string> referenceFiles = m_parameter->GetParam("references");
|
||||||
if ((!referenceFiles.size() && bleuWeightStr.size()) || (referenceFiles.size() && !bleuWeightStr.size())) {
|
if ((!referenceFiles.size() && bleuWeightStr.size()) || (referenceFiles.size() && !bleuWeightStr.size())) {
|
||||||
UserMessage::Add("You cannot use the bleu feature without references, and vice-versa");
|
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
|
//Set the references in the bleu feature
|
||||||
m_bleuScoreFeature->LoadReferences(references);
|
m_bleuScoreFeature->LoadReferences(references);
|
||||||
|
m_bleuScoreFeature->SetCurrentReference(0); //TODO: Temporary, for testing
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user