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__/dependencygraph.cpython-311.pyc
�

 T�c�{����dZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZGd�d	��Z
dd�ZGd�d
e��Zd�Zdd�Zd�Zd�Zd�ZdZdZdZedkre��dSdS)z�
Tools for reading and writing dependency trees.
The input is assumed to be in Malt-TAB format
(https://stp.lingfil.uu.se/~nivre/research/MaltXML.html).
�N)�defaultdict)�chain)�pformat)�find_binary)�Treec���eZdZdZ					d d�Zd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Ze	d!d���Zd�Zd�Zd�Z				d"d�Zd#d�Zd�Zd�Zd$d�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)%�DependencyGraphzQ
    A container for the nodes and labelled edges of a dependency structure.
    NF�ROOTc���td���|_|jd�dddd���d|_|r|�|||||���dSdS)a�Dependency graph.

        We place a dummy `TOP` node with the index 0, since the root node is
        often assigned 0 as its head. This also means that the indexing of the
        nodes corresponds directly to the Malt-TAB format, which starts at 1.

        If zero-based is True, then Malt-TAB-like input with node numbers
        starting at 0 and the root node assigned -1 (as produced by, e.g.,
        zpar).

        :param str cell_separator: the cell separator. If not provided, cells
            are split by whitespace.

        :param str top_relation_label: the label by which the top relation is
            identified, for examlple, `ROOT`, `null` or `TOP`.
        c
�>�dddddddtt��dd�	S)N)	�address�word�lemma�ctag�tag�feats�head�deps�rel)r�list���</usr/lib/python3/dist-packages/nltk/parse/dependencygraph.py�<lambda>z*DependencyGraph.__init__.<locals>.<lambda>=s1���������#�D�)�)��
�
�rr�TOP)rrr
N)�cell_extractor�
zero_based�cell_separator�top_relation_label)r�nodes�update�root�_parse)�self�tree_strrrrrs      r�__init__zDependencyGraph.__init__$s���0!�

�

�
�
��
�	
�
�1�
���e�E�a�H�H�I�I�I���	��	��K�K��-�%�-�#5�
�
�
�
�
�
�	�	rc��|j|=dS)zw
        Removes the node with the given address.  References
        to this node in others will still exist.
        N�r )r$r
s  r�remove_by_addressz!DependencyGraph.remove_by_addressWs��

�J�w���rc��|j���D]C}g}|dD]1}||vr|�|���|�|���2||d<�DdS)zp
        Redirects arcs to any of the nodes in the originals list
        to the redirect node address.
        rN)r �values�append)r$�	originals�redirect�node�new_deps�deps      r�
redirect_arcszDependencyGraph.redirect_arcs^s���
�J�%�%�'�'�	$�	$�D��H��F�|�
)�
)���)�#�#��O�O�H�-�-�-�-��O�O�C�(�(�(�(�#�D��L�L�	$�	$rc���|j|d}|j|d�|g��|j|d|�|��dS)zw
        Adds an arc from the node specified by head_address to the
        node specified by the mod address.
        rrN)r �
setdefaultr,)r$�head_address�mod_address�relations    r�add_arczDependencyGraph.add_arclsb��
�:�k�*�5�1���
�<� ��(�3�3�H�b�A�A�A��
�<� ��(��2�9�9�+�F�F�F�F�Frc�H�|j���D]�}|j���D]k}|d|dkrW|ddkrK|d}|d�|g��|d|�|d���l��dS)zr
        Fully connects all non-root nodes.  All nodes are set to be dependents
        of the root node.
        r
