antfarm- Referring expressions for definitions

Safe HaskellSafe-Infered



Discourse history tracking



isExact :: RefGroup -> BoolSource

A RefGroup is considered to refer exactly to its indices if it has no bounds information or examples associated with it.

mkSingletonDu :: RefKey -> DiscourseUnitSource

A discourse unit that would refer to just an element

data RefHistory Source




rhCount :: Map DiscourseUnit RefCount

How many times a DiscourseUnit has been mentioned

rhOrder :: Map Text [Text]

For each class: an ordering of indices that reflects what ordinal expression should be used for them (if at all)

So [c8,c3,c4] means

c8: the first c3: the second c4: the third

emptyHistory :: RefHistorySource

Discourse history without any objects

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.

duSingletons :: DiscourseUnit -> [RefKey]Source

Individuals mentioned in a discourse unit (see refSingleton)

refSingleton :: RefGroup -> Maybe RefKeySource

A refSingleton is an instance that appears by itself in a RefGroup without other items or constraints that imply that there could be other items

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 RefGroups, but you may also decide that this sort of behaviour is not desirable for your application, so it's off by default

hasDistractorGroup :: RefHistory -> RefKey -> BoolSource

hasDistractorGroup st k returns whether or not the discourse history st contains a group with distractors to k.

See distractorGroups for more details

distractorGroups :: RefHistory -> RefKey -> [DiscourseUnit]Source

distractorGroups st k returns all the distractor groups for k in the discourse history.

A distractor is defined (here) as something that has the the same class as k but a different index.

hasSupersetMention :: RefHistory -> DiscourseUnit -> BoolSource

hasSupersetMention st g returns whether or not the discourse history contains a group that includes all members of g

Note that if a group has already occured in the discourse history, this returns a True (ie. not a strict superset)

supersetMentions :: DiscourseUnit -> RefHistory -> RefHistorySource

supersetMentions g st returns the portion of discourse history st in which all groups are supersets of g (inclusive, not strict super)

lastMention :: RefHistory -> RefKey -> IntSource

lastMention st k returns the number of times k has been mentioned

lastMentions :: RefHistory -> DiscourseUnit -> IntSource

lastMention st g returns the number of times the group g has been mentioned

mentionOrder :: RefHistory -> RefKey -> Maybe IntSource

If it makes sense to refer to a key using an ordinal expression, the order we should assign it (Nothing if we either can't sensibly assign one, or the history does not give us enough information to do so)

hasTidyBackpointer :: RefHistory -> DiscourseUnit -> BoolSource

Is a subset of a previously mentioned group g where there are no distractors to g in the discourse history

isTheOther :: RefHistory -> RefKey -> BoolSource

isTheOther st k returns whether or not there is a two-member group in the discourse history which k is a member of such that the other member has already been mentioned as a part of a singleton group.

The idea is that if you have said one of the X, you will want to say the other X for the other member of that group

isClasswide :: RefGroup -> BoolSource

Is the class itself, not any individual entity within that class ie. “ants” instead of “an ant” or “some ants”

By convention, any group which containts no indices or constraints is considered to be classwide.

subtrees :: Tree a -> [Tree a]Source

Like flatten, but returns whole subtrees instead of just nodes:

 a(b c(d e(f g)) h)
 c(d e(f g))
 e(f g)

Invariant: map rootLabel (subtrees x) == flatten x

mkLeaf :: a -> Tree aSource

fst3 :: (a, b, c) -> aSource

snd3 :: (a, b, c) -> bSource

thd3 :: (a, b, c) -> cSource