delphin.sembase

Basic classes and functions for semantic representations.

Module Functions

delphin.sembase.role_priority(role)[source]

Return a representation of role priority for ordering.

delphin.sembase.property_priority(prop)[source]

Return a representation of property priority for ordering.

Note

The ordering provided by this function was modeled on the ERG and Jacy grammars and may be inaccurate for others. Properties not known to this function will be sorted alphabetically.

Classes

class delphin.sembase.Predication(id, predicate, type, lnk, surface, base)[source]

Bases: delphin.lnk.LnkMixin

An instance of a predicate in a semantic structure.

While a predicate (see delphin.predicate) is a description of a possible semantic entity, a predication is the instantiation of a predicate in a semantic structure. Thus, multiple predicates with the same form are considered the same thing, but multiple predications with the same predicate will have different identifiers and, if specified, different surface alignments.

class delphin.sembase.SemanticStructure(top, predications, lnk, surface, identifier)[source]

Bases: delphin.lnk.LnkMixin

A basic semantic structure.

DELPH-IN-style semantic structures are rooted DAGs with flat lists of predications.

Parameters
  • top – identifier for the top of the structure

  • predications – list of predications in the structure

  • identifier – a discourse-utterance identifier

top

identifier for the top of the structure

predications

list of predications in the structure

identifier

a discourse-utterance identifier

arguments(types=None, expressed=None)[source]

Return a mapping of the argument structure.

Parameters
  • types – an iterable of predication types to include

  • expressed – if True, only include arguments to expressed predications; if False, only include those unexpressed; if None, include both

Returns

A mapping of predication ids to lists of (role, target) pairs for outgoing arguments for the predication.

is_quantifier(id)[source]

Return True if id represents a quantifier.

properties(id)[source]

Return the morphosemantic properties for id.

quantification_pairs()[source]

Return a list of (Quantifiee, Quantifier) pairs.

Both the Quantifier and Quantifiee are Predication objects, unless they do not quantify or are not quantified by anything, in which case they are None. In well-formed and complete structures, the quantifiee will never be None.

Example

>>> [(p.predicate, q.predicate)
...  for p, q in m.quantification_pairs()]
[('_dog_n_1', '_the_q'), ('_bark_v_1', None)]