403Webshell
Server IP : 54.37.205.81  /  Your IP : 216.73.216.76
Web Server : nginx/1.22.1
System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64
User : debian ( 1000)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/nltk/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/nltk/__pycache__/data.cpython-311.pyc
�

 T�c����<�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZddlm
ZddlmZddlmZmZddlmZmZ	ddlmZn#e$r	dd	lmZYnwxYwdd
lmZmZddlmZm Z ddl!m"Z"ej#ej$d
���Z%gZ&	ej'�(dd���)ej*��Z+e&d�e+D��z
Z&dej'vrKej&�,d��dkr-e&�-ej&�,d����ej.�/d��r�e&ej&�0ej1d��ej&�0ej1dd��ej&�0ej1dd��ej&�0ej'�(dd��d��dddgz
Z&nhe&ej&�0ej1d��ej&�0ej1dd��ej&�0ej1dd��ddd d!gz
Z&						d]d%�Z2d&�Z3d'�Z4d^d)�Z5Gd*�d+e
�,��Z6Gd-�d.e6e7��Z8e"d/��Gd0�d1e����Z9Gd2�d3e8��Z:Gd4�d5e6��Z;iZ<	d_d6�Z=d`d7�Z>d8d9d:d;d<d=d>d?d@dAdBdC�Z?dDdEdFdGdHdIdJdKdLdMdMdN�Z@						dadQ�ZAdbdS�ZBdT�ZCdU�ZDGdV�dW��ZEGdX�dYejF��ZGGdZ�d[��ZHgd\�ZIdS)ca�
Functions to find and load NLTK resource files, such as corpora,
grammars, and saved processing objects.  Resource files are identified
using URLs, such as ``nltk:corpora/abc/rural.txt`` or
``http://nltk.org/sample/toy.cfg``.  The following URL protocols are
supported:

  - ``file:path``: Specifies the file whose path is *path*.
    Both relative and absolute paths may be used.

  - ``https://host/path``: Specifies the file stored on the web
    server *host* at path *path*.

  - ``nltk:path``: Specifies the file stored in the NLTK data
    package at *path*.  NLTK will search for these files in the
    directories specified by ``nltk.data.path``.

If no protocol is specified, then the default protocol ``nltk:`` will
be used.

This module provides to functions that can be used to access a
resource file, given its URL: ``load()`` loads a given resource, and
adds it to a resource cache; and ``retrieve()`` copies a given resource
to a local file.
�N)�ABCMeta�abstractmethod)�WRITE)�GzipFile)�BytesIO�
TextIOWrapper)�url2pathname�urlopen)�Z_SYNC_FLUSH)�Z_FINISH)�grammar�sem)�add_py3_data�py3_data)�
deprecatedz  )�prefix�	NLTK_DATA�c��g|]}|�|��S�r��.0�ds  �+/usr/lib/python3/dist-packages/nltk/data.py�
<listcomp>rHs��)�)�)�q�q�)��)�)�)��APPENGINE_RUNTIMEz~/z~/nltk_data�win�	nltk_data�share�lib�APPDATAzC:\zC:\nltk_datazD:\nltk_datazE:\nltk_dataz/usr/share/nltk_dataz/usr/local/share/nltk_dataz/usr/lib/nltk_dataz/usr/local/lib/nltk_data�rb�	�utf-8c�N�|�t||||��}t||||��S�N)rr)�filename�mode�
compresslevel�encoding�fileobj�errors�newlines       r�gzip_open_unicoder/is0�����8�T�=�'�B�B����(�F�G�<�<�<rc���|�dd��\}}|dkrnJ|dkr.|�d��rd|�d��z}ntjdd|��}||fS)a�
    Splits a resource url into "<protocol>:<path>".

    >>> windows = sys.platform.startswith('win')
    >>> split_resource_url('nltk:home/nltk')
    ('nltk', 'home/nltk')
    >>> split_resource_url('nltk:/home/nltk')
    ('nltk', '/home/nltk')
    >>> split_resource_url('file:/home/nltk')
    ('file', '/home/nltk')
    >>> split_resource_url('file:///home/nltk')
    ('file', '/home/nltk')
    >>> split_resource_url('file:///C:/home/nltk')
    ('file', '/C:/home/nltk')
    �:��nltk�file�/z^/{0,2}r)�split�
startswith�lstrip�re�sub��resource_url�protocol�path_s   r�split_resource_urlr?ws��� #�(�(��a�0�0�O�H�e��6����	�V�	�	����C� � �	,��%�,�,�s�+�+�+�E����z�2�u�-�-���U�?�rc�b�	t|��\}}n#t$rd}|}YnwxYw|dkr3tj�|��rd}t|dd��}n8|dkrd}t|dd��}n|dkrd}t|d��}n|dz
}d	�||g��S)
a�
    Normalizes a resource url

    >>> windows = sys.platform.startswith('win')
    >>> os.path.normpath(split_resource_url(normalize_resource_url('file:grammar.fcfg'))[1]) == \
    ... ('\\' if windows else '') + os.path.abspath(os.path.join(os.curdir, 'grammar.fcfg'))
    True
    >>> not windows or normalize_resource_url('file:C:/dir/file') == 'file:///C:/dir/file'
    True
    >>> not windows or normalize_resource_url('file:C:\\dir\\file') == 'file:///C:/dir/file'
    True
    >>> not windows or normalize_resource_url('file:C:\\dir/file') == 'file:///C:/dir/file'
    True
    >>> not windows or normalize_resource_url('file://C:/dir/file') == 'file:///C:/dir/file'
    True
    >>> not windows or normalize_resource_url('file:////C:/dir/file') == 'file:///C:/dir/file'
    True
    >>> not windows or normalize_resource_url('nltk:C:/dir/file') == 'file:///C:/dir/file'
    True
    >>> not windows or normalize_resource_url('nltk:C:\\dir\\file') == 'file:///C:/dir/file'
    True
    >>> windows or normalize_resource_url('file:/dir/file/toy.cfg') == 'file:///dir/file/toy.cfg'
    True
    >>> normalize_resource_url('nltk:home/nltk')
    'nltk:home/nltk'
    >>> windows or normalize_resource_url('nltk:/home/nltk') == 'file:///home/nltk'
    True
    >>> normalize_resource_url('https://example.com/dir/file')
    'https://example.com/dir/file'
    >>> normalize_resource_url('dir/file')
    'nltk:dir/file'
    r3zfile://FNr4znltk:Tz://r)r?�
