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::FileBackedLossSetter Class Reference

A “feature extractor” that reads lines from a backing file, setting each candidate’s loss via its Candidate::set_loss method. More...

#include <file-backed-loss-setter.H>

Inheritance diagram for reranker::FileBackedLossSetter:
reranker::AbstractFileBackedFeatureExtractor reranker::FeatureExtractor reranker::FactoryConstructible

Public Member Functions

 FileBackedLossSetter ()
 Constructs a new instance. More...
 
virtual ~FileBackedLossSetter ()
 Destroys this instance. More...
 
virtual void RegisterInitializers (Initializers &initializers)
 Registers the initializers for the filename_ and token_idx_ members. More...
 
virtual void Init (const Environment *env, const string &arg)
 Initializes this instance. More...
 
virtual void Extract (Candidate &candidate, FeatureVector< int, double > &features)
 Sets the loss for the specified candidate based on what was read from the last line in the stream backing this FeatureExtractor instance. More...
 
virtual void ExtractSymbolic (Candidate &candidate, FeatureVector< string, double > &symbolic_features)
 Overridden to do nothing. More...
 
- Public Member Functions inherited from reranker::AbstractFileBackedFeatureExtractor
 AbstractFileBackedFeatureExtractor ()
 Constructs an instance. More...
 
virtual ~AbstractFileBackedFeatureExtractor ()
 Destroys this instance. More...
 
virtual void Reset ()
 Indicates to this instance that iteration over candidate sets on which features are being extracted has been reset. More...
 
virtual void Extract (CandidateSet &candidate_set)
 Extracts features for all the candidates in the specified CandidateSet. More...
 
virtual long line_number () const
 Returns the current number of lines read by this feature extractor from the underlying stream. More...
 
- Public Member Functions inherited from reranker::FeatureExtractor
 FeatureExtractor ()
 Constructs an empty feature vector. More...
 
virtual ~FeatureExtractor ()
 Destroys this vector. More...
 
- Public Member Functions inherited from reranker::FactoryConstructible
virtual ~FactoryConstructible ()
 

Additional Inherited Members

- Protected Member Functions inherited from reranker::AbstractFileBackedFeatureExtractor
virtual void ReadFromStream ()
 Reads from the stream. More...
 
- Protected Attributes inherited from reranker::AbstractFileBackedFeatureExtractor
string filename_
 The name of the file backing this feature extractor. More...
 
istream * is_
 The stream created from the file backing this feature extractor. More...
 
string line_
 The last line read by this feature extractor. More...
 
long line_number_
 The number of lines read so far by this feature extractor. More...
 
Tokenizer tokenizer_
 A simple whitespace tokenizer for use by concrete subclasses. More...
 

Detailed Description

A “feature extractor” that reads lines from a backing file, setting each candidate’s loss via its Candidate::set_loss method.

Definition at line 52 of file file-backed-loss-setter.H.

Constructor & Destructor Documentation

reranker::FileBackedLossSetter::FileBackedLossSetter ( )
inline

Constructs a new instance.

Definition at line 55 of file file-backed-loss-setter.H.

virtual reranker::FileBackedLossSetter::~FileBackedLossSetter ( )
inlinevirtual

Destroys this instance.

Definition at line 58 of file file-backed-loss-setter.H.

Member Function Documentation

void reranker::FileBackedLossSetter::Extract ( Candidate candidate,
FeatureVector< int, double > &  features 
)
virtual

Sets the loss for the specified candidate based on what was read from the last line in the stream backing this FeatureExtractor instance.

Implements reranker::AbstractFileBackedFeatureExtractor.

Definition at line 48 of file file-backed-loss-setter.C.

virtual void reranker::FileBackedLossSetter::ExtractSymbolic ( Candidate candidate,
FeatureVector< string, double > &  symbolic_features 
)
inlinevirtual

Overridden to do nothing.

Implements reranker::AbstractFileBackedFeatureExtractor.

Definition at line 84 of file file-backed-loss-setter.H.

virtual void reranker::FileBackedLossSetter::Init ( const Environment env,
const string &  arg 
)
inlinevirtual

Initializes this instance.

This method is guaranteed to be invoked by a Factory just after construction.

Parameters
envthe environment just after initializing this object
argignored
See Also
Factory::Create(const string&,string&,string&,bool&,bool&)

Reimplemented from reranker::AbstractFileBackedFeatureExtractor.

Definition at line 74 of file file-backed-loss-setter.H.

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

Registers the initializers for the filename_ and token_idx_ members.

Reimplemented from reranker::AbstractFileBackedFeatureExtractor.

Definition at line 61 of file file-backed-loss-setter.H.


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