delphin.sembase
Basic classes and functions for semantic representations.
Module Functions
Classes
- class delphin.sembase.Predication(id, predicate, type, lnk, surface, base)[source]
Bases:
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:
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; ifFalse
, only include those unexpressed; ifNone
, include both
- Returns:
A mapping of predication ids to lists of (role, target) pairs for outgoing arguments for the predication.
- 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 areNone
. In well-formed and complete structures, the quantifiee will never beNone
.Example
>>> [(p.predicate, q.predicate) ... for p, q in m.quantification_pairs()] [('_dog_n_1', '_the_q'), ('_bark_v_1', None)]