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

Class VariableExpression

source code

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

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

Instance Methods [hide private]
 
__init__(self, variable)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
simplify(self) source code
 
replace(self, variable, expression, replace_bound=False)
Replace every instance of 'variable' with 'expression'
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
 
__eq__(self, other)
Allow equality between instances of VariableExpression and IndividualVariableExpression.
source code
 
str(self, syntax=1) source code

Inherited from Expression: __and__, __call__, __gt__, __hash__, __lt__, __neg__, __or__, __repr__, __str__, applyto, negate, substitute_bindings, tp_equals

Inherited from object: __delattr__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, variable)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

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

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

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?

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: Expression.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 no included.

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

See Also: Expression.free()

__eq__(self, other)
(Equality operator)

source code 

Allow equality between instances of VariableExpression and IndividualVariableExpression.

Overrides: Expression.__eq__