diff options
author | Nicola Bertoldi <bertoldi@fbk.eu> | 2014-12-13 14:52:47 +0300 |
---|---|---|
committer | Nicola Bertoldi <bertoldi@fbk.eu> | 2014-12-13 14:52:47 +0300 |
commit | e4eb201c52be74fee74399a6f35fcbe8eb85d834 (patch) | |
tree | 7792ef96d63262f6e28f1857741e1162c7dccbc4 /moses/Util.cpp | |
parent | cea2d9d8bb34a81660974cae20d66aefec4e0468 (diff) | |
parent | a0b6b6a341e74b47bbef4652ad7fd928cf91e17c (diff) |
merged master into dynamic-models and solved conflicts
Diffstat (limited to 'moses/Util.cpp')
-rw-r--r-- | moses/Util.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/moses/Util.cpp b/moses/Util.cpp index 79690668f..34d03cab8 100644 --- a/moses/Util.cpp +++ b/moses/Util.cpp @@ -37,6 +37,9 @@ #include "Timer.h" #include "util/exception.hh" #include "util/file.hh" +#include "moses/FF/StatelessFeatureFunction.h" +#include "moses/FF/StatefulFeatureFunction.h" +#include "moses/StaticData.h" using namespace std; @@ -337,6 +340,44 @@ std::string PassthroughSGML(std::string &line, const std::string tagName, const return meta; } +void PrintFeatureWeight(const FeatureFunction* ff) +{ + cout << ff->GetScoreProducerDescription() << "="; + size_t numScoreComps = ff->GetNumScoreComponents(); + vector<float> values = StaticData::Instance().GetAllWeights().GetScoresForProducer(ff); + for (size_t i = 0; i < numScoreComps; ++i) { + cout << " " << values[i]; + } + cout << endl; + } +void ShowWeights() +{ + FixPrecision(cout,6); + const vector<const StatelessFeatureFunction*>& slf = StatelessFeatureFunction::GetStatelessFeatureFunctions(); + const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions(); + + for (size_t i = 0; i < sff.size(); ++i) { + const StatefulFeatureFunction *ff = sff[i]; + if (ff->IsTuneable()) { + PrintFeatureWeight(ff); + } + else { + cout << ff->GetScoreProducerDescription() << " UNTUNEABLE" << endl; + } + } + for (size_t i = 0; i < slf.size(); ++i) { + const StatelessFeatureFunction *ff = slf[i]; + if (ff->IsTuneable()) { + PrintFeatureWeight(ff); + } + else { + cout << ff->GetScoreProducerDescription() << " UNTUNEABLE" << endl; + } + } +} + +} // namespace + |