mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
output weight formatted according to discussions with Ken & Barry
This commit is contained in:
parent
00e6e6f0b6
commit
5ab3c3f081
@ -467,7 +467,7 @@ void OutputFeatureScores( std::ostream& out
|
||||
if (ff->GetNumScoreComponents() != ScoreProducer::unlimited) {
|
||||
if( labeledOutput && lastName != ff->GetScoreProducerDescription() ) {
|
||||
lastName = ff->GetScoreProducerDescription();
|
||||
out << " " << lastName << ":";
|
||||
out << " " << lastName << "=";
|
||||
}
|
||||
vector<float> scores = features.GetScoresForProducer( ff );
|
||||
for (size_t j = 0; j<scores.size(); ++j) {
|
||||
@ -482,15 +482,17 @@ void OutputFeatureScores( std::ostream& out
|
||||
// report weighted aggregate
|
||||
if (! ff->GetSparseFeatureReporting()) {
|
||||
const FVector &weights = staticData.GetAllWeights().GetScoresVector();
|
||||
if (labeledOutput && !boost::contains(ff->GetScoreProducerDescription(), ":"))
|
||||
out << " " << ff->GetScoreProducerDescription() << ":";
|
||||
if (labeledOutput && lastName != ff->GetScoreProducerDescription()) {
|
||||
lastName = ff->GetScoreProducerDescription();
|
||||
out << " " << lastName << "=";
|
||||
}
|
||||
out << " " << scores.inner_product(weights);
|
||||
}
|
||||
|
||||
// report each feature
|
||||
else {
|
||||
for(FVector::FNVmap::const_iterator i = scores.cbegin(); i != scores.cend(); i++)
|
||||
out << " " << i->first << ": " << i->second;
|
||||
out << " " << i->first << "= " << i->second;
|
||||
/* if (i->second != 0) { // do not report zero-valued features
|
||||
float weight = staticData.GetSparseWeight(i->first);
|
||||
if (weight != 0)
|
||||
|
@ -21,7 +21,7 @@ ScoreProducer::ScoreProducer(const std::string& description, size_t numScoreComp
|
||||
|
||||
ostringstream dstream;
|
||||
dstream << description;
|
||||
dstream << "_" << index;
|
||||
dstream << index;
|
||||
|
||||
description_counts.insert(description);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user