mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
feature functions can be both sparse AND dense
This commit is contained in:
parent
d7ed014c5d
commit
82224a7a46
@ -1176,6 +1176,16 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/SourceWordDeletionFeature.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/SparsePhraseDictionaryFeature.cpp</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/SparsePhraseDictionaryFeature.cpp</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/SparsePhraseDictionaryFeature.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/SparsePhraseDictionaryFeature.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/StatefulFeatureFunction.cpp</name>
|
||||
<type>1</type>
|
||||
|
@ -439,10 +439,9 @@ void IOWrapper::OutputFeatureScores( std::ostream& out, const ScoreComponentColl
|
||||
}
|
||||
|
||||
// sparse features
|
||||
else {
|
||||
const FVector scores = features.GetVectorForProducer( ff );
|
||||
for(FVector::FNVmap::const_iterator i = scores.cbegin(); i != scores.cend(); i++)
|
||||
out << " " << i->first << "= " << i->second;
|
||||
const FVector scores = features.GetVectorForProducer( ff );
|
||||
for(FVector::FNVmap::const_iterator i = scores.cbegin(); i != scores.cend(); i++) {
|
||||
out << " " << i->first << "= " << i->second;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -493,11 +493,9 @@ void OutputFeatureScores( std::ostream& out
|
||||
}
|
||||
|
||||
// sparse features
|
||||
else {
|
||||
const FVector scores = features.GetVectorForProducer( ff );
|
||||
for(FVector::FNVmap::const_iterator i = scores.cbegin(); i != scores.cend(); i++) {
|
||||
out << " " << i->first << "= " << i->second;
|
||||
}
|
||||
const FVector scores = features.GetVectorForProducer( ff );
|
||||
for(FVector::FNVmap::const_iterator i = scores.cbegin(); i != scores.cend(); i++) {
|
||||
out << " " << i->first << "= " << i->second;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
virtual bool IsStateless() const = 0;
|
||||
virtual ~FeatureFunction();
|
||||
|
||||
//! override to load model files
|
||||
virtual void Load()
|
||||
{}
|
||||
|
||||
@ -71,11 +72,13 @@ public:
|
||||
return m_description;
|
||||
}
|
||||
|
||||
//! if false, then this feature is not displayed in the n-best list.
|
||||
// use with care
|
||||
virtual bool IsTuneable() const {
|
||||
return m_tuneable;
|
||||
}
|
||||
|
||||
//!
|
||||
//! Called before search and collecting of translation options
|
||||
virtual void InitializeForInput(InputType const& source)
|
||||
{}
|
||||
|
||||
@ -91,6 +94,7 @@ public:
|
||||
// return true if the feature function can be evaluated
|
||||
virtual bool IsUseable(const FactorMask &mask) const = 0;
|
||||
|
||||
// used by stateless ff. And stateful ff to make initial score estimate during loading of phrase table
|
||||
virtual void Evaluate(const Phrase &source
|
||||
, const TargetPhrase &targetPhrase
|
||||
, ScoreComponentCollection &scoreBreakdown
|
||||
|
Loading…
Reference in New Issue
Block a user