+
    ÖÇÜhë$  ã                   óv   € R t ^ RIHt ^ RIHtHtHt  ! R R]4      tRR lt ! R R]	4      t
 ! R	 R
]4      tR# )zACorpus reader for the XML version of the British National Corpus.)Úconcat)ÚElementTreeÚXMLCorpusReaderÚXMLCorpusViewc                   óf   a € ] tR t^t o RtRR ltRR ltRR ltRR ltRR lt	RR lt
R	 tR
tV tR# )ÚBNCCorpusReadera  Corpus reader for the XML version of the British National Corpus.

For access to the complete XML data structure, use the ``xml()``
method.  For access to simple word lists and tagged word lists, use
``words()``, ``sents()``, ``tagged_words()``, and ``tagged_sents()``.

You can obtain the full version of the BNC corpus at
https://www.ota.ox.ac.uk/desc/2554

If you extracted the archive to a directory called `BNC`, then you can
instantiate the reader as::

    BNCCorpusReader(root='BNC/Texts/', fileids=r'[A-K]/\w*/\w*\.xml')

c                ó@   € \         P                  ! WV4       W0n        R # ©N)r   Ú__init__Ú_lazy)ÚselfÚrootÚfileidsÚlazys   &&&&Ú8/usr/lib/python3/dist-packages/nltk/corpus/reader/bnc.pyr
   ÚBNCCorpusReader.__init__   s   € Ü× Ò  ¨WÔ5ØŽ
ó    Nc                ó*   € V P                  VRRW#4      # )a  
:return: the given file(s) as a list of words
    and punctuation symbols.
:rtype: list(str)

:param strip_space: If true, then strip trailing spaces from
    word tokens.  Otherwise, leave the spaces on the tokens.
:param stem: If true, then use word stems instead of word strings.
FN©Ú_views©r   r   Ústrip_spaceÚstems   &&&&r   ÚwordsÚBNCCorpusReader.words#   s   € ð �{‰{˜7 E¨4°ÓCÐCr   c                óB   € V'       d   RMRpV P                  VRWSV4      # )aÐ  
:return: the given file(s) as a list of tagged
    words and punctuation symbols, encoded as tuples
    ``(word,tag)``.
:rtype: list(tuple(str,str))

:param c5: If true, then the tags used will be the more detailed
    c5 tags.  Otherwise, the simplified tags will be used.
:param strip_space: If true, then strip trailing spaces from
    word tokens.  Otherwise, leave the spaces on the tokens.
:param stem: If true, then use word stems instead of word strings.
Úc5ÚposFr   ©r   r   r   r   r   Útags   &&&&& r   Útagged_wordsÚBNCCorpusReader.tagged_words/   s"   € ÷ ‰d˜eˆØ�{‰{˜7 E¨3¸TÓBÐBr   c                ó*   € V P                  VRRW#4      # )aH  
:return: the given file(s) as a list of
    sentences or utterances, each encoded as a list of word
    strings.
:rtype: list(list(str))

:param strip_space: If true, then strip trailing spaces from
    word tokens.  Otherwise, leave the spaces on the tokens.
