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 :  /lib/python3/dist-packages/nltk/parse/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

 T�c���(�ddlZGd�d��ZdS)�Nc�$�eZdZdZd�Zd�Zd�ZdS)�DependencyEvaluatora5
    Class for measuring labelled and unlabelled attachment score for
    dependency parsing. Note that the evaluation ignores punctuation.

    >>> from nltk.parse import DependencyGraph, DependencyEvaluator

    >>> gold_sent = DependencyGraph("""
    ... Pierre  NNP     2       NMOD
    ... Vinken  NNP     8       SUB
    ... ,       ,       2       P
    ... 61      CD      5       NMOD
    ... years   NNS     6       AMOD
    ... old     JJ      2       NMOD
    ... ,       ,       2       P
    ... will    MD      0       ROOT
    ... join    VB      8       VC
    ... the     DT      11      NMOD
    ... board   NN      9       OBJ
    ... as      IN      9       VMOD
    ... a       DT      15      NMOD
    ... nonexecutive    JJ      15      NMOD
    ... director        NN      12      PMOD
    ... Nov.    NNP     9       VMOD
    ... 29      CD      16      NMOD
    ... .       .       9       VMOD
    ... """)

    >>> parsed_sent = DependencyGraph("""
    ... Pierre  NNP     8       NMOD
    ... Vinken  NNP     1       SUB
    ... ,       ,       3       P
    ... 61      CD      6       NMOD
    ... years   NNS     6       AMOD
    ... old     JJ      2       NMOD
    ... ,       ,       3       AMOD
    ... will    MD      0       ROOT
    ... join    VB      8       VC
    ... the     DT      11      AMOD
    ... board   NN      9       OBJECT
    ... as      IN      9       NMOD
    ... a       DT      15      NMOD
    ... nonexecutive    JJ      15      NMOD
    ... director        NN      12      PMOD
    ... Nov.    NNP     9       VMOD
    ... 29      CD      16      NMOD
    ... .       .       9       VMOD
    ... """)

    >>> de = DependencyEvaluator([parsed_sent],[gold_sent])
    >>> las, uas = de.eval()
    >>> las
    0.6
    >>> uas
    0.8
    >>> abs(uas - 0.8) < 0.00001
    True
    c�"�||_||_dS)z�
        :param parsed_sents: the list of parsed_sents as the output of parser
        :type parsed_sents: list(DependencyGraph)
        N)�
_parsed_sents�_gold_sents)�self�parsed_sents�
gold_sentss   �5/usr/lib/python3/dist-packages/nltk/parse/evaluate.py�__init__zDependencyEvaluator.__init__Gs��
*���%�����c�N��hd��d��fd�|D����S)z�
        Function to remove punctuation from Unicode string.
        :param input: the input string
        :return: Unicode string after remove all punctuation
        >�Pc�Pd�Pe�Pf�Pi�Po�Ps�c3�H�K�|]}tj|���v�|V��dS)N)�unicodedata�category)�.0�x�punc_cats  �r�	<genexpr>z4DependencyEvaluator._remove_punct.<locals>.<genexpr>Vs8�����S�S�Q�;�+?��+B�+B�(�+R�+R�q�+R�+R�+R�+R�S�Sr
)�join)r�inStrrs  @r�
_remove_punctz!DependencyEvaluator._remove_punctOs7���>�=�=���w�w�S�S�S�S�%�S�S�S�S�S�Sr
c��t|j��t|j��krtd���d}d}d}t	t|j����D]�}|j|j}|j|j}t|��t|��krtd���|���D]�\}}||}	|d��|d|	dkrtd���|�|d��dkr�W|dz
}|d	|	d	kr|dz
}|d
|	d
kr|dz
}����||z||zfS)z�
        Return the Labeled Attachment Score (LAS) and Unlabeled Attachment Score (UAS)

        :return : tuple(float,float)
        zE Number of parsed sentence is different with number of gold sentence.rz!Sentences must have equal length.�wordNz!Sentence sequence is not matched.r��head�rel)�lenrr�
ValueError�range�nodes�itemsr )
r�corr�corrL�total�i�parsed_sent_nodes�gold_sent_nodes�parsed_node_address�parsed_node�	gold_nodes
          r�evalzDependencyEvaluator.evalXs����t�!�"�"�c�$�*:�&;�&;�;�;��W���
��������s�4�-�.�.�/�/�	#�	#�A� $� 2�1� 5� ;��"�.�q�1�7�O��$�%�%��_�)=�)=�=�=� �!D�E�E�E�4E�4K�4K�4M�4M�
#�
#�0�#�[�+�,?�@�	��v�&�.���v�&�)�F�*;�;�;�$�%H�I�I�I��%�%�k�&�&9�:�:�b�@�@����
���v�&�)�F�*;�;�;��A�I�D�"�5�)�Y�u�-=�=�=���
���#
#�&�u�}�d�U�l�*�*r
N)�__name__�
__module__�__qualname__�__doc__rr r4�r
rrrsO������8�8�t&�&�&�T�T�T�)+�)+�)+�)+�)+r
r)rrr9r
r�<module>r:sO������u+�u+�u+�u+�u+�u+�u+�u+�u+�u+r

Youez - 2016 - github.com/yon3zu
LinuXploit