ó
    ´OÂfŽ  ã                   óŠ   • S r SSKJrJr  SSKJrJr   " S S\5      r " S S\5      r " S S	\5      r	 " S
 S\5      r
SS jrg)aÔ  
Simple Tokenizers

These tokenizers divide strings into substrings using the string
``split()`` method.
When tokenizing using a particular delimiter string, use
the string ``split()`` method directly, as this is more efficient.

The simple tokenizers are *not* available as separate functions;
instead, you should just use the string ``split()`` method directly:

    >>> s = "Good muffins cost $3.88\nin New York.  Please buy me\ntwo of them.\n\nThanks."
    >>> s.split() # doctest: +NORMALIZE_WHITESPACE
    ['Good', 'muffins', 'cost', '$3.88', 'in', 'New', 'York.',
    'Please', 'buy', 'me', 'two', 'of', 'them.', 'Thanks.']
    >>> s.split(' ') # doctest: +NORMALIZE_WHITESPACE
    ['Good', 'muffins', 'cost', '$3.88\nin', 'New', 'York.', '',
    'Please', 'buy', 'me\ntwo', 'of', 'them.\n\nThanks.']
    >>> s.split('\n') # doctest: +NORMALIZE_WHITESPACE
    ['Good muffins cost $3.88', 'in New York.  Please buy me',
    'two of them.', '', 'Thanks.']

The simple tokenizers are mainly useful because they follow the
standard ``TokenizerI`` interface, and so can be used with any code
that expects a tokenizer.  For example, these tokenizers can be used
to specify the tokenization conventions when building a `CorpusReader`.

é    )ÚStringTokenizerÚ
TokenizerI)Úregexp_span_tokenizeÚstring_span_tokenizec                   ó   • \ rS rSrSrSrSrg)ÚSpaceTokenizeré*   a²  Tokenize a string using the space character as a delimiter,
which is the same as ``s.split(' ')``.

    >>> from nltk.tokenize import SpaceTokenizer
    >>> s = "Good muffins cost $3.88\nin New York.  Please buy me\ntwo of them.\n\nThanks."
    >>> SpaceTokenizer().tokenize(s) # doctest: +NORMALIZE_WHITESPACE
    ['Good', 'muffins', 'cost', '$3.88\nin', 'New', 'York.', '',
    'Please', 'buy', 'me\ntwo', 'of', 'them.\n\nThanks.']
Ú © N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú_stringÚ__static_attributes__r   ó    Ú6/usr/lib/python3/dist-packages/nltk/tokenize/simple.pyr   r   *   s   † ñð ƒGr   r   c                   ó   • \ rS rSrSrSrSrg)ÚTabTokenizeré8   zÐTokenize a string use the tab character as a delimiter,
the same as ``s.split('\t')``.

    >>> from nltk.tokenize import TabTokenizer
    >>> TabTokenizer().tokenize('a\tb c\n\t d')
    ['a', 'b c\n', ' d']
Ú	r   Nr   r   r   r   r   r   8   s   † ñð ƒGr   r   c                   ó(   • \ rS rSrSrSrS rS rSrg)ÚCharTokenizeréD   z|Tokenize a string into individual characters.  If this functionality
is ever required directly, use ``for char in string``.
Nc                 ó   • [        U5      $ ©N)Úlist©ÚselfÚss     r   ÚtokenizeÚCharTokenizer.tokenizeK   s   € Ü�A‹wˆr   c              #   ób   #   • [        [        S[        U5      S-   5      5       S h  v•N   g  N7f)Né   )Ú	enumerateÚrangeÚlenr    s     r   Úspan_tokenizeÚCharTokenizer.span_tokenizeN   s"   é € ÜœU 1¤c¨!£f¨q¡jÓ1Ó2×2Ó2ùs   ‚%/§-¨/r   )	r   r   r   r   r   r   r#   r*   r   r   r   r   r   r   D   s   † ñð €Gòõ3r   r   c                   ó.   • \ rS rSrSrSS jrS rS rSrg)	ÚLineTokenizeréR   aT  Tokenize a string into its lines, optionally discarding blank lines.
This is similar to ``s.split('\n')``.

    >>> from nltk.tokenize import LineTokenizer
    >>> s = "Good muffins cost $3.88\nin New York.  Please buy me\ntwo of them.\n\nThanks."
    >>> LineTokenizer(blanklines='keep').tokenize(s) # doctest: +NORMALIZE_WHITESPACE
    ['Good muffins cost $3.88', 'in New York.  Please buy me',
    'two of them.', '', 'Thanks.']
    >>> # same as [l for l in s.split('\n') if l.strip()]:
    >>> LineTokenizer(blanklines='discard').tokenize(s) # doctest: +NORMALIZE_WHITESPACE
    ['Good muffins cost $3.88', 'in New York.  Please buy me',
    'two of them.', 'Thanks.']

:param blanklines: Indicates how blank lines should be handled.  Valid values are:

    - ``discard``: strip blank lines out of the token list before returning it.
       A line is considered blank if it contains only whitespace characters.
    - ``keep``: leave all blank lines in the token list.
    - ``discard-eof``: if the string ends with a newline, then do not generate
       a corresponding token ``''`` after that newline.
c                 óX   • SnX;  a  [        SSR                  U5      -  5      eXl        g )N)ÚdiscardÚkeepúdiscard-eofzBlank lines must be one of: %sr
   )Ú
ValueErrorÚjoinÚ_blanklines)r!   Ú
blanklinesÚvalid_blankliness      r   Ú__init__ÚLineTokenizer.__init__i   s5   € Ø=ÐØÓ-ÜØ0°3·8±8Ð<LÓ3MÑMóð ð &Õr   c                 ó"  • UR                  5       nU R                  S:X  a*  U Vs/ s H  o3R                  5       (       d  M  UPM     nnU$ U R                  S:X  a/  U(       a(  US   R                  5       (       d  UR	                  5         U$ s  snf )Nr0   r2   éÿÿÿÿ)Ú
splitlinesr5   ÚrstripÚstripÚpop)r!   r"   ÚlinesÚls       r   r#   ÚLineTokenizer.tokenizer   sr   € Ø—‘“ˆà×Ñ˜yÓ(Ù %Ó4¢˜1¯©¯—Q¡ˆEÐ4ð ˆð ×Ñ Ó.Þ˜U 2™YŸ_™_×.Ñ.Ø—	‘	”Øˆùò	 5s   ¥BÁBc              #   ó†   #   • U R                   S:X  a  [        US5       S h  v•N   g [        US5       S h  v•N   g  N N7f)Nr1   z\nz
\n(\s+\n)*)r5   r   r   r    s     r   r*   ÚLineTokenizer.span_tokenize}   s;   é € Ø×Ñ˜vÓ%Ü+¨A¨uÓ5×5Ñ5ä+¨A¨}Ó=×=Ñ=ñ 6á=ùs   ‚ A¢=£A·?¸A¿A)r5   N©r0   )	r   r   r   r   r   r8   r#   r*   r   r   r   r   r-   r-   R   s   † ñô,&òõ>r   r-   c                 ó6   • [        U5      R                  U 5      $ r   )r-   r#   )Útextr6   s     r   Úline_tokenizerH   Š   s   € Ü˜Ó$×-Ñ-¨dÓ3Ð3r   NrE   )r   Únltk.tokenize.apir   r   Únltk.tokenize.utilr   r   r   r   r   r-   rH   r   r   r   Ú<module>rK      sH   ðñ÷: :ß Iô�_ô ô	�?ô 	ô3�Oô 3ô/>�Jô />õp4r   