Skip to main content

Module seq_feature

Module seq_feature 

Source
Expand description

Configurable feature templates for sequence labeling models.

Provides SeqFeatureTemplate for specifying what observations and labels each model sees, plus extraction functions used by both averaged perceptron and HMM models.

Structs§

FeatureBuffer
A reusable buffer for building feature strings.
SeqFeatureConfig
Validated collection of feature templates with pre-computed metadata.
SeqFeatureTemplate
A single feature template for sequence labeling.

Enums§

SeqTransform
Transform applied to observation strings.

Constants§

END
Sentinel strings for positions after the end of a sequence.
START
Sentinel strings for positions before the start of a sequence.

Functions§

default_segmenter_ap_features
Default features for the wordseg averaged perceptron.
default_segmenter_hmm_features
Default features for the wordseg HMM.
default_tagger_ap_features
Default features for the tagging averaged perceptron.
default_tagger_hmm_features
Default features for the tagging HMM.
extract_features
Extract AP features into buf for position i.
extract_observation
Extract a single observation string for an HMM feature template at position i.
extract_observation_cow
Like extract_observation, but returns Cow::Borrowed when possible (single-position templates) to avoid heap allocation.
final_char
Get the final character of a string, or an empty string if empty.
first_char
Get the first character of a string, or an empty string if empty.
validate_templates
Validate a list of feature templates.