:param stem: If true, then use word stems instead of word strings.
TNr   r   s   &&&&r   ÚsentsÚBNCCorpusReader.sents?   s   € ð �{‰{˜7 D¨$°ÓBÐBr   c                óD   € V'       d   RMRpV P                  VRWSVR7      # )aÆ  
:return: the given file(s) as a list of
    sentences, each encoded as a list of ``(word,tag)`` tuples.
:rtype: list(list(tuple(str,str)))

:param c5: If true, then the tags used will be the more detailed
    c5 tags.  Otherwise, the simplified tags will be used.
:param strip_space: If true, then strip trailing spaces from
    word tokens.  Otherwise, leave the spaces on the tokens.
:param stem: If true, then use word stems instead of word strings.
r   r   T)Úsentr   r   r   r   r   s   &&&&& r   Útagged_sentsÚBNCCorpusReader.tagged_sentsL   s,   € ÷ ‰d˜eˆØ�{‰{Ø˜$ CÀtð ó 
ð 	
r   c                ó¸   € V P                   '       d   \        MV P                  p\        V P	                  V4       Uu. uF  pV! WrW4V4      NK  	  up4      # u upi )zPA helper function that instantiates BNCWordViews or the list of words/sentences.)r   ÚBNCWordViewÚ_wordsr   Úabspaths)r   r   r&   r   r   r   ÚfÚfileids   &&&&&&  r   r   ÚBNCCorpusReader._views]   sV   € àŸ:Ÿ:˜:�K¨4¯;©;ˆÜð #Ÿm™m¨GÔ4óá4�Fñ �& °$Ö7Ù4ñó
ð 	
ùòs   ½Ac           	     ó–  € . p\         P                  ! V4      P                  4       pVP                  R4       EF  p. p	\	        V4       F§  p
V
P
                  pV'       g   RpV'       g	   V'       d   VP                  4       pV'       d   V
P                  RV4      pVR8X  d   WºP                  R4      3pM)VR8X  d#   WºP                  RV
P                  R4      4      3pV	P                  V4       K©  	  V'       d/   VP                  \        VP                  R,          V	4      4       Kò  VP                  V	4       EK  	  RV9  g   Q hV# )a�  
Helper used to implement the view methods -- returns a list of
words or a list of sentences, optionally tagged.

:param fileid: The name of the underlying file.
:param bracket_sent: If true, include sentence bracketing.
:param tag: The name of the tagset to use, or None for no tags.
:param strip_space: If true, strip spaces from word tokens.
:param stem: If true, then substitute stems for words.
z.//sÚ Úhwr   r   ÚnN)r   ÚparseÚgetrootÚfindallÚ_all_xmlwords_inÚtextÚstripÚgetÚappendÚBNCSentenceÚattribÚextend)r   r.   Úbracket_sentr   r   r   ÚresultÚxmldocÚxmlsentr&   ÚxmlwordÚwords   &&&&&&      r   r+   ÚBNCCorpusReader._wordsg   s  € ð ˆä×"Ò" 6Ó*×2Ñ2Ó4ˆØ—~‘~ f×-ˆGØˆDÜ+¨GÖ4�Ø—|‘|�ßØ�Dß§$ØŸ:™:›<�DßØ"Ÿ;™; t¨TÓ2�DØ˜$”;Ø §+¡+¨dÓ"3Ð4‘DØ˜E”\Ø §+¡+¨e°W·[±[ÀÓ5FÓ"GÐH�DØ—‘˜DÖ!ñ 5÷ Ø—‘œk¨'¯.©.¸Õ*=¸tÓDÖEà—‘˜d×#ñ% .ð( ˜6Ô!Ð!Ð!Øˆr   )r   )T)NTF)NFTF)NFFTF)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r
   r   r    r#   r'   r   r+   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      s5   ø‡ € ñô ô
DôCô Cô
ô"
÷#ð #r   r   Nc                 ó‚   € Vf   . pV  F2  pVP                   R9   d   VP                  V4       K'  \        W!4       K4  	  V# )N)ÚcÚw)r   r;   r7   )Úeltr@   Úchilds   && r   r7   r7   �   s=   € Ø‚~ØˆÛˆØ�9‰9˜
Ô"Ø�M‰M˜%Ö ä˜UÖ+ñ	 ð
 €Mr   c                   ó*   a € ] tR t^˜t o RtR tRtV tR# )r<   z
A list of words, augmented by an attribute ``num`` used to record
the sentence identifier (the ``n`` attribute from the XML).
c                ó<   € Wn         \        P                  W4       R # r	   )ÚnumÚlistr
   )r   rV   Úitemss   &&&r   r
   ÚBNCSentence.__init__ž   s   € ØŒÜ�‰�dÖ"r   )rV   N)rF   rG   rH   rI   rJ   r
   rK   rL   rM   s   @r   r<   r<   ˜   s   ø‡ € ñ÷
#ð #r   r<   c                   óL   a € ] tR t^£t o Rt0 R	mt R tR tR tR t	R t
RtV tR# )
r*   zF
A stream backed corpus view specialized for use with the BNC corpus.
c                óV  € V'       d   RpMRpW n         W0n        W@n        WPn        RV n        RV n        RV n        RV n        \        P                  ! WV4       V P                  4        V P                  V P                  RV P                  4       V P                  4        ^ R/V n        R# )a  
:param fileid: The name of the underlying file.
:param sent: If true, include sentence bracketing.
:param tag: The name of the tagset to use, or None for no tags.
:param strip_space: If true, strip spaces from word tokens.
:param stem: If true, then substitute stems for words.
z.*/sz.*/s/(.*/)?(c|w)Nz.*/teiHeader$© )Ú_sentÚ_tagÚ_strip_spaceÚ_stemÚtitleÚauthorÚeditorÚrespsr   r
   Ú_openÚ
