crf-chain2-tiers-0.1.1: 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
 

mkOb :: Int -> ObSource

Smart observation constructor.

unOb :: Ob -> IntSource

Deconstract observation.

newtype Lb Source

An atomic label.

Constructors

Lb 

Fields

_unLb :: Int16
 

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
 

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

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

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

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.