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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

 T�c�$��4�ddlmZmZGd�de���ZdS)�)�ABCMeta�abstractmethodc��eZdZdZdZdZdd�Zd�Zed���Z	d�Z
edd	���Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zeed�����ZdS)�Featurea
    An abstract base class for Features. A Feature is a combination of
    a specific property-computing method and a list of relative positions
    to apply that method to.

    The property-computing method, M{extract_property(tokens, index)},
    must be implemented by every subclass. It extracts or computes a specific
    property for the token at the current index. Typical extract_property()
    methods return features such as the token text or tag; but more involved
    methods may consider the entire sequence M{tokens} and
    for instance compute the length of the sentence the token belongs to.

    In addition, the subclass may have a PROPERTY_NAME, which is how
    it will be printed (in Rules and Templates, etc). If not given, defaults
    to the classname.

    znltk.tbl.FeatureNc�~�d|_|�,ttd�|D������|_nj	||krt�tt	||dz����|_n6#t$r)}td�||����|�d}~wwxYw|jjp|jj	|_dS)al
        Construct a Feature which may apply at C{positions}.

        >>> # For instance, importing some concrete subclasses (Feature is abstract)
        >>> from nltk.tag.brill import Word, Pos

        >>> # Feature Word, applying at one of [-2, -1]
        >>> Word([-2,-1])
        Word([-2, -1])

        >>> # Positions need not be contiguous
        >>> Word([-2,-1, 1])
        Word([-2, -1, 1])

        >>> # Contiguous ranges can alternatively be specified giving the
        >>> # two endpoints (inclusive)
        >>> Pos(-3, -1)
        Pos([-3, -2, -1])

        >>> # In two-arg form, start <= end is enforced
        >>> Pos(2, 1)
        Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
          File "nltk/tbl/template.py", line 306, in __init__
            raise TypeError
        ValueError: illegal interval specification: (start=2, end=1)

        :type positions: list of int
        :param positions: the positions at which this features should apply
        :raises ValueError: illegal position specifications

        An alternative calling convention, for contiguous positions only,
        is Feature(start, end):

        :type start: int
        :param start: start of range where this feature should apply
        :type end: int
        :param end: end of range (NOTE: inclusive!) where this feature should apply
        Nc�,�h|]}t|����S�)�int)�.0�is  �2/usr/lib/python3/dist-packages/nltk/tbl/feature.py�	<setcomp>z#Feature.__init__.<locals>.<setcomp>Ms��*E�*E�*E�a�3�q�6�6�*E�*E�*E��z2illegal interval specification: (start={}, end={}))
�	positions�tuple�sorted�	TypeError�range�
ValueError�format�	__class__�
PROPERTY_NAME�__name__)�selfr�end�es    r
�__init__zFeature.__init__#s���P����;�"�6�*E�*E�9�*E�*E�*E�#F�#F�G�G�D�N�N�

��s�?�?�#�O�!&�u�Y��a��'@�'@�!A�!A������
�
�
� �H�O�O�!�3������	�����
����"�^�9�T�T�^�=T����s�2A*�*
B�4$B�Bc��|jS�N)r�rs r
�encode_json_objzFeature.encode_json_obj^s
���~�rc��|}||��Sr r	)�cls�objrs   r
�decode_json_objzFeature.decode_json_objas���	��s�9�~�~�rc�J�|jj�dt|j���d�S)N�(�))rr�listrr!s r
�__repr__zFeature.__repr__fs(���.�)�E�E�D���,@�,@�E�E�E�ErFc�����td�|D����std|������fd�|D��}��fd�|D��S)a�
        Return a list of features, one for each start point in starts
        and for each window length in winlen. If excludezero is True,
        no Features containing 0 in its positions will be generated
        (many tbl trainers have a special representation for the
        target feature at [0])

        For instance, importing a concrete subclass (Feature is abstract)

        >>> from nltk.tag.brill import Word

        First argument gives the possible start positions, second the
        possible window lengths

        >>> Word.expand([-3,-2,-1], [1])
        [Word([-3]), Word([-2]), Word([-1])]

        >>> Word.expand([-2,-1], [1])
        [Word([-2]), Word([-1])]

        >>> Word.expand([-3,-2,-1], [1,2])
        [Word([-3]), Word([-2]), Word([-1]), Word([-3, -2]), Word([-2, -1])]

        >>> Word.expand([-2,-1], [1])
        [Word([-2]), Word([-1])]

        A third optional argument excludes all Features whose positions contain zero

        >>> Word.expand([-2,-1,0], [1,2], excludezero=False)
        [Word([-2]), Word([-1]), Word([0]), Word([-2, -1]), Word([-1, 0])]

        >>> Word.expand([-2,-1,0], [1,2], excludezero=True)
        [Word([-2]), Word([-1]), Word([-2, -1])]

        All window lengths must be positive

        >>> Word.expand([-2,-1], [0])
        Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
          File "nltk/tag/tbl/template.py", line 371, in expand
            :param starts: where to start looking for Feature
        ValueError: non-positive window length in [0]

        :param starts: where to start looking for Feature
        :type starts: list of ints
        :param winlens: window lengths where to look for Feature
        :type starts: list of ints
        :param excludezero: do not output any Feature with 0 in any of its positions.
        :type excludezero: bool
        :returns: list of Features
        :raises ValueError: for non-positive window lengths
        c3�"K�|]
}|dkV��dS)rNr	)r�xs  r
�	<genexpr>z!Feature.expand.<locals>.<genexpr>�s&����*�*�Q�1�q�5�*�*�*�*�*�*rznon-positive window length in c3�|�K�|]6}tt���|z
dz��D]}�|||z�V���7dS)rN)r�len)r�wr�startss   �r
r/z!Feature.expand.<locals>.<genexpr>�sU�����
U�
U�A�%��F���a��RS�@S�:T�:T�
U�
U�Q�f�Q��Q��Y��
U�
U�
U�
U�
U�
U�
Urc�2��g|]}�rd|v��|����S)rr	)rr.r$�excludezeros  ��r
�
<listcomp>z"Feature.expand.<locals>.<listcomp>�s+���C�C�C�1�;�C�1��6�6���A���6�6�6r)�allr)r$r3�winlensr5�xss`` ` r
�expandzFeature.expandisu�����l�*�*�'�*�*�*�*�*�	I��G�g�G�G�H�H�H�
U�
U�
U�
U��
U�
U�
U��C�C�C�C�C��C�C�C�Crc�r�|j|juo)t|j��t|j��kS)aQ
        Return True if this Feature always returns True when other does

        More precisely, return True if this feature refers to the same property as other;
        and this Feature looks at all positions that other does (and possibly
        other positions in addition).

        #For instance, importing a concrete subclass (Feature is abstract)
        >>> from nltk.tag.brill import Word, Pos

        >>> Word([-3,-2,-1]).issuperset(Word([-3,-2]))
        True

        >>> Word([-3,-2,-1]).issuperset(Word([-3,-2, 0]))
        False

        #Feature subclasses must agree
        >>> Word([-3,-2,-1]).issuperset(Pos([-3,-2]))
        False

        :param other: feature with which to compare
        :type other: (subclass of) Feature
        :return: True if this feature is superset, otherwise False
        :rtype: bool


        )r�setr�r�others  r
