o
    rZh                     @   sL   d dl mZ d dlmZ d dlmZ dd Zdd Zedkr!e  dgZ	d	S )
    )pylab)	gutenberg)Textc                    s   |    dd  dD } fdd|D  fddttD t| j td td t	 tj
tt|dd |D d	d
 t  d S )Nc                 S   s   g | ]\}}|qS  r   ).0item_r   r   D/var/www/auris/lib/python3.10/site-packages/nltk/app/wordfreq_app.py
<listcomp>       z'plot_word_freq_dist.<locals>.<listcomp>2   c                    s   g | ]} | qS r   r   )r   sample)fdr   r	   r
      r   c                    s,   g | ]}t d |d  d    qS )N   g      Y@)sumN)r   ir   valuesr   r	   r
      s   , ZSampleszCumulative Percentagec                 S   s   g | ]}t |qS r   )str)r   sr   r   r	   r
      r   Z   )Zrotation)Zvocabmost_commonrangelenr   titlenameZxlabelZylabelZplotZxticksshow)textZsamplesr   r   r	   plot_word_freq_dist   s   


"r   c                  C   s   t td} t|  d S )Nzmelville-moby_dick.txt)r   r   wordsr   )t1r   r   r	   app   s   r"   __main__N)
Z
matplotlibr   Znltk.corpusr   Z	nltk.textr   r   r"   __name____all__r   r   r   r	   <module>   s   
