+
    ÖÇÜhÝ  ã                   ó†   € ^ RI t ^ RIHtHt ^ RIHtHtHt ^ RIH	t	 R t
 ! R R]4      tR tR	 t]R
8X  d
   ]! 4        R# R# )é    N)ÚCorpusReaderÚSyntaxCorpusReader)ÚFileSystemPathPointerÚfind_corpus_fileidsÚread_blankline_block)ÚDependencyGraphc                 ó2   € R P                  R V  4       4      # )Ú/c              3   óR   "  € T F  q^ ,          R8w  g   K  V^ ,          x € K  	  R# 5i)r   ÚEOSN© ©Ú.0Úms   & Ú9/usr/lib/python3/dist-packages/nltk/corpus/reader/knbc.pyÚ	<genexpr>Ú<lambda>.<locals>.<genexpr>   s    é € Ð-T¹F°qÈÅdÈeÁm¬d¨a°¯dªd»Fùs   ‚'–'©Újoin©Úmorphss   &r   Ú<lambda>r      s   €  S§X¡XÑ-T¹FÓ-TÔ%Tó    c                   óN   a € ] tR t^t o RtR]3R ltR tR tR
R lt	R t
R	tV tR# )ÚKNBCorpusReaderaG  
This class implements:
  - ``__init__``, which specifies the location of the corpus
    and a method for detecting the sentence blocks in corpus files.
  - ``_read_block``, which reads a block from the input stream.
  - ``_word``, which takes a block and returns a list of list of words.
  - ``_tag``, which takes a block and returns a list of list of tagged
    words.
  - ``_parse``, which takes a block and returns a list of parsed
    sentences.

The structure of tagged words:
  tagged_word = (word(str), tags(tuple))
  tags = (surface, reading, lemma, pos1, posid1, pos2, posid2, pos3, posid3, others ...)

Usage example

>>> from nltk.corpus.util import LazyCorpusLoader
>>> knbc = LazyCorpusLoader(
...     'knbc/corpus1',
...     KNBCorpusReader,
...     r'.*/KN.*',
...     encoding='euc-jp',
... )

>>> len(knbc.sents()[0])
9

Úutf8c                ó@   € \         P                  ! WW#4       W@n        R# )zv
Initialize KNBCorpusReader
morphs2str is a function to convert morphlist to str for tree representation
for _parse()
N)r   Ú__init__Ú
morphs2str)ÚselfÚrootÚfileidsÚencodingr   s   &&&&&r   r   ÚKNBCorpusReader.__init__7   s   € ô 	×#Ò# D°ÔBØ$Žr   c                ó   € \        V4      # ©N)r   )r    Ústreams   &&r   Ú_read_blockÚKNBCorpusReader._read_block@   s   € ä# FÓ+Ð+r   c                óä   € . pVP                  4        FY  p\        P                  ! R V4      '       d   K"  VP                  4       P	                  R4      pVP                  V^ ,          4       K[  	  V# )úEOS|\*|\#|\+Ú )Ú
splitlinesÚreÚmatchÚstripÚsplitÚappend)r    ÚtÚresÚlineÚcellss   &&   r   Ú_wordÚKNBCorpusReader._wordD   sU   € ØˆØ—L‘L–NˆDä—8’8˜O¨T×2Ô2ØŸ
™
›×*Ñ*¨3Ó/�Ø—
‘
˜5 �8Ö$ñ	 #ð ˆ
r   Nc                ó  € . pVP                  4        Fq  p\        P                  ! R V4      '       d   K"  VP                  4       P	                  R4      pVP                  V^ ,          RP                  VR,          4      34       Ks  	  V# )r+   r,   ºé   NN)r-   r.   r/   r0   r1   r2   r   )r    r3   Útagsetr4   r5   r6   s   &&&   r   Ú_tagÚKNBCorpusReader._tagO   sg   € ØˆØ—L‘L–NˆDä—8’8˜O¨T×2Ô2ØŸ
™
›×*Ñ*¨3Ó/�à—
‘
˜E !�H c§h¡h¨u°R­yÓ&9Ð:Ö;ñ #ð ˆ
r   c           	     óÖ  € \        4       p^ pVP                  4        EFk  pV^ ,          R9   dÚ   VP                  4       P                  R^4      p\        P
                  ! RV^,          4      pVf   Q hVP                  V,          pVP                  RVRVP                  ^4      R. /4       \        VP                  ^4      4      pVR
