Safe Haskell | None |
---|
The module provides first-order, linear-chain conditional random fields (CRFs) with position-wide constraints over label values.
- data Word a b = Word {}
- unknown :: Word a b -> Bool
- type Sent a b = [Word a b]
- data Prob a
- mkProb :: Ord a => [(a, Double)] -> Prob a
- data WordL a b
- mkWordL :: Word a b -> Prob b -> WordL a b
- type SentL a b = [WordL a b]
- tag :: (Ord a, Ord b) => CRF a b -> Sent a b -> [b]
- tagK :: (Ord a, Ord b) => Int -> CRF a b -> Sent a b -> [[b]]
- module Data.CRF.Chain1.Constrained.Train
- module Data.CRF.Chain1.Constrained.Feature.Present
- module Data.CRF.Chain1.Constrained.Feature.Hidden
Data types
A Word is represented by a set of observations and a set of potential interpretation labels. When the set of potential labels is empty the word is considered to be unknown and the default potential set is used in its place.
unknown :: Word a b -> BoolSource
The word is considered to be unknown when the set of potential labels is empty.
A probability distribution defined over elements of type a. All elements not included in the map have probability equal to 0.
mkWordL :: Word a b -> Prob b -> WordL a bSource
Ensure, that every label from the distribution domain is a member of the set of potential labels corresponding to the word.
Tagging
tag :: (Ord a, Ord b) => CRF a b -> Sent a b -> [b]Source
Determine the most probable label sequence within the context of the
given sentence using the model provided by the CRF
.
tagK :: (Ord a, Ord b) => Int -> CRF a b -> Sent a b -> [[b]]Source
Determine the most probable label sets of the given size (at maximum) for each position in the input sentence.