
    '[f2                     b    d dl T d dlT d dlmZ d dlT  G d de          Z G d de          ZdS )    )*DependencyGraphc                   l    e Zd Zd e             edd          efdZddZddZdd	Z	dd
Z
ddZdS )DependencyCorpusReaderutf8
T)gapsc                 @    t                               | |||           d S N)SyntaxCorpusReader__init__)selfrootfileidsencodingword_tokenizersent_tokenizerpara_block_readers          Q/var/www/piapp/venv/lib/python3.11/site-packages/nltk/corpus/reader/dependency.pyr   zDependencyCorpusReader.__init__   s$     	##D$BBBBB    Nc                 ^    t          d |                     |d          D                       S )Nc           	      <    g | ]\  }}t          |d d d |          S )Fr   DependencyCorpusView.0fileidencs      r   
<listcomp>z0DependencyCorpusReader.words.<locals>.<listcomp>    s?       FC %VUE53OOO  r   Tinclude_encodingconcatabspathsr   r   s     r   wordszDependencyCorpusReader.words   @     #'==4=#P#P  
 
 	
r   c                 ^    t          d |                     |d          D                       S )Nc           	      <    g | ]\  }}t          |d dd|          S TFr   r   r   s      r   r!   z7DependencyCorpusReader.tagged_words.<locals>.<listcomp>(   s?       FC %VT5%#NNN  r   Tr"   r$   r'   s     r   tagged_wordsz#DependencyCorpusReader.tagged_words&   r)   r   c                 ^    t          d |                     |d          D                       S )Nc           	      <    g | ]\  }}t          |d dd |          S FTr   r   r   s      r   r!   z0DependencyCorpusReader.sents.<locals>.<listcomp>0   s?       FC %VUD%#NNN  r   Tr"   r$   r'   s     r   sentszDependencyCorpusReader.sents.   r)   r   c                 ^    t          d |                     |d          D                       S )Nc           	      <    g | ]\  }}t          |d d d|          S r,   r   r   s      r   r!   z7DependencyCorpusReader.tagged_sents.<locals>.<listcomp>8   s?       FC %VT4MMM  r   Tr"   r$   r'   s     r   tagged_sentsz#DependencyCorpusReader.tagged_sents6   r)   r   c                 v    t          d |                     |d          D                       }d |D             S )Nc           	      <    g | ]\  }}t          |d dd|          S r0   r   r   s      r   r!   z7DependencyCorpusReader.parsed_sents.<locals>.<listcomp>@   s?       FC %VUD$MMM  r   Tr"   c                 ,    g | ]}t          |          S  r   )r   sents     r   r!   z7DependencyCorpusReader.parsed_sents.<locals>.<listcomp>E   s     888$%%888r   r$   )r   r   r1   s      r   parsed_sentsz#DependencyCorpusReader.parsed_sents>   sS     #'==4=#P#P  
 
 98%8888r   r   )__name__
__module____qualname__TabTokenizerRegexpTokenizerread_blankline_blockr   r(   r-   r1   r4   r:   r8   r   r   r   r      s        
 #|~~&t$777.	C 	C 	C 	C
 
 
 

 
 
 

 
 
 

 
 
 
9 9 9 9 9 9r   r   c                   $    e Zd ZdZ	 	 ddZd ZdS )r   z-DOCSTART- -DOCSTART- O
Nr   c                 x    || _         || _        || _        || _        t                              | ||           d S )Nr   )_tagged_dependencies_group_by_sent_chunk_typesStreamBackedCorpusViewr   )r   corpus_filetaggedgroup_by_sentdependencieschunk_typesr   s          r   r   zDependencyCorpusView.__init__K   sD     )+'''kH'MMMMMr   c                 l   t          |          d                                         }|                    | j                  r.|t	          | j                  d                                          }| j        sd |                    d          D             }t	          |d                   dk    st	          |d                   dk    rd |D             }n5t	          |d                   dk    rd |D             }nt          d	          | j	        sd
 |D             }| j
        r|gS t          |          S )Nr   c                 8    g | ]}|                     d           S )	)splitr   lines     r   r!   z3DependencyCorpusView.read_block.<locals>.<listcomp>c   s$    CCC$TZZ%%CCCr   r	         c                 .    g | ]}|d          |d         fS )r      r8   rQ   s     r   r!   z3DependencyCorpusView.read_block.<locals>.<listcomp>e   %    ===ta$q'*===r   
   c                 .    g | ]}|d          |d         fS )rV   rT   r8   rQ   s     r   r!   z3DependencyCorpusView.read_block.<locals>.<listcomp>g   rW   r   z3Unexpected number of fields in dependency tree filec                     g | ]\  }}|S r8   r8   )r   wordtags      r   r!   z3DependencyCorpusView.read_block.<locals>.<listcomp>m   s    555$555r   )r@   strip
startswith	_DOCSTARTlenlstriprD   rP   
ValueErrorrC   rE   list)r   streamr9   liness       r   
read_blockzDependencyCorpusView.read_blockZ   s>   #F++A.4466??4>** 	8DN++--.5577D ! 	6CC$**T2B2BCCCE58}}!!Sq]]a%7%7==u===U1X"$$==u=== !VWWW < 655555  	6M::r   )Nr   )r;   r<   r=   r_   r   rf   r8   r   r   r   r   H   sH        +I N N N N    r   r   N)	nltk.corpus.reader.apinltk.corpus.reader.util
nltk.parser   nltk.tokenizer   r   rG   r   r8   r   r   <module>rk      s    % $ $ $ % % % % & & & & & &    59 59 59 59 59/ 59 59 59p+ + + + +1 + + + + +r   