Structures and operations for quantifier scope in DELPH-IN semantics.

While the predicate-argument structure of a semantic representation is a directed-acyclic graph, the quantifier scope is a tree overlayed on the edges of that graph. In a fully scope-resolved structure, there is one tree spanning the entire graph, but in underspecified representations like MRS, there are multiple subtrees that span the graph nodes but are not all connected together. The components are then connected via qeq constraints which specify a partial ordering for the tree such that quantifiers may float in between the nodes connected by qeqs.

Each node in the scope tree (called a scopal position) may encompass multiple nodes in the predicate-argument graph. Nodes that share a scopal position are said to be in a conjunction.

The dependency representations EDS and DMRS develop the idea of scope representatives (called representative nodes or sometimes heads), whereby a single node is selected from a conjunction to represent the conjunction as a whole.


class delphin.scope.ScopingSemanticStructure(top, index, predications, lnk, surface, identifier)[source]

Bases: delphin.sembase.SemanticStructure

A semantic structure that encodes quantifier scope.

This is a base class for semantic representations, namely MRS and DMRS, that distinguish scopal and non-scopal arguments. In addition to the attributes and methods of the SemanticStructure class, it also includes an index which indicates the non-scopal top of the structure, scopes() for describing the labeled scopes of a structure, and scopal_arguments() for describing the arguments that select scopes.


The non-scopal top of the structure.


Return a mapping of the scopal argument structure.

Unlike SemanticStructure.arguments(), the list of arguments is a 3-tuple including the scopal relation: (role, scope_relation, scope_label).


scopes – mapping of scope labels to lists of predications


Return a tuple containing the top label and the scope map.

The top label is the label of the top scope in the scope map.

The scope map is a dictionary mapping scope labels to the lists of predications sharing a scope.

Module Functions

delphin.scope.conjoin(scopes, leqs)[source]

Conjoin multiple scopes with equality constraints.

  • scopes – a mapping of scope labels to predications

  • leqs – a list of pairs of equated scope labels


A mapping of the labels to the predications of each conjoined scope. The conjoined scope labels are taken arbitrarily from each equated set).


>>> conjoined = scope.conjoin(mrs.scopes(), [('h2', 'h3')])
>>> {lbl: [ for p in ps] for lbl, ps in conjoined.items()}
{'h1': ['e2'], 'h2': ['x4', 'e6']}
delphin.scope.descendants(x, scopes=None)[source]

Return a mapping of predication ids to their scopal descendants.

  • x – an MRS or a DMRS

  • scopes – a mapping of scope labels to predications


A mapping of predication ids to lists of predications that are scopal descendants.


>>> m = mrs.MRS(...)  # Kim didn't think that Sandy left.
>>> descendants = scope.descendants(m)
>>> for id, ds in descendants.items():
...     print(m[id].predicate, [d.predicate for d in ds])
proper_q ['named']
named []
neg ['_think_v_1', '_leave_v_1']
_think_v_1 ['_leave_v_1']
_leave_v_1 []
proper_q ['named']
named []
delphin.scope.representatives(x, priority=None)[source]

Find the scope representatives in x sorted by priority.

When predications share a scope, generally one takes another as a non-scopal argument. For instance, the ERG analysis of a phrase like “very old book” has the predicates _very_x_deg, _old_a_1, and _book_n_of which all share a scope, where _very_x_deg takes _old_a_1 as its ARG1 and _old_a_1 takes _book_n_of as its ARG1. Predications that do not take any other predication within their scope as an argument (as _book_n_of above does not) are scope representatives.

priority is a function that takes a Predication object and returns a rank which is used to to sort the representatives for each scope. As the predication alone might not contain enough information for useful sorting, it can be helpful to create a function configured for the input semantic structure x. If priority is None, representatives are sorted according to the following criteria:

  1. Prefer predications that are quantifiers or instances (type ‘x’)

  2. Prefer eventualities (type ‘e’) over other types

  3. Prefer tensed over untensed eventualities

  4. Finally, prefer prefer those appearing first in x

The definition of “tensed” vs “untensed” eventualities is grammar-specific, but it is used by several large grammars. If a grammar does something different, criterion (3) is ignored. Criterion (4) is not linguistically motivated but is used as a final disambiguator to ensure consistent results.

  • x – an MRS or a DMRS

  • priority – a function that maps an EP to a rank for sorting


>>> sent = 'The new chef whose soup accidentally spilled quit.'
>>> m = ace.parse(erg, sent).result(0).mrs()
>>> # in this example there are 4 EPs in scope h7
>>> _, scopes = m.scopes()
>>> [ep.predicate for ep in scopes['h7']]
['_new_a_1', '_chef_n_1', '_accidental_a_1', '_spill_v_1']
>>> # there are 2 representatives for scope h7
>>> reps = scope.representatives(m)['h7']
>>> [ep.predicate for ep in reps]
['_chef_n_1', '_spill_v_1']


exception delphin.scope.ScopeError(*args, **kwargs)[source]

Bases: delphin.exceptions.PyDelphinException

Raised on invalid scope operations.