crf-chain2-generic-0.3.0: Second-order, generic, constrained, linear conditional random fields

Safe HaskellNone

Data.CRF.Chain2.Generic.Internal

Contents

Description

Internal core data types.

Synopsis

Input element (word)

data X o t Source

A word represented by a list of its observations and a list of its potential label interpretations.

Instances

(Eq o, Eq t) => Eq (X o t) 
(Eq (X o t), Ord o, Ord t) => Ord (X o t) 
(Show o, Show t) => Show (X o t) 

type Xs o t = Vector (X o t)Source

Sentence of words.

mkX :: (Ord o, Ord t) => [o] -> [t] -> X o tSource

X constructor.

unX :: X o t -> [o]Source

List of observations.

unR :: X o t -> [t]Source

List of potential labels.

Output element (choice)

data Y t Source

Vector of chosen labels together with corresponding probabilities.

Instances

Eq t => Eq (Y t) 
(Eq (Y t), Ord t) => Ord (Y t) 
Show t => Show (Y t) 

type Ys t = Vector (Y t)Source

Sentence of Y (label choices).

mkY :: Ord t => [(t, Double)] -> Y tSource

Y constructor.

unY :: Y t -> [(t, Double)]Source

Y deconstructor symetric to mkY.

Indexing

lbAt :: X o t -> LbIx -> tSource

Potential label at the given position.

lbOn :: Xs o t -> Int -> LbIx -> Maybe tSource

Potential label at the given position and at the given index. Return Nothing for positions outside the domain.

lbNum :: Xs o t -> Int -> IntSource

Number of potential labels at the given position of the sentence. Function extended to indices outside the positions' domain.

lbIxs :: Xs o t -> Int -> [LbIx]Source

List of label indices at the given position. Function extended to indices outside the positions' domain.

Feature index

newtype FeatIx Source

A feature index. To every model feature a unique index is assigned.

Constructors

FeatIx 

Fields

unFeatIx :: Int
 

Auxiliary

type LbIx = IntSource

An index of the label.

data AVec a Source

An ascending vector of distinct elements.

Instances

Eq a => Eq (AVec a) 
(Eq (AVec a), Ord a) => Ord (AVec a) 
Show a => Show (AVec a) 

mkAVec :: Ord a => [a] -> AVec aSource

Smart AVec constructor which ensures that the underlying vector is strictly ascending.

data AVec2 a b Source

An ascending vector of distinct elements with respect to fst values.

Instances

(Eq a, Eq b) => Eq (AVec2 a b) 
(Eq (AVec2 a b), Ord a, Ord b) => Ord (AVec2 a b) 
(Show a, Show b) => Show (AVec2 a b) 

mkAVec2 :: Ord a => [(a, b)] -> AVec2 a bSource

Smart AVec constructor which ensures that the underlying vector is strictly ascending with respect to fst values.