Safe Haskell | None |
---|
Internal implementation of the CRF model.
- newtype FeatIx = FeatIx {}
- data Model = Model {}
- mkModel :: Ob -> Lb -> [Feature] -> Model
- valueL :: Model -> FeatIx -> LogFloat
- featToIx :: Model -> Feature -> Maybe FeatIx
- featToJustIx :: Model -> Feature -> FeatIx
- featToJustInt :: Model -> Feature -> Int
- sgValue :: Model -> Lb -> LogFloat
- sgIxs :: Model -> [LbIx]
- obIxs :: Model -> Ob -> AVec LbIx
- nextIxs :: Model -> Lb -> AVec LbIx
- prevIxs :: Model -> Lb -> AVec LbIx
Documentation
A feature index. To every model feature a unique index is assigned.
The model is actually a map from features to their respective potentials, but for the sake of efficiency the internal representation is more complex.
Model | |
|
mkModel :: Ob -> Lb -> [Feature] -> ModelSource
Construct the model from the list of features. All parameters will be
set to 0. There can be repetitions in the input list.
We assume that the set of labels is of the {0, 1, .. lbMax
} form and,
similarly, the set of observations is of the {0, 1, .. obMax
} form.
valueL :: Model -> FeatIx -> LogFloatSource
Model potential defined for the given feature interpreted as a number in logarithmic domain.
featToJustIx :: Model -> Feature -> FeatIxSource
Determine index for the given feature. Throw error when the feature is not a member of the model.
featToJustInt :: Model -> Feature -> IntSource
Determine index for the given feature and return it as an integer. Throw error when the feature is not a member of the model.
sgValue :: Model -> Lb -> LogFloatSource
Potential value (in log domain) of the singular feature with the given label. The value defaults to 1 (0 in log domain) when the feature is not a member of the model.
sgIxs :: Model -> [LbIx]Source
List of labels which can be located on the first position of a sentence together with feature indices determined by them.
obIxs :: Model -> Ob -> AVec LbIxSource
List of labels which constitute a valid feature in combination with the given observation accompanied by feature indices determined by these labels.