Package nltk :: Package inference :: Module resolution :: Class Clause
[hide private]
[frames] | no frames]

Class Clause

source code

object --+    
         |    
      list --+
             |
            Clause

Instance Methods [hide private]
new list
__init__(self, data)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
unify(self, other, bindings=None, used=None, skipped=None, debug=False)
Attempt to unify this Clause with the other, returning a list of resulting, unified, Clauses.
source code
 
isSubsetOf(self, other)
Return True iff every term in 'self' is a term in 'other'.
source code
 
subsumes(self, other)
Return True iff 'self' subsumes 'other', this is, if there is a substitution such that every term in 'self' can be unified with a term in 'other'.
source code
 
__getslice__(self, start, end)
x[i:j]
source code
 
__sub__(self, other) source code
 
__add__(self, other)
x+y
source code
 
is_tautology(self)
Self is a tautology if it contains ground terms P and -P.
source code
 
free(self) source code
 
replace(self, variable, expression)
Replace every instance of variable with expression across every atom in the clause
source code
 
substitute_bindings(self, bindings)
Replace every binding
source code
 
__str__(self)
str(x)
source code
 
__repr__(self)
repr(x)
source code

Inherited from list: __contains__, __delitem__, __delslice__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __hash__, __iadd__, __imul__, __iter__, __le__, __len__, __lt__, __mul__, __ne__, __new__, __reversed__, __rmul__, __setitem__, __setslice__, append, count, extend, index, insert, pop, remove, reverse, sort

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, data)
(Constructor)

source code 

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

Returns: new list
Overrides: list.__init__
(inherited documentation)

unify(self, other, bindings=None, used=None, skipped=None, debug=False)

source code 

Attempt to unify this Clause with the other, returning a list of resulting, unified, Clauses.

Parameters:
  • other - Clause with which to unify
  • bindings - BindingDict containing bindings that should be used during the unification
  • used - tuple of two lists of atoms. The first lists the atoms from 'self' that were successfully unified with atoms from 'other'. The second lists the atoms from 'other' that were successfully unified with atoms from 'self'.
  • skipped - tuple of two Clauses. The first is a list of all the atoms from the 'self' Clause that have not been unified with anything on the path. The second is same thing for the 'other' Clause.
  • debug - bool indicating whether debug statements should print
Returns:
list containing all the resulting Clauses that could be obtained by unification

isSubsetOf(self, other)

source code 

Return True iff every term in 'self' is a term in 'other'.

Parameters:
  • other - Clause
Returns:
bool

subsumes(self, other)

source code 

Return True iff 'self' subsumes 'other', this is, if there is a substitution such that every term in 'self' can be unified with a term in 'other'.

Parameters:
  • other - Clause
Returns:
bool

__getslice__(self, start, end)
(Slicling operator)

source code 

x[i:j]

Use of negative indices is not supported.

Overrides: list.__getslice__
(inherited documentation)

__add__(self, other)
(Addition operator)

source code 

x+y

Overrides: list.__add__
(inherited documentation)

is_tautology(self)

source code 

Self is a tautology if it contains ground terms P and -P. The ground term, P, must be an exact match, ie, not using unification.

replace(self, variable, expression)

source code 

Replace every instance of variable with expression across every atom in the clause

Parameters:
  • variable - Variable
  • expression - Expression

substitute_bindings(self, bindings)

source code 

Replace every binding

Parameters:
  • bindings - A list of tuples mapping VariableExpressions to the Expressions to which they are bound
Returns:
Clause

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: list.__repr__
(inherited documentation)