Feature functions in cdec

From cdec Decoder

Jump to: navigation, search

The feature function interface lets you develop new feature functions that score candidate translations. All that is necessary is implementing one or, in the case of stateful features, two of the following interfaces:

  // mandatory, context will be unused for stateless items
  virtual void TraversalFeaturesImpl(const Hypergraph::Edge& edge,
                                     const std::vector<const void*>& ant_states,
                                     SparseVector<double>* features,
                                     SparseVector<double>* estimated_features,
                                     void* state) const = 0;

  // only used for stateful items (i.e., items returning context)
  virtual void FinalTraversalFeatures(const void* residual_state,
                                      SparseVector<double>* final_features) const;
Personal tools