crf-chain2-tiers-0.2.3: Second-order, tiered, constrained, linear conditional random fields

Safe HaskellNone
LanguageHaskell98

Data.CRF.Chain2.Tiers.Dataset.Internal

Contents

Description

Internal core data types.

Synopsis

Basic types

newtype Ob Source

An observation.

Constructors

Ob 

Fields

_unOb :: Int32
 

mkOb :: Int -> Ob Source

Smart observation constructor.

unOb :: Ob -> Int Source

Deconstract observation.

newtype Lb Source

An atomic label.

Constructors

Lb 

Fields

_unLb :: Int16
 

mkLb :: Int -> Lb Source

Smart label constructor.

unLb :: Lb -> Int Source

Deconstract label.

newtype FeatIx Source

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

Constructors

FeatIx 

Fields

_unFeatIx :: Int32
 

mkFeatIx :: Int -> FeatIx Source

Smart feature index constructor.

unFeatIx :: FeatIx -> Int Source

Deconstract feature index.

type CbIx = Int Source

An index of the label.

Complex label

newtype Cb Source

A complex label is a vector of atomic labels.

Constructors

Cb 

Fields

_unCb :: Vector Lb
 

Instances

mkCb :: [Lb] -> Cb Source

Smart complex label constructor.

unCb :: Cb -> [Lb] Source

Deconstract complex label.

Input element (word)

data X Source

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

Instances

type Xs = Vector X Source

Sentence of words.

mkX :: [Ob] -> [Cb] -> X Source

Smart X constructor.

unX :: X -> [Ob] Source

List of observations.

unR :: X -> [Cb] Source

List of potential labels.

Output element (choice)

data Y Source

Vector of chosen labels together with corresponding probabilities in log domain.

Instances

type Ys = Vector Y Source

Sentence of Y (label choices).

mkY :: [(Cb, Double)] -> Y Source

Y constructor.

unY :: Y -> [(Cb, LogFloat)] Source

Y deconstructor symetric to mkY.

Indexing

lbAt :: X -> CbIx -> Cb Source

Potential label at the given position.

lbOn :: Xs -> Int -> CbIx -> Maybe Cb Source

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

lbNum :: Xs -> Int -> Int Source

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

lbIxs :: Xs -> Int -> [CbIx] Source

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