nltk.draw.dispersion module

A utility for displaying lexical dispersion.

nltk.draw.dispersion.dispersion_plot(text, words, ignore_case=False, title='Lexical Dispersion Plot')[source]

Generate a lexical dispersion plot.

Parameters
  • text (list(str) or iter(str)) – The source text

  • words (list of str) – The target words

  • ignore_case (bool) – flag to set if case should be ignored when searching text

Returns

a matplotlib Axes object that may still be modified before plotting

Return type

Axes