Safe Haskell | Safe-Infered |
---|
- data SubRxInput = SubRxInput {}
- data SubRx = SubRx {
- srxNumber :: Number
- srxDiscriminator :: Discriminator
- srxDet :: SingPlu [Text]
- srxWord :: SingPlu Text
- type RxInput = [Tree SubRxInput]
- type Rx = [Tree SubRx]
- type DiscourseUnit = Tree RefGroup
- data RefGroup = RefGroup {}
- rgIdxList :: RefGroup -> [Text]
- type RefKey = (Text, Text)
- data Bounds = Bounds {}
- emptyBounds :: Bounds
- explicitBounds :: [Constraint] -> Bounds
- narrow :: Bounds -> Bounds -> Bounds
- data FuzzyNumber
- defuzz :: FuzzyNumber -> Number
- data Discriminator
- = NilDiscriminator
- | Bounded BoundsExpr
- | TheSame
- | TheOther
- | TheOrdinal Int
- | NewOrdinal Int
- | Another Int
- | PlainCardinal Int
- | CardinalOfThe Int
- | The
- data BoundsExpr
- = SayAtLeast Int
- | SayAtMost Int
- | SayBetween Int Int
- | SayExactly Int
- | SayArbitrary Text
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)
SubRxInput | |
|
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
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 DiscourseUnit
s
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 RefGroup
s
Bounds
explicitBounds :: [Constraint] -> BoundsSource
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
Number
data FuzzyNumber Source
defuzz :: FuzzyNumber -> NumberSource
defuzz
treats FN_MaybeSingular
as Singular
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