ValueError�os�path�isabs�normalize_resource_name�join)r<r=�names   r�normalize_resource_urlrH�s���B�+�L�9�9���$�$����������������
�6���b�g�m�m�D�1�1����&�t�U�D�9�9���	�V�	�	���&�t�U�D�9�9���	�V�	�	���&�t�T�2�2���	�E���
�7�7�H�d�#�$�$�$s��&�&Tc�2�ttjd|����p#|�tjj��}tj�	d��r|�
d��}ntjdd|��}|r tj�|��}nK|�tj
}tj�tj�||����}|�dd���tjjd��}tj�	d��r$tj�|��rd|z}|r|�d��s|dz
}|S)a(
    :type resource_name: str or unicode
    :param resource_name: The name of the resource to search for.
        Resource names are posix-style relative path names, such as
        ``corpora/brown``.  Directory names will automatically
        be converted to a platform-appropriate path separator.
        Directory trailing slashes are preserved

    >>> windows = sys.platform.startswith('win')
    >>> normalize_resource_name('.', True)
    './'
    >>> normalize_resource_name('./', True)
    './'
    >>> windows or normalize_resource_name('dir/file', False, '/') == '/dir/file'
    True
    >>> not windows or normalize_resource_name('C:/file', False, '/') == '/C:/file'
    True
    >>> windows or normalize_resource_name('/dir/file', False, '/') == '/dir/file'
    True
    >>> windows or normalize_resource_name('../dir/file', False, '/') == '/dir/file'
    True
    >>> not windows or normalize_resource_name('/dir/file', True, '/') == 'dir/file'
    True
    >>> windows or normalize_resource_name('/dir/file', True, '/') == '/dir/file'
    True
    z[\\/.]$rr5z^/+N�\)�boolr9�search�endswithrBrC�sep�sys�platformr7r8r:�normpath�curdir�abspathrF�replacerD)�
resource_name�allow_relative�
relative_path�is_dirs    rrErE�sZ��6�"�)�J�
�6�6�
7�
7��=�;Q�;Q�
���<�<�F��|���u�%�%�;�%�,�,�S�1�1�
�
���v�s�M�:�:�
��T���(�(��7�7�
�
�� ��I�M���������]�M�(R�(R�S�S�
�!�)�)�$��4�4�<�<�R�W�[�#�N�N�M�
�|���u�%�%�,�"�'�-�-�
�*F�*F�,��m�+�
�
��m�,�,�S�1�1�����
��rc�V�eZdZdZedd���Zed���Zed���ZdS)�PathPointeraq
    An abstract base class for 'path pointers,' used by NLTK's data
    package to identify specific paths.  Two subclasses exist:
    ``FileSystemPathPointer`` identifies a file that can be accessed
    directly via a given absolute path.  ``ZipFilePathPointer``
    identifies a file contained within a zipfile, that can be accessed
    by reading that zipfile.
    Nc��dS)z�
        Return a seekable read-only stream that can be used to read
        the contents of the file identified by this path pointer.

        :raise IOError: If the path specified by this pointer does
            not contain a readable file.
        Nr)�selfr+s  r�openzPathPointer.open	����rc��dS)z�
        Return the size of the file pointed to by this path pointer,
        in bytes.

        :raise IOError: If the path specified by this pointer does
            not contain a readable file.
        Nr�r\s r�	file_sizezPathPointer.file_sizer^rc��dS)aP
        Return a new path pointer formed by starting at the path
        identified by this pointer, and then following the relative
        path given by ``fileid``.  The path components of ``fileid``
        should be separated by forward slashes, regardless of
        the underlying file system's path separator character.
        Nr)r\�fileids  rrFzPathPointer.joinr^rr')�__name__�
__module__�__qualname__�__doc__rr]rarFrrrrZrZ�st�������������^������^������^���rrZ)�	metaclassc�^�eZdZdZed���Zed���Zd
d�Zd�Z	d�Z
d�Zd	�ZdS)�FileSystemPathPointerzm
    A path pointer that identifies a file which can be accessed
    directly via a given absolute path.
    c��tj�|��}tj�|��st	d|z���||_dS)z�
        Create a new path pointer for the given absolute path.

        :raise IOError: If the given path does not exist.
        zNo such file or directory: %rN)rBrCrS�exists�OSError�_path�r\rns  r�__init__zFileSystemPathPointer.__init__.sM�������&�&���w�~�~�e�$�$�	C��9�E�A�B�B�B���
�
�
rc��|jS)z2The absolute path identified by this path pointer.�rnr`s rrCzFileSystemPathPointer.path>s���z�rNc�T�t|jd��}|�t||��}|S�Nr#)r]rn�SeekableUnicodeStreamReader�r\r+�streams   rr]zFileSystemPathPointer.openCs-���d�j�$�'�'����0���B�B�F��
rc�>�tj|j��jSr')rB�statrn�st_sizer`s rrazFileSystemPathPointer.file_sizeIs���w�t�z�"�"�*�*rc�j�tj�|j|��}t	|��Sr')rBrCrFrnrj)r\rcrns   rrFzFileSystemPathPointer.joinLs'������T�Z��0�0��$�U�+�+�+rc��d|jzS)NzFileSystemPathPointer(%r)rrr`s r�__repr__zFileSystemPathPointer.__repr__Ps��*�T�Z�7�7rc��|jSr'rrr`s r�__str__zFileSystemPathPointer.__str__Ss
���z�rr')
rdrerfrgrrp�propertyrCr]rarFr}rrrrrjrj(s���������
�
�
��X�
�����X������+�+�+�,�,�,�8�8�8�����rrjz3Use gzip.GzipFile instead as it also uses a buffer.c�<��eZdZdZe	dd���Z�fd�Z�xZS)�BufferedGzipFilez�A ``GzipFile`` subclass for compatibility with older nltk releases.

    Use ``GzipFile`` directly as it also buffers in all supported
    Python versions.
    Nr$c�6�tj|||||��dS)z#Return a buffered gzip file object.N)rrp)r\r(r)r*r,�kwargss      rrpzBufferedGzipFile.__init___s#��
	��$��$�
