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/ccg/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

 T�c5%����dZddlZddlmZddlmZmZmZmZddl	m
Z
ddlmZej
d��Zej
d��Zej
d	��Zej
d
ej��Zej
dej��Zej
dej��Zej
d
��ZGd�d��ZGd�d��Zd�Zd�Zd�Zd�Zd�Zdd�Zdd�Ze
d��d���Zed��Z dS)z
CCG Lexicons
�N)�defaultdict)�CCGVar�	Direction�FunctionalCategory�PrimitiveCategory)�
deprecated)�
Expressionz([A-Za-z]+)(\[[A-Za-z,]+\])?z"([A-Za-z]+(?:\[[A-Za-z,]+\])?)(.*)z([\\/])([.,]?)([.,]?)(.*)z([\S_]+)\s*(::|[-=]+>)\s*(.+)z([^{}]*[^ {}])\s*(\{[^}]+\})?z\{([^}]+)\}z([^#]*)(?:#.*)?c�2�eZdZdZdd�Zd�Zd�Zd�Zd�ZdS)	�Tokenz�
    Class representing a token.

    token => category {semantics}
    e.g. eat => S\var[pl]/var {\x y.eat(x,y)}

    * `token` (string)
    * `categ` (string)
    * `semantics` (Expression)
    Nc�0�||_||_||_dS�N)�_token�_categ�
_semantics)�self�token�categ�	semanticss    �2/usr/lib/python3/dist-packages/nltk/ccg/lexicon.py�__init__zToken.__init__9s��������#�����c��|jSr
)r�rs rrzToken.categ>s
���{�rc��|jSr
)rrs rrzToken.semanticsAs
����rc�|�d}|j�dt|j��zdz}dt|j��z|zS)N�z {�})r�strr)r�
semantics_strs  r�__str__z
Token.__str__DsB���
��?�&� �3�t��#7�#7�7�#�=�M��C���$�$�$�}�4�4rc��t|t��sdSt|j|jf|���|�����S)N���)�
isinstancer�cmprrrr)r�others  r�__cmp__z
Token.__cmp__JsF���%��'�'�	��2��D�K���1�5�;�;�=�=�%�/�/�BS�BS�T�T�Trr
)	�__name__�
__module__�__qualname__�__doc__rrrr r&�rrrr-ss������	�	�$�$�$�$�
������5�5�5�U�U�U�U�Urrc�*�eZdZdZd�Zd�Zd�Zd�ZdS)�
CCGLexiconz�
    Class representing a lexicon for CCG grammars.

    * `primitives`: The list of primitive categories for the lexicon
    * `families`: Families of categories
    * `entries`: A mapping of words to possible categories
    c�X�t|��|_||_||_||_dSr
)r�_start�_primitives�	_families�_entries)r�start�
primitives�families�entriess     rrzCCGLexicon.__init__Ys+��'��.�.���%���!�����
�
�
rc��|j|S)z@
        Returns all the possible categories for a word
        )r2)r�words  r�
categorieszCCGLexicon.categories_s���}�T�"�"rc��|jS)z;
        Return the target category for the parser
        )r/rs rr3zCCGLexicon.startes���{�rc��d}d}t|j��D]5}|s|dz}||zdz}d}|j|D]}|s|dz}nd}|d|zz}��6|S)zK
        String representation of the lexicon. Used for debugging.
        rT�
z => z | Fz%s)�sortedr2)r�string�first�ident�cats     rr zCCGLexicon.__str__ks��������D�M�*�*�	-�	-�E��
'��$����e�^�f�,�F��E��}�U�+�
-�
-���"�#�e�^�F�F�!�E��$��*�,���
-��
rN)r'r(r)r*rr9r3r r+rrr-r-PsZ�������� � � �#�#�#��������rr-c�|�|dd�}d}|dkrr|�d��s]|�d��rt|��\}}||z}n||dz}|dd�}|dkr|�d���]|�d��r|dz|dd�fStd|zdz���)	zb
    Separate the contents matching the first set of brackets from the rest of
    the input.
    �N�(r�)rzUnmatched bracket in string '�')�
startswith�
matchBrackets�AssertionError)r>�rest�inside�parts    rrHrH�s���
�!�"�"�:�D�
�F�
�"�*�*�T�_�_�S�1�1�*��?�?�3���	�(��.�.�L�T�4��d�]�F�F��d�1�g�%�F�����8�D�
�"�*�*�T�_�_�S�1�1�*����s���(����d�1�2�2�h�'�'�
�8�6�A�C�G�
H�
H�Hrc��|�d��rt|��St�|�����S)zb
    Separate the string for the next portion of the category from the rest
    of the string
    rD)rGrH�NEXTPRIM_RE�match�groups)r>s r�nextCategoryrQ�sH��
������%��V�$�$�$����V�$�$�+�+�-�-�-rc�>�t|d|dd���S)z'
    Parse an application operator
    rrCN)r)�apps r�parseApplicationrT�s ���S��V�S����W�%�%�%rc�D�|r|dd��d��SgS)z7
    Parse the subscripts for a primitive category
    rCr"�,)�split)�subscrs r�parseSubscriptsrY�s-���'��a��d�|�!�!�#�&�&�&�
�Irc�B�|ddkr|d�|�t��}||fS|d}||vr,||\}}|�|}n|�||fg��}||fS||vr't|d��}t||��|fSt	d|zdz���)z�
    Parse a primitive category

    If the primitive is the special category 'var', replace it with the
    correct `CCGVar`.
    r�varrCNzString 'z-' is neither a family nor primitive category.)r�
substituterYrrI)�chunksr4r5r[�catstrrA�cvar�subscrss        r�parsePrimitiveCategoryra�s����a�y�E����!�9���{��h�h����:��
�A�Y�F�
�����v�&���d��;��C�C��.�.�4��+��/�/�C��S�z��
����!�&��)�,�,��!�&�'�2�2�C�8�8�
��V��M�M���rc���t|��\}}|�d��rt|dd�|||��\}}n?tt�|�����|||��\}}|dkr�t�|�����}t|dd���}|d}t|��\}}|�d��rt|dd�|||��\}	}n?tt�|�����|||��\}	}t||	|��}|dk��||fS)z{
    Parse a string representing a category, and returns a tuple with
    (possibly) the CCG variable for the category
    rDrCr"rr�)
rQrG�augParseCategoryra�PRIM_RErOrP�APP_RErTr)
�liner4r5r[�
cat_stringrJ�resrS�	direction�args
          rrdrd�ss��
&�d�+�+��Z�����S�!�!�
�%�j��2��&6�
�H�c�R�R�
��c�c�,��M�M�*�%�%�,�,�.�.�
�H�c�
�
�
��c��"�*�*��l�l�4� � �'�'�)�)��$�S��1��X�.�.�	��1�v��)�$�/�/���T�� � ��%�%�	�)�*�Q�r�T�*:�J��RU�V�V�J�S�#�#�/��
�
�j�)�)�0�0�2�2�J��#���J�S�#�!��c�9�5�5���"�*�*�
��:�rFc��tj��g}i}tt��}|���D�]�}t
�|�����d���}|dkr�N|�	d��r=|d�|dd�����
d��D��z}��t�|�����\}}}t�|�����\}	}
t|	||��\}}|dkr	||f||<��"d}
|d	urX|
�t|d
z���tjt"�|
�����d��}
||�t'|||
�������t)|d|||��S)z@
    Convert string representation into a lexicon for CCGs.
    rrz:-c�6�g|]}|�����Sr+)�strip)�.0�prims  r�
<listcomp>zfromstring.<locals>.<listcomp>s-��'�'�'�!%��
�
���'�'�'r�NrVz::Tz@ must contain semantics because include_semantics is set to True)r�reset_idr�list�
splitlines�COMMENTS_RErOrPrnrGrW�LEX_RE�RHS_RErdrIr	�
fromstring�SEMANTICS_RE�appendrr-)�lex_str�include_semanticsr4r5r6rgr@�sep�rhsr^rrAr[rs              rryry�s���O�����J��H��$���G��"�"�$�$�%D�%D��� � ��&�&�-�-�/�/��2�8�8�:�:���2�:�:���?�?�4� � �	D�$�'�'�)-�a�b�b����)9�)9�)?�)?��)D�)D�'�'�'��J�J�
!'���T� 2� 2� 9� 9� ;� ;��U�C��&,�l�l�3�&7�&7�&>�&>�&@�&@�#�V�]�)�&�*�h�G�G�J�S�#��d�{�{�$'��*����� �	�$��,�,�$�,�,� �`�a����
%/�$9�(�.�.�}�=�=�D�D�F�F�q�I�%�%�	�
���%�%�e�E�3�	�&B�&B�C�C�C�C��j��m�Z��7�C�C�CrzUse fromstring() instead.c� �t|��Sr
)ry)r|s r�parseLexiconr�"s���g���ra�
    # Rather minimal lexicon based on the openccg `tinytiny' grammar.
    # Only incorporates a subset of the morphological subcategories, however.
    :- S,NP,N                    # Primitive categories
    Det :: NP/N                  # Determiners
    Pro :: NP
    IntransVsg :: S\NP[sg]    # Tensed intransitive verbs (singular)
    IntransVpl :: S\NP[pl]    # Plural
    TransVsg :: S\NP[sg]/NP   # Tensed transitive verbs (singular)
    TransVpl :: S\NP[pl]/NP   # Plural

    the => NP[sg]/N[sg]
    the => NP[pl]/N[pl]

    I => Pro
    me => Pro
    we => Pro
    us => Pro

    book => N[sg]
    books => N[pl]

    peach => N[sg]
    peaches => N[pl]

    policeman => N[sg]
    policemen => N[pl]

    boy => N[sg]
    boys => N[pl]

    sleep => IntransVsg
    sleep => IntransVpl

    eat => IntransVpl
    eat => TransVpl
    eats => IntransVsg
    eats => TransVsg

    see => TransVpl
    sees => TransVsg
    r
)F)!r*�re�collectionsr�nltk.ccg.apirrrr�nltk.internalsr�nltk.sem.logicr	�compilererNrf�UNICODErwrxrzrvrr-rHrQrTrYrardryr��openccg_tinytinyr+rr�<module>r�s(����
�	�	�	�#�#�#�#�#�#�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�%�%�%�%�%�%�%�%�%�%�%�%��"�*�8�
9�
9���b�j�B�C�C��
���4�	5�	5��
���8�"�*�	E�	E��
���8�"�*�	E�	E���r�z�,�b�j�9�9���b�j�.�/�/�� U� U� U� U� U� U� U� U�F-�-�-�-�-�-�-�-�jI�I�I�(.�.�.�&�&�&�������<����@.D�.D�.D�.D�b��'�(�(���)�(���:�)�+�+���r

Youez - 2016 - github.com/yon3zu
LinuXploit