FeatureFunction

Trait FeatureFunction 

Source
pub trait FeatureFunction: Send + Sync {
    // Required methods
    fn compute(
        &self,
        prev_label: Option<usize>,
        curr_label: usize,
        input_sequence: &[usize],
        position: usize,
    ) -> f64;
    fn name(&self) -> &str;
}
Expand description

Feature function for linear-chain CRF.

Features can be:

  • Transition features: depend on (yᵢ₋₁, yᵢ, x, i)
  • Emission features: depend on (yᵢ, x, i)

Required Methods§

Source

fn compute( &self, prev_label: Option<usize>, curr_label: usize, input_sequence: &[usize], position: usize, ) -> f64

Compute feature value for a transition.

§Arguments
  • prev_label - Previous output label (None for first position)
  • curr_label - Current output label
  • input_sequence - Input sequence
  • position - Current position in sequence
Source

fn name(&self) -> &str

Get feature name/description.

Implementors§