rrrN)r r+r4r,)r$�node1�node2r7s    r�
connect_graphzDependencyGraph.connect_graphvs���
�Z�&�&�(�(�	E�	E�E���*�*�,�,�
E�
E����#�u�Y�'7�7�7�E�%�L�E�<Q�<Q�$�U�|�H��&�M�,�,�X�r�:�:�:��&�M�(�+�2�2�5��3C�D�D�D��	
E�	E�	Erc��|j|S)z'Return the node with the given address.r(�r$�node_addresss  r�get_by_addresszDependencyGraph.get_by_address�s���z�,�'�'rc��||jvS)zq
        Returns true if the graph contains a node with the given node
        address, false otherwise.
        r(r>s  r�contains_addressz DependencyGraph.contains_address�s��
�t�z�)�)rc	��d}|dz
}|dz
}t|j���d����D]�}|d�|d|d|d��z
}|d	���D]L\}}|D]D}|�!|d�|d||��z
}�%|d�|d|��z
}�E�M��|d
z
}|S)aReturn a dot representation suitable for using with Graphviz.

        >>> dg = DependencyGraph(
        ...     'John N 2\n'
        ...     'loves V 0\n'
        ...     'Mary N 2'
        ... )
        >>> print(dg.to_dot())
        digraph G{
        edge [dir=forward]
        node [shape=plaintext]
        <BLANKLINE>
        0 [label="0 (None)"]
        0 -> 2 [label="ROOT"]
        1 [label="1 (John)"]
        2 [label="2 (loves)"]
        2 -> 1 [label=""]
        2 -> 3 [label=""]
        3 [label="3 (Mary)"]
        }

        zdigraph G{
zedge [dir=forward]
znode [shape=plaintext]
c��|dS�Nr
r)�vs rrz(DependencyGraph.to_dot.<locals>.<lambda>�s
��a�	�l�r)�keyz
{} [label="{} ({})"]r
rrNz
{} -> {} [label="{}"]z

{} -> {} z
})�sortedr r+�format�items)r$�sr/rrr1s      r�to_dotzDependencyGraph.to_dot�s ��0
��	�
#�#��	�
'�'���4�:�,�,�.�.�4J�4J�K�K�K�	H�	H�D�
�)�0�0��Y���Y���V����
�A�
"�&�\�/�/�1�1�
H�
H�	��T��H�H�C����6�=�=�d�9�o�s�TW�X�X�X����]�1�1�$�y�/�3�G�G�G���	H�
H�	
�U�
���rc�H�|���}t|��S)a�Show SVG representation of the transducer (IPython magic).
        >>> from nltk.test.setup_fixt import check_binary
        >>> check_binary('dot')
        >>> dg = DependencyGraph(
        ...     'John N 2\n'
        ...     'loves V 0\n'
        ...     'Mary N 2'
        ... )
        >>> dg._repr_svg_().split('\n')[0]
        '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'

        )rL�dot2img)r$�
dot_strings  r�
_repr_svg_zDependencyGraph._repr_svg_�s���[�[�]�]�
��z�"�"�"rc�*�t|j��S�N)rr �r$s r�__str__zDependencyGraph.__str__�s���t�z�"�"�"rc�2�dt|j���d�S)Nz<DependencyGraph with z nodes>)�lenr rSs r�__repr__zDependencyGraph.__repr__�s��@��D�J���@�@�@�@rc������t|��5}���fd�|����d��D��cddd��S#1swxYwYdS)a�
        :param filename: a name of a file in Malt-TAB format
        :param zero_based: nodes in the input file are numbered starting from 0
            rather than 1 (as produced by, e.g., zpar)
        :param str cell_separator: the cell separator. If not provided, cells
            are split by whitespace.
        :param str top_relation_label: the label by which the top relation is
            identified, for examlple, `ROOT`, `null` or `TOP`.

        :return: a list of DependencyGraphs

        c�6��g|]}t|��������S))rrr�r	)�.0r%rrrs  ���r�
<listcomp>z(DependencyGraph.load.<locals>.<listcomp>�sF�������
 ��)�#1�'9�	�����r�

N)�open�read�split)�filenamerrr�infiles ``` r�loadzDependencyGraph.load�s������ �(�^�^�		�v�������!'���
�
� 3� 3�F� ;� ;����		�		�		�		�		�		�		�		�		�		�		�		����		�		�		�		�		�		s�5A�A�Ac����tj|j|d�����}|j|d�t	�fd�|D����S)zl
        Returns the number of left children under the node specified
        by the given address.
        rr
c3�(�K�|]}|�k�dV��
dS��Nr�r[�c�indexs  �r�	<genexpr>z0DependencyGraph.left_children.<locals>.<genexpr>��'�����4�4��!�e�)�)�1�)�)�)�)�4�4r�r�
from_iterabler r+�sum�r$�
node_index�childrenrjs   @r�
left_childrenzDependencyGraph.left_children��a���
�&�t�z�*�'=�f�'E�'L�'L�'N�'N�O�O���
�:�&�y�1���4�4�4�4�h�4�4�4�4�4�4rc����tj|j|d�����}|j|d�t	�fd�|D����S)zm
        Returns the number of right children under the node specified
        by the given address.
        rr
c3�(�K�|]}|�k�dV��
dSrfrrhs  �rrkz1DependencyGraph.right_children.<locals>.<genexpr>�rlrrmrps   @r�right_childrenzDependencyGraph.right_children�rtrc��|�|d��s(|j|d�|��dSdSrE)rBr r!)r$r/s  r�add_nodezDependencyGraph.add_node�sK���$�$�T�)�_�5�5�	5��J�t�I��'�.�.�t�4�4�4�4�4�	5�	5rc�D�d�}d�}d�}d�}	||||	d�}
t|t��rd�|�d��D��}d�|D��}d	�|D��}d
}t|d���D�]D\}
}|�|��}|�t	|��}n|t	|��ksJ�|�?	|
|}n5#t
$r(}t
d
�|����|�d
}~wwxYw	|||
��\}
}}}}}}}n*#ttf$r||��\}}}}}}}YnwxYw|dkr��t|��}|r|dz
}|j
|
�|
|||||||d���|dkr|dkr|}|j
|d|�|
����F|j
dd|r:|j
dd|d}|j
||_
||_d
Stjd��d
S)a�Parse a sentence.

        :param extractor: a function that given a tuple of cells returns a
        7-tuple, where the values are ``word, lemma, ctag, tag, feats, head,
        rel``.

        :param str cell_separator: the cell separator. If not provided, cells
        are split by whitespace.

        :param str top_relation_label: the label by which the top relation is
        identified, for examlple, `ROOT`, `null` or `TOP`.

        c�"�|\}}}|||||d|dfS�N�r)�cellsrjrrrs     r�extract_3_cellsz/DependencyGraph._parse.<locals>.extract_3_cellss$��#�O�D�#�t��$��c�3��D�"�<�<rc�$�|\}}}}|||||d||fSr|r)r~rjrrrrs      r�extract_4_cellsz/DependencyGraph._parse.<locals>.extract_4_cellss'��#(� �D�#�t�S��$��c�3��D�#�=�=rc�l�|\}}}}}}}	t|��}n#t$rYnwxYw|||||d||fSr|��int�
ValueError)	r~rj�
line_indexrrr�_rrs	         r�extract_7_cellsz/DependencyGraph._parse.<locals>.extract_7_cells sa��9>�6�J��e�S�!�T�3�
��J�������
�
�
���
�����$��s�C��T�3�>�>s��
)�)c
�r�|\
}}}}}}}}	}
}
	t|��}n#t$rYnwxYw||||||||	fSrRr�)r~rjr�rrrrrrrr�s           r�extract_10_cellsz0DependencyGraph._parse.<locals>.extract_10_cells)sg��IN�F�J��e�T�3��t�S�!�Q�
��J�������
�
�
���
�����$��t�S�%��s�B�Bs��
,�,)����
c3�K�|]}|V��dSrRr)r[�lines  rrkz)DependencyGraph._parse.<locals>.<genexpr>:s"����:�:�t�d�:�:�:�:�:�:r�
c3�>K�|]}|���V��dSrR)�rstrip�r[�ls  rrkz)DependencyGraph._parse.<locals>.<genexpr><s*����,�,�������,�,�,�,�,�,rc3�K�|]}|�|V��	dSrRrr�s  rrkz)DependencyGraph._parse.<locals>.<genexpr>=s'����'�'�q�Q�'��'�'�'�'�'�'rNrg)�start�TNumber of tab-delimited fields ({}) not supported by CoNLL(10) or Malt-Tab(4) formatr�)r
rrrrrrrr�rrzBThe graph doesn't contain a node that depends on the root element.)�
isinstance�strr`�	enumeraterV�KeyErrorr�rI�	TypeErrorr�r r!r,r"r�warnings�warn)r$�input_rrrrrr�r�r��
extractors�lines�cell_numberrjr�r~�errrrrrr�root_addresss                         rr#zDependencyGraph._parses
��,	=�	=�	=�	>�	>�	>�	?�	?�	?�	C�	C�	C���� �	
�
�
��f�c�"�"�	;�:�:�v�|�|�D�'9�'9�:�:�:�F�,�,�V�,�,�,��'�'�E�'�'�'����$�U�!�4�4�4�1	8�1	8�K�E�4��J�J�~�.�.�E��"�!�%�j�j���"�c�%�j�j�0�0�0�0��%��%/��%<�N�N������$�:�:@�&��:M�:M�������������
Q�BP�.��5�C�C�?��t�U�D�#�u�d�C�C���z�*�
Q�
Q�
Q�<J�>�%�;P�;P�8��e�T�3��t�S�S�S�	
Q�����s�{�{���t�9�9�D��
���	���J�u��$�$�$� �"� ��"� ��	�	�
�
�
��q� � �t�q�y�y�(���J�t��V�$�S�)�0�0��7�7�7�7��:�a�=�� �!3�4�	��:�a�=��0�1C�D�Q�G�L��
�<�0�D�I�&8�D�#�#�#��M�W�
�
�
�
�
s*�8C�
C3�#C.�.C3�7D
�
$D4�3D4Tc�*�|d}|r|dkr|S|S)Nr�,r)r$r/�filter�ws    r�_wordzDependencyGraph._word|s&����L���	��C�x�x����rc������|��}|d}ttj|d�������}|rt|�fd�|D����S|S)z�Turn dependency graphs into NLTK trees.

        :param int i: index of a node
        :return: either a word (if the indexed node is a leaf) or a ``Tree``.
        rrc�:��g|]}��|����Sr��_tree�r[r1r$s  �rr\z)DependencyGraph._tree.<locals>.<listcomp>�s#���?�?�?�3�t�z�z�#���?�?�?r)r@rHrrnr+r)r$�ir/rrs`    rr�zDependencyGraph._tree�s{����"�"�1�%�%���F�|���e�)�$�v�,�*=�*=�*?�*?�@�@�A�A���	���?�?�?�?�$�?�?�?�@�@�@��Krc�����j}|d}ttj|d�������}t|�fd�|D����S)z�
        Starting with the ``root`` node, build a dependency tree using the NLTK
        ``Tree`` constructor. Dependency labels are omitted.
        rrc�:��g|]}��|����Srr�r�s  �rr\z(DependencyGraph.tree.<locals>.<listcomp>�s#���;�;�;�s�4�:�:�c�?�?�;�;�;r)r"rHrrnr+r)r$r/rrs`   r�treezDependencyGraph.tree�sb���
�y���F�|���e�)�$�v�,�*=�*=�*?�*?�@�@�A�A���D�;�;�;�;�d�;�;�;�<�<�<rc#�LK�|s|j}|d|df}ttj|d�������D]N}|�|��}||d|d|dffV�|�|���Ed{V���OdS)zs
        Extract dependency triples of the form:
        ((head word, head tag), rel, (dep word, dep tag))
        rrrr)r/N)r"rHrrnr+r@�triples)r$r/rr�r1s     rr�zDependencyGraph.triples�s������	��9�D��V��d�6�l�+����+�D��L�,?�,?�,A�,A�B�B�C�C�	.�	.�A��%�%�a�(�(�C���U��c�&�k�3�v�;�%?�@�@�@�@��|�|��|�-�-�-�-�-�-�-�-�-�-�	.�	.rc�L�	|j|dS#t$rYdSwxYw)Nr�r �
