
    Ng                     \    d dl mZ d dlmZ d dlmZ d Zd Zedk    r
 e             dgZ	dS )	    )pylab)	gutenberg)Textc                 $   |                                  d                     d          D             }fd|D             fdt          t                              D             t	          j        | j                   t	          j        d           t	          j        d           t	          j	                   t	          j
        t          t          |                    d |D             d	           t	          j                     d S )
Nc                     g | ]\  }}|S  r   ).0item_s      Q/var/www/html/ai-engine/env/lib/python3.11/site-packages/nltk/app/wordfreq_app.py
<listcomp>z'plot_word_freq_dist.<locals>.<listcomp>   s    666at666    2   c                      g | ]
}|         S r   r   )r	   samplefds     r   r   z'plot_word_freq_dist.<locals>.<listcomp>   s    ///Vbj///r   c                 t    g | ]4}t          d |dz                      dz                                  z  5S )N   g      Y@)sumN)r	   ir   valuess     r   r   z'plot_word_freq_dist.<locals>.<listcomp>   s?    PPPc&1q5/""U*RTTVV3PPPr   SampleszCumulative Percentagec                 ,    g | ]}t          |          S r   )str)r	   ss     r   r   z'plot_word_freq_dist.<locals>.<listcomp>   s    &?&?&?!s1vv&?&?&?r   Z   )rotation)vocabmost_commonrangelenr   titlenamexlabelylabelplotxticksshow)textsamplesr   r   s     @@r   plot_word_freq_distr,      s    	B662>>"#5#5666G////w///FPPPPPU3v;;=O=OPPPF	K		L	L()))	Jv	Ls7||$$&?&?w&?&?&?"MMMM	JLLLLLr   c                  f    t          t          j        d                    } t          |            d S )Nzmelville-moby_dick.txt)r   r   wordsr,   )t1s    r   appr0      s.    	io677	8	8Br   __main__r0   N)

matplotlibr   nltk.corpusr   	nltk.textr   r,   r0   __name____all__r   r   r   <module>r7      s~          ! ! ! ! ! !          
 zCEEE'r   