Safe Haskell | None |
---|
Observation schema blocks for Concraft.
- type Ob = ([Int], Text)
- type Ox t a = Ox (Word t) Text a
- type Schema t a = Vector (Word t) -> Int -> Ox t a
- void :: a -> Schema t a
- sequenceS_ :: [Vector (Word t) -> a -> Ox t b] -> Vector (Word t) -> a -> Ox t ()
- schematize :: Schema t a -> Sent t -> [[Ob]]
- data Body a = Body {}
- type Entry a = Maybe (Body a)
- entry :: [Int] -> Entry ()
- entryWith :: a -> [Int] -> Entry a
- data SchemaConf = SchemaConf {}
- nullConf :: SchemaConf
- fromConf :: SchemaConf -> Schema t ()
- guessConfDefault :: SchemaConf
- disambConfDefault :: SchemaConf
- type Block t a = Vector (Word t) -> [Int] -> Ox t a
- fromBlock :: Block t a -> [Int] -> Bool -> Schema t a
- orthB :: Block t ()
- lowOrthB :: Block t ()
- lowPrefixesB :: [Int] -> Block t ()
- lowSuffixesB :: [Int] -> Block t ()
- knownB :: Block t ()
- shapeB :: Block t ()
- packedB :: Block t ()
- begPackedB :: Block t ()
Types
An observation consist of an index (of list type) and an actual observation value.
type Ox t a = Ox (Word t) Text aSource
The Ox monad specialized to word token type and text observations.
type Schema t a = Vector (Word t) -> Int -> Ox t aSource
A schema is a block of the Ox computation performed within the context of the sentence and the absolute sentence position.
sequenceS_ :: [Vector (Word t) -> a -> Ox t b] -> Vector (Word t) -> a -> Ox t ()Source
Sequence the list of schemas (or blocks) and discard individual values.
Usage
schematize :: Schema t a -> Sent t -> [[Ob]]Source
Use the schema to extract observations from the sentence.
Configuration
Body of configuration entry.
data SchemaConf 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.
SchemaConf | |
|
Null configuration of the observation schema.
fromConf :: SchemaConf -> Schema t ()Source
Build the schema based on the configuration.
guessConfDefault :: SchemaConfSource
Default configuration for the guessing observation schema.
disambConfDefault :: SchemaConfSource
Default configuration for the guessing observation schema.
Schema blocks
type Block t a = Vector (Word t) -> [Int] -> Ox t 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 t a -> [Int] -> Bool -> Schema t aSource
Transform a block to a schema depending on * A list of relative sentence positions, * A boolean value; if true, the block computation will be performed only on positions where an OOV word resides.
lowPrefixesB :: [Int] -> Block t ()Source
List of lowercased prefixes of given lengths.
lowSuffixesB :: [Int] -> Block t ()Source
List of lowercased suffixes of given lengths.
begPackedB :: Block t ()Source
Packed shape of the word.