IndexError�r$r�s  r�_hdzDependencyGraph._hd�s:��	��:�a�=��(�(���	�	�	��4�4�	������
#�#c�L�	|j|dS#t$rYdSwxYw)Nrr�r�s  r�_relzDependencyGraph._rel�s:��	��:�a�=��'�'���	�	�	��4�4�	���r�c��i}|j���D])}|dD]}t|d|g��}d||<��*|jD]�}i}|D]J}|D]E}|d|dkr1t|d|dg��}||||z||<�F�K|D]Z}	||	||	<|	d|	dkr;|�|�|	d��|	d��}
|
ccS�[��dS)aECheck whether there are cycles.

        >>> dg = DependencyGraph(treebank_data)
        >>> dg.contains_cycle()
        False

        >>> cyclic_dg = DependencyGraph()
        >>> top = {'word': None, 'deps': [1], 'rel': 'TOP', 'address': 0}
        >>> child1 = {'word': None, 'deps': [2], 'rel': 'NTOP', 'address': 1}
        >>> child2 = {'word': None, 'deps': [4], 'rel': 'NTOP', 'address': 2}
        >>> child3 = {'word': None, 'deps': [1], 'rel': 'NTOP', 'address': 3}
        >>> child4 = {'word': None, 'deps': [3], 'rel': 'NTOP', 'address': 4}
        >>> cyclic_dg.nodes = {
        ...     0: top,
        ...     1: child1,
        ...     2: child2,
        ...     3: child3,
        ...     4: child4,
        ... }
        >>> cyclic_dg.root = top

        >>> cyclic_dg.contains_cycle()
        [1, 2, 4, 3]

        rr
rgrF)r r+�tuple�get_cycle_pathr@)r$�	distancesr/r1rGr��new_entries�pair1�pair2�pair�paths           r�contains_cyclezDependencyGraph.contains_cycle�sb��4�	��J�%�%�'�'�	#�	#�D��F�|�
#�
#���T�)�_�c�2�3�3��!"�	�#���
#���
	 �
	 �A��K�"�
O�
O��&�O�O�E��Q�x�5��8�+�+�#�U�1�X�u�Q�x�$8�9�9��+4�U�+;�i��>N�+N��C�(��O�
$�
 �
 ��"-�d�"3�	�$����7�d�1�g�%�%��.�.�t�/B�/B�4��7�/K�/K�T�RS�W�U�U�D��K�K�K�K�K�&�
 ��urc��|dD]}||kr|dgcS�|dD]^}|�|�|��|��}t|��dkr |�d|d��|cS�_gS)Nrr
r)r�r@rV�insert)r$�	curr_node�goal_node_indexr1r�s     rr�zDependencyGraph.get_cycle_path�s����V�$�	.�	.�C��o�%�%�!�)�,�-�-�-�-�&��V�$�	�	�C��&�&�t�':�':�3�'?�'?��Q�Q�D��4�y�y�1�}�}����A�y��3�4�4�4�������	rc���|dkrd�n4|dkrd�n+|dkrd�n"td�|�����d��fd	�t|j�����D����S)
z�
        The dependency graph in CoNLL format.

        :param style: the style to use for the format (3, 4, 10 columns)
        :type style: int
        :rtype: str
        r�z{word}	{tag}	{head}
r�z{word}	{tag}	{head}	{rel}
r�z9{i}	{word}	{lemma}	{ctag}	{tag}	{feats}	{head}	{rel}	_	_
r�r}c3�T�K�|]"\}}|ddk��jdd|i|��V��#dS)rrr�Nr)rI)r[r�r/�templates   �rrkz+DependencyGraph.to_conll.<locals>.<genexpr>
sY�����
�
���4��E�{�e�#�#�
�H�O�(�(�a�(�4�(�(�#�#�#�#�
�
r)r�rI�joinrHr rJ)r$�styler�s  @r�to_conllzDependencyGraph.to_conll�s�����A�:�:�0�H�H�
�a�Z�Z�7�H�H�
�b�[�[�U�
�H��2�28�&��-�-���
�
�w�w�
�
�
�
�!�$�*�"2�"2�"4�"4�5�5�
�
�
�
�
�	
rc�T��ddl}ttdt�j������}�fd�|D��}i�_|D]}�j|d�j|<�|���}|�|��|�|��|S)zJConvert the data in a ``nodelist`` into a networkx labeled directed graph.rNrgc���g|]B}��|���|��|����|��f��CSr)r�r�)r[�nr$s  �rr\z,DependencyGraph.nx_graph.<locals>.<listcomp>sS���
�
�
�/0�4�8�8�A�;�;�
�
�������T�Y�Y�q�\�\�*�
�
�
rr)	�networkxr�rangerVr �	nx_labels�MultiDiGraph�add_nodes_from�add_edges_from)r$r��nx_nodelist�nx_edgelistr��gs`     r�nx_graphzDependencyGraph.nx_graphs���������5��C��
�O�O�4�4�5�5��
�
�
�
�4?�
�
�
������	6�	6�A� $�
�1�
�f� 5�D�N�1����!�!�#�#��	����%�%�%�	����%�%�%��r)NNFNr
)FNr
)NFNr
)TrR)�__name__�
__module__�__qualname__�__doc__r&r)r2r8r<r@rBrLrPrTrW�staticmethodrcrsrwryr#r�r�r�r�r�r�r�r�r�r�rrrr	r	s�������������!�
1�1�1�1�f � � �$�$�$�G�G�G�
E�
E�
E�(�(�(�*�*�*�+�+�+�Z#�#�#� #�#�#�A�A�A��LR�����\��45�5�5�5�5�5�5�5�5����!�
x�x�x�x�t����
�
�
�	=�	=�	=�
.�
.�
.�
.�������0�0�0�d	�	�	�
�
�
�:����rr	�svgc�\�	td��	|dvrtjdd|zgd|d���}n*tjdd|zgt|d������}|jS#td	�|�����xYw#t$r}td
��|�d}~wwxYw)a�
    Create image representation fom dot_string, using the 'dot' program
    from the Graphviz package.

    Use the 't' argument to specify the image file format, for ex. 'jpeg', 'eps',
    'json', 'png' or 'webp' (Running 'dot -T:' lists all available formats).

    Note that the "capture_output" option of subprocess.run() is only available
    with text formats (like svg), but not with binary image formats (like png).
    �dot)r��dot_json�jsonr�z-T%sT)�capture_output�input�text�utf8)�encoding)r�zACannot create image representation by running dot from string: {}z0Cannot find the dot binary from Graphviz packageN)r�
subprocess�run�bytes�stdout�	ExceptionrI�OSError)rO�t�procr�s    rrNrN&s���S��E����	��6�6�6�!�~��F�Q�J�'�#'�$��	�����"�~��F�Q�J�'��
�V�<�<�<������;���	����6�*�%�%���
������S�S�S��J�K�K�QR�R�����S���s)�B�AA%�%$B	�	B�
B+�B&�&B+c��eZdZdZdS)�DependencyGraphErrorzDependency graph exception.N)r�r�r�r�rrrr�r�Ks������%�%�%�%rr�c�v�t��t��t��t��dSrR)�	malt_demo�
conll_demo�conll_file_demo�cycle_finding_demorrr�demor�Os2��
�K�K�K��L�L�L����������rFc��td��}|���}|���|r�ddl}ddlm}|���}|���|�|d���}|�	||d���|�
|||j��|�g��|�
g��|�d	��|���dSdS)
zw
    A demonstration of the result of reading a dependency
    version of the first sentence of the Penn Treebank.
    �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
rN)�pylabrg)�dim�2)�	node_sizeztree.png)r	r��pprintr��
matplotlibrr��info�
spring_layout�draw_networkx_nodes�draw_networkx_labelsr��xticks�yticks�savefig�show)�nx�dgr�r�rr��poss       rr�r�Vs��

�	�
�
�B�*�7�7�9�9�D��K�K�M�M�M�	������$�$�$�$�$�$��K�K�M�M��	�������$�$�Q�A�$�.�.���$�$�Q��r�$�:�:�:��%�%�a��b�l�;�;�;�
���R����
���R����
�
�
�j�!�!�!�
�
�
�������rc���tt��}|���}|���t	|��t	|�d����dS)zg
    A demonstration of how to read a string representation of
    a CoNLL format dependency tree.
    r�N)r	�conll_data1r�r�printr�)rr�s  rr�r��sT��

��	%�	%�B�
�7�7�9�9�D��K�K�M�M�M�	�"�I�I�I�	�"�+�+�a�.�.�����rc���td��d�t�d��D��}|D]9}|���}td��|����:dS)NzMass conll_read demo...c�0�g|]}|�t|����SrrZ)r[�entrys  rr\z#conll_file_demo.<locals>.<listcomp>�s%��
U�
U�
U��u�
U�o�e�$�$�
U�
U�
Urr]r�)r�conll_data2r`r�r)�graphs�graphr�s   rr�r��sr��	�
#�$�$�$�
U�
U�+�2C�2C�F�2K�2K�
U�
U�
U�F������z�z�|�|��
�d�������
�
�
�
��rc���tt��}t|�����t��}|�ddgddd���|�ddgddd���|�ddgddd���|�ddgddd���|�ddgddd���t|�����dS)	Nrgrr)rrrr
��NTOPr�r�)r	�
treebank_datarr�ry)r�	cyclic_dgs  rr�r��s���	��	'�	'�B�	�"�
�
�
�
�����!�!�I�
����q�c�%�A�N�N�O�O�O�
����q�c�&�Q�O�O�P�P�P�
����q�c�&�Q�O�O�P�P�P�
����q�c�&�Q�O�O�P�P�P�
����q�c�&�Q�O�O�P�P�P�	�)�
"�
"�
$�
$�%�%�%�%�%rr�a/
1   Ze                ze                Pron  Pron  per|3|evofmv|nom                 2   su      _  _
2   had               heb               V     V     trans|ovt|1of2of3|ev             0   ROOT    _  _
3   met               met               Prep  Prep  voor                             8   mod     _  _
4   haar              haar              Pron  Pron  bez|3|ev|neut|attr               5   det     _  _
5   moeder            moeder            N     N     soort|ev|neut                    3   obj1    _  _
6   kunnen            kan               V     V     hulp|ott|1of2of3|mv              2   vc      _  _
7   gaan              ga                V     V     hulp|inf                         6   vc      _  _
8   winkelen          winkel            V     V     intrans|inf                      11  cnj     _  _
9   ,                 ,                 Punc  Punc  komma                            8   punct   _  _
10  zwemmen           zwem              V     V     intrans|inf                      11  cnj     _  _
11  of                of                Conj  Conj  neven                            7   vc      _  _
12  terrassen         terras            N     N     soort|mv|neut                    11  cnj     _  _
13  .                 .                 Punc  Punc  punt                             12  punct   _  _
a1   Cathy             Cathy             N     N     eigen|ev|neut                    2   su      _  _
2   zag               zie               V     V     trans|ovt|1of2of3|ev             0   ROOT    _  _
3   hen               hen               Pron  Pron  per|3|mv|datofacc                2   obj1    _  _
4   wild              wild              Adj   Adj   attr|stell|onverv                5   mod     _  _
5   zwaaien           zwaai             N     N     soort|mv|neut                    2   vc      _  _
6   .                 .                 Punc  Punc  punt                             5   punct   _  _

