Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
|
A class to read one line at a time from a backing file, and tokenize that line based on whitespace, and then interpret each token as a feature-value pair via a protected method ExtractFeatureValuePair (see the documentation for that method for details on how tokens are interpreted as feature-value pairs). More...
#include <basic-file-backed-feature-extractor.H>
Public Member Functions | |
BasicFileBackedFeatureExtractor () | |
Constructs an instance. More... | |
virtual | ~BasicFileBackedFeatureExtractor () |
Destroys this instance. More... | |
virtual void | Extract (Candidate &candidate, FeatureVector< int, double > &features) |
Does nothing. More... | |
virtual void | ExtractSymbolic (Candidate &candidate, FeatureVector< string, double > &symbolic_features) |
Extracts symbolic features based on the most recent line read from the file (or stream) that backs this feature extractor. More... | |
Public Member Functions inherited from reranker::AbstractFileBackedFeatureExtractor | |
AbstractFileBackedFeatureExtractor () | |
Constructs an instance. More... | |
virtual | ~AbstractFileBackedFeatureExtractor () |
Destroys this instance. More... | |
virtual void | RegisterInitializers (Initializers &initializers) |
Registers the data member to be initialized when an instance of this class is constructed by a Factory. More... | |
virtual void | Init (const Environment *env, const string &arg) |
This method is guaranteed to be inokved by a Factory after invoking the RegisterInitializers method just after construction. 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 () |
Protected Member Functions | |
virtual void | ExtractFeatureValuePair (const string &s, string &feature, double &value) |
Extracts a symbolic feature and value from the specified string. More... | |
Protected Member Functions inherited from reranker::AbstractFileBackedFeatureExtractor | |
virtual void | ReadFromStream () |
Reads from the stream. More... | |
Additional Inherited Members | |
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 class to read one line at a time from a backing file, and tokenize that line based on whitespace, and then interpret each token as a feature-value pair via a protected method ExtractFeatureValuePair (see the documentation for that method for details on how tokens are interpreted as feature-value pairs).
Definition at line 57 of file basic-file-backed-feature-extractor.H.
|
inline |
Constructs an instance.
Definition at line 61 of file basic-file-backed-feature-extractor.H.
|
inlinevirtual |
Destroys this instance.
Definition at line 64 of file basic-file-backed-feature-extractor.H.
|
inlinevirtual |
Does nothing.
Implements reranker::AbstractFileBackedFeatureExtractor.
Reimplemented in reranker::FileBackedNgramFeatureExtractor.
Definition at line 67 of file basic-file-backed-feature-extractor.H.
|
inlineprotectedvirtual |
Extracts a symbolic feature and value from the specified string.
The specified string may have one of three forms:
String | Feature name | Feature weight |
---|---|---|
foo | foo | 1.0 |
foo= | foo | 1.0 |
foo=value | foo | value |
where value
is the (string representation of) a floating-point value.
[in] | s | the string from which to extract a feature-value pair |
[out] | feature | the symbolic feature name extracted from the specified string s |
[out] | value | the symbolic feature’s value extracted from the specified string s |
Definition at line 97 of file basic-file-backed-feature-extractor.H.
|
virtual |
Extracts symbolic features based on the most recent line read from the file (or stream) that backs this feature extractor.
The line is tokenized based on whitespace, and each token is transformed into a feature-value pair via the ExtractFeatureValuePair method.
Implements reranker::AbstractFileBackedFeatureExtractor.
Reimplemented in reranker::FileBackedNgramFeatureExtractor.
Definition at line 43 of file basic-file-backed-feature-extractor.C.