o
    rZh
                     @   s6   d Z ddlT ddlT G dd dZG dd deZdS )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                   @   s   e Zd Zdd Zdd ZdS )PPAttachmentc                 C   s(   || _ || _|| _|| _|| _|| _d S Nsentverbnoun1prepnoun2
attachment)selfr   r   r   r	   r
   r    r   J/var/www/auris/lib/python3.10/site-packages/nltk/corpus/reader/ppattach.py__init__.   s   
zPPAttachment.__init__c                 C   s    d| j | j| j| j| j| jf S )NzJPPAttachment(sent=%r, verb=%r, noun1=%r, prep=%r, noun2=%r, attachment=%r)r   r   r   r   r   __repr__6   s   zPPAttachment.__repr__N)__name__
__module____qualname__r   r   r   r   r   r   r   -   s    r   c                   @   s0   e Zd ZdZdd Zdd Zdd Zdd	 Zd
S )PPAttachmentCorpusReaderz=
    sentence_id verb noun1 preposition noun2 attachment
    c                       t  fdd |dD S )Nc                        g | ]\}}t | j|d qS )encoding)StreamBackedCorpusView_read_obj_block.0Zfileidencr   r   r   
<listcomp>E       z8PPAttachmentCorpusReader.attachments.<locals>.<listcomp>TconcatZabspathsr   Zfileidsr   r   r   attachmentsC   
   

z$PPAttachmentCorpusReader.attachmentsc                    r   )Nc                    r   r   )r   _read_tuple_blockr   r   r   r   r   M   r    z3PPAttachmentCorpusReader.tuples.<locals>.<listcomp>Tr!   r#   r   r   r   tuplesK   r%   zPPAttachmentCorpusReader.tuplesc                 C   s   |  }|rt| gS g S r   )readlinetuplesplitr   streamliner   r   r   r&   S      z*PPAttachmentCorpusReader._read_tuple_blockc                 C   s   |  }|rt|  gS g S r   )r(   r   r*   r+   r   r   r   r   Z   r.   z(PPAttachmentCorpusReader._read_obj_blockN)r   r   r   __doc__r$   r'   r&   r   r   r   r   r   r   >   s    r   N)r/   Znltk.corpus.reader.apiZnltk.corpus.reader.utilr   ZCorpusReaderr   r   r   r   r   <module>   s
    