nltk.sem.DRS¶
- class nltk.sem.DRS[source]¶
Bases:
DrtExpression
,Expression
A Discourse Representation Structure.
- __init__(refs, conds, consequent=None)[source]¶
- Parameters
refs – list of
DrtIndividualVariableExpression
for the discourse referentsconds – list of
Expression
for the conditions
- replace(variable, expression, replace_bound=False, alpha_convert=True)[source]¶
Replace all instances of variable v with expression E in self, where v is free in self.
- constants()[source]¶
Return a set of individual constants (non-predicates). :return: set of
Variable
objects
- equiv(other, prover=None)[source]¶
Check for logical equivalence. Pass the expression (self <-> other) to the theorem prover. If the prover says it is valid, then the self and other are equal.
- Parameters
other – an
DrtExpression
to check equality againstprover – a
nltk.inference.api.Prover
- findtype(variable)[source]¶
Find the type of the given variable as it is used in this expression. For example, finding the type of “P” in “P(x) & Q(x,y)” yields “<e,t>”
- Parameters
variable – Variable
- predicates()[source]¶
Return a set of predicates (constants, not variables). :return: set of
Variable
objects
- substitute_bindings(bindings)[source]¶
- Returns
The object that is obtained by replacing each variable bound by
bindings
with its values. Aliases are already resolved. (maybe?)- Return type
(any)
- property type¶