�w�G�G�G�G�Grc�J��t���|��dSr')�super�write)r\�data�	__class__s  �rr�zBufferedGzipFile.writefs!���	���
�
�d�����r)NNr$N)rdrerfrgrrpr��
__classcell__)r�s@rr�r�Wsi����������AE�H�H�H��X�H���������rr�c��eZdZdZdd�ZdS)�GzipFileSystemPathPointerz�
    A subclass of ``FileSystemPathPointer`` that identifies a gzip-compressed
    file located at a given absolute path.  ``GzipFileSystemPathPointer`` is
    appropriate for loading large gzip-compressed pickle objects efficiently.
    Nc�T�t|jd��}|rt||��}|Srt)rrnrurvs   rr]zGzipFileSystemPathPointer.openss0���$�*�d�+�+���	C�0���B�B�F��
rr')rdrerfrgr]rrrr�r�ls2�������������rr�c�v�eZdZdZedd���Zed���Zed���Zd
d�Z	d�Z
d	�Zd
�Zd�Z
dS)�ZipFilePathPointerz~
    A path pointer that identifies a file contained within a zipfile,
    which can be accessed by reading that zipfile.
    rc����t|t��r,ttj�|����}�r�t
�dd���d���	|j���nc#t$rV}��
d��r�fd�|j��D��rntd|j
�d�����|�Yd}~nd}~wwxYw||_�|_dS)z�
        Create a new path pointer pointing at the specified entry
        in the given zipfile.

        :raise IOError: If the given zipfile does not exist, or if it
        does not contain the specified entry.
        Tr5c�>��g|]}|�����|��Sr)r7)r�n�entrys  �rrz/ZipFilePathPointer.__init__.<locals>.<listcomp>�s:���,�,�,��Q�\�\�%�5H�5H�,��,�,�,rzZipfile z does not contain N)�
isinstance�str�OpenOnDemandZipFilerBrCrSrEr8�getinfo�	ExceptionrM�namelistrmr(�_zipfile�_entry)r\�zipfiler��es  ` rrpzZipFilePathPointer.__init__�s6����g�s�#�#�	D�)�"�'�/�/�'�*B�*B�C�C�G��	�,�E�4��=�=�D�D�S�I�I�E�
�����&�&�&�&���

�

�

�
�>�>�#�&�&��,�,�,�,�/�w�/�1�1�,�,�,���"�R�7�#3�R�R��R�R������D�D�D�D�����

���� ��
�����s�*A;�;
C�AC�Cc��|jS)z�
        The zipfile.ZipFile object used to access the zip file
        containing the entry identified by this path pointer.
        )r�r`s rr�zZipFilePathPointer.zipfile�s���}�rc��|jS)z_
        The name of the file within zipfile that this path
        pointer points to.
        )r�r`s rr�zZipFilePathPointer.entry�s���{�rNc���|j�|j��}t|��}|j�d��rt|j|���}n|�t
||��}|S)N�.gz)r,)r��readr�rrMrru)r\r+r�rws    rr]zZipFilePathPointer.open�sm���}�!�!�$�+�.�.��������;����&�&�	C��d�k�6�:�:�:�F�F�
�
!�0���B�B�F��
rc�J�|j�|j��jSr')r�r�r�rar`s rrazZipFilePathPointer.file_size�s���}�$�$�T�[�1�1�;�;rc�D�|j�d|��}t|j|��S)Nr5)r�r�r�)r\rcr�s   rrFzZipFilePathPointer.join�s)���;�)�)��)�)��!�$�-��7�7�7rc�2�d|jj�d|j�d�S)NzZipFilePathPointer(z, �))r�r(r�r`s rr}zZipFilePathPointer.__repr__�s"��Q�T�]�%;�Q�Q���Q�Q�Q�Qrc��tj�tj�|jj|j����Sr')rBrCrQrFr�r(r�r`s rrzZipFilePathPointer.__str__�s/���w�������T�]�-C�T�[� Q� Q�R�R�Rr)rr')rdrerfrgrrpr�r�r�r]rarFr}rrrrr�r�zs���������
�"�"�"��X�"�H����X������X������<�<�<�8�8�8�R�R�R�S�S�S�S�Srr�c�P�t|d��}|�t}tjd|��}|���\}}|D�]t}|rWt
j�|��r8|�d��r#	t||��cS#t$rY�XwxYw|rt
j�
|��r�|��t
j�|t|����}t
j�
|��r7|�d��rt|��cSt|��cS��t
j�|t|����}t
j�
|��r$	t||��cS#t$rY��pwxYw��v|��|�d��}t#t%|����D]Y}d�|d|�||dzgz||d�z��}		t'|	|��cS#t($rY�VwxYw|�d��d}
|
�d��r|
�d��d	}
t-d
���|
���}t1|��}|dz
}|d
�|���z
}|dd�d�|D����zz
}d}d|�d|�d|�d�}
t)|
���)a�
    Find the given resource by searching through the directories and
    zip files in paths, where a None or empty string specifies an absolute path.
    Returns a corresponding path name.  If the given resource is not
    found, raise a ``LookupError``, whose message gives a pointer to
    the installation instructions for the NLTK downloader.

    Zip File Handling:

      - If ``resource_name`` contains a component with a ``.zip``
        extension, then it is assumed to be a zipfile; and the
        remaining path components are used to look inside the zipfile.

      - If any element of ``nltk.data.path`` has a ``.zip`` extension,
        then it is assumed to be a zipfile.

      - If a given resource name that does not contain any zipfile
        component is not found initially, then ``find()`` will make a
        second attempt to find that resource, by replacing each
        component *p* in the path with *p.zip/p*.  For example, this
        allows ``find()`` to map the resource name
        ``corpora/chat80/cities.pl`` to a zip file path pointer to
        ``corpora/chat80.zip/chat80/cities.pl``.

      - When using ``find()`` to locate a directory contained in a
        zipfile, the resource name must end with the forward slash
        character.  Otherwise, ``find()`` will not locate the
        directory.

    :type resource_name: str or unicode
    :param resource_name: The name of the resource to search for.
        Resource names are posix-style relative path names, such as
        ``corpora/brown``.  Directory names will be
        automatically converted to a platform-appropriate path separator.
    :rtype: str
    TNz(.*\.zip)/?(.*)$|z.zipr�r5r2�.rz�Resource {resource} not found.
