nltk.misc.minimalset module

class nltk.misc.minimalset.MinimalSet[source]

Bases: object

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’.


Create a new minimal set.


parameters (list(tuple(str, str, str))) – The (context, target, display) tuples for the item

add(context, target, display)[source]

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

  • context (str) – The context in which the item of interest appears

  • target (str) – The item of interest

  • display (str) – The information to be reported for each item


Determine which contexts occurred with enough distinct targets.


minimum (int) – the minimum number of distinct target forms

Return type


display(context, target, default='')[source]