mosesdecoder/moses/PP/Factory.h
Matthias Huck 1740478238 Framework for additional phrase properties in decoding.
Derive your property class from PhraseProperty. Do any expensive string
processing of the property value in there, not in the feature
implementation, and provide methods to access the information in
appropriate data formats. The property value string will thus have to
be processed only once (on loading) rather than each time the respective
phrase is applied and your feature needs to access the property value.
2014-05-19 21:54:08 +01:00

34 lines
642 B
C++

#pragma once
#include "moses/PP/PhraseProperty.h"
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/unordered_map.hpp>
namespace Moses
{
class PhrasePropertyCreator;
class PhrasePropertyFactory
{
public:
PhrasePropertyFactory();
~PhrasePropertyFactory();
boost::shared_ptr<PhraseProperty> ProduceProperty(const std::string &key, const std::string &value) const;
void PrintPP() const;
private:
void Add(const std::string &name, PhrasePropertyCreator *creator);
typedef boost::unordered_map<std::string, boost::shared_ptr<PhrasePropertyCreator> > Registry;
Registry m_registry;
};
} // namespace Moses