Expand description
Discourse Representation Structure (DRS) for anaphora resolution and scope tracking.
This module implements a simplified DRS following the theory developed by Hans Kamp and Uwe Reyle. The DRS tracks referents (discourse entities) across sentences and handles pronoun resolution, donkey anaphora, and quantifier scope.
§Core Concepts
- Box: A scope container holding referents and conditions. Boxes nest to form scope islands (conditionals, quantifiers, negation).
- Referent: A discourse entity with a variable, noun class, gender, and number. Introduced by indefinites, proper names, or quantifiers.
- Accessibility: Whether a referent can be accessed from a given scope. Negation and disjunction block accessibility outward.
§Key Types
| Type | Purpose |
|---|---|
Drs | The box hierarchy tracking referents and their scopes |
WorldState | Unified discourse state persisting across sentences |
BoxType | Classification of scope containers (Main, Negation, Modal, etc.) |
Referent | A discourse entity with gender, number, and source information |
ScopeError | Error when pronoun resolution fails due to scope constraints |
§Accessibility Rules
A pronoun in box B can access referent R in box A if:
- A is B (same box)
- A is an ancestor of B (parent chain)
- A is a conditional antecedent and B is the consequent of the same conditional
- A is a universal restrictor and B is the universal scope
Referents in negation or disjunction boxes are NEVER accessible from outside.
§Example
“If a farmer owns a donkey, he beats it.”
- “a farmer” introduces referent x in conditional antecedent box
- “a donkey” introduces referent y in conditional antecedent box
- “he” resolves to x (accessible from consequent)
- “it” resolves to y (accessible from consequent)
- Both receive universal quantification due to conditional DRS signature
Structs§
- Drs
- DrsBox
- Modal
Context - Modal context for tracking hypothetical worlds across sentences. Enables modal subordination: “A wolf might walk in. It would eat you.”
- Referent
- Telescope
Candidate - A referent that may be accessed via telescoping across sentence boundaries
- Time
Constraint - World
State - The unified discourse state that persists across sentences.
Enums§
- BoxType
- Case
- Grammatical case (for pronouns).
- Gender
- Grammatical gender (for pronouns and agreement).
- Number
- Grammatical number for nouns and agreement.
- Ownership
State - Referent
Source - Scope
Error - Error when pronoun resolution fails due to scope constraints
- Scope
Path - Path segment for navigating to insertion point during AST restructuring
- Time
Relation