Please use the NLTK Downloader to obtain the resource:

>>> import nltk
>>> nltk.download('{resource}')
)�resourcez<
  For more information see: https://www.nltk.org/data.html
z.
  Attempted to load {resource_name}
)rUz
  Searched in:rc3� K�|]	}d|zV��
dS)z	
    - %rNrrs  r�	<genexpr>zfind.<locals>.<genexpr>Ds'����'H�'H�Q��q�(8�'H�'H�'H�'H�'H�'HrzF**********************************************************************�
)rErCr9�match�groupsrB�isfilerMr�rm�isdirrFr	rlr�rjr6�range�len�find�LookupError�
rpartitionr��format�textwrap_indent)rU�paths�mr��zipentryr>�p�pieces�i�
modified_name�resource_zipname�msgrN�resource_not_founds              rr�r��s���J,�M�4�@�@�M�
�}���	��%�}�5�5�A����
�
��G�X��!�!���	!�b�g�n�n�U�+�+�	!����v�0F�0F�	!�
�)�%��?�?�?�?�?���
�
�
���
����
�	!�"�'�-�-��.�.�	!����G�L�L���]�(C�(C�D�D���7�>�>�!�$�$�8��z�z�%�(�(�8�8��;�;�;�;�;�4�Q�7�7�7�7�7�	8��G�L�L���W�(=�(=�>�>���7�>�>�!�$�$�!�!�1�!�X�>�>�>�>�>��"�!�!�!� ��!��������$�$�S�)�)���s�6�{�{�#�#�	�	�A��H�H�V�B�Q�B�Z�6�!�9�v�3E�2F�%F��PQ�PR�PR��%S�T�T�M�
��M�5�1�1�1�1�1���
�
�
���
����%�*�*�3�/�/��2��� � ��(�(�?�+�6�6�s�;�;�A�>��

�	���
�f�&�f�'�'���#�
�
�C��K�K�C��B�I�I�#�J����C������'H�'H�%�'H�'H�'H� H� H�H�H�C�
�C�3�c�3�3�S�3�3�C�3�3�3��
�(�
)�
)�)s6�B�
B!� B!�F+�+
F9�8F9�)H;�;
I�Ic��t|��}|�Q|�d��r&tj�|��d}ntjdd|��}tj�|��r1tj�|��}td|z���|rtd|�d|����t|��}t|d	��5}	|�
d��}|�|��|sn�.	ddd��n#1swxYwY|���dS)a�
    Copy the given resource to a local file.  If no filename is
    specified, then use the URL's filename.  If there is already a
    file named ``filename``, then raise a ``ValueError``.

    :type resource_url: str
    :param resource_url: A URL specifying where the resource should be
        loaded from.  The default protocol is "nltk:", which searches
        for the file in the the NLTK data package.
    Nzfile:���z(^\w+:)?.*/rzFile %r already exists!zRetrieving z, saving to �wbTi)rHr7rBrCr6r9r:rlrSrA�print�_openr]r�r��close)r<r(�verbose�infile�outfile�ss      r�retriever�Js���*�,�7�7�L����"�"�7�+�+�	@��w�}�}�\�2�2�2�6�H�H��v�n�b�,�?�?�H�	�w�~�~�h���?��7�?�?�8�,�,���2�X�=�>�>�>��F�
�D�L�D�D��D�D�E�E�E��<�
 �
 �F�
�h��	�	���	����I�&�&�A��M�M�!�����
��		���������������������L�L�N�N�N�N�Ns�)0D&�&D*�-D*z;A serialized python object, stored using the pickle module.z9A serialized python object, stored using the json module.z9A serialized python object, stored using the yaml module.zA context free grammar.zA probabilistic CFG.zA feature CFG.zZA list of first order logic expressions, parsed with nltk.sem.logic.Expression.fromstring.zA list of first order logic expressions, parsed with nltk.sem.logic.LogicParser.  Requires an additional logic_parser parameterz>A semantic valuation, parsed by nltk.sem.Valuation.fromstring.z)The raw (byte string) contents of a file.z-The raw (unicode string) contents of a file. )�pickle�json�yaml�cfg�pcfg�fcfg�fol�logic�val�raw�textr�r�r�r�r�r�r�r�r�r�)r�r�r�r�r�r�r�r�r��txtr��autoFc���t|��}t|��}|dkrY|�d��}|d}|dkr|d}t�|��}|�td|z���|tvrtd|�d	����|r5t�||f��}	|	�|rtd
|�d���|	S|rtd|�d���t|��}
|d
kr|
�
��}	�n!|dkrtj|
��}	�n|dkrjddl
}ddlm}|�|
��}	d}
t!|	��dkr!t#|	�����}
|
|vrtd����n�|dkrddl}|�|
��}	�nt|
�
��}|�|�|��}n<	|�d��}n%#t,$r|�d��}YnwxYw|dkr|}	�n|dkr"t.j�||���}	n�|dkr"t.j�||���}	n�|dkr$t.j�||||���}	n�|dkr4t9j|t8j���|���}	nN|dkrt9j|||���}	n0|d krt9j ||���}	ntCd!|�d"����|
�"��|r	|	t||f<n#tF$rYnwxYw|	S)#a�
    Load a given resource from the NLTK data package.  The following
    resource formats are currently supported:

      - ``pickle``
      - ``json``
      - ``yaml``
      - ``cfg`` (context free grammars)
      - ``pcfg`` (probabilistic CFGs)
      - ``fcfg`` (feature-based CFGs)
      - ``fol`` (formulas of First Order Logic)
      - ``logic`` (Logical formulas to be parsed by the given logic_parser)
      - ``val`` (valuation of First Order Logic model)
      - ``text`` (the file contents as a unicode string)
      - ``raw`` (the raw file contents as a byte string)

    If no format is specified, ``load()`` will attempt to determine a
    format based on the resource name's file extension.  If that
    fails, ``load()`` will raise a ``ValueError`` exception.

    For all text formats (everything except ``pickle``, ``json``, ``yaml`` and ``raw``),
    it tries to decode the raw contents using UTF-8, and if that doesn't
    work, it tries with ISO-8859-1 (Latin-1), unless the ``encoding``
    is specified.

    :type resource_url: str
    :param resource_url: A URL specifying where the resource should be
        loaded from.  The default protocol is "nltk:", which searches
        for the file in the the NLTK data package.
    :type cache: bool
    :param cache: If true, add this resource to a cache.  If load()
        finds a resource in its cache, then it will return it from the
        cache rather than loading it.
    :type verbose: bool
    :param verbose: If true, print a message when loading a resource.
        Messages are not displayed when a resource is retrieved from
        the cache.
    :type logic_parser: LogicParser
    :param logic_parser: The parser that will be used to parse logical
        expressions.
    :type fstruct_reader: FeatStructReader
    :param fstruct_reader: The parser that will be used to parse the
        feature structure of an fcfg.
    :type encoding: str
    :param encoding: the encoding of the input; only used for text formats.
    r�r�r��gz���NzzCould not determine format for %s based on its file
