antfarm- Referring expressions for definitions

Safe HaskellSafe-Infered




Referring expressions

data SubRxInput Source

Input needed to realise a subunit of a referring expression A subunit corresponds to RefGroup (but in practice, we need the whole DiscourseUnit, not just the RefGroup root)




srxInpDet :: SingPlu [Text]

determiner (can be empty)

srxInpWord :: SingPlu Text

main word

srxInpEntity :: DiscourseUnit

data SubRx Source

Output for a subunit of a referring expression


type RxInput = [Tree SubRxInput]Source

A single referring expression has subunits, each of which potentially having examples

type Rx = [Tree SubRx]Source

A referring expression

Discourse units

type DiscourseUnit = Tree RefGroupSource

A discourse unit includes all instances and constraints needed to uniquely identify it. (see note discourse tree)

In the current implementation, a referring expression may contain more than one discourse unit. So in a referring expression “three cats and at most two dogs (a poodle and a labrador)”, the “at most two dogs (a poodle and a labrador)” and “three cats” would each correspond to different DiscourseUnits

data RefGroup Source

A sub-unit in a referring expression, instances of and/or constraints over class. So in a referring expression “three cats and at most two dogs”, the “at most two dogs” and “three cats” would each be RefGroups



type RefKey = (Text, Text)Source

A unique object


data Bounds Source




bUnknown :: [Text]
bLower :: Maybe Int


bUpper :: Maybe Int


narrow :: Bounds -> Bounds -> BoundsSource

When two Bounds are combined the result is narrower: the highest low and the lowest high.

The unknown bounds are not really defined. We concatenate them, for what it's worth, which is at least sensible when none or only one of them is defined, but not ideal when both are


data FuzzyNumber Source

Fuzzy number is a variant on Number that allows us the option of overriding what would otherwise be singular agreement

If you don't need to, or have no idea why somebody would even want to do such a thing, just defuzz it

data Discriminator Source

Somewhat abstract representation of subrx discriminators (but in reality just based on English)

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“. This isn't a technical term as far as I'm aware, just a made-up convenience word