�
issupersetzFeature.issuperset�s>��8�~���0�
�S���5H�5H�C��O�M
�M
�6
�	
rc��t|j|juo(t|j��t|j��z��S)a�
        Return True if the positions of this Feature intersects with those of other

        More precisely, return True if this feature refers to the same property as other;
        and there is some overlap in the positions they look at.

        #For instance, importing a concrete subclass (Feature is abstract)
        >>> from nltk.tag.brill import Word, Pos

        >>> Word([-3,-2,-1]).intersects(Word([-3,-2]))
        True

        >>> Word([-3,-2,-1]).intersects(Word([-3,-2, 0]))
        True

        >>> Word([-3,-2,-1]).intersects(Word([0]))
        False

        #Feature subclasses must agree
        >>> Word([-3,-2,-1]).intersects(Pos([-3,-2]))
        False

        :param other: feature with which to compare
        :type other: (subclass of) Feature
        :return: True if feature classes agree and there is some overlap in the positions they look at
        :rtype: bool
        )�boolrr<rr=s  r
�
intersectszFeature.intersects�sC��:��N�e�o�-�
;��D�N�#�#�c�%�/�&:�&:�:�
�
�	
rc�>�|j|juo|j|jkSr )rrr=s  r
�__eq__zFeature.__eq__�s���~���0�V�T�^�u��5V�Vrc�V�|jj|jjkp|j|jkSr )rrrr=s  r
�__lt__zFeature.__lt__�s,���N�#�e�o�&>�>�
-�
�N�U�_�,�		
rc��||kSr r	r=s  r
�__ne__zFeature.__ne__�s���E�M�"�"rc��||kSr r	r=s  r
�__gt__zFeature.__gt__�s���t�|�rc��||kSr r	r=s  r
�__ge__zFeature.__ge__�s���%�<��rc��||kp||kSr r	r=s  r
�__le__zFeature.__le__�s���e�|�,�t�u�}�,rc��dS)a@
        Any subclass of Feature must define static method extract_property(tokens, index)

        :param tokens: the sequence of tokens
        :type tokens: list of tokens
        :param index: the current index
        :type index: int
        :return: feature value
        :rtype: any (but usually scalar)
        Nr	)�tokens�indexs  r
�extract_propertyzFeature.extract_property�s���rr )F)r�
__module__�__qualname__�__doc__�json_tagrrr"�classmethodr&r+r:r?rBrDrFrHrJrLrN�staticmethodrrRr	rr
rr
sF��������$"�H��M�9U�9U�9U�9U�v�������[��F�F�F��8D�8D�8D��[�8D�t
�
�
�@ 
� 
� 
�HW�W�W�
�
�
�#�#�#���� � � �-�-�-���
�
��^��\�
�
�
rr)�	metaclassN)�abcrrrr	rr
�<module>r[sc��(�'�'�'�'�'�'�'�~�~�~�~�~��~�~�~�~�~�~r

Youez - 2016 - github.com/yon3zu
LinuXploit