
    Ngg                         d Z d
dZedk    r;ddlmZ ddlmZ g dZ e ej        d	          e            ej	                     dS dS )z.
A utility for displaying lexical dispersion.
FLexical Dispersion Plotc           	         	 ddl m} n"# t          $ r}t          d          |d}~ww xY wfdt          t	          |                    D             }g g }}t          |           D ]^\  }	}
r|
                                n|
}
|                    |
          }|*|                    |	           |                    |           _|ddd         } |j                    \  }}|	                    ||d           dt          |           dz
  c|j        _        |j        _        |                    d	           |                    t!          t#          t          |                              |d
           |                    dt          |                     |                    |           |                    d           |S )a  
    Generate a lexical dispersion plot.

    :param text: The source text
    :type text: list(str) or iter(str)
    :param words: The target words
    :type words: list of str
    :param ignore_case: flag to set if case should be ignored when searching text
    :type ignore_case: bool
    :return: a matplotlib Axes object that may still be modified before plotting
    :rtype: Axes
        NzRThe plot function requires matplotlib to be installed. See https://matplotlib.org/c                 H    i | ]\  }}r|                                 n||S  )casefold).0ywordignore_cases      P/var/www/html/ai-engine/env/lib/python3.11/site-packages/nltk/draw/dispersion.py
<dictcomp>z#dispersion_plot.<locals>.<dictcomp>#   s@       At '0D!      |   x)axisC0)colorzWord Offset)matplotlib.pyplotpyplotImportError	enumeratereversedr   getappendsubplotsplotlendataLimx0x1	autoscale
set_ytickslistrangeset_ylim	set_title
set_xlabel)textwordsr   titleplteword2yxsysr   tokenr	   _axs     `           r   dispersion_plotr5      s   '''''''   *
 
 	    %11  F BdOO  5$/:   UJJu=IIaLLLIIaLLL$$B$KECLNNEArGGBC#$c$ii!m BJM2:=LLcLMM$uSZZ(())5M===KKCJJLLMM-   Is   
 
)$)__main__r   N)	gutenberg)ElinorMarianneEdward
Willoughbyzausten-sense.txt)Fr   )
__doc__r5   __name__r   r   r-   nltk.corpusr7   r+   showr   r   r   <module>r@      s    
, , , ,^ z######%%%%%%:::EOOIO$677???CHJJJJJ r   