1   Ze                ze                Pron  Pron  per|3|evofmv|nom                 2   su      _  _
2   had               heb               V     V     trans|ovt|1of2of3|ev             0   ROOT    _  _
3   met               met               Prep  Prep  voor                             8   mod     _  _
4   haar              haar              Pron  Pron  bez|3|ev|neut|attr               5   det     _  _
5   moeder            moeder            N     N     soort|ev|neut                    3   obj1    _  _
6   kunnen            kan               V     V     hulp|ott|1of2of3|mv              2   vc      _  _
7   gaan              ga                V     V     hulp|inf                         6   vc      _  _
8   winkelen          winkel            V     V     intrans|inf                      11  cnj     _  _
9   ,                 ,                 Punc  Punc  komma                            8   punct   _  _
10  zwemmen           zwem              V     V     intrans|inf                      11  cnj     _  _
11  of                of                Conj  Conj  neven                            7   vc      _  _
12  terrassen         terras            N     N     soort|mv|neut                    11  cnj     _  _
13  .                 .                 Punc  Punc  punt                             12  punct   _  _

1   Dat               dat               Pron  Pron  aanw|neut|attr                   2   det     _  _
2   werkwoord         werkwoord         N     N     soort|ev|neut                    6   obj1    _  _
3   had               heb               V     V     hulp|ovt|1of2of3|ev              0   ROOT    _  _
4   ze                ze                Pron  Pron  per|3|evofmv|nom                 6   su      _  _
5   zelf              zelf              Pron  Pron  aanw|neut|attr|wzelf             3   predm   _  _
6   uitgevonden       vind              V     V     trans|verldw|onverv              3   vc      _  _
7   .                 .                 Punc  Punc  punt                             6   punct   _  _

