44 bool clear_symbolic_features,
46 bool compiled_this_invocation =
false;
47 if ((!compiled_ || force) && !symbolic_features_.empty()) {
52 symbolic_features_.
begin();
53 it != symbolic_features_.end();
55 features_.IncrementWeight(symbols->GetIndex(it->first), it->second);
58 compiled_this_invocation =
true;
60 if (clear_symbolic_features) {
61 symbolic_features_.clear();
64 return compiled_this_invocation;
68 bool clear_symbolic_features,
71 if (compiled_ || force) {
72 if (clear_symbolic_features) {
73 symbolic_features_.
clear();
77 it != features_.
end();
Provides the reranker::Candidate class for representing a candidate hypothesis from an initial model...
void Decompile(Symbols *symbols, bool clear_symbolic_features=false, bool clear_features=true, bool force=false)
Decompiles any non-symbolic features in this candidate.
const_iterator end() const
Returns a const iterator pointing to the end of the feature-value pairs of this feature vector...
const_iterator begin() const
Returns a const iterator pointing to the first of the feature-value pairs of this feature vector...
virtual const string & GetSymbol(int index) const =0
Returns the unique symbol for the specified index, or the empty string if the specified index does no...
An interface specifying a converter from symbols (strings) to int indices.
A class to represent a candidate in a set of candidates that constitutes a training instance for a re...
#define IMPLEMENT_FACTORY(BASE)
Provides the necessary implementation for a factory for the specified BASE class type.
V IncrementWeight(const K &uid, V by)
Increments the weight of the specified feature by the specified amount.
void clear()
Sets all feature weights to zero and, because this is a sparse vector, clears all storage...
A class to represent a feature vector, where features are represented by unique identifiers, and feature values are represented by the template type.