crf-chain1-constrained-0.6.0: First-order, constrained, linear-chain conditional random fields

Safe HaskellNone
LanguageHaskell98

Data.CRF.Chain1.Constrained.Core

Contents

Synopsis

Basic Types

newtype Ob Source #

An observation.

Constructors

Ob 

Fields

Instances
Eq Ob Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

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

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

Ord Ob Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.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 #

Read Ob Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Show Ob Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

showsPrec :: Int -> Ob -> ShowS #

show :: Ob -> String #

showList :: [Ob] -> ShowS #

Binary Ob Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

put :: Ob -> Put #

get :: Get Ob #

putList :: [Ob] -> Put #

Unbox Ob Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Vector Vector Ob Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

MVector MVector Ob Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

data Vector Ob Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

data MVector s Ob Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

data MVector s Ob = MV_Ob (MVector s Int)

newtype Lb Source #

A label.

Constructors

Lb 

Fields

Instances
Eq Lb Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

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

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

Num Lb Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.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.Chain1.Constrained.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 #

Read Lb Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Show Lb Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

showsPrec :: Int -> Lb -> ShowS #

show :: Lb -> String #

showList :: [Lb] -> ShowS #

Ix Lb Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.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.Chain1.Constrained.Core

Methods

put :: Lb -> Put #

get :: Get Lb #

putList :: [Lb] -> Put #

Unbox Lb Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Vector Vector Lb Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

MVector MVector Lb Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

data Vector Lb Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

data MVector s Lb Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

data MVector s Lb = MV_Lb (MVector s Int)

data X Source #

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

Constructors

X

The word with default set of potential interpretations.

Fields

R

The word with restricted set of potential labels.

Fields

Instances
Eq X Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

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

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

Ord X Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.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 #

Read X Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Show X Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

showsPrec :: Int -> X -> ShowS #

show :: X -> String #

showList :: [X] -> ShowS #

Binary X Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

put :: X -> Put #

get :: Get X #

putList :: [X] -> Put #

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

X constructor.

unX :: X -> [Ob] Source #

List of observations.

unR :: AVec Lb -> X -> [Lb] Source #

List of potential labels.

newtype Y Source #

Probability distribution over labels. We assume, that when y is a member of chosen labels list it is also a member of the list potential labels for corresponding X word. TODO: Perhaps we should substitute Lbs with label indices corresponding to labels from the vector of potential labels? FIXME: The type definition is incorrect (see fromList definition), it should be something like AVec2.

Constructors

Y 

Fields

Instances
Eq Y Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

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

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

Ord Y Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.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 #

Read Y Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Show Y Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

showsPrec :: Int -> Y -> ShowS #

show :: Y -> String #

showList :: [Y] -> ShowS #

Binary Y Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

put :: Y -> Put #

get :: Get Y #

putList :: [Y] -> Put #

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

Y constructor.

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

Y deconstructor symetric to mkY.

newtype AVec a Source #

An ascending vector of unique elements.

Constructors

AVec 

Fields

Instances
(Unbox a, Eq a) => Eq (AVec a) Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

(==) :: AVec a -> AVec a -> Bool #

(/=) :: AVec a -> AVec a -> Bool #

(Unbox a, Ord a) => Ord (AVec a) Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

compare :: AVec a -> AVec a -> Ordering #

(<) :: AVec a -> AVec a -> Bool #

(<=) :: AVec a -> AVec a -> Bool #

(>) :: AVec a -> AVec a -> Bool #

(>=) :: AVec a -> AVec a -> Bool #

max :: AVec a -> AVec a -> AVec a #

min :: AVec a -> AVec a -> AVec a #

(Read a, Unbox a) => Read (AVec a) Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

(Show a, Unbox a) => Show (AVec a) Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

showsPrec :: Int -> AVec a -> ShowS #

show :: AVec a -> String #

showList :: [AVec a] -> ShowS #

(Unbox a, Binary a) => Binary (AVec a) Source # 
Instance details

Defined in Data.CRF.Chain1.Constrained.Core

Methods

put :: AVec a -> Put #

get :: Get (AVec a) #

putList :: [AVec a] -> Put #

fromList :: (Ord a, Unbox a) => [a] -> AVec a Source #

Smart AVec constructor which ensures that the underlying vector satisfies the AVec properties.

fromSet :: (Ord a, Unbox a) => Set a -> AVec a Source #

Smart AVec constructor which ensures that the underlying vector satisfies the AVec properties.

toAscList :: (Ord a, Unbox a) => AVec a -> [a] Source #

Convert AVec to an ascending list.

Features

data Feature Source #

A Feature is either an observation feature OFeature o x, which models relation between observation o and label x assigned to the same word, or a transition feature TFeature x y (SFeature x for the first position in the sentence), which models relation between two subsequent labels, x (on i-th position) and y (on (i-1)-th positoin).

Constructors

SFeature !Lb 
TFeature !Lb !Lb 
OFeature !Ob !Lb