extension; use the "format" argument to specify the format explicitly.zUnknown format type: �!z<<Using cached copy of z>>z
<<Loading r�r�r�r)�	json_tagsr2zUnknown json tag.r�r%zlatin-1r�r�)r+r�r�)�logic_parser�fstruct_readerr+r�)r�r+r�r�zInternal NLTK error: Format z" isn't handled by nltk.data.load())$rHrr6�AUTO_FORMATS�getrA�FORMATS�_resource_cacher�r�r�r��loadr��
nltk.jsontagsr�r��next�keysr��	safe_load�decode�UnicodeDecodeErrorr
�CFG�
fromstring�PCFG�FeatureGrammarr�
read_logicr��LogicParser�read_valuation�AssertionErrorr��	TypeError)r<r��cacher�r�r�r+�resource_url_parts�ext�resource_val�opened_resourcer�r��tagr��binary_data�string_datas                 rr�r��s=��n*�,�7�7�L���-�-�L�����)�/�/��4�4�� ��$���$�;�;�$�R�(�C��!�!�#�&�&���>��=�?K�L���
��W����:��:�:�:�;�;�;�
� �&�*�*�L�&�+A�B�B���#��
B��@��@�@�@�A�A�A����-�
�+�<�+�+�+�,�,�,��L�)�)�O�
����&�+�+�-�-���	�8�	�	��{�?�3�3���	�6�	�	�����+�+�+�+�+�+��y�y��1�1�����|����!�!��|�(�(�*�*�+�+�C��i����0�1�1�1� �	�6�	�	������~�~�o�6�6���&�*�*�,�,����%�,�,�X�6�6�K�K�
<�)�0�0��9�9����%�
<�
<�
<�)�0�0��;�;����
<�����V���&�L�L�
�u�_�_�"�;�1�1�+��1�Q�Q�L�L�
�v�
�
�"�<�2�2�;��2�R�R�L�L�
�v�
�
�"�1�<�<��)�-�!�	=���L�L��u�_�_��>�� �Y�2�2�4�4�!����L�L�
�w�
�
��>��,�����L�L��u�_�_��-�k�H�M�M�M�L�L� �.�17���:���
�
������
��	�6B�O�\�6�2�3�3���	�	�	�
�D�	����
�s$�+H�H#�"H#�	M�
M#�"M#�##c���t|��}t|dd���}|���}|D]=}|�|��r�t	jd|��r�.t
|���>dS)a}
    Write out a grammar file, ignoring escaped and empty lines.

    :type resource_url: str
    :param resource_url: A URL specifying where the resource should be
        loaded from.  The default protocol is "nltk:", which searches
        for the file in the the NLTK data package.
    :type escape: str
    :param escape: Prepended string that signals lines to be ignored
    r�F)r�r�z^$N)rHr��
splitlinesr7r9r�r�)r<�escaper��lines�ls     r�show_cfgr<s���*�,�7�7�L���V�5�A�A�A�L��#�#�%�%�E�
�����<�<����	��
�8�D�!���	��
�a������rc�8�t���dS)zF
    Remove all objects from the resource cache.
    :see: load()
    N)r��clearrrr�clear_cacherRs��
�������rc�b�t|��}t|��\}}|�|���dkr+t|tdgz�����S|���dkr#t|dg�����St
|��S)ao
    Helper function that returns an open file object for a resource,
    given its resource URL.  If the given resource URL uses the "nltk:"
    protocol, or uses no protocol, then use ``nltk.data.find`` to find
    its path, and open it with the given mode; if the resource URL
    uses the 'file' protocol, then open the file with the given mode;
    otherwise, delegate to ``urllib2.urlopen``.

    :type resource_url: str
    :param resource_url: A URL specifying where the resource should be
        loaded from.  The default protocol is "nltk:", which searches
        for the file in the the NLTK data package.
    Nr3rr4)rHr?�lowerr�rCr]r
