
    OfF                     \    S SK r S SK7  S SK7  S SKJrJr   " S S\5      r " S S\5      r	g)    N)*)map_tag	str2tuplec                   $    \ rS rSrSrS rS rSrg)SwitchboardTurn   a-  
A specialized list object used to encode switchboard utterances.
The elements of the list are the words in the utterance; and two
attributes, ``speaker`` and ``id``, are provided to retrieve the
spearker identifier and utterance id.  Note that utterance ids
are only unique within a given discourse.
c                 Z    [         R                  X5        X l        [        U5      U l        g N)list__init__speakerintid)selfwordsr   r   s       @/usr/lib/python3/dist-packages/nltk/corpus/reader/switchboard.pyr   SwitchboardTurn.__init__   s    d"b'    c                     [        U 5      S:X  a  SnOB[        U S   [        5      (       a  SR                  S U  5       5      nOSR                  U 5      nSU R                   SU R
                   SU< S3$ )	Nr     c              3   ,   #    U  H
  nS U-  v   M     g7f)z%s/%sN ).0ws     r   	<genexpr>+SwitchboardTurn.__repr__.<locals>.<genexpr>    s     6AGaKs   <.z: >)len
isinstancetuplejoinr   r   )r   texts     r   __repr__SwitchboardTurn.__repr__   sg    t9>DQ''88666D88D>D4<<.$''"THA66r   )r   r   N)__name__
__module____qualname____firstlineno____doc__r   r&   __static_attributes__r   r   r   r   r      s    
7r   r   c                       \ rS rSrS/rSS jrS rSS jrS rSS jr	S	 r
SS
 jrS rSS jrS rSS jrS rSS jr\R&                  " S5      rSrSS jrSrg)SwitchboardCorpusReader&   taggedNc                 P    [         R                  XU R                  5        X l        g r
   )CorpusReaderr   _FILES_tagset)r   roottagsets      r   r    SwitchboardCorpusReader.__init__+   s    d$++6r   c                 L    [        U R                  S5      U R                  5      $ Nr1   )StreamBackedCorpusViewabspath_words_block_readerr   s    r   r   SwitchboardCorpusReader.words/       %dll8&<d>V>VWWr   c                 J   ^ ^ U U4S jn[        T R                  S5      U5      $ )Nc                 (   > TR                  U T5      $ r
   )_tagged_words_block_readerstreamr   r7   s    r   tagged_words_block_readerGSwitchboardCorpusReader.tagged_words.<locals>.tagged_words_block_reader3       2266BBr   r1   r;   r<   )r   r7   rF   s   `` r   tagged_words$SwitchboardCorpusReader.tagged_words2   "    	C &dll8&<>WXXr   c                 L    [        U R                  S5      U R                  5      $ r:   )r;   r<   _turns_block_readerr>   s    r   turnsSwitchboardCorpusReader.turns8   r@   r   c                 J   ^ ^ U U4S jn[        T R                  S5      U5      $ )Nc                 (   > TR                  U T5      $ r
   )_tagged_turns_block_readerrD   s    r   tagged_turns_block_readerGSwitchboardCorpusReader.tagged_turns.<locals>.tagged_turns_block_reader<   rH   r   r1   rI   )r   r7   rT   s   `` r   tagged_turns$SwitchboardCorpusReader.tagged_turns;   rL   r   c                 L    [        U R                  S5      U R                  5      $ r:   )r;   r<   _discourses_block_readerr>   s    r   
discourses"SwitchboardCorpusReader.discoursesA   s#    %LL"D$A$A
 	
r   c                 J   ^ ^ U U4S jn[        T R                  S5      U5      $ )Nc                 (   > TR                  U T5      $ r
   _tagged_discourses_block_readerrD   s    r   tagged_discourses_block_readerQSwitchboardCorpusReader.tagged_discourses.<locals>.tagged_discourses_block_readerG   s    77GGr   r1   rI   )r   r7   r`   s   `` r   tagged_discourses)SwitchboardCorpusReader.tagged_discoursesF   s'    	H &LL"$B
 	
r   c           
          [        U5       VVs/ s HC  nUR                  S5        H*  nUR                  5       (       d  M  U R                  USS9PM,     ME     snn/$ s  snnf )N
F)include_tagread_blankline_blocksplitstrip_parse_utterance)r   rE   bus       r   rY   0SwitchboardCorpusReader._discourses_block_readerN   sc    
 .f55AA779 <%%aU%;& <5
 	
s   .AAc                     [        U5       VVs/ s HD  nUR                  S5        H+  nUR                  5       (       d  M  U R                  USUS9PM-     MF     snn/$ s  snnf )Nre   T)rf   r7   rg   )r   rE   r7   rl   rm   s        r   r_   7SwitchboardCorpusReader._tagged_discourses_block_readerY   sg    
 .f55AA779 J%%aT&%I& J5
 	
s   .AAc                 *    U R                  U5      S   $ Nr   )rY   r   rE   s     r   rN   +SwitchboardCorpusReader._turns_block_readerd   s    ,,V4Q77r   c                 *    U R                  X5      S   $ rr   r^   r   rE   r7   s      r   rS   2SwitchboardCorpusReader._tagged_turns_block_readerg   s    33FCAFFr   c                 >    [        U R                  U5      S   / 5      $ rr   )sumrY   rs   s     r   r=   +SwitchboardCorpusReader._words_block_readerj   s    4008;R@@r   c                 >    [        U R                  X5      S   / 5      $ rr   )ry   r_   rv   s      r   rC   2SwitchboardCorpusReader._tagged_words_block_readerm   s    477GJBOOr   z(\w+)\.(\d+)\:\s*(.*)/c           
         U R                   R                  U5      nUc  [        SU-  5      eUR                  5       u  pVnUR	                  5        Vs/ s H  n[        XR                  5      PM     n	nU(       d  U	 V
Vs/ s H  u  pU
PM	     n	n
nOBU(       a;  X0R                  :w  a,  U	 V
Vs/ s H  u  pU
[        U R                  X;5      4PM     n	n
n[        XU5      $ s  snf s  snn
f s  snn
f )NzBad utterance %r)
_UTTERANCE_REmatch
ValueErrorgroupsri   r   _SEPr5   r   r   )r   	utterancerf   r7   mr   r   r%   sr   r   ts               r   rk   (SwitchboardCorpusReader._parse_utterances   s    $$Y/9/);<<HHJT26**,?,Q1ii(,?%*+U6AQUE+E,,.INOvav9:EOur22 @+Os   C?C$,$C*)r5   r
   )F)r(   r)   r*   r+   r4   r   r   rJ   rO   rV   rZ   rb   rY   r_   rN   rS   r=   rC   recompiler   r   rk   r-   r   r   r   r/   r/   &   sl    ZFXYXY


	
	
8GAP JJ78MD
3r   r/   )
r   nltk.corpus.reader.apinltk.corpus.reader.utilnltk.tagr   r   r   r   r3   r/   r   r   r   <module>r      s-    
 $ % '7d 70W3l W3r   