a
     ˜ëjø
  ã                   @   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   úZ/mnt/bigstor/www/usecases/.venv/lib/python3.9/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                    s   t ‡ fdd„ˆ  |d¡D ƒƒS )Nc                    s    g | ]\}}t |ˆ j|d �‘qS ©)Úencoding)ÚStreamBackedCorpusViewÚ_read_obj_block©Ú.0ZfileidÚencr   r   r   Ú
<listcomp>E   s   ÿz8PPAttachmentCorpusReader.attachments.<locals>.<listcomp>T©ÚconcatZabspaths©r   Zfileidsr   r   r   ÚattachmentsC   s
    

þÿz$PPAttachmentCorpusReader.attachmentsc                    s   t ‡ fdd„ˆ  |d¡D ƒƒS )Nc                    s    g | ]\}}t |ˆ j|d �‘qS r   )r   Ú_read_tuple_blockr   r   r   r   r   M   s   ÿz3PPAttachmentCorpusReader.tuples.<locals>.<listcomp>Tr   r    r   r   r   ÚtuplesK   s
    

þÿzPPAttachmentCorpusReader.tuplesc                 C   s"   |  ¡ }|rt| ¡ ƒgS g S d S r   )ÚreadlineÚtupleÚsplit©r   ÚstreamÚliner   r   r   r"   S   s    z*PPAttachmentCorpusReader._read_tuple_blockc                 C   s"   |  ¡ }|rt| ¡ Ž gS g S d S r   )r$   r   r&   r'   r   r   r   r   Z   s    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    