diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2015-01-08 15:37:34 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2015-01-08 15:37:34 +0300 |
commit | 782ac856748b54535498a4ae7b8f479db6d83f3d (patch) | |
tree | f9f6bac3d3a436d6c816a67ca3a4c71aec9cc754 | |
parent | 13ec6060b0d7ef600f056c15dd249d190cc16b25 (diff) |
allow mira compilation for Eva
-rw-r--r-- | Jamroot | 6 | ||||
-rw-r--r-- | contrib/mira/Decoder.cpp | 2 | ||||
-rw-r--r-- | contrib/mira/Jamfile | 4 | ||||
-rw-r--r-- | moses/StaticData.cpp | 15 | ||||
-rw-r--r-- | moses/StaticData.h | 2 |
5 files changed, 23 insertions, 6 deletions
@@ -173,8 +173,8 @@ project : requirements ; #Add directories here if you want their incidental targets too (i.e. tests). -build-projects lm util phrase-extract phrase-extract/syntax-common search moses moses/LM mert moses-cmd scripts regression-testing ; -# mira +build-projects lm util phrase-extract phrase-extract/syntax-common search moses moses/LM mert moses-cmd scripts regression-testing ; +# contrib/mira if [ option.get "with-mm" : : "yes" ] { @@ -229,7 +229,7 @@ phrase-extract//extract-mixed-syntax phrase-extract//score-stsg phrase-extract//filter-rule-table biconcor -#mira//mira +#contrib/mira//mira contrib/server//mosesserver mm rephraser diff --git a/contrib/mira/Decoder.cpp b/contrib/mira/Decoder.cpp index c9bb4c983..7855536bb 100644 --- a/contrib/mira/Decoder.cpp +++ b/contrib/mira/Decoder.cpp @@ -280,7 +280,7 @@ void MosesDecoder::initialize(StaticData& staticData, const std::string& source, // set weight of BleuScoreFeature //cerr << "Reload Bleu feature weight: " << bleuObjectiveWeight*bleuScoreWeight << " (" << bleuObjectiveWeight << "*" << bleuScoreWeight << ")" << endl; - //staticData.ReLoadBleuScoreFeatureParameter(bleuObjectiveWeight*bleuScoreWeight); + staticData.ReLoadBleuScoreFeatureParameter(bleuObjectiveWeight*bleuScoreWeight); m_bleuScoreFeature->SetCurrSourceLength((*m_sentence).GetSize()); if (chartDecoding) diff --git a/contrib/mira/Jamfile b/contrib/mira/Jamfile index e43a993b5..c196c1032 100644 --- a/contrib/mira/Jamfile +++ b/contrib/mira/Jamfile @@ -1,8 +1,8 @@ lib mira_lib : [ glob *.cpp : *Test.cpp Main.cpp ] -../mert//mert_lib ../moses//moses ../OnDiskPt//OnDiskPt ..//boost_program_options ; +../../mert//mert_lib ../../moses//moses ../../OnDiskPt//OnDiskPt ../..//boost_program_options ; -exe mira : Main.cpp mira_lib ../mert//mert_lib ../moses//moses ../OnDiskPt//OnDiskPt ..//boost_program_options ..//boost_filesystem ; +exe mira : Main.cpp mira_lib ../../mert//mert_lib ../../moses//moses ../../OnDiskPt//OnDiskPt ../..//boost_program_options ../..//boost_filesystem ; alias programs : mira ; diff --git a/moses/StaticData.cpp b/moses/StaticData.cpp index 5b4aa5d87..7397d69f5 100644 --- a/moses/StaticData.cpp +++ b/moses/StaticData.cpp @@ -803,6 +803,21 @@ void StaticData::LoadDecodeGraphsNew(const std::vector<std::string> &mappingVect } +void StaticData::ReLoadBleuScoreFeatureParameter(float weight) +{ + //loop over ScoreProducers to update weights of BleuScoreFeature + const std::vector<FeatureFunction*> &producers = FeatureFunction::GetFeatureFunctions(); + for(size_t i=0; i<producers.size(); ++i) { + FeatureFunction *ff = producers[i]; + std::string ffName = ff->GetScoreProducerDescription(); + + if (ffName == "BleuScoreFeature") { + SetWeight(ff, weight); + break; + } + } +} + // ScoreComponentCollection StaticData::GetAllWeightsScoreComponentCollection() const {} // in ScoreComponentCollection.h diff --git a/moses/StaticData.h b/moses/StaticData.h index 869acdf84..5d13e07a7 100644 --- a/moses/StaticData.h +++ b/moses/StaticData.h @@ -613,6 +613,8 @@ public: return m_continuePartialTranslation; } + void ReLoadBleuScoreFeatureParameter(float weight); + Parameter* GetParameter() { return m_parameter; } |