+
    ÖÇÜh¦$  ã                   ó
  € R t ^ RIt^ RI5 ^ RI5 ^ RIHt ^ RIHt ]P                  R4      t
]P                  R4      t]P                  R4      t]P                  R4      t ! R	 R
]4      t ! R R]]4      t ! R R]4      tR# )zO
Corpus reader for corpora that consist of parenthesis-delineated parse trees.
N)Ú*)Úmap_tag)ÚTreez\((\d+) ([^\s()]+) ([^\s()]+)\)z\(([^\s()]+) ([^\s()]+)\)z\([^\s()]+ ([^\s()]+)\)z
\s*\(\s*\(c                   óP   a € ] tR t^t o RtR
R ltR tR tR tRR lt	R t
R	tV tR# )ÚBracketParseCorpusReaderzË
Reader for corpora that consist of parenthesis-delineated parse trees,
like those found in the "combined" section of the Penn Treebank,
e.g. "(S (NP (DT the) (JJ little) (NN dog)) (VP (VBD barked)))".

Nc                óV   € \         P                  WW%4       W0n        W@n        W`n        R# )ag  
:param root: The root directory for this corpus.
:param fileids: A list or regexp specifying the fileids in this corpus.
:param comment_char: The character which can appear at the start of
    a line to indicate that the rest of the line is a comment.
:param detect_blocks: The method that is used to find blocks
    in the corpus; can be 'unindented_paren' (every unindented
    parenthesis starts a new parse) or 'sexpr' (brackets are
    matched).
:param tagset: The name of the tagset used by this corpus, to be used
    for normalizing or converting the POS tags returned by the
    ``tagged_...()`` methods.
N)ÚSyntaxCorpusReaderÚ__init__Ú_comment_charÚ_detect_blocksÚ_tagset)ÚselfÚrootÚfileidsÚcomment_charÚdetect_blocksÚencodingÚtagsets   &&&&&&&ÚB/usr/lib/python3/dist-packages/nltk/corpus/reader/bracket_parse.pyr	   Ú!BracketParseCorpusReader.__init__"   s%   € ô, 	×#Ñ# D°ÔBØ)ÔØ+ÔØŽó    c           	     ó˜  € V P                   R 8X  d   \        WP                  R7      # V P                   R8X  d   \        V4      # V P                   R8X  dl   \	        VRR7      pV P                  '       dK   V Uu. uF>  p\
        P                  R\
        P                  V P                  4      ,          RV4      NK@  	  ppV# Q R4       hu upi )	Úsexpr)r   Ú	blanklineÚunindented_parenz^\()Ústart_rez	(?m)^%s.*Ú zbad block type)r   Úread_sexpr_blockr
   Úread_blankline_blockÚread_regexp_blockÚreÚsubÚescape)r   ÚstreamÚtoksÚtoks   &&  r   Ú_read_blockÚ$BracketParseCorpusReader._read_block=   s»   € Ø×Ñ 'Ô)Ü# F×9KÑ9KÔLÐLØ× Ñ  KÔ/Ü'¨Ó/Ð/Ø× Ñ Ð$6Ô6ä$ V°fÔ=ˆDà×!×!Ð!ñ  $óá#˜ô —F‘F˜;¬¯©°4×3EÑ3EÓ)FÕFÈÈCÖPÙ#ð ð ð ˆKà&Ð&Ó&�1ùòs   Á8ACc                ób   € \         P                  R RV4      p\         P                  RRV4      pV# )z\((.)\)z(\1 \1)z"\(([^\s()]+) ([^\s()]+) [^\s()]+\)ú(\1 \2)©r    r!   ©r   Úts   &&r   Ú
_normalizeÚ#BracketParseCorpusReader._normalizeO   s,   € ä�F‰F�:˜z¨1Ó-ˆä�F‰FÐ8¸*ÀaÓHˆØˆr   c           	     ó¨  €  \         P                  ! V P                  V4      4      pVP                  4       R 8X  d   \	        V4      ^8X  d
   V^ ,          # V#   \
         dð   p\        P                  P                  R4       TP                  R8X  d|   \        ^^4       Fk  p \        T P                  TRT,          ,           4      4      p\        P                  P                  RT,          4       Tu u Rp?#   \
         d     Ki  i ; i	  \        P                  P                  R4       \        RT P                  T4      4      u Rp?# Rp?ii ; i)r   z(Bad tree detected; trying to recover...
Ú)z(  Recovered by adding %d close paren(s)
Nz'  Recovered by returning a flat parse.
ÚS)zmismatched parens)r   Ú
fromstringr-   ÚlabelÚlenÚ
ValueErrorÚsysÚstderrÚwriteÚargsÚrangeÚ_tag)r   r,   ÚtreeÚeÚnÚvs   &&    r   Ú_parseÚBracketParseCorpusReader._parseV   s  € ð	+Ü—?’? 4§?¡?°1Ó#5Ó6ˆDà�z‰z‹|˜rÔ!¤c¨$£i°1¤nØ˜A•w�à�øäô 	+Ü�J‰J×ÑÐHÔIà�v‰vÐ/Ô/Ü˜q !ž�AðÜ  §¡°°S¸1µWµÓ!=Ó>˜ÜŸ
™
×(Ñ(ØJÈQÕNôð  !ŸøÜ%ô Úðúñ %ô �J‰J×ÑÐGÔHä˜˜TŸY™Y q›\Ó*Õ*ûð!	+úsO   ‚AA ÁA ÁEÁ"?EÂ"AC9Ã1EÃ3EÃ9DÄEÄDÄ>EÅEÅEc           
     ó  € \         P                  V P                  V4      4       UUu. uF  w  r4WC3NK
  	  pppV'       d<   W P                  8w  d,   V UUu. uF  w  rCV\	        V P                  W#4      3NK  	  pppV# u uppi u uppi ©N)ÚTAGWORDÚfindallr-   r   r   )r   r,   r   ÚpÚwÚtagged_sents   &&&   r   r;   ÚBracketParseCorpusReader._tagq   s{   € Ü,3¯O©O¸D¿O¹OÈAÓ<NÔ,OÔPÑ,O¡& 1˜“vÑ,OˆÑPß�f§¡Ô,áDOôÙDO¹&¸1�”G˜DŸL™L¨&Ó4Ó5ÁKð ñ ð Ðùó Qùós   ¨A>Á#Bc                óJ   € \         P                  V P                  V4      4      # rC   )ÚWORDrE   r-   r+   s   &&r   Ú_wordÚBracketParseCorpusReader._wordy   s   € Ü�|‰|˜DŸO™O¨AÓ.Ó/Ð/r   )r
   r   r   )Nr   Úutf8NrC   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r	   r&   r-   r@   r;   rL   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      s-   ø‡ € ñôò6'ò$ò+ô6÷0ð 0r   r   c                   ó�   a a€ ] tR t^}t oRtR tR
V 3R lltR
V 3R lltR
V 3R lltRV 3R llt	RV 3R llt
RV 3R lltR	tVtV ;t# )Ú#CategorizedBracketParseCorpusReaderzš
A reader for parsed corpora whose documents are
divided into categories based on their file identifiers.
@author: Nathan Schneider <nschneid@cs.cmu.edu>
c                ód   € \         P                  W4       \        P                  ! V .VO5/ VB  R# )a<  
Initialize the corpus reader.  Categorization arguments
(C{cat_pattern}, C{cat_map}, and C{cat_file}) are passed to
the L{CategorizedCorpusReader constructor
<CategorizedCorpusReader.__init__>}.  The remaining arguments
are passed to the L{BracketParseCorpusReader constructor
<BracketParseCorpusReader.__init__>}.
N)ÚCategorizedCorpusReaderr	   r   )r   r9   Úkwargss   &*,r   r	   Ú,CategorizedBracketParseCorpusReader.__init__†   s*   € ô 	 ×(Ñ(¨Ô6Ü ×)Ò)¨$Ð@°Ò@¸Ô@r   c                óB   <€ \         SV `  V P                  W4      V4      # rC   )ÚsuperÚtagged_wordsÚ_resolve©r   r   Ú
categoriesr   Ú	__class__s   &&&&€r   r`   Ú0CategorizedBracketParseCorpusReader.tagged_words’   ó   ø€ Ü‰wÑ# D§M¡M°'Ó$FÈÓOÐOr   c                óB   <€ \         SV `  V P                  W4      V4      # rC   )r_   Útagged_sentsra   rb   s   &&&&€r   rh   Ú0CategorizedBracketParseCorpusReader.tagged_sents•   rf   r   c                óB   <€ \         SV `  V P                  W4      V4      # rC   )r_   Útagged_parasra   rb   s   &&&&€r   rk   Ú0CategorizedBracketParseCorpusReader.tagged_paras˜   rf   r   c                ó@   <€ \         SV `  V P                  W4      4      # rC   )r_   Úparsed_wordsra   ©r   r   rc   rd   s   &&&€r   rn   Ú0CategorizedBracketParseCorpusReader.parsed_words›   ó   ø€ Ü‰wÑ# D§M¡M°'Ó$FÓGÐGr   c                ó@   <€ \         SV `  V P                  W4      4      # rC   )r_   Úparsed_sentsra   ro   s   &&&€r   rs   Ú0CategorizedBracketParseCorpusReader.parsed_sentsž   rq   r   c                ó@   <€ \         SV `  V P                  W4      4      # rC   )r_   Úparsed_parasra   ro   s   &&&€r   rv   Ú0CategorizedBracketParseCorpusReader.parsed_paras¡   rq   r   © )NNN)NN)rO   rP   rQ   rR   rS   r	   r`   rh   rk   rn   rs   rv   rT   rU   Ú__classcell__)rd   rW   s   @@r   rY   rY   }   s:   ù‡ € ñò
A÷P÷P÷P÷H÷H÷H÷ Hr   rY   c                   óH   a € ] tR t^¥t o RtRR ltR	R ltR
R ltR tRt	V t
R# )ÚAlpinoCorpusReadera¯  
Reader for the Alpino Dutch Treebank.
This corpus has a lexical breakdown structure embedded, as read by `_parse`
Unfortunately this puts punctuation and some other words out of the sentence
order in the xml element tree. This is no good for `tag_` and `word_`
`_tag` and `_word` will be overridden to use a non-default new parameter 'ordered'
to the overridden _normalize function. The _parse function can then remain
untouched.
Nc           	     ó<   € \         P                  V VR RVVR7       R# )zalpino\.xmlr   )r   r   r   N)r   r	   )r   r   r   r   s   &&&&r   r	   ÚAlpinoCorpusReader.__init__°   s'   € Ü ×)Ñ)ØØØØ%ØØð 	*ö 	
r   c                óL  € VR,          R8w  d   R# \         P                  RRV4      pV'       d   \         P                  RRV4      pM\         P                  RR	V4      p\         P                  R
RV4      p\         P                  RRV4      p\         P                  RRV4      pV# )a=  Normalize the xml sentence element in t.
The sentence elements <alpino_ds>, although embedded in a few overall
xml elements, are separated by blank lines. That's how the reader can
deliver them one at a time.
Each sentence has a few category subnodes that are of no use to us.
The remaining word nodes may or may not appear in the proper order.
Each word node has attributes, among which:
- begin : the position of the word in the sentence
- pos   : Part of Speech: the Tag
- word  : the actual word
The return value is a string with all xml elementes replaced by
clauses: either a cat clause with nested clauses, or a word clause.
The order of the bracket clauses closely follows the xml.
If ordered == True, the word clauses include an order sequence number.
If ordered == False, the word clauses only have pos and word parts.
:Né
   Nz
