mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-08 20:46:59 +03:00
49 lines
911 B
C++
49 lines
911 B
C++
#pragma once
|
|
#include <boost/unordered_map.hpp>
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
namespace Moses2
|
|
{
|
|
class FeatureFunction;
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
class FeatureFactory
|
|
{
|
|
public:
|
|
virtual ~FeatureFactory()
|
|
{
|
|
}
|
|
|
|
virtual FeatureFunction *Create(size_t startInd, const std::string &line) = 0;
|
|
|
|
protected:
|
|
FeatureFactory()
|
|
{
|
|
}
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
class FeatureRegistry
|
|
{
|
|
public:
|
|
FeatureRegistry();
|
|
|
|
~FeatureRegistry();
|
|
|
|
FeatureFunction *Construct(size_t startInd, const std::string &name,
|
|
const std::string &line);
|
|
void PrintFF() const;
|
|
|
|
private:
|
|
void Add(const std::string &name, FeatureFactory *factory);
|
|
|
|
typedef boost::unordered_map<std::string, boost::shared_ptr<FeatureFactory> > Map;
|
|
|
|
Map registry_;
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
}
|
|
|