nerf-0.1.0: Nerf, the named entity recognition tool based on linear-chain CRFs

Safe HaskellNone

NLP.Nerf.Schema

Contents

Description

Observation schema blocks for Nerf.

Synopsis

Schema

type Ox a = Ox Word Text aSource

The Ox monad specialized to word token type and text observations.

type Schema a = Vector Word -> Int -> Ox aSource

A schema is a block of the Ox computation performed within the context of the sentence and the absolute sentence position.

void :: a -> Schema aSource

A dummy schema block.

sequenceS_ :: [Schema a] -> Schema ()Source

Sequence the list of schemas and discard individual values.

Using the schema

schematize :: Schema a -> [Word] -> Sent ObSource

Use the schema to extract observations from the sentence.

Building schema

From config

data SchemaCfg Source

Configuration of the schema. All configuration elements specify the range over which a particular observation type should be taken on account. For example, the [-1, 0, 2] range means that observations of particular type will be extracted with respect to previous (k - 1), current (k) and after the next (k + 2) positions when identifying the observation set for position k in the input sentence.

Constructors

SchemaCfg 

Fields

orthC :: [Int]

The orthS schema block

lemmaC :: [Int]

The lemmaS schema block

shapeC :: [Int]

The shapeS schema block

shapePairC :: [Int]

The shapePairS schema block

suffixC :: [Int]

The suffixS schema block

dictC :: Maybe (NeDict, [Int])

The searchS schema block

Instances

defaultCfgSource

Arguments

:: FilePath

Path to NeDict in a binary form

-> IO SchemaCfg 

Default configuration for Nerf observation schema.

fromCfg :: SchemaCfg -> Schema ()Source

Build the schema based on the configuration.

Schema blocks

type Block a = Vector Word -> [Int] -> Ox aSource

A block is a chunk of the Ox computation performed within the context of the sentence and the list of absolute sentence positions.

fromBlock :: Block a -> [Int] -> Schema aSource

Transform the block to the schema dependent on the list of relative sentence positions.

orthS :: Block ()Source

Orthographic observations determined with respect to the list of relative positions.

lemmaS :: Block ()Source

Lemma substitute determined with respect to the list of relative positions.

shapeS :: Block ()Source

Shape and packed shape determined with respect to the list of relative positions.

shapePairS :: Block ()Source

Shape pairs determined with respect to the list of relative positions.

suffixS :: Block ()Source

Several suffixes determined with respect to the list of relative positions.

searchS :: NeDict -> Block ()Source

Plain dictionary search determined with respect to the list of relative positions.