Package nltk :: Module util :: Class MinimalSet
[hide private]
[frames] | no frames]

Class MinimalSet

source code

object --+
         |
        MinimalSet

Find contexts where more than one possible target value can appear. E.g. if targets are word-initial letters, and contexts are the remainders of words, then we would like to find cases like "fat" vs "cat", and "training" vs "draining". If targets are parts-of-speech and contexts are words, then we would like to find cases like wind (noun) 'air in rapid motion', vs wind (verb) 'coil, wrap'.

Instance Methods [hide private]
 
__init__(self, parameters=None)
Create a new minimal set.
source code
 
add(self, context, target, display)
Add a new item to the minimal set, having the specified context, target, and display form.
source code
 
contexts(self, minimum=2)
Determine which contexts occurred with enough distinct targets.
source code
 
display(self, context, target, default='') source code
 
display_all(self, context) source code
 
targets(self) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, parameters=None)
(Constructor)

source code 

Create a new minimal set.

Parameters:
  • parameters (list of tuple of string) - The (context, target, display) tuples for the item
Overrides: object.__init__

add(self, context, target, display)

source code 

Add a new item to the minimal set, having the specified context, target, and display form.

Parameters:
  • context (string) - The context in which the item of interest appears
  • target (string) - The item of interest
  • display (string) - The information to be reported for each item

contexts(self, minimum=2)

source code 

Determine which contexts occurred with enough distinct targets.

Parameters:
  • minimum (int @rtype list) - the minimum number of distinct target forms