Format: application/x-python-code
⬇ Download File (1.0 KB)
   1  U
   2  
   3  .R�`��@sddlmZGdd�d�ZdS)�)�ngramsc@seZdZddd�ZdS)�Corpus��<s>�</s>cCsZd|_t�|_t�|_t�|_|D]�}|D]4}|j�|d�d|j|<|j�|d�d|j|<q*|j�|d�d|j|<|j�|d�d|j|<t|g||gd�}|D]:}|jd7_||jkr�|j|d7<q�d|j|<q�q"t|j���||g}	|	D]R}
   4  |	D]F}|j|7_|j�|
   5  |fd�||j|
   6  |f<|j||7<�q
   7  �qdS)Nrr�)	�n�dictZ
   8  vocabularyZunigramsZbigrams�getr�list�keys)�selfZcorpus�alpha�start_symbolZ
   9  end_symbol�sentence�wordZgramsZgramZ_vocabulary�wZw2�r�8C:\Users\PC\Pytho\Projects\NLP\brownclustering\corpus.py�__init__s,
  10   zCorpus.__init__N)rrr)�__name__�
  11  __module__�__qualname__rrrrrrsrN)Z	nltk.utilrrrrrr�<module>s