GenI-0.23.20130212: A natural language generator (specifically, an FB-LTAG surface realiser)

Safe HaskellSafe-Infered

NLP.GenI.Morphology

Contents

Description

This module handles mostly everything to do with morphology in Geni. There are two basic tasks: morphological input and output. GenI farms out morphology to whatever third party program you specify on the command line. Note that a simple and stupid `sillymorph' realiser is provided either in the GenI repository or on hackage.

Synopsis

Documentation

Morphological predicates

readMorph :: [(Text, [AvPair GeniVal])] -> MorphInputFn

Converts information from a morphological information file into GenI's internal format.

stripMorphSem :: MorphInputFn -> Sem -> Sem

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

attachMorph :: MorphInputFn -> Sem -> [TagElem] -> [TagElem]

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.

setMorphAnchor :: GNode GeniVal -> Tree (GNode GeniVal) -> Tree (GNode GeniVal)

setMorphAnchor n t replaces the anchor node of a tree with n

We assume the tree has exactly one anchor node. If it has none, this explodes; if it has more than one, they all get replaced.

Morphological realisation

inflectSentencesUsingCmd :: String -> [LemmaPlusSentence] -> IO [(LemmaPlusSentence, MorphOutput)]

Converts a list of uninflected sentences into inflected ones by calling

sansMorph :: LemmaPlusSentence -> MorphOutput

Extracts the lemmas from a list of uninflected sentences. This is used when the morphological generator is unavailable, doesn't work, etc.