1   Het               het               Pron  Pron  onbep|neut|zelfst                2   su      _  _
2   hoorde            hoor              V     V     trans|ovt|1of2of3|ev             0   ROOT    _  _
3   bij               bij               Prep  Prep  voor                             2   ld      _  _
4   de                de                Art   Art   bep|zijdofmv|neut                6   det     _  _
5   warme             warm              Adj   Adj   attr|stell|vervneut              6   mod     _  _
6   zomerdag          zomerdag          N     N     soort|ev|neut                    3   obj1    _  _
7   die               die               Pron  Pron  betr|neut|zelfst                 6   mod     _  _
8   ze                ze                Pron  Pron  per|3|evofmv|nom                 12  su      _  _
9   ginds             ginds             Adv   Adv   gew|aanw                         12  mod     _  _
10  achter            achter            Adv   Adv   gew|geenfunc|stell|onverv        12  svp     _  _
11  had               heb               V     V     hulp|ovt|1of2of3|ev              7   body    _  _
12  gelaten           laat              V     V     trans|verldw|onverv              11  vc      _  _
13  .                 .                 Punc  Punc  punt                             12  punct   _  _

1   Ze                ze                Pron  Pron  per|3|evofmv|nom                 2   su      _  _
2   hadden            heb               V     V     trans|ovt|1of2of3|mv             0   ROOT    _  _
3   languit           languit           Adv   Adv   gew|geenfunc|stell|onverv        11  mod     _  _
4   naast             naast             Prep  Prep  voor                             11  mod     _  _
5   elkaar            elkaar            Pron  Pron  rec|neut                         4   obj1    _  _
6   op                op                Prep  Prep  voor                             11  ld      _  _
7   de                de                Art   Art   bep|zijdofmv|neut                8   det     _  _
8   strandstoelen     strandstoel       N     N     soort|mv|neut                    6   obj1    _  _
9   kunnen            kan               V     V     hulp|inf                         2   vc      _  _
10  gaan              ga                V     V     hulp|inf                         9   vc      _  _
11  liggen            lig               V     V     intrans|inf                      10  vc      _  _
12  .                 .                 Punc  Punc  punt                             11  punct   _  _

