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

__init__(parameters=None)[source]

Create a new minimal set.

Parameters:

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.

Parameters:
  • 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

contexts(minimum=2)[source]

Determine which contexts occurred with enough distinct targets.

Parameters:

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

Return type:

list

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