
    g
                     F    d Z ddl ddl  G d d      Z G d de      Zy)a  
Read lines from the Prepositional Phrase Attachment Corpus.

The PP Attachment Corpus contains several files having the format:

sentence_id verb noun1 preposition noun2 attachment

For example:

42960 gives authority to administration V
46742 gives inventors of microchip N

The PP attachment is to the verb phrase (V) or noun phrase (N), i.e.:

(VP gives (NP authority) (PP to administration))
(VP gives (NP inventors (PP of microchip)))

The corpus contains the following files:

training:   training set
devset:     development test set, used for algorithm development.
test:       test set, used to report results
bitstrings: word classes derived from Mutual Information Clustering for the Wall Street Journal.

Ratnaparkhi, Adwait (1994). A Maximum Entropy Model for Prepositional
Phrase Attachment.  Proceedings of the ARPA Human Language Technology
Conference.  [http://www.cis.upenn.edu/~adwait/papers/hlt94.ps]

The PP Attachment Corpus is distributed with NLTK with the permission
of the author.
    )*c                       e Zd Zd Zd Zy)PPAttachmentc                 X    || _         || _        || _        || _        || _        || _        y Nsentverbnoun1prepnoun2
attachment)selfr	   r
   r   r   r   r   s          P/var/www/openai/venv/lib/python3.12/site-packages/nltk/corpus/reader/ppattach.py__init__zPPAttachment.__init__.   s,    		
	
$    c                     d| j                   d| j                  d| j                  d| j                  d| j                  d| j
                  dS )NzPPAttachment(sent=z, verb=z, noun1=z, prep=z, noun2=z, attachment=)r   )r   s    r   __repr__zPPAttachment.__repr__6   s4     yy$))TZZDJJY	
r   N)__name__
__module____qualname__r   r    r   r   r   r   -   s    %
r   r   c                   (    e Zd ZdZd Zd Zd Zd Zy)PPAttachmentCorpusReaderz=
    sentence_id verb noun1 preposition noun2 attachment
    c                     t        | j                  |d      D cg c]  \  }}t        || j                  |       c}}      S c c}}w NT)encoding)concatabspathsStreamBackedCorpusView_read_obj_blockr   fileidsfileidencs       r   attachmentsz$PPAttachmentCorpusReader.attachmentsC   sO     &*]]7D%A%AMVS 'vt/C/CcR%A
 	
   "A
c                     t        | j                  |d      D cg c]  \  }}t        || j                  |       c}}      S c c}}w r   )r   r    r!   _read_tuple_blockr#   s       r   tupleszPPAttachmentCorpusReader.tuplesK   sP     &*]]7D%A%AMVS 'vt/E/EPST%A
 	
r(   c                 ^    |j                         }|rt        |j                               gS g S r   )readlinetuplesplitr   streamlines      r   r*   z*PPAttachmentCorpusReader._read_tuple_blockS   s*     $**,'((Ir   c                 X    |j                         }|rt        |j                          gS g S r   )r-   r   r/   r0   s      r   r"   z(PPAttachmentCorpusReader._read_obj_blockZ   s*      $**,/00Ir   N)r   r   r   __doc__r'   r+   r*   r"   r   r   r   r   r   >   s    

r   r   N)r4   nltk.corpus.reader.apinltk.corpus.reader.utilr   CorpusReaderr   r   r   r   <module>r8      s)   @ % %
 
"!| !r   