Package nltk :: Package sem :: Module logic :: Class AbstractVariableExpression
[hide private]
[frames] | no frames]

type AbstractVariableExpression

source code

         object --+        
                  |        
SubstituteBindingsI --+    
                      |    
             Expression --+
                          |
                         AbstractVariableExpression
Known Subclasses:

This class represents a variable to be used as a predicate or entity

Instance Methods [hide private]
 
__init__(self, variable) source code
 
simplify(self)
Returns: beta-converted version of this expression
source code
 
replace(self, variable, expression, replace_bound=False, alpha_convert=True)
Replace every instance of 'variable' with 'expression'
source code
 
_set_type(self, other_type=?, signature=None)
@see Expression._set_type()
source code
 
findtype(self, variable)
@see Expression.findtype()
source code
 
visit(self, function, combinator, default)
Recursively visit sub expressions
source code
 
__eq__(self, other)
Allow equality between instances of AbstractVariableExpression subtypes.
source code
 
__str__(self) source code
 
str(self, syntax=Tokens.NLTK)

Inherited from Expression: __and__, __call__, __gt__, __hash__, __lt__, __neg__, __neq__, __or__, __repr__, applyto, equiv, free, make_VariableExpression, negate, normalize, substitute_bindings, tp_equals, typecheck, variables

Method Details [hide private]

__init__(self, variable)
(Constructor)

source code 
Parameters:
  • variable - Variable, for the variable
Overrides: object.__init__

simplify(self)

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

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

source code 

Replace every instance of 'variable' with 'expression'

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: Expression.replace

See Also: Expression.replace()

_set_type(self, other_type=?, signature=None)

source code 

@see Expression._set_type()

Parameters:
  • other_type - Type to set
  • signature - dict<str, list<AbstractVariableExpression>> store all variable expressions with a given name
Overrides: Expression._set_type

findtype(self, variable)

source code 

@see Expression.findtype()

Parameters:
  • variable - Variable
Overrides: Expression.findtype

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: Expression.visit

See Also: Expression.visit()

__eq__(self, other)
(Equality operator)

source code 

Allow equality between instances of AbstractVariableExpression subtypes.

Overrides: Expression.__eq__

__str__(self)
(Informal representation operator)

source code 
Overrides: Expression.__str__