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

Safe HaskellNone
LanguageHaskell98

Data.CRF.Chain2.Tiers.Core

Contents

Description

Internal core data types.

Synopsis

Basic types

newtype Ob Source #

An observation.

Constructors

Ob 

Fields

Instances
Eq Ob Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

(==) :: Ob -> Ob -> Bool #

(/=) :: Ob -> Ob -> Bool #

Ord Ob Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

compare :: Ob -> Ob -> Ordering #

(<) :: Ob -> Ob -> Bool #

(<=) :: Ob -> Ob -> Bool #

(>) :: Ob -> Ob -> Bool #

(>=) :: Ob -> Ob -> Bool #

max :: Ob -> Ob -> Ob #

min :: Ob -> Ob -> Ob #

Show Ob Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

showsPrec :: Int -> Ob -> ShowS #

show :: Ob -> String #

showList :: [Ob] -> ShowS #

Binary Ob Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

put :: Ob -> Put #

get :: Get Ob #

putList :: [Ob] -> Put #

Unbox Ob Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Vector Vector Ob Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

MVector MVector Ob Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

data Vector Ob Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

data MVector s Ob Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

mkOb :: Int -> Ob Source #

Smart observation constructor.

unOb :: Ob -> Int Source #

Deconstract observation.

newtype Lb Source #

An atomic label.

Constructors

Lb 

Fields

Instances
Eq Lb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

(==) :: Lb -> Lb -> Bool #

(/=) :: Lb -> Lb -> Bool #

Num Lb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

(+) :: Lb -> Lb -> Lb #

(-) :: Lb -> Lb -> Lb #

(*) :: Lb -> Lb -> Lb #

negate :: Lb -> Lb #

abs :: Lb -> Lb #

signum :: Lb -> Lb #

fromInteger :: Integer -> Lb #

Ord Lb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

compare :: Lb -> Lb -> Ordering #

(<) :: Lb -> Lb -> Bool #

(<=) :: Lb -> Lb -> Bool #

(>) :: Lb -> Lb -> Bool #

(>=) :: Lb -> Lb -> Bool #

max :: Lb -> Lb -> Lb #

min :: Lb -> Lb -> Lb #

Show Lb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

showsPrec :: Int -> Lb -> ShowS #

show :: Lb -> String #

showList :: [Lb] -> ShowS #

Ix Lb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

range :: (Lb, Lb) -> [Lb] #

index :: (Lb, Lb) -> Lb -> Int #

unsafeIndex :: (Lb, Lb) -> Lb -> Int

inRange :: (Lb, Lb) -> Lb -> Bool #

rangeSize :: (Lb, Lb) -> Int #

unsafeRangeSize :: (Lb, Lb) -> Int

Binary Lb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

put :: Lb -> Put #

get :: Get Lb #

putList :: [Lb] -> Put #

Unbox Lb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Bounds Lb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

lower :: Lb -> Lb -> Lb Source #

upper :: Lb -> Lb -> Lb Source #

Vector Vector Lb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

MVector MVector Lb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

data Vector Lb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

data MVector s Lb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

mkLb :: Int -> Lb Source #

Smart label constructor.

unLb :: Lb -> Int Source #

Deconstruct label.

newtype FeatIx Source #

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

Constructors

FeatIx 

Fields

Instances
Eq FeatIx Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

(==) :: FeatIx -> FeatIx -> Bool #

(/=) :: FeatIx -> FeatIx -> Bool #

Ord FeatIx Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Show FeatIx Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Binary FeatIx Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

put :: FeatIx -> Put #

get :: Get FeatIx #

putList :: [FeatIx] -> Put #

Unbox FeatIx Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Vector Vector FeatIx Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

MVector MVector FeatIx Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

data Vector FeatIx Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

data MVector s FeatIx Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

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

Instances
Eq Cb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

(==) :: Cb -> Cb -> Bool #

(/=) :: Cb -> Cb -> Bool #

Ord Cb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

compare :: Cb -> Cb -> Ordering #

(<) :: Cb -> Cb -> Bool #

(<=) :: Cb -> Cb -> Bool #

(>) :: Cb -> Cb -> Bool #

(>=) :: Cb -> Cb -> Bool #

max :: Cb -> Cb -> Cb #

min :: Cb -> Cb -> Cb #

Show Cb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

showsPrec :: Int -> Cb -> ShowS #

show :: Cb -> String #

showList :: [Cb] -> ShowS #

Binary Cb Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

put :: Cb -> Put #

get :: Get Cb #

putList :: [Cb] -> Put #

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
Eq X Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

(==) :: X -> X -> Bool #

(/=) :: X -> X -> Bool #

Ord X Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

compare :: X -> X -> Ordering #

(<) :: X -> X -> Bool #

(<=) :: X -> X -> Bool #

(>) :: X -> X -> Bool #

(>=) :: X -> X -> Bool #

max :: X -> X -> X #

min :: X -> X -> X #

Show X Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

showsPrec :: Int -> X -> ShowS #

show :: X -> String #

showList :: [X] -> ShowS #

Binary X Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

put :: X -> Put #

get :: Get X #

putList :: [X] -> Put #

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

Smart X constructor.

unX :: X -> [Ob] Source #

List of observations.

unR :: X -> [Cb] Source #

List of potential labels.

Indexing

lbAt :: X -> CbIx -> Cb Source #

Potential label at the given position.

Output element (choice)

data Y Source #

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

Instances
Eq Y Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

(==) :: Y -> Y -> Bool #

(/=) :: Y -> Y -> Bool #

Ord Y Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

compare :: Y -> Y -> Ordering #

(<) :: Y -> Y -> Bool #

(<=) :: Y -> Y -> Bool #

(>) :: Y -> Y -> Bool #

(>=) :: Y -> Y -> Bool #

max :: Y -> Y -> Y #

min :: Y -> Y -> Y #

Show Y Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

showsPrec :: Int -> Y -> ShowS #

show :: Y -> String #

showList :: [Y] -> ShowS #

Binary Y Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

put :: Y -> Put #

get :: Get Y #

putList :: [Y] -> Put #

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

Y constructor.

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

Y deconstructor symetric to mkY.

Feature

data Feat Source #

Feature; every feature is associated to a layer with ln identifier.

Constructors

TFeat3

Second-order transition feature.

Fields

TFeat2

First-order transition feature.

Fields

TFeat1

Zero-order transition feature.

Fields

OFeat

Observation feature.

Fields

Instances
Eq Feat Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

(==) :: Feat -> Feat -> Bool #

(/=) :: Feat -> Feat -> Bool #

Ord Feat Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

compare :: Feat -> Feat -> Ordering #

(<) :: Feat -> Feat -> Bool #

(<=) :: Feat -> Feat -> Bool #

(>) :: Feat -> Feat -> Bool #

(>=) :: Feat -> Feat -> Bool #

max :: Feat -> Feat -> Feat #

min :: Feat -> Feat -> Feat #

Show Feat Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

showsPrec :: Int -> Feat -> ShowS #

show :: Feat -> String #

showList :: [Feat] -> ShowS #

Binary Feat Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.Core

Methods

put :: Feat -> Put #

get :: Get Feat #

putList :: [Feat] -> Put #

Feature generation

obFeats :: Ob -> Cb -> [Feat] Source #

Generate observation features.

trFeats1 :: Cb -> [Feat] Source #

Generate zero-order transition features.

trFeats2 :: Cb -> Cb -> [Feat] Source #

Generate first-order transition features.

trFeats3 :: Cb -> Cb -> Cb -> [Feat] Source #

Generate second-order transition features.