<alpino_dsr   z  <node .*? cat="(\w+)".*>z(\1z>  <node. *?begin="(\d+)".*? pos="(\w+)".*? word="([^"]+)".*?/>z
(\1 \2 \3)z-  <node .*?pos="(\w+)".*? word="([^"]+)".*?/>r)   z	  </node>r0   z<sentence>.*</sentence>z</?alpino_ds.*>r*   )r   r,   Úordereds   &&&r   r-   ÚAlpinoCorpusReader._normalizeº   s“   € ð" ˆS�6�\Ô!Ùä�F‰FÐ0°&¸!Ó<ˆßÜ—‘ØQØØó‰Aô —‘ÐGÈÐUVÓWˆAÜ�F‰F�<  qÓ)ˆÜ�F‰FÐ-¨s°AÓ6ˆÜ�F‰FÐ% s¨AÓ.ˆØˆr   c                óž  € \         P                  V P                  VR R7      4       UUUu. uF  w  r4p\        V4      WT3NK  	  ppppVP	                  4        V'       d@   W P
                  8w  d0   V UUUu. uF  w  r5qE\        V P
                  W$4      3NK  	  ppppV# V UUUu. uF	  w  r5qEV3NK  	  ppppV# u upppi u upppi u upppi )T)r€   )Ú
