Portability | portable |
---|---|
Stability | experimental |
Maintainer | eric.kow@gmail.com |
Safe Haskell | Safe-Infered |
Referring expression generation for definitions.
- module NLP.Antfarm.Refex
- data RefHistory = RefHistory {}
- addToHistory :: [DiscourseUnit] -> RefHistory -> RefHistory
- emptyHistory :: RefHistory
- noteImplicitBounds :: RefGroup -> RefGroup
- rx :: RefHistory -> [Tree SubRxInput] -> [Tree SubRx]
- subrx :: RefHistory -> Tree SubRxInput -> Tree SubRx
- subrxNumber :: DiscourseUnit -> FuzzyNumber
- englishRx :: [Tree SubRx] -> Text
- englishSubrx :: SubRx -> Text
Key structures
module NLP.Antfarm.Refex
Discourse history
data RefHistory Source
RefHistory | |
|
addToHistory :: [DiscourseUnit] -> RefHistory -> RefHistorySource
Take note of the fact that these discourse units have been mentioned (again) in the history.
You probably want to realise the units first, then add them to the history.
emptyHistory :: RefHistorySource
Discourse history without any objects
noteImplicitBounds :: RefGroup -> RefGroupSource
If a RefGroup has explicit constraints, augment them with the implicit constraints that arise from treating each item as evidence of an at least constraint
It's a good idea to run this once when building RefGroup
s,
but you may also decide that this sort of behaviour is not
desirable for your application, so it's off by default
Core generation
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)
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.
English surface form
englishSubrx :: SubRx -> TextSource
English realisation for a referring expression subunit (this can be useful if you need special formatting between units, eg. bullet points)