start show weights

This commit is contained in:
Hieu Hoang 2016-08-11 14:00:55 +02:00
parent 33ec4cb7ab
commit 7eb759d1d9
3 changed files with 19 additions and 22 deletions

View File

@ -16,12 +16,15 @@ using namespace std;
namespace Moses2
{
FeatureFunction::FeatureFunction(size_t startInd, const std::string &line) :
m_startInd(startInd), m_numScores(1), m_PhraseTableInd(NOT_FOUND)
{
ParseLine(line);
cerr << GetName() << " " << m_startInd << "-" << (m_startInd + m_numScores - 1) << endl;
}
FeatureFunction::FeatureFunction(size_t startInd, const std::string &line)
:m_startInd(startInd)
,m_numScores(1)
,m_PhraseTableInd(NOT_FOUND)
,m_tuneable(true)
{
ParseLine(line);
cerr << GetName() << " " << m_startInd << "-" << (m_startInd + m_numScores - 1) << endl;
}
FeatureFunction::~FeatureFunction()
{

View File

@ -73,6 +73,14 @@ public:
return m_PhraseTableInd;
}
//! if false, then this feature is not displayed in the n-best list.
// use with care
virtual bool IsTuneable() const
{
return m_tuneable;
}
// may have more factors than actually need, but not guaranteed.
virtual void
EvaluateInIsolation(MemPool &pool, const System &system, const Phrase<Moses2::Word> &source,

View File

@ -212,27 +212,13 @@ void FeatureFunctions::EvaluateWhenAppliedBatch(const Batch &batch) const
void FeatureFunctions::ShowWeights()
{
/*
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];
BOOST_FOREACH(const FeatureFunction *ff, m_featureFunctions) {
if (ff->IsTuneable()) {
PrintFeatureWeight(ff);
} else {
cout << ff->GetScoreProducerDescription() << " UNTUNEABLE" << endl;
cout << ff->GetName() << " 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;
}
}
*/
}
}