SORTTAGWRDrE   r-   ÚintÚsortr   r   )r   r,   r   ÚorF   rG   rH   s   &&&    r   r;   ÚAlpinoCorpusReader._tagÜ   sÊ   € ô (×/Ñ/°·±ÀÈ4°Ó0PÔQõ
áQ‘	��qô �‹V�Q‹NÙQð 	ò 
ð 	×ÑÔß�f§¡Ô,áGRõÙGR¹)¸1À”G˜DŸL™L¨&Ó4Ó5Á{ð ò ð
 Ðñ 4?Õ?±;¡i q¨Q˜q›6±;ˆKÒ?ØÐùô
ùôùô @s   «B:Á6#CÂ%Cc                ó\   € V P                  V4      pV UUu. uF  w  r4VNK	  	  upp# u uppi )z(Return a correctly ordered list if words)r;   )r   r,   rH   rG   rF   s   &&   r   rL   ÚAlpinoCorpusReader._wordê   s)   € à—i‘i “lˆÙ +Ô,¡‘f�q“¡Ò,Ð,ùÓ,s   —(rx   )z
ISO-8859-1N)FrC   )rO   rP   rQ   rR   rS   r	   r-   r;   rL   rT   rU   rV   s   @r   r{   r{   ¥   s$   ø‡ € ñô
ô ôD÷-ð -r   r{   )rS   r6   Únltk.corpus.reader.apiÚnltk.corpus.reader.utilÚnltk.tagr   Ú	nltk.treer   r    Úcompilerƒ   rD   rK   ÚEMPTY_BRACKETSr   r   r[   rY   r{   rx   r   r   Ú<module>r�      sŠ   ðñó ä $Ü %Ý Ý ð �Z‰ZÐ:Ó;€
Ø
�*‰*Ð1Ó
2€Ø	‡z�zÐ,Ó-€Ø—‘˜MÓ*€ô`0Ð1ô `0ôF%HØÐ5ô%HôPH-Ð1ö H-r   