delphin.sembase¶
Basic classes and functions for semantic representations.
Module Functions¶
- delphin.sembase.role_priority(role: str) tuple[bool, bool, str][source]¶
Return a representation of role priority for ordering.
- delphin.sembase.property_priority(prop: str) tuple[int, str][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: ID, predicate: str, type: str | None, lnk: Lnk | None, surface: str | None, base)[source]¶
Bases:
LnkMixin,Generic[ID],ABCAn 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: ID | None, predications: Sequence[P], lnk: Lnk | None, surface: str | None, identifier)[source]¶
Bases:
LnkMixin,Generic[ID,P],ABCA 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
- Type:
delphin.sembase.ID | None
- identifier¶
a discourse-utterance identifier
- abstractmethod arguments(types: Iterable[str] | None = None, expressed: bool | None = None) dict[ID, list[tuple[str, ID]]][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.
- abstractmethod is_quantifier(id: ID | None) bool[source]¶
Return
Trueif id represents a quantifier.
- abstractmethod properties(id: ID | None) dict[str, str][source]¶
Return the morphosemantic properties for id.
- abstractmethod quantification_pairs() list[tuple[P | None, P | None]][source]¶
Return a list of (Quantifiee, Quantifier) pairs.
Both the Quantifier and Quantifiee are
Predicationobjects, 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)]