libGenI-0.16.1: A natural language generator (specifically, an FB-LTAG surface realiser)ContentsIndex
NLP.GenI.Builder
Synopsis
data Builder st it pa = Builder {
init :: Input -> pa -> (st, Statistics)
step :: BuilderState st ()
stepAll :: BuilderState st ()
finished :: st -> Bool
unpack :: st -> [Output]
partial :: st -> [Output]
}
type Output = (UninflectedSentence, Derivation)
type Derivation = TagDerivation
data Input = Input {
inSemInput :: SemInput
inLex :: [ILexEntry]
inCands :: [(TagElem, BitVector)]
}
type UninflectedWord = (String, Flist)
type UninflectedSentence = [UninflectedWord]
type UninflectedDisjunction = ([String], Flist)
type SentenceAut = NFA Int UninflectedWord
type BuilderState s a = StateT s (State Statistics) a
preInit :: Input -> Params -> (Input, (Int, Int, Int), PolResult)
unlessEmptySem :: Input -> Params -> a -> a
run :: Builder st it Params -> Input -> Params -> (st, Statistics)
type SemBitMap = Map Pred BitVector
defineSemanticBits :: Sem -> SemBitMap
semToBitVector :: SemBitMap -> Sem -> BitVector
bitVectorToSem :: SemBitMap -> BitVector -> Sem
type IafMap = Map String Sem
dependentSem :: IafMap -> String -> Sem
literalArgs :: Pred -> [GeniVal]
semToIafMap :: Sem -> IafMap
fromUniConst :: Monad m => GeniVal -> m String
getIdx :: Flist -> [GeniVal]
ts_iafFailure :: [String] -> [Pred] -> String
recalculateAccesibility :: IafAble a => a -> a
iafBadSem :: IafAble a => IafMap -> SemBitMap -> BitVector -> a -> BitVector -> a -> BitVector
class IafAble a where
iafAcc :: a -> [String]
iafInacc :: a -> [String]
iafSetAcc :: [String] -> a -> a
iafSetInacc :: [String] -> a -> a
iafNewAcc :: a -> [String]
defaultStepAll :: Builder st it pa -> BuilderState st ()
type DispatchFilter s a = a -> s (Maybe a)
(>-->) :: Monad s => DispatchFilter s a -> DispatchFilter s a -> DispatchFilter s a
nullFilter :: Monad s => DispatchFilter s a
condFilter :: Monad s => (a -> Bool) -> DispatchFilter s a -> DispatchFilter s a -> DispatchFilter s a
addCounters :: Statistics -> Statistics -> Statistics
modifyStats :: (Metric -> Metric) -> BuilderState st ()
incrCounter :: String -> Int -> BuilderState st ()
queryCounter :: String -> Statistics -> Maybe Int
initStats :: Params -> Statistics
namedMetric :: String -> Metric
defaultMetricNames :: [String]
chart_size :: String
num_comparisons :: String
num_iterations :: String
nullBuilder :: Builder () (NullState ()) Params
type NullState a = BuilderState () a
initNullBuilder :: Input -> Params -> ((), Statistics)
Documentation
data Builder st it pa
Constructors
Builder
init :: Input -> pa -> (st, Statistics)
step :: BuilderState st ()
stepAll :: BuilderState st ()
finished :: st -> Bool
unpack :: st -> [Output]
partial :: st -> [Output]
type Output = (UninflectedSentence, Derivation)
type Derivation = TagDerivation
data Input
Constructors
Input
inSemInput :: SemInput
inLex :: [ILexEntry]for the debugger
inCands :: [(TagElem, BitVector)]tag tree
type UninflectedWord = (String, Flist)
type UninflectedSentence = [UninflectedWord]
type UninflectedDisjunction = ([String], Flist)
type SentenceAut = NFA Int UninflectedWord
type BuilderState s a = StateT s (State Statistics) a
preInit :: Input -> Params -> (Input, (Int, Int, Int), PolResult)
unlessEmptySem :: Input -> Params -> a -> a
Equivalent to id unless the input contains an empty or uninstatiated semantics
run :: Builder st it Params -> Input -> Params -> (st, Statistics)
Performs surface realisation from an input semantics and a lexical selection.
type SemBitMap = Map Pred BitVector
defineSemanticBits :: Sem -> SemBitMap
assign a bit vector value to each literal in the semantics the resulting map can then be used to construct a bit vector representation of the semantics
semToBitVector :: SemBitMap -> Sem -> BitVector
bitVectorToSem :: SemBitMap -> BitVector -> Sem
type IafMap = Map String Sem
dependentSem :: IafMap -> String -> Sem
Return the literals of the semantics (in bit vector form) whose accesibility depends on the given index
literalArgs :: Pred -> [GeniVal]
Return the handle and arguments of a literal
semToIafMap :: Sem -> IafMap
fromUniConst :: Monad m => GeniVal -> m String
Like fromGConst but only for the non-disjoint ones: meant to be used as Maybe or List
getIdx :: Flist -> [GeniVal]
ts_iafFailure :: [String] -> [Pred] -> String
recalculateAccesibility :: IafAble a => a -> a
Calculate the new set of accessibility/inaccesible indices, returning a a tuple of accesible / inaccesible indices
iafBadSem
:: IafAble a
=> IafMap
-> SemBitMap
-> BitVectorthe input semantics
-> a -> BitVectorthe semantics of the item
-> a
-> BitVector
Return, in bitvector form, the portion of a semantics that is inaccesible from an item
class IafAble a where
Methods
iafAcc :: a -> [String]
iafInacc :: a -> [String]
iafSetAcc :: [String] -> a -> a
iafSetInacc :: [String] -> a -> a
iafNewAcc :: a -> [String]
show/hide Instances
defaultStepAll :: Builder st it pa -> BuilderState st ()
Default implementation for the stepAll function in Builder
type DispatchFilter s a = a -> s (Maybe a)
(>-->) :: Monad s => DispatchFilter s a -> DispatchFilter s a -> DispatchFilter s a
Sequence two dispatch filters.
nullFilter :: Monad s => DispatchFilter s a
A filter that always fails (i.e. no filtering)
condFilter :: Monad s => (a -> Bool) -> DispatchFilter s a -> DispatchFilter s a -> DispatchFilter s a
If the item meets some condition, use the first filter, otherwise use the second one.
addCounters :: Statistics -> Statistics -> Statistics
modifyStats :: (Metric -> Metric) -> BuilderState st ()
incrCounter :: String -> Int -> BuilderState st ()
queryCounter :: String -> Statistics -> Maybe Int
initStats :: Params -> Statistics
namedMetric :: String -> Metric
defaultMetricNames :: [String]
chart_size :: String
num_comparisons :: String
num_iterations :: String
nullBuilder :: Builder () (NullState ()) Params
type NullState a = BuilderState () a
initNullBuilder :: Input -> Params -> ((), Statistics)
Produced by Haddock version 2.1.0