-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A natural language generator (specifically, an FB-LTAG surface realiser)
--
-- A natural language generator (specifically, an FB-LTAG surface
-- realiser)
@package GenI
@version 0.17.4
module NLP.GenI.Statistics
data Statistics
type StatisticsState a = forall m. (MonadState Statistics m) => m a
type StatisticsStateIO a = forall m. (MonadState Statistics m, MonadIO m) => m a
emptyStats :: Statistics
printOutAllMetrics :: StatisticsStateIO ()
printOutAllMetrics' :: Statistics -> IO ()
printOutInspectionMetrics :: StatisticsStateIO ()
showFinalStats :: Statistics -> String
initialStatisticsStateFor :: (MonadState Statistics m) => (m a -> Statistics -> b) -> m a -> b
-- | Adds a metric at the end of the list (thus, metrics are printed out in
-- the order in which they were added
addMetric :: Metric -> StatisticsState ()
-- | Adds a metric that will be printed out at regular intervals
addInspectionMetric :: Metric -> StatisticsState ()
setPrintOutInterval :: Int -> StatisticsState ()
mergeMetrics :: (Metric -> Metric -> Metric) -> Statistics -> Statistics -> Statistics
data Metric
IntMetric :: String -> Int -> Metric
queryMetrics :: (Metric -> Maybe a) -> Statistics -> [a]
updateMetrics :: (Metric -> Metric) -> Statistics -> Statistics
incrIntMetric :: String -> Int -> Metric -> Metric
queryIntMetric :: String -> Metric -> Maybe Int
addIntMetrics :: Metric -> Metric -> Metric
instance [overlap ok] Show Metric
-- | This module provides some very generic, non-GenI specific functions on
-- strings, trees and other miscellaneous odds and ends. Whenever
-- possible, one should try to replace these functions with versions that
-- are available in the standard libraries, or the Haskell platform ones,
-- or on hackage.
module NLP.GenI.General
-- | putStr on stderr
ePutStr :: String -> IO ()
ePutStrLn :: String -> IO ()
eFlush :: IO ()
-- | Using readFile' can be a good idea if you're dealing with not-so-huge
-- files (i.e. where you don't want lazy evaluation), because it ensures
-- that the handles are closed. No more ``too many open files''
readFile' :: FilePath -> IO String
lazySlurp :: ForeignPtr Word8 -> Int -> Int -> IO String
withTimeout :: Integer -> IO a -> IO a -> IO a
-- | Like exitFailure, except that we return with a code that we
-- reserve for timing out
exitTimeout :: IO ()
-- | Drop all characters up to and including the one in question
dropTillIncluding :: Char -> String -> String
trim :: String -> String
-- | Make the first character of a string upper case
toUpperHead :: String -> String
-- | Make the first character of a string lower case
toLowerHead :: String -> String
-- | An alphanumeric sort is one where you treat the numbers in the string
-- as actual numbers. An alphanumeric sort would put x2 before x100,
-- because 2 < 10, wheraeas a naive sort would put it the other way
-- around because the characters 1 < 2. To sort alphanumerically, just
-- 'sortBy (comparing toAlphaNum)'
toAlphaNum :: String -> [AlphaNum]
fst3 :: (a, b, c) -> a
snd3 :: (a, b, c) -> b
thd3 :: (a, b, c) -> c
equating :: (Eq b) => (a -> b) -> (a -> a -> Bool)
comparing :: (Ord b) => (a -> b) -> (a -> a -> Ordering)
-- | A strict version of map
map' :: (a -> b) -> [a] -> [b]
-- | A generic version of the Data.List.words TODO: replace by version from
-- split
wordsBy :: (Eq a) => a -> [a] -> [[a]]
-- | Makes sure that index s is in the bounds of list l. Surely there must
-- be some more intelligent way to deal with this.
boundsCheck :: Int -> [a] -> Bool
-- | True if the intersection of two lists is empty.
isEmptyIntersect :: (Eq a) => [a] -> [a] -> Bool
-- | Serves the same function as groupBy. It groups together items
-- by some property they have in common. The difference is that the
-- property is used as a key to a Map that you can lookup.
groupByFM :: (Ord b) => (a -> b) -> [a] -> (Map b [a])
-- | Same as groupByFM, except that we let an item appear in
-- multiple groups. The fn extracts the property from the item, and
-- returns multiple results in the form of a list
multiGroupByFM :: (Ord b) => (a -> [b]) -> [a] -> (Map b [a])
insertToListMap :: (Ord b) => b -> a -> Map b [a] -> Map b [a]
-- | Convert a list of items into a list of tuples (a,b) where a is an item
-- in the list and b is the number of times a in occurs in the list.
groupAndCount :: (Eq a, Ord a) => [a] -> [(a, Int)]
combinations :: [[a]] -> [[a]]
mapMaybeM :: (Monad m) => (a -> m (Maybe b)) -> [a] -> m [b]
-- | Return the list, modifying only the first matching item.
repList :: (a -> Bool) -> (a -> a) -> [a] -> [a]
-- | Strict version of mapTree (for non-strict, just use fmap)
mapTree' :: (a -> b) -> Tree a -> Tree b
-- | Like filter, except on Trees. Filter might not be a good name,
-- though, because we return a list of nodes, not a tree.
filterTree :: (a -> Bool) -> Tree a -> [a]
-- | The leaf nodes of a Tree
treeLeaves :: Tree a -> [a]
-- | Return pairs of (parent, terminal)
preTerminals :: Tree a -> [(a, a)]
-- | repNode fn filt t returns a version of t in
-- which the first node which filt matches is transformed using
-- fn.
repNode :: (Tree a -> Tree a) -> (Tree a -> Bool) -> Tree a -> Maybe (Tree a)
-- | Like repNode except that it performs the operations on all
-- nodes that match and doesn't care if any nodes match or not
repAllNode :: (Tree a -> Tree a) -> (Tree a -> Bool) -> Tree a -> Tree a
-- | Like repNode but on a list of tree nodes
listRepNode :: (Tree a -> Tree a) -> (Tree a -> Bool) -> [Tree a] -> ([Tree a], Bool)
-- | Replace a node in the tree in-place with another node; keep the
-- children the same. If the node is not found in the tree, or if there
-- are multiple instances of the node, this is treated as an error.
repNodeByNode :: (a -> Bool) -> a -> Tree a -> Tree a
type Interval = (Int, Int)
-- | Add two intervals
(!+!) :: Interval -> Interval -> Interval
-- | ival x builds a trivial interval from x to
-- x
ival :: Int -> Interval
showInterval :: Interval -> String
type BitVector = Integer
-- | displays a bit vector, using a minimum number of bits
showBitVector :: Int -> BitVector -> String
-- | errors specifically in GenI, which is very likely NOT the user's
-- fault.
geniBug :: String -> a
instance [overlap ok] Eq AlphaNum
instance [overlap ok] Typeable TimeOut
instance [overlap ok] Ord AlphaNum
module NLP.GenI.Automaton
-- | Note: there are two ways to define the final states. 1. you may define
-- them as a list of states in finalStList 2. you may define them via the
-- isFinalSt function The state list is ignored if you define
-- isFinalSt
data NFA st ab
NFA :: st -> Maybe (st -> Bool) -> [st] -> Map st (Map st [Maybe ab]) -> [[st]] -> NFA st ab
startSt :: NFA st ab -> st
isFinalSt :: NFA st ab -> Maybe (st -> Bool)
finalStList :: NFA st ab -> [st]
transitions :: NFA st ab -> Map st (Map st [Maybe ab])
states :: NFA st ab -> [[st]]
finalSt :: NFA st ab -> [st]
addTrans :: (Ord ab, Ord st) => NFA st ab -> st -> Maybe ab -> st -> NFA st ab
lookupTrans :: (Ord ab, Ord st) => NFA st ab -> st -> (Maybe ab) -> [st]
automatonPaths :: (Ord st, Ord ab) => (NFA st ab) -> [[ab]]
-- | Not quite the set of all paths, but the sets of all transitions
automatonPathSets :: (Ord st, Ord ab) => (NFA st ab) -> [[[ab]]]
numStates :: NFA st ab -> Int
numTransitions :: NFA st ab -> Int
module NLP.GenI.Btypes
data GNode
GN :: NodeName -> Flist -> Flist -> Bool -> [String] -> GType -> Bool -> String -> GNode
gnname :: GNode -> NodeName
gup :: GNode -> Flist
gdown :: GNode -> Flist
ganchor :: GNode -> Bool
glexeme :: GNode -> [String]
gtype :: GNode -> GType
gaconstr :: GNode -> Bool
-- | for TAG, this would be the elementary tree that this node originally
-- came from
gorigin :: GNode -> String
data GType
Subs :: GType
Foot :: GType
Lex :: GType
Other :: GType
type NodeName = String
data Ttree a
TT :: [GeniVal] -> String -> String -> Flist -> Ptype -> Maybe Sem -> [String] -> Tree a -> Ttree a
params :: Ttree a -> [GeniVal]
pfamily :: Ttree a -> String
pidname :: Ttree a -> String
pinterface :: Ttree a -> Flist
ptype :: Ttree a -> Ptype
psemantics :: Ttree a -> Maybe Sem
ptrace :: Ttree a -> [String]
tree :: Ttree a -> Tree a
type MTtree = Ttree GNode
type SemPols = [Int]
data TestCase
TestCase :: String -> String -> SemInput -> [String] -> [(String, Map (String, String) [String])] -> TestCase
tcName :: TestCase -> String
-- | for gui
tcSemString :: TestCase -> String
tcSem :: TestCase -> SemInput
-- | expected results (for testing)
tcExpected :: TestCase -> [String]
-- | results we actually got, and their traces (for testing)
tcOutputs :: TestCase -> [(String, Map (String, String) [String])]
data Ptype
Initial :: Ptype
Auxiliar :: Ptype
Unspecified :: Ptype
type Pred = (GeniVal, GeniVal, [GeniVal])
type Flist = [AvPair]
type AvPair = (String, GeniVal)
data GeniVal
GConst :: [String] -> GeniVal
GVar :: !String -> GeniVal
GAnon :: GeniVal
-- | A lexicon maps semantic predicates to lexical entries.
type Lexicon = Map String [ILexEntry]
data ILexEntry
ILE :: [String] -> String -> [GeniVal] -> Flist -> Flist -> Flist -> Ptype -> Sem -> [SemPols] -> ILexEntry
iword :: ILexEntry -> [String]
ifamname :: ILexEntry -> String
iparams :: ILexEntry -> [GeniVal]
iinterface :: ILexEntry -> Flist
ifilters :: ILexEntry -> Flist
iequations :: ILexEntry -> Flist
iptype :: ILexEntry -> Ptype
isemantics :: ILexEntry -> Sem
isempols :: ILexEntry -> [SemPols]
type MorphLexEntry = (String, String, Flist)
type Macros = [MTtree]
type Sem = [Pred]
type LitConstr = (Pred, [String])
type SemInput = (Sem, Flist, [LitConstr])
type Subst = Map String GeniVal
emptyLE :: ILexEntry
-- | A null GNode which you can use for various debugging or display
-- purposes.
emptyGNode :: GNode
-- | A null tree which you can use for various debugging or display
-- purposes.
emptyMacro :: MTtree
-- | Return the value of the cat attribute, if available
gCategory :: Flist -> Maybe GeniVal
showLexeme :: [String] -> String
-- | Attributes recognised as lexemes, in order of preference
lexemeAttributes :: [String]
gnnameIs :: NodeName -> GNode -> Bool
-- | Plug the first tree into the second tree at the specified node.
-- Anything below the second node is silently discarded. We assume the
-- trees are pluggable; it is treated as a bug if they are not!
plugTree :: Tree NodeName -> NodeName -> Tree NodeName -> Tree NodeName
-- | Given two trees auxt and t, splice the tree
-- auxt into t via the TAG adjunction rule.
spliceTree :: NodeName -> Tree NodeName -> NodeName -> Tree NodeName -> Tree NodeName
root :: Tree a -> a
rootUpd :: Tree a -> a -> Tree a
foot :: Tree GNode -> GNode
-- | Given a lexical item l and a tree node n (actually a
-- subtree with no children), return the same node with the lexical item
-- as its unique child. The idea is that it converts terminal lexeme
-- nodes into preterminal nodes where the actual terminal is the given
-- lexical item
setLexeme :: [String] -> Tree GNode -> Tree GNode
-- | Given a lexical item s and a Tree GNode t, returns the tree
-- t' where l has been assigned to the anchor node in t'
setAnchor :: [String] -> Tree GNode -> Tree GNode
-- | Given a Semantics, return the string with the proper keys
-- (propsymbol+arity) to access the agenda
toKeys :: Sem -> [String]
subsumeSem :: Sem -> Sem -> [(Sem, Subst)]
-- | Sort semantics first according to its predicate, and then to its
-- handles.
sortSem :: Sem -> Sem
showSem :: Sem -> String
showPred :: Pred -> String
emptyPred :: Pred
-- | Sort an Flist according with its attributes
sortFlist :: Flist -> Flist
unify :: (Monad m) => [GeniVal] -> [GeniVal] -> m ([GeniVal], Subst)
unifyFeat :: (Monad m) => Flist -> Flist -> m (Flist, Subst)
-- | Note that the first Subst is assumed to come chronologically before
-- the second one; so merging { X -> Y } and { Y -> 3
-- } should give us { X -> 3; Y -> 3 };
--
-- See prependToSubst for a warning!
mergeSubst :: Subst -> Subst -> Subst
showFlist :: Flist -> String
showPairs :: Flist -> String
showAv :: AvPair -> String
class Replacable a
replace :: (Replacable a) => Subst -> a -> a
replaceMap :: (Replacable a) => Map String GeniVal -> a -> a
replaceOne :: (Replacable a) => (String, GeniVal) -> a -> a
replaceList :: (Replacable a) => [(String, GeniVal)] -> a -> a
-- | Default implementation for replaceOne but not a good idea for the core
-- stuff; which is why it is not a typeclass default
replaceOneAsMap :: (Replacable a) => (String, GeniVal) -> a -> a
class Collectable a
collect :: (Collectable a) => a -> Set String -> Set String
class Idable a
idOf :: (Idable a) => a -> Integer
alphaConvert :: (Collectable a, Replacable a) => String -> a -> a
alphaConvertById :: (Collectable a, Replacable a, Idable a) => a -> a
-- | (assumes that it's a GConst!)
fromGConst :: GeniVal -> [String]
-- | (assumes that it's a GVar!)
fromGVar :: GeniVal -> String
isConst :: GeniVal -> Bool
isVar :: GeniVal -> Bool
isAnon :: GeniVal -> Bool
prop_unify_anon :: [GeniVal] -> Bool
prop_unify_self :: [GeniVal] -> Property
prop_unify_sym :: [GeniVal] -> [GeniVal] -> Property
instance [overlap ok] Typeable GeniVal
instance [overlap ok] Typeable GType
instance [overlap ok] Typeable GNode
instance [overlap ok] Typeable ILexEntry
instance [overlap ok] Typeable Ptype
instance [overlap ok] Typeable1 Ttree
instance [overlap ok] Show TestCase
instance [overlap ok] Eq GeniVal
instance [overlap ok] Ord GeniVal
instance [overlap ok] Data GeniVal
instance [overlap ok] Show GType
instance [overlap ok] Eq GType
instance [overlap ok] Data GType
instance [overlap ok] Eq GNode
instance [overlap ok] Data GNode
instance [overlap ok] Show ILexEntry
instance [overlap ok] Eq ILexEntry
instance [overlap ok] Data ILexEntry
instance [overlap ok] Show Ptype
instance [overlap ok] Eq Ptype
instance [overlap ok] Data Ptype
instance [overlap ok] (Show a) => Show (Ttree a)
instance [overlap ok] (Data a) => Data (Ttree a)
instance [overlap ok] Arbitrary GeniVal
instance [overlap ok] Arbitrary GTestString2
instance [overlap ok] Arbitrary GTestString
instance [overlap ok] Replacable Pred
instance [overlap ok] Replacable (String, ([String], Flist))
instance [overlap ok] Replacable AvPair
instance [overlap ok] (Replacable a) => Replacable [a]
instance [overlap ok] Replacable GeniVal
instance [overlap ok] (Replacable a) => Replacable (Maybe a)
instance [overlap ok] Collectable GNode
instance [overlap ok] Collectable (String, GeniVal)
instance [overlap ok] Collectable GeniVal
instance [overlap ok] (Collectable a, Collectable b, Collectable c) => Collectable (a, b, c)
instance [overlap ok] (Collectable a) => Collectable (Tree a)
instance [overlap ok] (Collectable a) => Collectable [a]
instance [overlap ok] (Collectable a) => Collectable (Maybe a)
instance [overlap ok] Show GeniVal
instance [overlap ok] (Replacable a) => Replacable (Tree a)
instance [overlap ok] Replacable GNode
instance [overlap ok] Show GNode
instance [overlap ok] Collectable ILexEntry
instance [overlap ok] Replacable ILexEntry
instance [overlap ok] (Collectable a) => Collectable (Ttree a)
instance [overlap ok] (Replacable a) => Replacable (Ttree a)
module NLP.GenI.BtypesBinary
instance [overlap ok] Binary ILexEntry
instance [overlap ok] (Binary a) => Binary (Ttree a)
instance [overlap ok] Binary GType
instance [overlap ok] Binary GNode
instance [overlap ok] Binary GeniVal
instance [overlap ok] Binary Ptype
module NLP.GenI.Tags
-- | An anchored grammar. The grammar associates a set of semantic
-- predicates to a list of trees each.
type Tags = Map String [TagElem]
data TagElem
TE :: String -> String -> Integer -> !Ptype -> Tree GNode -> Sem -> Map String (Int, Int) -> Flist -> [String] -> [SemPols] -> TagElem
idname :: TagElem -> String
ttreename :: TagElem -> String
tidnum :: TagElem -> Integer
ttype :: TagElem -> !Ptype
ttree :: TagElem -> Tree GNode
tsemantics :: TagElem -> Sem
tpolarities :: TagElem -> Map String (Int, Int)
tinterface :: TagElem -> Flist
ttrace :: TagElem -> [String]
tsempols :: TagElem -> [SemPols]
-- | TagItem is a generalisation of TagElem.
class TagItem t
tgIdName :: (TagItem t) => t -> String
tgIdNum :: (TagItem t) => t -> Integer
tgSemantics :: (TagItem t) => t -> Sem
data TagSite
TagSite :: !String -> !Flist -> !Flist -> !String -> TagSite
tsName :: TagSite -> !String
tsUp :: TagSite -> !Flist
tsDown :: TagSite -> !Flist
tsOrigin :: TagSite -> !String
type TagDerivation = [(Char, String, (String, String))]
emptyTE :: TagElem
ts_synIncomplete :: String
ts_semIncomplete :: [Pred] -> String
ts_tbUnificationFailure :: String
ts_rootFeatureMismatch :: Flist -> String
-- | addTags tags key elem adds elem to the the
-- list of elements associated to the key
addToTags :: Tags -> String -> TagElem -> Tags
tagLeaves :: TagElem -> [(String, UninflectedDisjunction)]
-- | Assigns a unique id to each element of this list, that is, an integer
-- between 1 and the size of the list.
setTidnums :: [TagElem] -> [TagElem]
-- | Sorts trees into a Map.Map organised by the first literal of their
-- semantics. This is useful in at least three places: the polarity
-- optimisation, the gui display code, and code for measuring the
-- efficiency of GenI. Note: trees with a null semantics are filed under
-- an empty predicate, if any.
mapBySem :: (TagItem t) => [t] -> Map Pred [t]
-- | subsumedBy cs ts determines if the candidate semantics
-- cs is subsumed by the proposition semantics ts.
-- Notice how the proposition semantics is only a single item where as
-- the candidate semantics is a list.
--
-- We assume
--
--
-- - most importantly that cs has already its semantics
-- instatiated (all variables assigned)
-- - cs and ts are sorted
-- - the list in each element of cs and ts is itself sorted
--
subsumedBy :: Sem -> Pred -> Bool
showTagSites :: [TagSite] -> String
collect :: (Collectable a) => a -> Set String -> Set String
-- | Given a tree(GNode) returns a list of substitution or adjunction
-- nodes, as well as remaining nodes with a null adjunction constraint.
detectSites :: Tree GNode -> ([TagSite], [TagSite], [TagSite])
instance [overlap ok] Show TagElem
instance [overlap ok] Eq TagElem
instance [overlap ok] Show TagSite
instance [overlap ok] Eq TagSite
instance [overlap ok] Ord TagSite
instance [overlap ok] TagItem TagElem
instance [overlap ok] Idable TagElem
instance [overlap ok] Collectable TagElem
instance [overlap ok] Replacable TagSite
instance [overlap ok] Replacable TagElem
instance [overlap ok] Ord TagElem
module NLP.GenI.GeniShow
class GeniShow a
geniShow :: (GeniShow a) => a -> String
squares :: String -> String
parens :: String -> String
geniShowKeyword :: String -> ShowS
geniShowSemInput :: SemInput -> ShowS
instance [overlap ok] GeniShow TestCase
instance [overlap ok] (GeniShow a) => GeniShow (Ttree a)
instance [overlap ok] GeniShow TagElem
instance [overlap ok] (GeniShow a) => GeniShow (Tree a)
instance [overlap ok] (GeniShow a) => GeniShow [a]
instance [overlap ok] GeniShow GNode
instance [overlap ok] GeniShow Pred
instance [overlap ok] GeniShow GeniVal
instance [overlap ok] GeniShow AvPair
instance [overlap ok] GeniShow Ptype
module NLP.GenI.GeniParsers
geniTestSuite :: Parser [TestCase]
geniSemanticInput :: Parser (Sem, Flist, [LitConstr])
-- | Just the String representations of the semantics in the test suite
geniTestSuiteString :: Parser [String]
-- | This is only used by the script genimakesuite
geniDerivations :: Parser [TestCaseOutput]
toSemInputString :: SemInput -> String -> SemInputString
geniMacros :: Parser [MTtree]
geniLexicon :: Parser [ILexEntry]
geniMorphLexicon :: Parser [MorphLexEntry]
geniMorphInfo :: Parser [(String, Flist)]
geniFeats :: Parser Flist
geniPolarities :: Parser (Map String Interval)
geniTagElems :: Parser [TagElem]
geniSemantics :: Parser Sem
geniValue :: Parser GeniVal
geniWords :: Parser String
geniLanguageDef :: LanguageDef ()
tillEof :: Parser a -> Parser a
instance [overlap ok] GeniShow SemInputString
module NLP.GenI.Morphology
type MorphFn = Pred -> Maybe Flist
-- | Converts information from a morphological information file into GenI's
-- internal format.
readMorph :: [(String, [AvPair])] -> MorphFn
-- | Filters away from an input semantics any literals whose realisation is
-- strictly morphological. The first argument tells us helps identify the
-- morphological literals -- it associates literals with morphological
-- stuff; if it returns Nothing, then it is non-morphological
stripMorphSem :: MorphFn -> Sem -> Sem
-- | attachMorph morphfn sem cands does the bulk of the
-- morphological input processing. We use morphfn to determine
-- which literals in sem contain morphological information and
-- what information they contain. Then we attach this morphological
-- information to the relevant trees in cand. A tree is
-- considered relevant w.r.t to a morphological literal if its semantics
-- contains at least one literal whose first index is the same as the
-- first index of the morphological literal.
attachMorph :: MorphFn -> Sem -> [TagElem] -> [TagElem]
-- | Actually unify the morphological features into the anchor node
--
-- FIXME: we'll need to make sure this still works as promised when we
-- implement co-anchors.
attachMorphHelper :: Flist -> TagElem -> TagElem
setMorphAnchor :: GNode -> Tree GNode -> Tree GNode
-- | Extracts the lemmas from a list of uninflected sentences. This is used
-- when the morphological generator is unavailable, doesn't work, etc.
sansMorph :: [(String, Flist)] -> [String]
type MorphLexicon = [(String, String, Flist)]
type UninflectedDisjunction = (String, Flist)
-- | Return a list of results for each sentence
inflectSentencesUsingLex :: MorphLexicon -> [[UninflectedDisjunction]] -> [[String]]
inflectSentenceUsingLex :: MorphLexicon -> [UninflectedDisjunction] -> [String]
-- | Return only n matches, but note any excessive ambiguities or missing
-- matches
inflectWordUsingLex :: MorphLexicon -> UninflectedDisjunction -> [String]
-- | Converts a list of uninflected sentences into inflected ones by
-- calling
inflectSentencesUsingCmd :: String -> [[UninflectedDisjunction]] -> IO [[String]]
singleton :: a -> [a]
module NLP.GenI.Polarity
type PolAut = NFA PolState PolTrans
data PolState
-- | position in the input semantics, extra semantics, polarity interval
PolSt :: Int -> [Pred] -> [(Int, Int)] -> PolState
type AutDebug = (String, PolAut, PolAut)
-- | intermediate auts, seed aut, final aut, potentially modified sem
type PolResult = ([AutDebug], PolAut, PolAut, Sem)
-- | Constructs a polarity automaton from the surface realiser's input:
-- input semantics, lexical selection, extra polarities and index
-- constraints. For debugging purposes, it returns all the intermediate
-- automata produced by the construction algorithm.
buildAutomaton :: SemInput -> [TagElem] -> Flist -> PolMap -> PolResult
makePolAut :: [TagElem] -> Sem -> PolMap -> PolResult
-- | Returns a modified input semantics and lexical selection in which
-- pronouns are properly accounted for.
fixPronouns :: (Sem, [TagElem]) -> (Sem, [TagElem])
detectSansIdx :: [TagElem] -> [TagElem]
detectPolFeatures :: [TagElem] -> [String]
detectPols :: [TagElem] -> [TagElem]
-- | Given a list of paths (i.e. a list of list of trees) return a list of
-- trees such that each tree is annotated with the paths it belongs to.
detectPolPaths :: [[TagElem]] -> [(TagElem, BitVector)]
declareIdxConstraints :: Flist -> PolMap
detectIdxConstraints :: Flist -> Flist -> PolMap
showLite :: (ShowLite a) => a -> String
-- | Display a PolMap in human-friendly text. The advantage is that it
-- displays fewer quotation marks.
showLitePm :: PolMap -> String
-- | Render the list of polarity automaton paths as a string
showPolPaths :: BitVector -> String
showPolPaths' :: BitVector -> Int -> [Int]
automatonPaths :: (Ord st, Ord ab) => (NFA st ab) -> [[ab]]
finalSt :: NFA st ab -> [st]
-- | Note: there are two ways to define the final states. 1. you may define
-- them as a list of states in finalStList 2. you may define them via the
-- isFinalSt function The state list is ignored if you define
-- isFinalSt
data NFA st ab
instance [overlap ok] Eq PolState
instance [overlap ok] ShowLite TagElem
instance [overlap ok] ShowLite Char
instance [overlap ok] ShowLite Int
instance [overlap ok] (ShowLite a, ShowLite b) => ShowLite (a, b)
instance [overlap ok] (ShowLite a) => ShowLite [a]
instance [overlap ok] Ord PolState
instance [overlap ok] Show PolState
module NLP.GenI.Configuration
-- | Holds the specification for how Geni should be run, its input files,
-- etc. This is the stuff that would normally be found in the
-- configuration file.
data Params
Prms :: GrammarType -> BuilderType -> [Flag] -> Params
grammarType :: Params -> GrammarType
builderType :: Params -> BuilderType
geniFlags :: Params -> [Flag]
data GrammarType
-- | geni's text format
GeniHand :: GrammarType
-- | built into geni, no parsing needed
PreCompiled :: GrammarType
-- | lexical selection already done
PreAnchored :: GrammarType
data BuilderType
NullBuilder :: BuilderType
SimpleBuilder :: BuilderType
SimpleOnePhaseBuilder :: BuilderType
CkyBuilder :: BuilderType
EarleyBuilder :: BuilderType
type Instruction = (FilePath, Maybe [String])
data Flag
data BatchDirFlg
BatchDirFlg :: FilePath -> BatchDirFlg
data DisableGuiFlg
DisableGuiFlg :: () -> DisableGuiFlg
data EarlyDeathFlg
EarlyDeathFlg :: () -> EarlyDeathFlg
data ExtraPolaritiesFlg
ExtraPolaritiesFlg :: (Map String Interval) -> ExtraPolaritiesFlg
data FromStdinFlg
FromStdinFlg :: () -> FromStdinFlg
data HelpFlg
HelpFlg :: () -> HelpFlg
data IgnoreSemanticsFlg
IgnoreSemanticsFlg :: () -> IgnoreSemanticsFlg
data InstructionsFileFlg
InstructionsFileFlg :: FilePath -> InstructionsFileFlg
data LexiconFlg
LexiconFlg :: FilePath -> LexiconFlg
data MacrosFlg
MacrosFlg :: FilePath -> MacrosFlg
data MaxTreesFlg
MaxTreesFlg :: Int -> MaxTreesFlg
data MetricsFlg
MetricsFlg :: [String] -> MetricsFlg
data MorphCmdFlg
MorphCmdFlg :: String -> MorphCmdFlg
data MorphInfoFlg
MorphInfoFlg :: FilePath -> MorphInfoFlg
data MorphLexiconFlg
MorphLexiconFlg :: FilePath -> MorphLexiconFlg
data NoLoadTestSuiteFlg
NoLoadTestSuiteFlg :: () -> NoLoadTestSuiteFlg
data OptimisationsFlg
OptimisationsFlg :: [Optimisation] -> OptimisationsFlg
data OutputFileFlg
OutputFileFlg :: String -> OutputFileFlg
data PartialFlg
PartialFlg :: () -> PartialFlg
data RegressionTestModeFlg
RegressionTestModeFlg :: () -> RegressionTestModeFlg
data RootFeatureFlg
RootFeatureFlg :: Flist -> RootFeatureFlg
data RunUnitTestFlg
RunUnitTestFlg :: () -> RunUnitTestFlg
data StatsFileFlg
StatsFileFlg :: FilePath -> StatsFileFlg
data TestCaseFlg
TestCaseFlg :: String -> TestCaseFlg
data TestInstructionsFlg
TestInstructionsFlg :: [Instruction] -> TestInstructionsFlg
data TestSuiteFlg
TestSuiteFlg :: FilePath -> TestSuiteFlg
data TimeoutFlg
TimeoutFlg :: Integer -> TimeoutFlg
data TracesFlg
TracesFlg :: FilePath -> TracesFlg
data VerboseModeFlg
VerboseModeFlg :: () -> VerboseModeFlg
data ViewCmdFlg
ViewCmdFlg :: String -> ViewCmdFlg
mainBuilderTypes :: [BuilderType]
getFlagP :: (Show f, Show x, Typeable f, Typeable x) => (x -> f) -> Params -> Maybe x
getListFlagP :: (Show f, Show x, Typeable f, Typeable x) => ([x] -> f) -> Params -> [x]
setFlagP :: (Eq f, Show f, Show x, Typeable f, Typeable x) => (x -> f) -> x -> Params -> Params
hasFlagP :: (Typeable f, Typeable x) => (x -> f) -> Params -> Bool
deleteFlagP :: (Typeable f, Typeable x) => (x -> f) -> Params -> Params
hasOpt :: Optimisation -> Params -> Bool
polarised :: Params -> Bool
getFlag :: (Show f, Show x, Typeable f, Typeable x) => (x -> f) -> [Flag] -> Maybe x
setFlag :: (Eq f, Show f, Show x, Typeable f, Typeable x) => (x -> f) -> x -> [Flag] -> [Flag]
hasFlag :: (Typeable f, Typeable x) => (x -> f) -> [Flag] -> Bool
data Optimisation
PolOpts :: Optimisation
AdjOpts :: Optimisation
Polarised :: Optimisation
NoConstraints :: Optimisation
RootCatFiltered :: Optimisation
SemFiltered :: Optimisation
Iaf :: Optimisation
rootcatfiltered :: Params -> Bool
semfiltered :: Params -> Bool
isIaf :: Params -> Bool
-- | The default parameters configuration
emptyParams :: Params
defineParams :: [Flag] -> Params -> Params
treatArgs :: [OptDescr Flag] -> [String] -> IO Params
treatStandardArgs :: [String] -> IO Params
treatArgsWithParams :: [OptDescr Flag] -> [String] -> Params -> IO Params
treatStandardArgsWithParams :: [String] -> Params -> IO Params
processInstructions :: Params -> IO Params
-- | Uses the GetOpt library to process the command line arguments. Note
-- that we divide them into basic and advanced usage.
optionsForStandardGenI :: [OptDescr Flag]
optionsForBasicStuff :: [OptDescr Flag]
optionsForOptimisation :: [OptDescr Flag]
optionsForMorphology :: [OptDescr Flag]
optionsForInputFiles :: [OptDescr Flag]
optionsForBuilder :: [OptDescr Flag]
optionsForTesting :: [OptDescr Flag]
nubBySwitches :: [OptDescr a] -> [OptDescr a]
noArg :: (Eq f, Show f, Typeable f) => (() -> f) -> ArgDescr Flag
reqArg :: (Eq f, Show f, Typeable f, Eq x, Show x, Typeable x) => (x -> f) -> (String -> x) -> String -> ArgDescr Flag
optArg :: (Eq f, Show f, Typeable f, Eq x, Show x, Typeable x) => (x -> f) -> x -> (String -> x) -> String -> ArgDescr Flag
parseFlagWithParsec :: String -> CharParser () b -> String -> b
-- | The class Typeable allows a concrete representation of a type
-- to be calculated.
class Typeable a
instance [overlap ok] Typeable WeirdFlg
instance [overlap ok] Typeable GrammarTypeFlg
instance [overlap ok] Typeable BuilderFlg
instance [overlap ok] Typeable ViewCmdFlg
instance [overlap ok] Typeable VerboseModeFlg
instance [overlap ok] Typeable TimeoutFlg
instance [overlap ok] Typeable TestSuiteFlg
instance [overlap ok] Typeable TestInstructionsFlg
instance [overlap ok] Typeable TestCaseFlg
instance [overlap ok] Typeable StatsFileFlg
instance [overlap ok] Typeable NoLoadTestSuiteFlg
instance [overlap ok] Typeable RunUnitTestFlg
instance [overlap ok] Typeable RootFeatureFlg
instance [overlap ok] Typeable RegressionTestModeFlg
instance [overlap ok] Typeable PartialFlg
instance [overlap ok] Typeable OutputFileFlg
instance [overlap ok] Typeable OptimisationsFlg
instance [overlap ok] Typeable MorphLexiconFlg
instance [overlap ok] Typeable MorphInfoFlg
instance [overlap ok] Typeable MorphCmdFlg
instance [overlap ok] Typeable MetricsFlg
instance [overlap ok] Typeable MaxTreesFlg
instance [overlap ok] Typeable TracesFlg
instance [overlap ok] Typeable MacrosFlg
instance [overlap ok] Typeable LexiconFlg
instance [overlap ok] Typeable InstructionsFileFlg
instance [overlap ok] Typeable IgnoreSemanticsFlg
instance [overlap ok] Typeable HelpFlg
instance [overlap ok] Typeable FromStdinFlg
instance [overlap ok] Typeable ExtraPolaritiesFlg
instance [overlap ok] Typeable EarlyDeathFlg
instance [overlap ok] Typeable DisableGuiFlg
instance [overlap ok] Typeable BatchDirFlg
instance [overlap ok] Typeable Flag
instance [overlap ok] Typeable GrammarType
instance [overlap ok] Typeable BuilderType
instance [overlap ok] Typeable Optimisation
instance [overlap ok] Eq WeirdFlg
instance [overlap ok] Show WeirdFlg
instance [overlap ok] Eq GrammarTypeFlg
instance [overlap ok] Show GrammarTypeFlg
instance [overlap ok] Eq BuilderFlg
instance [overlap ok] Show BuilderFlg
instance [overlap ok] Eq ViewCmdFlg
instance [overlap ok] Show ViewCmdFlg
instance [overlap ok] Eq VerboseModeFlg
instance [overlap ok] Show VerboseModeFlg
instance [overlap ok] Eq TimeoutFlg
instance [overlap ok] Show TimeoutFlg
instance [overlap ok] Eq TestSuiteFlg
instance [overlap ok] Show TestSuiteFlg
instance [overlap ok] Eq TestInstructionsFlg
instance [overlap ok] Show TestInstructionsFlg
instance [overlap ok] Eq TestCaseFlg
instance [overlap ok] Show TestCaseFlg
instance [overlap ok] Eq StatsFileFlg
instance [overlap ok] Show StatsFileFlg
instance [overlap ok] Eq NoLoadTestSuiteFlg
instance [overlap ok] Show NoLoadTestSuiteFlg
instance [overlap ok] Eq RunUnitTestFlg
instance [overlap ok] Show RunUnitTestFlg
instance [overlap ok] Eq RootFeatureFlg
instance [overlap ok] Show RootFeatureFlg
instance [overlap ok] Eq RegressionTestModeFlg
instance [overlap ok] Show RegressionTestModeFlg
instance [overlap ok] Eq PartialFlg
instance [overlap ok] Show PartialFlg
instance [overlap ok] Eq OutputFileFlg
instance [overlap ok] Show OutputFileFlg
instance [overlap ok] Eq OptimisationsFlg
instance [overlap ok] Show OptimisationsFlg
instance [overlap ok] Eq MorphLexiconFlg
instance [overlap ok] Show MorphLexiconFlg
instance [overlap ok] Eq MorphInfoFlg
instance [overlap ok] Show MorphInfoFlg
instance [overlap ok] Eq MorphCmdFlg
instance [overlap ok] Show MorphCmdFlg
instance [overlap ok] Eq MetricsFlg
instance [overlap ok] Show MetricsFlg
instance [overlap ok] Eq MaxTreesFlg
instance [overlap ok] Show MaxTreesFlg
instance [overlap ok] Eq TracesFlg
instance [overlap ok] Show TracesFlg
instance [overlap ok] Eq MacrosFlg
instance [overlap ok] Show MacrosFlg
instance [overlap ok] Eq LexiconFlg
instance [overlap ok] Show LexiconFlg
instance [overlap ok] Eq InstructionsFileFlg
instance [overlap ok] Show InstructionsFileFlg
instance [overlap ok] Eq IgnoreSemanticsFlg
instance [overlap ok] Show IgnoreSemanticsFlg
instance [overlap ok] Eq HelpFlg
instance [overlap ok] Show HelpFlg
instance [overlap ok] Eq FromStdinFlg
instance [overlap ok] Show FromStdinFlg
instance [overlap ok] Eq ExtraPolaritiesFlg
instance [overlap ok] Show ExtraPolaritiesFlg
instance [overlap ok] Eq EarlyDeathFlg
instance [overlap ok] Show EarlyDeathFlg
instance [overlap ok] Eq DisableGuiFlg
instance [overlap ok] Show DisableGuiFlg
instance [overlap ok] Eq BatchDirFlg
instance [overlap ok] Show BatchDirFlg
instance [overlap ok] Show GrammarType
instance [overlap ok] Eq GrammarType
instance [overlap ok] Eq BuilderType
instance [overlap ok] Show Optimisation
instance [overlap ok] Eq Optimisation
instance [overlap ok] Show Params
instance [overlap ok] Eq Flag
instance [overlap ok] Show Flag
instance [overlap ok] Show BuilderType
module NLP.GenI.Builder
data Builder st it pa
Builder :: (Input -> pa -> (st, Statistics)) -> BuilderState st () -> BuilderState st () -> (st -> Bool) -> (st -> [Output]) -> (st -> [Output]) -> Builder st it pa
init :: Builder st it pa -> Input -> pa -> (st, Statistics)
step :: Builder st it pa -> BuilderState st ()
stepAll :: Builder st it pa -> BuilderState st ()
finished :: Builder st it pa -> st -> Bool
unpack :: Builder st it pa -> st -> [Output]
partial :: Builder st it pa -> st -> [Output]
type Output = (UninflectedSentence, Derivation)
type Derivation = TagDerivation
data Input
Input :: SemInput -> [ILexEntry] -> [(TagElem, BitVector)] -> Input
inSemInput :: Input -> SemInput
-- | for the debugger
inLex :: Input -> [ILexEntry]
-- | tag tree
inCands :: Input -> [(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)
-- | Equivalent to id unless the input contains an empty or
-- uninstatiated semantics
unlessEmptySem :: Input -> Params -> a -> a
-- | Performs surface realisation from an input semantics and a lexical
-- selection.
run :: Builder st it Params -> Input -> Params -> (st, Statistics)
type SemBitMap = Map Pred BitVector
-- | 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
defineSemanticBits :: Sem -> SemBitMap
semToBitVector :: SemBitMap -> Sem -> BitVector
bitVectorToSem :: SemBitMap -> BitVector -> Sem
type IafMap = Map String Sem
-- | Return the literals of the semantics (in bit vector form) whose
-- accesibility depends on the given index
dependentSem :: IafMap -> String -> Sem
-- | Return the handle and arguments of a literal
literalArgs :: Pred -> [GeniVal]
semToIafMap :: Sem -> IafMap
-- | Like fromGConst but only for the non-disjoint ones: meant to
-- be used as Maybe or List
fromUniConst :: (Monad m) => GeniVal -> m String
getIdx :: Flist -> [GeniVal]
ts_iafFailure :: [String] -> [Pred] -> String
-- | Calculate the new set of accessibility/inaccesible indices, returning
-- a a tuple of accesible / inaccesible indices
recalculateAccesibility :: (IafAble a) => a -> a
-- | Return, in bitvector form, the portion of a semantics that is
-- inaccesible from an item
iafBadSem :: (IafAble a) => IafMap -> SemBitMap -> BitVector -> (a -> BitVector) -> a -> BitVector
class IafAble a
iafAcc :: (IafAble a) => a -> [String]
iafInacc :: (IafAble a) => a -> [String]
iafSetAcc :: (IafAble a) => [String] -> a -> a
iafSetInacc :: (IafAble a) => [String] -> a -> a
iafNewAcc :: (IafAble a) => a -> [String]
-- | Default implementation for the stepAll function in
-- Builder
defaultStepAll :: Builder st it pa -> BuilderState st ()
type DispatchFilter s a = a -> s (Maybe a)
-- | Sequence two dispatch filters.
(>-->) :: (Monad s) => DispatchFilter s a -> DispatchFilter s a -> DispatchFilter s a
-- | A filter that always fails (i.e. no filtering)
nullFilter :: (Monad s) => DispatchFilter s a
-- | If the item meets some condition, use the first filter, otherwise use
-- the second one.
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)
module NLP.GenI.Simple.SimpleBuilder
type Agenda = [SimpleItem]
type AuxAgenda = [SimpleItem]
type Chart = [SimpleItem]
data SimpleStatus
type SimpleState a = BuilderState SimpleStatus a
data SimpleItem
SimpleItem :: ChartId -> ![TagSite] -> ![TagSite] -> !BitVector -> !BitVector -> [String] -> [String] -> [(String, UninflectedDisjunction)] -> Tree String -> TagSite -> Maybe TagSite -> [TagSite] -> TagDerivation -> SimpleItem
siId :: SimpleItem -> ChartId
siSubstnodes :: SimpleItem -> ![TagSite]
siAdjnodes :: SimpleItem -> ![TagSite]
siSemantics :: SimpleItem -> !BitVector
siPolpaths :: SimpleItem -> !BitVector
siAccesible :: SimpleItem -> [String]
siInaccessible :: SimpleItem -> [String]
-- | actually: a set of pre-terminals and their leaves
siLeaves :: SimpleItem -> [(String, UninflectedDisjunction)]
siDerived :: SimpleItem -> Tree String
siRoot :: SimpleItem -> TagSite
siFoot :: SimpleItem -> Maybe TagSite
siPendingTb :: SimpleItem -> [TagSite]
siDerivation :: SimpleItem -> TagDerivation
simpleBuilder_1p :: SimpleBuilder
simpleBuilder_2p :: SimpleBuilder
simpleBuilder :: Bool -> SimpleBuilder
theAgenda :: SimpleStatus -> Agenda
theAuxAgenda :: SimpleStatus -> AuxAgenda
theChart :: SimpleStatus -> Chart
theResults :: SimpleStatus -> [SimpleItem]
-- | Creates an initial SimpleStatus.
initSimpleBuilder :: Bool -> Input -> Params -> (SimpleStatus, Statistics)
addToAgenda :: SimpleItem -> SimpleState ()
addToChart :: SimpleItem -> SimpleState ()
genconfig :: SimpleStatus -> Params
instance [overlap ok] Show SimpleItem
instance [overlap ok] Show SimpleStatus
instance [overlap ok] IafAble SimpleItem
instance [overlap ok] Replacable SimpleItem
module NLP.GenI.CkyEarley.CkyBuilder
ckyBuilder :: CkyBuilder
earleyBuilder :: CkyBuilder
data CkyStatus
S :: Agenda -> Chart -> Trash -> BitVector -> IafMap -> Integer -> Params -> [CKY_InferenceRule] -> (CkyItem -> CkyState (Maybe CkyItem)) -> [CkyItem] -> Integer -> CkyStatus
theAgenda :: CkyStatus -> Agenda
theChart :: CkyStatus -> Chart
theTrash :: CkyStatus -> Trash
tsemVector :: CkyStatus -> BitVector
theIafMap :: CkyStatus -> IafMap
gencounter :: CkyStatus -> Integer
genconfig :: CkyStatus -> Params
theRules :: CkyStatus -> [CKY_InferenceRule]
theDispatcher :: CkyStatus -> CkyItem -> CkyState (Maybe CkyItem)
theResults :: CkyStatus -> [CkyItem]
genAutCounter :: CkyStatus -> Integer
data CkyItem
CkyItem :: GNode -> TagElem -> [GeniVal] -> BitVector -> BitVector -> Maybe ChartId -> BitVector -> ChartId -> RoutingMap -> [CkyItem] -> [GeniVal] -> SemBitMap -> TreeSide -> [String] -> [ChartOperation] -> [String] -> [String] -> [TagSite] -> CkyItem
ciNode :: CkyItem -> GNode
ciSourceTree :: CkyItem -> TagElem
ciOrigVariables :: CkyItem -> [GeniVal]
ciPolpaths :: CkyItem -> BitVector
ciSemantics :: CkyItem -> BitVector
ciAdjPoint :: CkyItem -> Maybe ChartId
-- | the semantics of the item when it was first initialised
ciInitialSem :: CkyItem -> BitVector
-- | unique identifier for this item
ciId :: CkyItem -> ChartId
ciRouting :: CkyItem -> RoutingMap
ciPayload :: CkyItem -> [CkyItem]
ciVariables :: CkyItem -> [GeniVal]
ciSemBitMap :: CkyItem -> SemBitMap
ciTreeSide :: CkyItem -> TreeSide
ciDiagnostic :: CkyItem -> [String]
ciDerivation :: CkyItem -> [ChartOperation]
ciAccesible :: CkyItem -> [String]
ciInaccessible :: CkyItem -> [String]
ciSubstnodes :: CkyItem -> [TagSite]
type ChartId = Integer
ciAdjDone :: CkyItem -> Bool
ciRoot :: CkyItem -> Bool
-- | Returns all the derivations trees for this item: note that this is not
-- a TAG derivation tree but a history of inference rule applications in
-- tree form
extractDerivations :: CkyStatus -> CkyItem -> [Tree (ChartId, String)]
mJoinAutomata :: Maybe SentenceAut -> Maybe SentenceAut -> Maybe SentenceAut
mAutomatonPaths :: (Ord st, Ord ab) => Maybe (NFA st ab) -> [[ab]]
emptySentenceAut :: SentenceAut
unpackItemToAuts :: CkyStatus -> CkyItem -> SentenceAutPairMaybe
bitVectorToSem :: SemBitMap -> BitVector -> Sem
findId :: CkyStatus -> ChartId -> Maybe CkyItem
instance [overlap ok] Eq TreeSide
instance [overlap ok] Show ChartOperation
instance [overlap ok] IafAble CkyItem
instance [overlap ok] Show CKY_InferenceRule
module NLP.GenI.Geni
data ProgState
ST :: Params -> Macros -> Lexicon -> MorphFn -> Maybe [(String, String, Flist)] -> SemInput -> String -> [TestCase] -> [String] -> ProgState
-- | the current configuration being processed
pa :: ProgState -> Params
gr :: ProgState -> Macros
le :: ProgState -> Lexicon
morphinf :: ProgState -> MorphFn
morphlex :: ProgState -> Maybe [(String, String, Flist)]
ts :: ProgState -> SemInput
-- | names of test case to run
tcase :: ProgState -> String
-- | name, original string (for gui), sem
tsuite :: ProgState -> [TestCase]
-- | simplified traces (optional)
traces :: ProgState -> [String]
type ProgStateRef = IORef ProgState
-- | The program state when you start GenI for the very first time
emptyProgState :: Params -> ProgState
-- | Show the sentences produced by the generator, in a relatively compact
-- form
showRealisations :: [String] -> String
-- | Convert a list of items into a list of tuples (a,b) where a is an item
-- in the list and b is the number of times a in occurs in the list.
groupAndCount :: (Eq a, Ord a) => [a] -> [(a, Int)]
-- | initGeni performs lexical selection and strips the input
-- semantics of any morpohological literals
initGeni :: ProgStateRef -> IO (Input)
-- | Returns a list of sentences, a set of Statistics, and the generator
-- state. The generator state is mostly useful for debugging via the
-- graphical interface. Note that we assumes that you have already loaded
-- in your grammar and parsed your input semantics.
runGeni :: ProgStateRef -> Builder st it Params -> IO ([GeniResult], Statistics, st)
runGeniWithSelector :: ProgStateRef -> Selector -> Builder st it Params -> IO ([GeniResult], Statistics, st)
-- | getTraces is most likely useful for grammars produced by a
-- metagrammar system. Given a tree name, we retrieve the
-- `trace' information from the grammar for all trees that have
-- this name. We assume the tree name was constructed by GenI; see the
-- source code for details.
getTraces :: ProgState -> String -> [String]
type GeniResult = (String, Derivation)
-- | Only used for instances of GenI where the grammar is compiled directly
-- into GenI.
type Selector = ProgState -> IO ([TagElem], [ILexEntry])
loadEverything :: ProgStateRef -> IO ()
loadLexicon :: ProgStateRef -> IO ()
loadGeniMacros :: ProgStateRef -> IO ()
-- | The macros are stored as a hashing function in the monad.
--
-- The results are stored as a lookup function in the monad.
--
-- Stores the results in the tcase and tsuite fields
loadTestSuite :: ProgStateRef -> IO ()
-- | Updates program state the same way as loadTestSuite
loadTargetSemStr :: ProgStateRef -> String -> IO ()
-- | combine macros lex creates the Tags repository
-- combining lexical entries and un-anchored trees from the grammar. It
-- also unifies the parameters used to specialize un-anchored trees and
-- propagates additional features given in the ILexEntry.
combine :: Macros -> Lexicon -> Tags
-- | Select and returns the set of entries from the lexicon whose semantics
-- subsumes the input semantics.
chooseLexCand :: Lexicon -> Sem -> [ILexEntry]
instance [overlap ok] Show LexCombineError
instance [overlap ok] Error LexCombineError