read_blockÚ_streamÚhandle_headerÚcloseÚ_tag_context)r   r.   r&   r   r   r   Útagspecs   &&&&&& r   r
   ÚBNCWordView.__init__¸   sŽ   € ÷ Ø‰Gà(ˆGØŒ
ØŒ	Ø'ÔØŒ
àˆŒ
ØˆŒØˆŒØˆŒ
ä×Ò˜t¨WÔ5ð 	�
‰
ŒØ�‰˜Ÿ™ o°t×7IÑ7IÔJØ�
‰
Œð  ˜GˆÖr   c                óº  € VP                  R 4      pV'       d   RP                  R V 4       4      V n        VP                  R4      pV'       d   RP                  R V 4       4      V n        VP                  R4      pV'       d   RP                  R V 4       4      V n        VP                  R4      pV'       d    RP                  R	 V 4       4      V n        R
# R
# )ztitleStmt/titleÚ
c              3   óT   "  € T F  qP                   P                  4       x € K   	  R # 5ir	   ©r8   r9   )Ú.0ra   s   & r   Ú	<genexpr>Ú,BNCWordView.handle_header.<locals>.<genexpr>Ü   s   é € Ð"JÁ6¸%§:¡:×#3Ñ#3×#5Ð#5Ã6ùó   ‚&(ztitleStmt/authorc              3   óT   "  € T F  qP                   P                  4       x € K   	  R # 5ir	   rp   )rq   rb   s   & r   rr   rs   à   ó   é € Ð#NÁg¸F§K¡K×$5Ñ$5×$7Ð$7Ãgùrt   ztitleStmt/editorc              3   óT   "  € T F  qP                   P                  4       x € K   	  R # 5ir	   rp   )rq   rc   s   & r   rr   rs   ä   rv   rt   ztitleStmt/respStmtz

c              3   óR   "  € T F  pR P                  R V 4       4      x € K  	  R# 5i)rn   c              3   óT   "  € T F  qP                   P                  4       x € K   	  R # 5ir	   rp   )rq   Úresp_elts   & r   rr   Ú6BNCWordView.handle_header.<locals>.<genexpr>.<genexpr>é   s   é € ÐEÁ°HŸ-™-×-Ñ-×/Ð/Ãùrt   N)Újoin)rq   Úresps   & r   rr   rs   è   s&   é € ð %ÙRWÈ$�—	‘	ÑEÁÓE×EÐEÓRWùs   ‚%'N)r6   r|   ra   rb   rc   rd   )r   rR   ÚcontextÚtitlesÚauthorsÚeditorsrd   s   &&&    r   rh   ÚBNCWordView.handle_headerØ   s®   € à—‘Ð.Ó/ˆßØŸ™Ñ"JÁ6Ó"JÓJˆDŒJà—+‘+Ð0Ó1ˆßØŸ)™)Ñ#NÁgÓ#NÓNˆDŒKà—+‘+Ð0Ó1ˆßØŸ)™)Ñ#NÁgÓ#NÓNˆDŒKà—‘Ð0Ó1ˆßØŸ™ñ %ÙRWó%ó ˆDŽJñ r   c                ój   € V P                   '       d   V P                  V4      # V P                  V4      # r	   )r]   Úhandle_sentÚhandle_word)r   rR   r~   s   &&&r   Ú
handle_eltÚBNCWordView.handle_eltì   s-   € Ø�:�:ˆ:Ø×#Ñ# CÓ(Ð(à×#Ñ# CÓ(Ð(r   c                ó’  € VP                   pV'       g   R pV P                  '       g   V P                  '       d   VP                  4       pV P                  '       d   VP	                  RV4      pV P
                  R8X  d   W!P	                  R4      3pV# V P
                  R8X  d#   W!P	                  RVP	                  R4      4      3pV# )r1   r2   r   r   )r8   r_   r`   r9   r:   r^   )r   rR   rD   s   && r   r…   ÚBNCWordView.handle_wordò   sœ   € Ø�x‰xˆßØˆDØ××Ð §
§
 
Ø—:‘:“<ˆDØ�:�:ˆ:Ø—7‘7˜4 Ó&ˆDØ�9‰9˜ÔØŸ'™' $›-Ð(ˆDð ˆð �Y‰Y˜%ÔØŸ'™' %¨¯©°«Ó7Ð8ˆDØˆr   c                ó¢  € . pV F¦  pVP                   R9   d)   Y# Uu. uF  q@P                  V4      NK  	  up,          pK<  VP                   R9   d#   VP                  V P                  V4      4       Ko  VP                   V P                  9  g   KŒ  \	        RVP                   ,          4      h	  \        VP                  R,          V4      # u upi )ÚmwzUnexpected element %sr3   )r‹   ÚhiÚcorrÚtrunc)rQ   rP   )r   r…   r;   Útags_to_ignoreÚ
ValueErrorr<   r=   )r   rR   r&   rS   rQ   s   &&   r   r„   ÚBNCWordView.handle_sent   s¦   € ØˆÛˆEØ�y‰yÐ9Ô9Ø°eÓ<±e°×)Ñ)¨!Ö,±eÑ<Õ<’Ø—‘˜jÔ(Ø—‘˜D×,Ñ,¨UÓ3Ö4Ø—‘ $×"5Ñ"5Ö5Ü Ð!8¸5¿9¹9Õ!DÓEÐEñ ô ˜3Ÿ:™: c�?¨DÓ1Ð1ùò =s   �C)	r]   r`   r_   r^   rj   rb   rc   rd   ra   N>   ÚpbÚgapÚalignÚeventÚpauseÚshiftÚvocalÚunclear)rF   rG   rH   rI   rJ   r�   r
   rh   r†   r…   r„   rK   rL   rM   s   @r   r*   r*   £   s5   ø‡ € ñò	€Nðò$ò@ò()ò÷	2ð 	2r   r*   r	   )rJ   Únltk.corpus.reader.utilr   Únltk.corpus.reader.xmldocsr   r   r   r   r7   rW   r<   r*   r\   r   r   Ú<module>rœ      sB   ðñ Hå *ß RÑ Rô|�oô |ô~ô#�$ô #ôf2�-ö f2r   