8X  d   Wrn
        M)VP                  V,          R,          P                  V4       V^,          pKë  V^ ,          R8w  g   Kû  VP                  4       P                  R4      pV^ ,          RP                  VR	,          4      3p	VP                  V^,
          ,          R,          P                  V	4       EKn  	  V P                  '       d=   VP                  P                  4        F  pV P                  VR,          4      VR&   K   	  VP                  4       # )r   z*+r,   z([\-0-9]*)([ADIP])ÚaddressÚrelÚwordÚdepsÚ#r:   éÿÿÿÿ)r   r-   r0   r1   r.   r/   ÚnodesÚupdateÚgroupÚintr!   r2   r   r   ÚvaluesÚtree)
r    r3   ÚdgÚir5   r6   r   ÚnodeÚ
dep_parentÚmorphs
   &&        r   Ú_parseÚKNBCorpusReader._parseZ   ss  € ÜÓˆØˆØ—L‘L—NˆDØ�A�w˜$Œð Ÿ
™
›×*Ñ*¨3°Ó2�Ü—H’HÐ2°E¸!µHÓ=�à’}Ð$�}à—x‘x •{�Ø—‘˜Y¨¨5°!·'±'¸!³*¸fÀbÐIÔJä  §¡¨£›_�
à Ô#Ø"•Gà—H‘H˜ZÕ(¨Õ0×7Ñ7¸Ô:à�Q•’Ø�a•˜C–àŸ
™
›×*Ñ*¨3Ó/�à˜a� #§(¡(¨5°­9Ó"5Ð5�Ø—‘˜˜Q�• Õ'×.Ñ.¨u×5ñ3 #ð6 �?�?ˆ?ØŸ™Ÿ™Ö)�Ø#Ÿ™¨t°F­|Ó<��V“ñ *ð �w‰w‹yÐr   )r   r&   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú_morphs2str_defaultr   r(   r7   r=   rQ   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r      s0   ø‡ € ñð< 06ÐBUô %ò,òô	÷"ð "r   r   c            	      ó  € ^ RI p ^ RIHp V P                  P	                  R4      p\        \        V4      R4       Uu. uF$  p\        P                  ! RV4      '       g   K"  VNK&  	  ppR pV! R\        \        WER7      R	R
7      p\        VP                  4       R,          4       \        RP                  VP                  4       R,          4      4       \        RP                  R VP                  4       R,           4       4      4       R Vn        \        RP                  R VP                  4       R,           4       4      4       \        RP                  R VP#                  4       R,           4       4      4       R# u upi )r   N©ÚLazyCorpusLoaderzcorpora/knbc/corpus1z.*z\d\-\d\-[\d]+\-[\d]+c                 óž   € V P                  R 4      pV^ ,          \        V^,          4      \        V^,          4      \        V^,          4      3# )Ú-)r1   rI   )Úxr6   s   & r   Ú_knbc_fileids_sortÚ demo.<locals>._knbc_fileids_sort�   s:   € Ø—‘˜“ˆØ�a•œ#˜e A�h›-¬¨U°1­X«¼¸EÀ!½H»ÐFÐFr   úknbc/corpus1)Úkeyúeuc-jp©r#   :Né
   NÚ :Néd   Nz

c              3   ó8   "  € T F  p\        V4      x € K  	  R # 5ir&   )Ústr©r   rK   s   & r   r   Údemo.<locals>.<genexpr>�   s   é € ÐDÑ,C D”c˜$—i�iÓ,Cùs   ‚:Né   Nc                 óP   € R P                  R V  4       4      P                  R4      # )r
   c              3   ó¬   "  € T FJ  q^ ,          R8w  g   K  RP                  V^ ,          V^,          P                  R4      ^,          4      x € KL  	  R# 5i)r   r   z{}({})r,   N©Úformatr1   r   s   & r   r   Ú)demo.<locals>.<lambda>.<locals>.<genexpr>Ÿ   sA   é € ð .Ù;A°aÀqÅTÈUÁ]Ô1ˆ�‰˜˜!�˜a �dŸj™j¨›o¨aÕ0×1Ð1»6ùs
   ‚A–>Azutf-8)r   Úencoder   s   &r   r   Údemo.<locals>.<lambda>Ÿ   s(   €  S§X¡Xñ .Ù;Aó.ó &ç�fˆWƒoð&r   c              3   ó4   "  € T F  pR V,          x € K  	  R# 5i)z%sNr   rm   s   & r   r   rn   £   s   é € ÐFÑ.E d�d˜T—k’kÓ.Eùs   ‚Ú
c              3   óR   "  € T F  pR P                  R V 4       4      x € K  	  R# 5i)r,   c              3   óŽ   "  € T F;  pR P                  V^ ,          V^,          P                  R4      ^,          4      x € K=  	  R# 5i)z{}/{}r,   Nrr   )r   Úws   & r   r   Ú!demo.<locals>.<genexpr>.<genexpr>§   s3   é € ÐLÁtÀ!�W—^‘^ A a¥D¨!¨A­$¯*©*°S«/¸!Õ*<×=Ð=Ãtùs   ‚AANr   )r   Úsents   & r   r   rn   ¦   s)   é € ð 
á0�ð �H‰HÑLÁtÓL×LÐLÛ0ùs   ‚%':r   ro   N)ÚnltkÚnltk.corpus.utilr^   ÚdataÚfindr   r   r.   Úsearchr   ÚsortedÚprintr"   r   ÚwordsÚparsed_sentsr   Útagged_sents)r~   r^   r!   Úfr"   rb   Úknbcs          r   ÚdemorŠ   „   s8  € ÛÝ1à�9‰9�>‰>Ð0Ó1€Dô %Ô%:¸4Ó%@À$ÔGóáGˆAÜ�9Š9Ð,¨a×0÷ 	
ˆÙGð ð òGñ ØÜÜˆwÔ/Øô	€Dô 
ˆ$�,‰,‹.˜Õ
ÔÜ	ˆ"�'‰'�$—*‘*“,˜tÕ$Ó
%Ô&ä	ˆ&�+‰+ÑD¨D×,=Ñ,=Ó,?ÀÖ,CÓDÓ
DÔEñ€D„Oô 
ˆ&�+‰+ÑF¨d×.?Ñ.?Ó.AÀ"Ö.EÓFÓ
FÔGä	Ø�	‰	ñ 
à×)Ñ)Ó+¨CÖ0ó
ó 	
öùò9s   ½FÁ!Fc                  ó¶  € ^ RI Hp  V ! R\        RRR7      p\        VP	                  4       ^ ,          \
        4      '       g   Q h\        VP                  4       ^ ,          ^ ,          \
        4      '       g   Q h\        VP                  4       ^ ,          \        4      '       g   Q h\        VP                  4       ^ ,          ^ ,          \        4      '       g   Q hR# )r   r]   rd   z.*/KN.*rf   rg   N)
r   r^   r   Ú
isinstancer…   rl   ÚsentsÚtagged_wordsÚtupler‡   )r^   r‰   s     r   Útestr�   ­   s    € Ý1áØœ¨¸hô€Dô �d—j‘j“l 1•o¤s×+Ò+Ð+Ð+Ü�d—j‘j“l 1•o aÕ(¬#×.Ò.Ð.Ð.Ü�d×'Ñ'Ó)¨!Õ,¬e×4Ò4Ð4Ð4Ü�d×'Ñ'Ó)¨!Õ,¨QÕ/´×7Ò7Ð7Ò7r   Ú__main__)r.   Únltk.corpus.reader.apir   r   Únltk.corpus.reader.utilr   r   r   Ú
nltk.parser   rX   r   rŠ   r�   rS   r   r   r   Ú<module>r•      sT   ðó 
ç C÷ñ õ
 'ñ UÐ ôdÐ(ô dòX&òR	8ð ˆzÔÙ†Fñ r   