r;s   rr�r�Zs���*�,�7�7�L�(��6�6�O�H�e���8�>�>�+�+�v�5�5��E�4�2�$�;�'�'�,�,�.�.�.�	���	�	�V�	#�	#��E�B�4� � �%�%�'�'�'��|�$�$�$rc�6�eZdZed���Zd�Zd�Zd�ZdS)�
LazyLoaderc��||_dSr'rrros  rrpzLazyLoader.__init__zs
����
�
�
rc�^�t|j��}|j|_|j|_dSr')r�rn�__dict__r�)r\r�s  r�__loadzLazyLoader.__load~s+����
�#�#��!�)��
�!�+����rc�J�|���t||��Sr')�_LazyLoader__load�getattr)r\�attrs  r�__getattr__zLazyLoader.__getattr__�s!�����
�
�
��t�T�"�"�"rc�H�|���t|��Sr')r�reprr`s rr}zLazyLoader.__repr__�s�����
�
�
��D�z�z�rN)rdrerfrrprrr}rrrrrysZ������
����X��,�,�,�#�#�#�����rrc�@�eZdZdZed���Zd�Zd�Zd�Zd�Z	dS)r�a�
    A subclass of ``zipfile.ZipFile`` that closes its file pointer
    whenever it is not using it; and re-opens it when it needs to read
    data from the zipfile.  This is useful for reducing the number of
    open file handles when many zip files are being accessed at once.
    ``OpenOnDemandZipFile`` must be constructed from a filename, not a
    file-like object (to allow re-opening).  ``OpenOnDemandZipFile`` is
    read-only (i.e. ``write()`` and ``writestr()`` are disabled.
    c���t|t��std���tj�||��|j|ksJ�|���d|_dS)Nz+ReopenableZipFile filename must be a stringr)	r�r�r�r��ZipFilerpr(r��_fileRefCnt)r\r(s  rrpzOpenOnDemandZipFile.__init__�sl���(�C�(�(�	K��I�J�J�J��� � ��x�0�0�0��}��(�(�(�(��
�
��������rc���|j�J�t|jd��|_tj�||��}|xjdz
c_|���|S)Nr#r2)�fpr]r(r�rr�rr�)r\rG�values   rr�zOpenOnDemandZipFile.read�s_���w�����t�}�d�+�+�����$�$�T�4�0�0��	
���A�����
�
�����rc� �td����z<:raise NotImplementedError: OpenOnDemandZipfile is read-onlyz OpenOnDemandZipfile is read-only��NotImplementedError�r\�argsr�s   rr�zOpenOnDemandZipFile.write����!�"D�E�E�Erc� �td���rr r"s   r�writestrzOpenOnDemandZipFile.writestr�r$rc�0�td|jz��S)NzOpenOnDemandZipFile(%r))rr(r`s rr}zOpenOnDemandZipFile.__repr__�s���-��
�=�>�>�>rN)
rdrerfrgrrpr�r�r&r}rrrr�r��s{������������X�����F�F�F�F�F�F�?�?�?�?�?rr�c��eZdZdZdZed"d���Zd#d�Zd�Zd#d�Z	d$d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zed���Zed���Zed���Zd�Zd%d�Zd�Zd#d�Zd�Zd#d�Zd�Zejdfgejdfej dfgejdfgej dfgej!dfej"dfgej!dfgej"dfgd �Z#d!�Z$dS)&rua�
    A stream reader that automatically encodes the source byte stream
    into unicode (like ``codecs.StreamReader``); but still supports the
    ``seek()`` and ``tell()`` operations correctly.  This is in contrast
    to ``codecs.StreamReader``, which provide *broken* ``seek()`` and
    ``tell()`` methods.

    This class was motivated by ``StreamBackedCorpusView``, which
    makes extensive use of ``seek()`` and ``tell()``, and needs to be
    able to handle unicode-encoded files.

    Note: this class requires stateless decoders.  To my knowledge,
    this shouldn't cause a problem with any of python's builtin
    unicode encodings.
    T�strictc��|�d��||_	||_	||_	t	j|��|_	d|_	d|_	d|_		d|_
	|���|_dS)Nrr)
�seekrwr+r-�codecs�
getdecoderr��
bytebuffer�
linebuffer�_rewind_checkpoint�_rewind_numchars�
_check_bom�_bom)r\rwr+r-s    rrpz$SeekableUnicodeStreamReader.__init__�s���	���A�������$� ��
�	!����	��'��1�1���	����	F����	;�#$���	@�
!%���	M�
�O�O�%�%��	�	=�	=rNc��|�|��}|jr+d�|j��|z}d|_d|_|S)a6
        Read up to ``size`` bytes, decode them using this reader's
        encoding, and return the resulting unicode string.

        :param size: The maximum number of bytes to read.  If not
            specified, then read as many bytes as possible.
        :type size: int
        :rtype: unicode
        rN)�_readr/rFr1)r\�size�charss   rr�z SeekableUnicodeStreamReader.readsM���
�
�4� � ���?�	)��G�G�D�O�,�,�u�4�E�"�D�O�$(�D�!��rc���|jrQt|j��dkr9|j�d��}|xjt|��z
c_dS|j���dS)Nr2r)r/r��popr1rw�readline�r\�lines  r�discard_linez(SeekableUnicodeStreamReader.discard_line)so���?�	#�s�4�?�3�3�a�7�7��?�&�&�q�)�)�D��!�!�S��Y�Y�.�!�!�!�!��K� � �"�"�"�"�"rc��|jrQt|j��dkr9|j�d��}|xjt|��z
c_|S|pd}d}|jr#||j���z
}d|_	|j���t|j��z
}|�|��}|r-|�d��r||�d��z
}||z
}|�	d��}t|��dkrS|d}|dd�|_t|��t|��t|��z
z
|_||_
nYt|��dkr2|d}|d�	d��d}	||	kr|}n|r|�|}n
|d	kr|d
z}��K|S)aj
        Read a line of text, decode it using this reader's encoding,
        and return the resulting unicode string.

        :param size: The maximum number of bytes to read.  If no
            newline is encountered before ``size`` bytes have been read,
            then the returned value may not be a complete line of text.
        :type size: int
        r2r�HrNT�
Fi@�)r/r�r9r1rw�tellr.r5rMrr0)
r\r6r<�readsizer7�startpos�	new_charsr�line0withend�line0withoutends
          rr:z$SeekableUnicodeStreamReader.readline0s����?�	�s�4�?�3�3�a�7�7��?�&�&�q�)�)�D��!�!�S��Y�Y�.�!�!��K��:�2�����?�	#��T�_�(�(�*�*�*�E�"�D�O�	��{�'�'�)�)�C���,@�,@�@�H��
�
�8�,�,�I��
+�Y�/�/��5�5�
+��T�Z�Z��]�]�*�	��Y��E��$�$�T�*�*�E��5�z�z�A�~�~��Q�x��"'����)���(+�I���#�e�*�*�s�4�y�y�:P�(Q��%�*2��'���U���q���$�Q�x��"'��(�"5�"5�e�"<�"<�Q�"?���?�2�2�'�D���
�� 0�����$����A�
��=	�@�rc�P�|����|��S)a
        Read this file's contents, decode them using this reader's
        encoding, and return it as a list of unicode lines.

        :rtype: list(unicode)
        :param sizehint: Ignored.
        :param keepends: If false, then strip newlines.
        )r�r)r\�sizehint�keependss   r�	readlinesz%SeekableUnicodeStreamReader.readlinesls ���y�y�{�{�%�%�h�/�/�/rc�@�|���}|r|St�)z8Return the next decoded line from the underlying stream.)r:�
StopIterationr;s  rr�z SeekableUnicodeStreamReader.nextws"���}�}�����	 ��K��rc�*�|���Sr')r�r`s r�__next__z$SeekableUnicodeStreamReader.__next__s���y�y�{�{�rc��|S�zReturn selfrr`s r�__iter__z$SeekableUnicodeStreamReader.__iter__�����rc�@�|js|���dSdSr')�closedr�r`s r�__del__z#SeekableUnicodeStreamReader.__del__�s'���{�	��J�J�L�L�L�L�L�	�	rc��|Sr'rr`s r�	__enter__z%SeekableUnicodeStreamReader.__enter__�s���rc�.�|���dSr')r�)r\�typer�	tracebacks    r�__exit__z$SeekableUnicodeStreamReader.__exit__�s���
�
�����rc��|SrQrr`s r�
xreadlinesz&SeekableUnicodeStreamReader.xreadlines�rSrc��|jjS)z(True if the underlying stream is closed.)rwrUr`s rrUz"SeekableUnicodeStreamReader.closed�s���{�!�!rc��|jjS)z"The name of the underlying stream.)rwrGr`s rrGz SeekableUnicodeStreamReader.name�����{��rc��|jjS)z"The mode of the underlying stream.)rwr)r`s rr)z SeekableUnicodeStreamReader.mode�rarc�8�|j���dS)z.
        Close the underlying stream.
        N)rwr�r`s rr�z!SeekableUnicodeStreamReader.close�s��	
��������rrc���|dkrtd���|j�||��d|_d|_d|_|j���|_dS)a
        Move the stream to a new file position.  If the reader is
        maintaining any buffers, then they will be cleared.

        :param offset: A byte count offset.
        :param whence: If 0, then the offset is from the start of the file
            (offset should be positive), if 1, then the offset is from the
            current position (offset may be positive or negative); and if 2,
            then the offset is from the end of the file (offset should
            typically be negative).
        r2zmRelative seek is not supported for SeekableUnicodeStreamReader -- consider using char_seek_forward() instead.Nr)rArwr+r/r.r1rBr0)r\�offset�whences   rr+z SeekableUnicodeStreamReader.seek�sp���Q�;�;��5���
�
	
������(�(�(������� $���"&�+�"2�"2�"4�"4����rc��|dkrtd���|�|�����|�|��dS)zI
        Move the read pointer forward by ``offset`` characters.
        rz"Negative offsets are not supportedN)rAr+rB�_char_seek_forward)r\res  r�char_seek_forwardz-SeekableUnicodeStreamReader.char_seek_forward�sP���A�:�:��A�B�B�B��	�	�$�)�)�+�+��������'�'�'�'�'rc��|�|}d}	|j�|t|��z
��}||z
}|�|��\}}t|��|kr.|j�t|��|zd��dSt|��|kr�t|��|krH||t|��z
z
}|�|d|���\}}t|��|k�H|j�t|��|zd��dS||t|��z
z
}��;)a
        Move the file position forward by ``offset`` characters,
        ignoring all buffers.

        :param est_bytes: A hint, giving an estimate of the number of
            bytes that will be needed to move forward by ``offset`` chars.
            Defaults to ``offset``.
        NrTr2)rwr�r��_incr_decoder+)r\re�	est_bytes�bytes�newbytesr7�
bytes_decodeds       rrhz.SeekableUnicodeStreamReader._char_seek_forward�sO�����I���	-��{�'�'�	�C��J�J�(>�?�?�H��X��E�$(�#4�#4�U�#;�#;� �E�=��5�z�z�V�#�#��� � �#�e�*�*��}�!<�a�@�@�@����5�z�z�F�"�"��%�j�j�6�)�)���#�e�*�*�!4�4�I�+/�+<�+<�U�:�I�:�=N�+O�+O�(�E�=��%�j�j�6�)�)��� � �#�e�*�*��}�!<�a�@�@�@���
��#�e�*�*�,�,�I�3	-rc�n�|j�.|j���t|j��z
S|j���}|t|j��z
|jz
}t
d�|jD����}t||jz|j|zz��}|j�	|j��|�
|j|��|j���}|jr�|j�	|��|�|j�
d����d}d�|j��}|�|��s|�|��sJ�|j�	|��|S)z�
        Return the current file position on the underlying byte
        stream.  If this reader is maintaining any buffers, then the
        returned file position will be the position of the beginning
        of those buffers.
        Nc3�4K�|]}t|��V��dSr')r�)rr<s  rr�z3SeekableUnicodeStreamReader.tell.<locals>.<genexpr>s(����=�=�T�s�4�y�y�=�=�=�=�=�=r�2rr)r/rwrBr�r.r0�sum�intr1r+rh�DEBUGrkr�rFr7)r\�orig_filepos�
bytes_read�buf_sizerl�filepos�check1�check2s        rrBz SeekableUnicodeStreamReader.tell�s����?�"��;�#�#�%�%��D�O�(<�(<�<�<��{�'�'�)�)��#�S���%9�%9�9�T�=T�T�
��=�=�T�_�=�=�=�=�=�����.�.�$�2G�(�2R�S�
�
�	�	
�����0�1�1�1����� 5�y�A�A�A��+�"�"�$�$���:�	J��K���W�%�%�%��&�&�t�{�'7�'7��';�';�<�<�Q�?�F��W�W�T�_�-�-�F��$�$�V�,�,�I��0A�0A�&�0I�0I�I�I�I�	
�����&�&�&��rc��|dkrdS|jr<|j���dkr|j�|j��|�|j���}n|j�|��}|j|z}|�|��\}}|�S|sQt
|��dkr>|s<|j�d��}|sn||z
}|�|��\}}|�<||d�|_|S)z�
        Read up to ``size`` bytes from the underlying stream, decode
        them using this reader's encoding, and return the resulting
        unicode string.  ``linebuffer`` is not included in the result.
        rrNr2)r3rwrBr�r.rkr�)r\r6�	new_bytesrmr7ros      rr5z!SeekableUnicodeStreamReader._read+s1���1�9�9��2��9�	(���)�)�+�+�q�0�0��K���T�Y�'�'�'��<���(�(�*�*�I�I���(�(��.�.�I���)�+�� $�0�0��7�7���}�
��u��3�y�>�>�A�3E�3E��
@� �K�,�,�Q�/�/�	� �����"��'+�'8�'8��'?�'?�$��}��
@� �
���/����rc�8�		|�|d��S#t$rv}|jt|��kr-|�|d|j�|j��cYd}~S|jdkr�|�||j��cYd}~Sd}~wwxYw)a�
        Decode the given byte string into a unicode string, using this
        reader's encoding.  If an exception is encountered that
        appears to be caused by a truncation error, then just decode
        the byte string without the bytes that cause the trunctaion
        error.

        Return a tuple ``(chars, num_consumed)``, where ``chars`` is
        the decoded unicode string, and ``num_consumed`` is the
        number of bytes that were consumed.
        Tr)N)r�r��endr��startr-)r\rm�excs   rrkz(SeekableUnicodeStreamReader._incr_decodeQs���	;�
;��{�{�5�(�3�3�3��%�

;�

;�

;��7�c�%�j�j�(�(��;�;�u�[�s�y�[�'9�4�;�G�G�G�G�G�G�G�G��[�H�,�,��
 �;�;�u�d�k�:�:�:�:�:�:�:�:�����

;���s&��
B�?B�"B�(&B�B�Bzutf16-lezutf16-bezutf32-lezutf32-be)�utf8�utf16�utf16le�utf16be�utf32�utf32le�utf32bec�n�tjdd|j�����}|j�|��}|rk|j�d��}|j�d��|D]4\}}|�	|��r|r||_t|��cS�5dS)Nz[ -]r�r)r9r:r+r	�
_BOM_TABLEr�rwr�r+r7r�)r\�enc�bom_inform�bom�new_encodings      rr2z&SeekableUnicodeStreamReader._check_bomys����f�V�R���!4�!4�!6�!6�7�7���?�&�&�s�+�+���
	$��K�$�$�R�(�(�E��K���Q����(0�
$�
$�#��l��#�#�C�(�(�$�#�5�(4��
��s�8�8�O�O�O�$�
�tr)r)r'�NT)r)%rdrerfrgrurrpr�r=r:rKr�rOrRrVrXr\r^r�rUrGr)r�r+rirhrBr5rkr,�BOM_UTF8�BOM_UTF16_LE�BOM_UTF16_BE�BOM_UTF32_LE�BOM_UTF32_BEr�r2rrrruru�sW�������� 
�E�
�2=�2=�2=��X�2=�p����(#�#�#�:�:�:�:�x	0�	0�	0�	0� � � ����������
����������"�"��X�"�� � ��X� �� � ��X� ����5�5�5�5�0	(�	(�	(�&-�&-�&-�&-�P(�(�(�\$�$�$�$�L;�;�;�>�/�4�(�)��&�
�3�f�6I�:�5V�W��(�$�/�0��(�$�/�0��&�
�3�f�6I�:�5V�W��(�$�/�0��(�$�/�0���J�����rru)rCrZrjr�r�r�r�r�r�r�r�rrrr�r�ru)r#r$r%NNN)TNr'r�)r�TFNNN)r�)Jrgr,�	functoolsrBr�r9rO�textwrapr��abcrr�gzipr�GZ_WRITEr�iorr�urllib.requestr	r
�zlibr�FLUSH�ImportErrorrr3r
r�nltk.compatrr�nltk.internalsr�partial�indentr�rC�environr�r6�pathsep�_paths_from_env�
expanduser�appendrPr7rFrr/r?rHrErZr�rjr�r�r�r�r�r�r�r�r�rrr�rrr�ru�__all__rrr�<module>r�s�����4�
�
�
�����	�	�	�	�
�
�
�
�	�	�	�	�
�
�
�
���������'�'�'�'�'�'�'�'�"�"�"�"�"�"�������%�%�%�%�%�%�%�%�0�0�0�0�0�0�0�0�'�*�*�*�*�*�*�*���'�'�'�&�&�&�&�&�&�&�&�'������������.�.�.�.�.�.�.�.�%�%�%�%�%�%�#�)�#�H�O�D�A�A�A��
��9��*�.�.��b�1�1�7�7��
�C�C���)�)�O�)�)�)�)���b�j�(�(�R�W�-?�-?��-E�-E��-M�-M��K�K���"�"�=�1�1�2�2�2��<���5�!�!���
����S�Z��-�-�
����S�Z��+�6�6�
����S�Z���4�4�
����R�Z�^�^�I�v�6�6��D�D����
��D�D�	�
����S�Z��-�-�
����S�Z��+�6�6�
����S�Z���4�4��$��"�
��D�$
��
����=�=�=�=����65%�5%�5%�p-�-�-�-�j&�&�&�&�&�G�&�&�&�&�R,�,�,�,�,�K��,�,�,�^��A�B�B������x���C�B��(����� 5����OS�OS�OS�OS�OS��OS�OS�OS�p��(�p*�p*�p*�p*�f#�#�#�#�TL�G�G�$�"��,��L�6�;����*�������
�������"�
����
�c�c�c�c�L����,���%�%�%�>��������>)?�)?�)?�)?�)?�'�/�)?�)?�)?�bC�C�C�C�C�C�C�C�L�����s�A�A�A

Youez - 2016 - github.com/yon3zu
LinuXploit