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




type Tags = Map String [TagElem]Source

An anchored grammar. The grammar associates a set of semantic predicates to a list of trees each.

class TagItem t whereSource

TagItem is a generalisation of TagElem.


addToTags :: Tags -> String -> TagElem -> TagsSource

addTags tags key elem adds elem to the the list of elements associated to the key

tagLeaves :: TagElem -> [(String, UninflectedDisjunction)]Source

setTidnums :: [TagElem] -> [TagElem]Source

Assigns a unique id to each element of this list, that is, an integer between 1 and the size of the list.

mapBySem :: TagItem t => [t] -> Map Pred [t]Source

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.

subsumedBy :: Sem -> Pred -> BoolSource

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

detectSites :: Tree GNode -> ([TagSite], [TagSite], [TagSite])Source

Given a tree(GNode) returns a list of substitution or adjunction nodes, as well as remaining nodes with a null adjunction constraint.