Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
reranker::PerceptronModelProtoReader Class Reference

A class to construct a PerceptronModel from a ModelMessage instance. More...

#include <perceptron-model-proto-reader.H>

Inheritance diagram for reranker::PerceptronModelProtoReader:
reranker::ModelProtoReader reranker::FactoryConstructible

Public Member Functions

 PerceptronModelProtoReader ()
 Constructs a new instance that can serialize Model instances to ModelMessage protocol buffer messages. More...
 
virtual ~PerceptronModelProtoReader ()
 Destroys this reader. More...
 
virtual void RegisterInitializers (Initializers &initializers)
 Registers the smart_copy_ data member with the name "smart_copy". More...
 
virtual void Read (const ModelMessage &model_message, Model *model) const
 De-serializes a PerceptronModel instance from a ModelMessage. More...
 
virtual void ReadFeatures (istream &is, Model *model, bool skip_key, const string &separator) const
 De-serializes Features from an instance. More...
 
- Public Member Functions inherited from reranker::ModelProtoReader
 ModelProtoReader ()
 Constructs a new instance that can de-serialize Model instances from ModelMessage protocol buffer messages. More...
 
virtual ~ModelProtoReader ()
 Destroys this reader. More...
 
- Public Member Functions inherited from reranker::FactoryConstructible
virtual ~FactoryConstructible ()
 
virtual void Init (const Environment *env, const string &arg)
 

Detailed Description

A class to construct a PerceptronModel from a ModelMessage instance.

TODO(dbikel): Need some kind of a factory for model readers, so the proper ModelProtoReader gets instantiated given a particular Model subclass.

Definition at line 57 of file perceptron-model-proto-reader.H.

Constructor & Destructor Documentation

reranker::PerceptronModelProtoReader::PerceptronModelProtoReader ( )
inline

Constructs a new instance that can serialize Model instances to ModelMessage protocol buffer messages.

Definition at line 61 of file perceptron-model-proto-reader.H.

virtual reranker::PerceptronModelProtoReader::~PerceptronModelProtoReader ( )
inlinevirtual

Destroys this reader.

Definition at line 63 of file perceptron-model-proto-reader.H.

Member Function Documentation

void reranker::PerceptronModelProtoReader::Read ( const ModelMessage &  model_message,
Model model 
) const
virtual

De-serializes a PerceptronModel instance from a ModelMessage.

Parameters
[in]model_messagethe ModelMessage from which to de-serialize a PerceptronModel instance
[out]modelthe PerceptronModel to be de-serialized from the specified ModelMessage

Implements reranker::ModelProtoReader.

Definition at line 54 of file perceptron-model-proto-reader.C.

void reranker::PerceptronModelProtoReader::ReadFeatures ( istream &  is,
Model model,
bool  skip_key,
const string &  separator 
) const
virtual

De-serializes Features from an instance.

Parameters
[in]isinput stream from which to read data
[in,out]modelmodel to add features to
[in]skip_keyassumes there is a key before the separator
[in]separatorthe string separator to use

Implements reranker::ModelProtoReader.

Definition at line 98 of file perceptron-model-proto-reader.C.

virtual void reranker::PerceptronModelProtoReader::RegisterInitializers ( Initializers initializers)
inlinevirtual

Registers the smart_copy_ data member with the name "smart_copy".

“Smart copying” is when only one of the parameter vectors of a model is present in a message, and so this reader automatically copies the non-empty vector’s contents to the empty vector

Reimplemented from reranker::FactoryConstructible.

Definition at line 71 of file perceptron-model-proto-reader.H.


The documentation for this class was generated from the following files: