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

Safe HaskellNone

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
 

Instances

Eq Ob 
Ord Ob 
Show Ob 
Unbox Ob 
Binary Ob 
Vector Vector Ob 
MVector MVector Ob 
IArray UArray Ob 

mkOb :: Int -> ObSource

Smart observation constructor.

unOb :: Ob -> IntSource

Deconstract observation.

newtype Lb Source

An atomic label.

Constructors

Lb 

Fields

_unLb :: Int16
 

Instances

Eq Lb 
Num Lb 
Ord Lb 
Show Lb 
Ix Lb 
Unbox Lb 
Binary Lb 
Bounds Lb 
Vector Vector Lb 
MVector MVector Lb 
IArray UArray Lb 

mkLb :: Int -> LbSource

Smart label constructor.

unLb :: Lb -> IntSource

Deconstract label.

newtype FeatIx Source

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

Constructors

FeatIx 

Fields

_unFeatIx :: Int32
 

Instances

Eq FeatIx 
Ord FeatIx 
Show FeatIx 
Unbox FeatIx 
Binary FeatIx 
Vector Vector FeatIx 
MVector MVector FeatIx 
IArray UArray FeatIx 

mkFeatIx :: Int -> FeatIxSource

Smart feature index constructor.

unFeatIx :: FeatIx -> IntSource

Deconstract feature index.

type CbIx = IntSource

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

Eq Cb 
Ord Cb 
Show Cb 
Binary Cb 

mkCb :: [Lb] -> CbSource

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

Eq X 
Ord X 
Show X 
Binary X 

type Xs = Vector XSource

Sentence of words.

mkX :: [Ob] -> [Cb] -> XSource

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

Eq Y 
Ord Y 
Show Y 
Binary Y 

type Ys = Vector YSource

Sentence of Y (label choices).

mkY :: [(Cb, Double)] -> YSource

Y constructor.

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

Y deconstructor symetric to mkY.

Indexing

lbAt :: X -> CbIx -> CbSource

Potential label at the given position.

lbOn :: Xs -> Int -> CbIx -> Maybe CbSource

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

lbNum :: Xs -> Int -> IntSource

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.