concraft-0.9.0: Morphological disambiguation based on constrained CRFs

Safe HaskellNone

NLP.Concraft.Disamb

Contents

Synopsis

Model

data Disamb Source

A disambiguation model.

Constructors

Disamb 

Fields

tiers :: [Tier]
 
schemaConf :: SchemaConf
 
crf :: CRF Ob Atom
 

Instances

Binary Disamb 

Tiers

data Tier Source

A tier description.

Constructors

Tier 

Fields

withPos :: Bool

Does it include the part of speech?

withAtts :: Set Attr

Tier grammatical attributes.

Instances

Binary Tier 

data Atom Source

An atomic part of morphosyntactic tag with optional POS.

Constructors

Atom 

Fields

pos :: Maybe POS
 
atts :: Map Attr Text
 

Instances

Eq Atom 
Ord Atom 
Show Atom 
Binary Atom 

Disambiguation

marginals :: Word w => Disamb -> Sent w Tag -> [WMap Tag]Source

Tag labels with marginal probabilities.

disamb :: Word w => Disamb -> Sent w Tag -> [Tag]Source

Perform context-sensitive disambiguation.

include :: (Sent w Tag -> [Tag]) -> Sent w Tag -> Sent w TagSource

Insert disambiguation results into the sentence.

disambSent :: Word w => Disamb -> Sent w Tag -> Sent w TagSource

Combine disamb with include.

Training

data TrainConf Source

Training configuration.

Constructors

TrainConf 

Fields

tiersT :: [Tier]
 
schemaConfT :: SchemaConf
 
sgdArgsT :: SgdArgs
 
onDiskT :: Bool
 
ReTrainConf 

Fields

initDmb :: Disamb
 
sgdArgsT :: SgdArgs
 
onDiskT :: Bool
 

trainSource

Arguments

:: Word w 
=> TrainConf

Training configuration

-> IO [Sent w Tag]

Training data

-> IO [Sent w Tag]

Evaluation data

-> IO Disamb

Resultant model

Train disamb model.

Pruning

prune :: Double -> Disamb -> DisambSource

Prune disamb model: discard model features with absolute values (in log-domain) lower than the given threshold.