+
    ÖÇÜh*  ã                   óV   € R t ^ RIt^ RIHt  ! R R]4      t]! 4       P
                  tR# )aê  
S-Expression Tokenizer

``SExprTokenizer`` is used to find parenthesized expressions in a
string.  In particular, it divides a string into a sequence of
substrings that are either parenthesized expressions (including any
nested parenthesized expressions), or other whitespace-separated
tokens.

    >>> from nltk.tokenize import SExprTokenizer
    >>> SExprTokenizer().tokenize('(a b (c d)) e f (g)')
    ['(a b (c d))', 'e', 'f', '(g)']

By default, `SExprTokenizer` will raise a ``ValueError`` exception if
used to tokenize an expression with non-matching parentheses:

    >>> SExprTokenizer().tokenize('c) d) e (f (g')
    Traceback (most recent call last):
      ...
    ValueError: Un-matched close paren at char 1

The ``strict`` argument can be set to False to allow for
non-matching parentheses.  Any unmatched close parentheses will be
listed as their own s-expression; and the last partial sexpr with
unmatched open parentheses will be listed as its own sexpr:

    >>> SExprTokenizer(strict=False).tokenize('c) d) e (f (g')
    ['c', ')', 'd', ')', 'e', '(f (g']

The characters used for open and close parentheses may be customized
using the ``parens`` argument to the `SExprTokenizer` constructor:

    >>> SExprTokenizer(parens='{}').tokenize('{a b {c d}} e f {g}')
    ['{a b {c d}}', 'e', 'f', '{g}']

The s-expression tokenizer is also available as a function:

    >>> from nltk.tokenize import sexpr_tokenize
    >>> sexpr_tokenize('(a b (c d)) e f (g)')
    ['(a b (c d))', 'e', 'f', '(g)']

N)Ú
TokenizerIc                   ó4   a € ] tR t^9t o RtRR ltR tRtV tR# )ÚSExprTokenizera   
A tokenizer that divides strings into s-expressions.
An s-expresion can be either:

  - a parenthesized expression, including any nested parenthesized
    expressions, or
  - a sequence of non-whitespace non-parenthesis characters.

For example, the string ``(a (b c)) d e (f)`` consists of four
s-expressions: ``(a (b c))``, ``d``, ``e``, and ``(f)``.

By default, the characters ``(`` and ``)`` are treated as open and
close parentheses, but alternative strings may be specified.

:param parens: A two-element sequence specifying the open and close parentheses
    that should be used to find sexprs.  This will typically be either a
    two-character string, or a list of two strings.
:type parens: str or list
:param strict: If true, then raise an exception when tokenizing an ill-formed sexpr.
c                ó,  € \        V4      ^8w  d   \        R4      hW n        V^ ,          V n        V^,          V n        \
        P                  ! \
        P                  ! V^ ,          4       R\
        P                  ! V^,          4       24      V n        R# )é   z'parens must contain exactly two stringsÚ|N)	ÚlenÚ
ValueErrorÚ_strictÚ_open_parenÚ_close_parenÚreÚcompileÚescapeÚ_paren_regexp)ÚselfÚparensÚstricts   &&&Ú5/usr/lib/python3/dist-packages/nltk/tokenize/sexpr.pyÚ__init__ÚSExprTokenizer.__init__O   sr   € Üˆv‹;˜!ÔÜÐFÓGÐGØŒØ! !�9ˆÔØ" 1�IˆÔÜŸZšZÜ�yŠy˜ �Ó#Ð$ A¤b§i¢i°°qµ	Ó&:Ð%;Ð<ó
ˆÖó    c                óò  € . p^ p^ pV P                   P                  V4       EF  pVP                  4       pV^ 8X  d7   W!W5P                  4        P	                  4       ,          pVP                  4       pW`P
                  8X  d
   V^,          pW`P                  8X  g   K|  V P                  '       d(   V^ 8X  d!   \        RVP                  4       ,          4      h\        ^ V^,
          4      pV^ 8X  g   KÑ  VP                  WVP                  4        4       VP                  4       pEK  	  V P                  '       d   V^ 8”  d   \        RV,          4      hV\        V4      8  d   VP                  WR 4       V# )a±  
Return a list of s-expressions extracted from *text*.
For example:

    >>> SExprTokenizer().tokenize('(a b (c d)) e f (g)')
    ['(a b (c d))', 'e', 'f', '(g)']

All parentheses are assumed to mark s-expressions.
(No special processing is done to exclude parentheses that occur
inside strings, or following backslash characters.)

If the given expression contains non-matching parentheses,
then the behavior of the tokenizer depends on the ``strict``
parameter to the constructor.  If ``strict`` is ``True``, then
raise a ``ValueError``.  If ``strict`` is ``False``, then any
unmatched close parentheses will be listed as their own
s-expression; and the last partial s-expression with unmatched open
parentheses will be listed as its own s-expression:

    >>> SExprTokenizer(strict=False).tokenize('c) d) e (f (g')
    ['c', ')', 'd', ')', 'e', '(f (g']

:param text: the string to be tokenized
:type text: str or iter(str)
:rtype: iter(str)
z!Un-matched close paren at char %dz Un-matched open paren at char %dN)r   ÚfinditerÚgroupÚstartÚsplitr   r   r
   r	   ÚmaxÚappendÚendr   )r   ÚtextÚresultÚposÚdepthÚmÚparens   &&     r   ÚtokenizeÚSExprTokenizer.tokenizeY   s)  € ð6 ˆØˆØˆØ×#Ñ#×,Ñ,¨T×2ˆAØ—G‘G“IˆEØ˜ŒzØ˜s§W¡W£YÐ/×5Ñ5Ó7Õ7�Ø—g‘g“i�Ø×(Ñ(Ô(Ø˜•
�Ø×)Ñ)Ö)Ø—<—<�< E¨Q¤JÜ$Ð%HÈ1Ï7É7Ë9Õ%TÓUÐUÜ˜A˜u q�yÓ)�Ø˜A–:Ø—M‘M $¨Q¯U©U«WÐ"5Ô6ØŸ%™%›'“Cñ 3ð �<�<ˆ<˜E AœIÜÐ?À#ÕEÓFÐFØ”�T“Œ?Ø�M‰M˜$˜t˜*Ô%Øˆr   )r   r   r   r
   N)z()T)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r&   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r   9   s   ø‡ € ñô*
÷0ð 0r   r   )r,   r   Únltk.tokenize.apir   r   r&   Úsexpr_tokenize© r   r   Ú<module>r3      s2   ðñ)óV 
å (ôP�Zô Pñf  Ó!×*Ñ*‚r   