code: def dispersion(
      search_terms,
      corpus,
      y=None,
      ax=None,
      colors=None,
      colormap=None,
      annotate_docs=False,
      ignore_case=False,
      labels=None,
      show=True,
      **kwargs,
  ):
      """Displays lexical dispersion plot for words in a corpus
  
      This helper function is a quick wrapper to utilize the DispersionPlot
      Visualizer for one-off analysis
  
      Parameters
      ----------
  
      search_terms : list
          A list of words whose dispersion will be examined within a corpus
  
      corpus : list
          Should be provided as a list of documents that contain
          a list of words in the order they appear in the document.
  
      y : ndarray or Series of length n
          An optional array or series of target or class values for
          instances. If this is specified, then the points will be colored
          according to their class.
  
      ax : matplotlib axes, default: None
          The axes to plot the figure on.
  
      colors : list or tuple of colors
          Specify the colors for each individual class. Will override colormap if both are
          provided.
  
      colormap : string or matplotlib cmap
          Qualitative colormap for discrete target
  
      annotate_docs : boolean, default: False
          Specify whether document boundaries will be displayed.  Vertical lines
          are positioned at the end of each document.
  
      ignore_case : boolean, default: False
          Specify whether input  will be case-sensitive.
  
      labels : list of strings
          The names of the classes in the target, used to create a legend.
          Labels must match names of classes in sorted order.
  
      show : bool, default: True
          If True, calls ``show()``, which in turn calls ``plt.show()`` however
          you cannot call ``plt.savefig`` from this signature, nor
          ``clear_figure``. If False, simply calls ``finalize()``
  
      kwargs : dict
          Pass any additional keyword arguments to the super class.
  
      Returns
      -------
      viz: DispersionPlot
          Returns the fitted, finalized visualizer
      """
  
      # Instantiate the visualizer
      visualizer = DispersionPlot(
          search_terms,
          ax=ax,
          colors=colors,
          colormap=colormap,
          ignore_case=ignore_case,
          labels=labels,
          annotate_docs=annotate_docs,
          **kwargs,
      )
  
      visualizer.fit(corpus, y, **kwargs)
  
      if show:
          visualizer.show()
      else:
          visualizer.finalize()
  
      return visualizer
  
file_path: yellowbrick/yellowbrick/text/dispersion.py
imports: import itertools
  from collections import defaultdict
  import numpy
  from yellowbrick.text.base import TextVisualizer
  from yellowbrick.style.colors import resolve_colors
  from yellowbrick.exceptions import YellowbrickValueError
label_desc: Use image node_id 1 for calling a global function with example usage: dispersion(search_terms, corpus, y, ax, colors, colormap, annotate_docs, ignore_case, labels, show) and returns: visualizer