mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
move collection of DistortionScoreProducer to it own class
This commit is contained in:
parent
2793888cf2
commit
10d41d025e
@ -57,7 +57,7 @@ public:
|
||||
m_totalWeightDistortion = 0;
|
||||
const StaticData &staticData = StaticData::Instance();
|
||||
|
||||
const std::vector<const DistortionScoreProducer*> &ffs = FeatureFunction::GetDistortionFeatureFunctions();
|
||||
const std::vector<const DistortionScoreProducer*> &ffs = DistortionScoreProducer::GetDistortionFeatureFunctions();
|
||||
std::vector<const DistortionScoreProducer*>::const_iterator iter;
|
||||
for (iter = ffs.begin(); iter != ffs.end(); ++iter) {
|
||||
const DistortionScoreProducer *ff = *iter;
|
||||
|
@ -22,9 +22,12 @@ struct DistortionState_traditional : public FFState {
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<const DistortionScoreProducer*> DistortionScoreProducer::s_staticColl;
|
||||
|
||||
DistortionScoreProducer::DistortionScoreProducer(const std::string &line)
|
||||
: StatefulFeatureFunction(1, line)
|
||||
{
|
||||
s_staticColl.push_back(this);
|
||||
ReadParameters();
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,14 @@ class WordsRange;
|
||||
*/
|
||||
class DistortionScoreProducer : public StatefulFeatureFunction
|
||||
{
|
||||
protected:
|
||||
static std::vector<const DistortionScoreProducer*> s_staticColl;
|
||||
|
||||
public:
|
||||
static const std::vector<const DistortionScoreProducer*>& GetDistortionFeatureFunctions() {
|
||||
return s_staticColl;
|
||||
}
|
||||
|
||||
DistortionScoreProducer(const std::string &line);
|
||||
|
||||
bool IsUseable(const FactorMask &mask) const {
|
||||
|
@ -17,7 +17,6 @@ namespace Moses
|
||||
multiset<string> FeatureFunction::description_counts;
|
||||
|
||||
std::vector<FeatureFunction*> FeatureFunction::s_staticColl;
|
||||
std::vector<const DistortionScoreProducer*> FeatureFunction::s_staticCollDistortion;
|
||||
|
||||
FeatureFunction &FeatureFunction::FindFeatureFunction(const std::string& name)
|
||||
{
|
||||
@ -71,10 +70,6 @@ Initialize(const std::string &line)
|
||||
|
||||
ScoreComponentCollection::RegisterScoreProducer(this);
|
||||
s_staticColl.push_back(this);
|
||||
|
||||
const DistortionScoreProducer *distortion = dynamic_cast<const DistortionScoreProducer*>(this);
|
||||
if(distortion)
|
||||
s_staticCollDistortion.push_back (distortion);
|
||||
}
|
||||
|
||||
FeatureFunction::~FeatureFunction() {}
|
||||
|
@ -31,7 +31,6 @@ class FeatureFunction
|
||||
protected:
|
||||
/**< all the score producers in this run */
|
||||
static std::vector<FeatureFunction*> s_staticColl;
|
||||
static std::vector<const DistortionScoreProducer*> s_staticCollDistortion;
|
||||
|
||||
std::string m_description, m_argLine;
|
||||
std::vector<std::vector<std::string> > m_args;
|
||||
@ -49,10 +48,6 @@ public:
|
||||
return s_staticColl;
|
||||
}
|
||||
|
||||
static const std::vector<const DistortionScoreProducer*>& GetDistortionFeatureFunctions() {
|
||||
return s_staticCollDistortion;
|
||||
}
|
||||
|
||||
static FeatureFunction &FindFeatureFunction(const std::string& name);
|
||||
static void Destroy();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user