Safe Haskell | None |
---|
Observation schema blocks for Nerf.
- type Ox a = Ox Word Text a
- type Schema a = Vector Word -> Int -> Ox a
- void :: a -> Schema a
- sequenceS_ :: [Vector Word -> a -> Ox b] -> Vector Word -> a -> Ox ()
- schematize :: Schema a -> [Word] -> Sent Ob
- data Body a = Body {}
- type Entry a = Maybe (Body a)
- entry :: [Int] -> Entry ()
- entryWith :: a -> [Int] -> Entry a
- data SchemaConf = SchemaConf {}
- nullConf :: SchemaConf
- defaultConf :: [Dict] -> Maybe Dict -> Maybe Dict -> IO SchemaConf
- fromConf :: SchemaConf -> Schema ()
- type Block a = Vector Word -> [Int] -> Ox a
- fromBlock :: Block a -> [Int] -> Schema a
- orthB :: Block ()
- splitOrthB :: Block ()
- lowPrefixesB :: [Int] -> Block ()
- lowSuffixesB :: [Int] -> Block ()
- lemmaB :: Int -> Block ()
- shapeB :: Block ()
- packedB :: Block ()
- shapePairB :: Block ()
- packedPairB :: Block ()
- dictB :: Dict -> Block ()
Types
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.
sequenceS_ :: [Vector Word -> a -> Ox b] -> Vector Word -> a -> Ox ()Source
Sequence the list of schemas (or blocks) and discard individual values.
Usage
schematize :: Schema a -> [Word] -> Sent ObSource
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.
:: [Dict] | Named Entity dictionaries |
-> Maybe Dict | Dictionary of internal triggers |
-> Maybe Dict | Dictionary of external triggers |
-> IO SchemaConf |
Default configuration of the observation schema.
fromConf :: SchemaConf -> 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 depending on the list of relative sentence positions.
splitOrthB :: Block ()Source
Orthographic form split into two observations: the lowercased form and the original form (only when different than the lowercased one).
lowPrefixesB :: [Int] -> Block ()Source
List of lowercased prefixes of given lengths.
lowSuffixesB :: [Int] -> Block ()Source
List of lowercased suffixes of given lengths.
lemmaB :: Int -> Block ()Source
Lemma substitute parametrized by the number specifying the span
over which lowercased prefixes and suffixes will be save
d.
For example, lemmaB 2
will take affixes of lengths 0, -1
and -2
on account.
shapePairB :: Block ()Source
Combined shapes of two consecutive (at k-1
and k
positions) words.
packedPairB :: Block ()Source
Combined packed shapes of two consecutive (at k-1
and k
positions)
words.