nltk.ContextIndex.common_contexts

ContextIndex.common_contexts(words, fail_on_unknown=False)[source]

Find contexts where the specified words can all appear; and return a frequency distribution mapping each context to the number of times that context was used.

Parameters:
  • words (str) – The words used to seed the similarity search
  • fail_on_unknown – If true, then raise a value error if any of the given words do not occur at all in the index.