Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
|
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>
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... | |
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.
|
inline |
Constructs a new instance.
Definition at line 55 of file file-backed-loss-setter.H.
|
inlinevirtual |
Destroys this instance.
Definition at line 58 of file file-backed-loss-setter.H.
|
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.
|
inlinevirtual |
Overridden to do nothing.
Implements reranker::AbstractFileBackedFeatureExtractor.
Definition at line 84 of file file-backed-loss-setter.H.
|
inlinevirtual |
Initializes this instance.
This method is guaranteed to be invoked by a Factory just after construction.
env | the environment just after initializing this object |
arg | ignored |
Reimplemented from reranker::AbstractFileBackedFeatureExtractor.
Definition at line 74 of file file-backed-loss-setter.H.
|
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.