1   Zij               zij               Pron  Pron  per|3|evofmv|nom                 2   su      _  _
2   zou               zal               V     V     hulp|ovt|1of2of3|ev              7   cnj     _  _
3   mams              mams              N     N     soort|ev|neut                    4   det     _  _
4   rug               rug               N     N     soort|ev|neut                    5   obj1    _  _
5   ingewreven        wrijf             V     V     trans|verldw|onverv              6   vc      _  _
6   hebben            heb               V     V     hulp|inf                         2   vc      _  _
7   en                en                Conj  Conj  neven                            0   ROOT    _  _
8   mam               mam               V     V     trans|ovt|1of2of3|ev             7   cnj     _  _
9   de                de                Art   Art   bep|zijdofmv|neut                10  det     _  _
10  hare              hare              Pron  Pron  bez|3|ev|neut|attr               8   obj1    _  _
11  .                 .                 Punc  Punc  punt                             10  punct   _  _

1   Of                of                Conj  Conj  onder|metfin                     0   ROOT    _  _
2   ze                ze                Pron  Pron  per|3|evofmv|nom                 3   su      _  _
3   had               heb               V     V     hulp|ovt|1of2of3|ev              0   ROOT    _  _
4   gewoon            gewoon            Adj   Adj   adv|stell|onverv                 10  mod     _  _
5   met               met               Prep  Prep  voor                             10  mod     _  _
6   haar              haar              Pron  Pron  bez|3|ev|neut|attr               7   det     _  _
7   vriendinnen       vriendin          N     N     soort|mv|neut                    5   obj1    _  _
8   rond              rond              Adv   Adv   deelv                            10  svp     _  _
9   kunnen            kan               V     V     hulp|inf                         3   vc      _  _
10  slenteren         slenter           V     V     intrans|inf                      9   vc      _  _
11  in                in                Prep  Prep  voor                             10  mod     _  _
12  de                de                Art   Art   bep|zijdofmv|neut                13  det     _  _
13  buurt             buurt             N     N     soort|ev|neut                    11  obj1    _  _
14  van               van               Prep  Prep  voor                             13  mod     _  _
15  Trafalgar_Square  Trafalgar_Square  MWU   N_N   eigen|ev|neut_eigen|ev|neut      14  obj1    _  _
16  .                 .                 Punc  Punc  punt                             15  punct   _  _
�__main__)r�)F)r�r�r��collectionsr�	itertoolsrrr�nltk.internalsr�	nltk.treerr	rNr�r�r�r�r�r�r�rrrr�rrr�<module>r$s�������������#�#�#�#�#�#�������������&�&�&�&�&�&�������D�D�D�D�D�D�D�D�N"S�"S�"S�"S�J&�&�&�&�&�9�&�&�&����*�*�*�*�Z	�	�	����	&�	&�	&��
�(�� T��l�z����D�F�F�F�F�F��r

Youez - 2016 - github.com/yon3zu
LinuXploit