Package nltk :: Package sem :: Module drt :: Class DRS
[hide private]
[frames] | no frames]

type DRS

source code

                   object --+    
                            |    
                  AbstractDrs --+
                                |
               object --+       |
                        |       |
logic.SubstituteBindingsI --+   |
                            |   |
             logic.Expression --+
                                |
                               DRS

A Discourse Representation Structure.

Instance Methods [hide private]
 
__init__(self, refs, conds, consequent=None) source code
 
replace(self, variable, expression, replace_bound=False, alpha_convert=True)
Replace all instances of variable v with expression E in self, where v is free in self.
source code
 
variables(self)
Return a set of all the variables that are available to be replaced.
source code
 
free(self, indvar_only=True)
Return a set of all the free (non-bound) variables in self.
source code
 
get_refs(self, recursive=False)
Return the set of discourse referents in this DRS.
source code
 
visit(self, function, combinator, default)
Recursively visit sub expressions
source code
 
eliminate_equality(self) source code
 
simplify(self)
Returns: beta-converted version of this expression
source code
 
fol(self) source code
 
_pretty(self) source code
 
_order_ref_strings(self, refs) source code
 
__eq__(self, other)
Defines equality modulo alphabetic variance.
source code
 
__str__(self) source code

Inherited from AbstractDrs: __add__, __and__, __gt__, __neg__, __or__, applyto, draw, equiv, is_pronoun_function, make_EqualityExpression, make_VariableExpression, pprint, pretty, resolve_anaphora, typecheck

Inherited from AbstractDrs (private): _get_type

Inherited from logic.Expression: __call__, __hash__, __lt__, __neq__, __repr__, findtype, negate, normalize, substitute_bindings, tp_equals

Inherited from logic.Expression (private): _set_type

Properties [hide private]

Inherited from AbstractDrs: type

Method Details [hide private]

__init__(self, refs, conds, consequent=None)
(Constructor)

source code 
Parameters:
  • refs - list of DrtIndividualVariableExpression for the discourse referents
  • conds - list of Expression for the conditions
Overrides: object.__init__

replace(self, variable, expression, replace_bound=False, alpha_convert=True)

source code 

Replace all instances of variable v with expression E in self, where v is free in self.

Parameters:
  • variable - Variable The variable to replace
  • expression - Expression The expression with which to replace it
  • replace_bound - boolean Should bound variables be replaced?
Overrides: logic.Expression.replace

variables(self)

source code 

Return a set of all the variables that are available to be replaced. This includes free (non-bound) variables as well as predicates.

Returns:
set of Variables
Overrides: logic.SubstituteBindingsI.variables

See Also: Expression.variables()

free(self, indvar_only=True)

source code 

Return a set of all the free (non-bound) variables in self. Variables serving as predicates are not included.

Parameters:
  • indvar_only - boolean only return individual variables?
Returns:
set of Variables
Overrides: logic.Expression.free

See Also: Expression.free()

get_refs(self, recursive=False)

source code 

Return the set of discourse referents in this DRS.

Parameters:
  • recursive - boolean Also find discourse referents in subterms?
Returns:
list of Variables
Overrides: AbstractDrs.get_refs

See Also: AbstractExpression.get_refs()

visit(self, function, combinator, default)

source code 

Recursively visit sub expressions

Parameters:
  • function - Function to call on each sub expression
  • combinator - Function to combine the results of the function calls
Returns:
result of combination
Overrides: logic.Expression.visit

See Also: Expression.visit()

eliminate_equality(self)

source code 
Overrides: AbstractDrs.eliminate_equality

simplify(self)

source code 
Returns:
beta-converted version of this expression
Overrides: logic.Expression.simplify
(inherited documentation)

__eq__(self, other)
(Equality operator)

source code 

Defines equality modulo alphabetic variance. If we are comparing \x.M and \y.N, then check equality of M and N[x/y].

Overrides: logic.Expression.__eq__

__str__(self)
(Informal representation operator)

source code 
Overrides: logic.Expression.__str__