antfarm-0.1.0.0: Referring expressions for definitions

Portabilityportable
Stabilityexperimental
Maintainereric.kow@gmail.com
Safe HaskellSafe-Infered

NLP.Antfarm.Internal

Description

The heart of the referring expression generation

Synopsis

Documentation

rx :: RefHistory -> [Tree SubRxInput] -> [Tree SubRx]Source

Decide how to realise a referring expression

subrx :: RefHistory -> Tree SubRxInput -> Tree SubRxSource

Decide how to realise a single unit within a referring expression

Keep in mind that this is only for one DiscourseUnit within a single rx. An rx may involve multiple discourse units (eg. 3 cats and 1 dog)

surfaceNumber :: RefHistory -> DiscourseUnit -> NumberSource

Helper for fromConcept

Whether the noun in a DiscourseUnit should be realised as singular or plural. Note the difference between this and actualNumber

subrxNumber :: DiscourseUnit -> FuzzyNumberSource

Whether a DiscourseUnit should be considered *morally* (semantically) singular or plural. The actual form used may be different (see conceptNumber because of deeper issues that override this).

Consider one of the *dogs*; here the rx number is Singular — one dog — but on the surface we use the Plural (the NP 'the dogs' is itself plural). This discrepency is partly due to the hacky way we've written this. A cleaner implementation would recursively realise 'the dogs' as a separate expression with its own number.

discriminateSource

Arguments

:: RefHistory

discourse history

-> DiscourseUnit 
-> Discriminator 

Helper for fromConcept

A discriminator is what we call the optional bit of text that helps you distinguish one set instances of a class from another, eg, “the same” or “another three”, or simply “the“

boundsText :: Bounds -> Maybe BoundsExprSource

If there are any unknown constraints, we pick the first one. Otherwise, we generate an expression appropriate for the lower/upper bounds