
    /h{                         S r SSKrSSKrSSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr   " S S	5      rSS
 jr " S S\5      rS rSS jrS rS rS rSrSrSr\S:X  a  \" 5         gg)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                       \ rS rSrSr     SS jrS rS rS rS r	S	 r
S
 rS rS rS rS r\ S S j5       rS rS rS r    S!S jrS"S jrS rS rS#S jrS rS rS rS rS rS rSr g)$DependencyGraph   zI
A container for the nodes and labelled edges of a dependency structure.
Nc                     [        S 5      U l        U R                  S   R                  SSSS.5        SU l        U(       a  U R	                  UUUUUS9  gg)aT  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            
      4    S S S S S S S [        [        5      S S.	$ )N)	addresswordlemmactagtagfeatsheaddepsrel)r   list     R/var/www/auris/envauris/lib/python3.13/site-packages/nltk/parse/dependencygraph.py<lambda>*DependencyGraph.__init__.<locals>.<lambda>=   s'    #D)
r   r   TOP)r   r   r   N)cell_extractor
zero_basedcell_separatortop_relation_label)r   nodesupdateroot_parse)selftree_strr   r   r   r    s         r   __init__DependencyGraph.__init__$   sc    0 !


 	

1eEaHI	KK-%-#5   r   c                     U R                   U	 g)z_
Removes the node with the given address.  References
to this node in others will still exist.
Nr!   )r%   r   s     r   remove_by_address!DependencyGraph.remove_by_addressW   s    
 JJwr   c                     U R                   R                  5        H>  n/ nUS    H,  nXQ;   a  UR                  U5        M  UR                  U5        M.     XCS'   M@     g)zX
Redirects arcs to any of the nodes in the originals list
to the redirect node address.
r   N)r!   valuesappend)r%   	originalsredirectnodenew_depsdeps         r   redirect_arcsDependencyGraph.redirect_arcs^   sU    
 JJ%%'DHF|#OOH-OOC(	 $
 $L (r   c                     U R                   U   S   nU R                   U   S   R                  U/ 5        U R                   U   S   U   R                  U5        g)z_
Adds an arc from the node specified by head_address to the
node specified by the mod address.
r   r   N)r!   
setdefaultr/   )r%   head_addressmod_addressrelations       r   add_arcDependencyGraph.add_arcl   sV    
 ::k*51

< (33HbA

< (299+Fr   c                 "   U R                   R                  5        Hq  nU R                   R                  5        HP  nUS   US   :w  d  M  US   S:w  d  M  US   nUS   R                  U/ 5        US   U   R                  US   5        MR     Ms     g)zZ
Fully connects all non-root nodes.  All nodes are set to be dependents
of the root node.
r   r   r   r   N)r!   r.   r8   r/   )r%   node1node2r;   s       r   connect_graphDependencyGraph.connect_graphv   s    
 ZZ&&(E**,#uY'77E%LE<Q$U|H&M,,Xr:&M(+2253CD	 - )r   c                      U R                   U   $ )z'Return the node with the given address.r*   r%   node_addresss     r   get_by_addressDependencyGraph.get_by_address   s    zz,''r   c                     XR                   ;   $ )zY
Returns true if the graph contains a node with the given node
address, false otherwise.
r*   rD   s     r   contains_address DependencyGraph.contains_address   s    
 zz))r   c           	      n   SnUS-  nUS-  n[        U R                  R                  5       S S9 H|  nUSR                  US   US   US   5      -  nUS	   R	                  5        HC  u  p4U H8  nUb  US
R                  US   XS5      -  nM   USR                  US   U5      -  nM:     ME     M~     US-  nU$ )a  Return 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)"]
}

zdigraph G{
zedge [dir=forward]
znode [shape=plaintext]
c                     U S   $ Nr   r   )vs    r   r   (DependencyGraph.to_dot.<locals>.<lambda>   s    a	lr   )keyz
{} [label="{} ({})"]r   r   r   z
{} -> {} [label="{}"]z

{} -> {} z
})sortedr!   r.   formatitems)r%   sr2   r   r   r4   s         r   to_dotDependencyGraph.to_dot   s    0 	##	'' 4::,,.4JKD)00YYV A
 "&\//1	C6==d9osXX]11$y/3GG	   2 L 	
U
r   c                 8    U R                  5       n[        U5      $ )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"?>'

)rU   dot2img)r%   
dot_strings     r   
_repr_svg_DependencyGraph._repr_svg_   s     [[]
z""r   c                 ,    [        U R                  5      $ N)r   r!   r%   s    r   __str__DependencyGraph.__str__   s    tzz""r   c                 4    S[        U R                  5       S3$ )Nz<DependencyGraph with z nodes>)lenr!   r^   s    r   __repr__DependencyGraph.__repr__   s    'DJJ'8@@r   c                     [        U 5       nUR                  5       R                  S5       Vs/ s H  n[        UUUUS9PM     snsSSS5        $ s  snf ! , (       d  f       g= f)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



)r   r   r    N)openreadsplitr	   )filenamer   r   r    infiler&   s         r   loadDependencyGraph.load   sd      (^v !' 3 3F ; !<H  )#1'9	 !< ^ ^s   "AAAA
A#c                    ^ [         R                  " U R                  U   S   R                  5       5      nU R                  U   S   m[	        U4S jU 5       5      $ )zT
Returns the number of left children under the node specified
by the given address.
r   r   c              3   6   >#    U  H  oT:  d  M
  S v   M     g7f   Nr   .0cindexs     r   	<genexpr>0DependencyGraph.left_children.<locals>.<genexpr>        4he)11h   		r   from_iterabler!   r.   sumr%   
node_indexchildrenru   s      @r   left_childrenDependencyGraph.left_children   P    
 &&tzz*'=f'E'L'L'NO

:&y14h444r   c                    ^ [         R                  " U R                  U   S   R                  5       5      nU R                  U   S   m[	        U4S jU 5       5      $ )zU
Returns the number of right children under the node specified
by the given address.
r   r   c              3   6   >#    U  H  oT:  d  M
  S v   M     g7frp   r   rr   s     r   rv   1DependencyGraph.right_children.<locals>.<genexpr>   rx   ry   rz   r}   s      @r   right_childrenDependencyGraph.right_children   r   r   c                 z    U R                  US   5      (       d"  U R                  US      R                  U5        g g rM   )rI   r!   r"   )r%   r2   s     r   add_nodeDependencyGraph.add_node   s7    $$T)_55JJtI'..t4 6r   c                    S nS nS nS n	UUUU	S.n
[        U[        5      (       a  S UR                  S5       5       nS U 5       nS	 U 5       nS
n[        USS9 H  u  pUR                  U5      nUc  [	        U5      nOU[	        U5      :X  d   eUc   X   n U" X5      u  nnnnnnnnUS:X  a  MX  [        U5      nU(       a  US-  nU R                  U   R                  UUUUUUUUS.5        US:X  a  US:X  a  UnU R                  U   S   U   R                  U5        M     U R                  S   S   U   (       a3  U R                  S   S   U   S   nU R                  U   U l        XPl        g
[        R                   " S5        g
! [
         a   n[        SR                  U5      5      UeS
nAff = f! [        [        4 a    U" U5      u  nnnnnnn GN0f = f)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                     U u  p#nXX#USUS4$ N r   )cellsru   r   r   r   s        r   extract_3_cells/DependencyGraph._parse.<locals>.extract_3_cells  s    #ODt3D"<<r   c                     U u  p#pEXX#USXE4$ r   r   )r   ru   r   r   r   r   s         r   extract_4_cells/DependencyGraph._parse.<locals>.extract_4_cells  s    #( Dt3D==r   c                 V    U u  p#pEpgn [        U5      nXXEUSXx4$ ! [         a     Nf = fr   int
ValueError)	r   ru   
line_indexr   r   r   _r   r   s	            r   extract_7_cells/DependencyGraph._parse.<locals>.extract_7_cells   sE    9>6Je!3J CT>>  s    
((c           
      X    U u
  p#pEpgp  n
 [        U5      nXXEXgX4$ ! [         a     Nf = fr]   r   )r   ru   r   r   r   r   r   r   r   r   r   s              r   extract_10_cells0DependencyGraph._parse.<locals>.extract_10_cells)  sG    INFJe3t!QJ SBB  s    
)))         
   c              3   $   #    U  H  ov   M     g 7fr]   r   )rs   lines     r   rv   )DependencyGraph._parse.<locals>.<genexpr>:  s     :'9td'9s   
c              3   @   #    U  H  oR                  5       v   M     g 7fr]   )rstriprs   ls     r   rv   r   <  s     ,VVs   c              3   6   #    U  H  o(       d  M  Uv   M     g 7fr]   r   r   s     r   rv   r   =  s     'EqQEs   
	Nrq   )startTNumber of tab-delimited fields ({}) not supported by CoNLL(10) or Malt-Tab(4) formatr   )r   r   r   r   r   r   r   r   r   r   r   zBThe graph doesn't contain a node that depends on the root element.)
isinstancestrri   	enumeraterb   KeyErrorr   rR   	TypeErrorr   r!   r"   r/   r#   r    warningswarn)r%   input_r   r   r   r    r   r   r   r   
extractorslinescell_numberru   r   r   er   r   r   r   r   r   r   root_addresss                            r   r$   DependencyGraph._parse  s/   ,	=	>	?	C  	

 fc"":v||D'9:F,V,'E'$U!4KEJJ~.E"!%j"c%j000%%/%<NQBPC?tUD#udC s{t9D	JJu$$$ " " 	 q tqy(JJtV$S)007c 5f ::a= !34::a=01CDQGL

<0DI&8#MMW]   $::@&:M  z* Q <J%;P8eT3tS	Qs*   FF<
F9F44F9< G G c                 .    US   nU(       a  US:w  a  U$ U$ )Nr   ,r   )r%   r2   filterws       r   _wordDependencyGraph._word|  s    LCxr   c           	          U R                  U5      nUS   n[        [        R                  " US   R	                  5       5      5      nU(       a*  [        X4 Vs/ s H  oPR                  U5      PM     sn5      $ U$ s  snf )zTurn 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``.
r   r   )rF   rQ   r   r{   r.   r   _tree)r%   ir2   r   r   r4   s         r   r   DependencyGraph._tree  so     ""1%F|e))$v,*=*=*?@A$?$3zz#$?@@K @s   A:
c           	          U R                   nUS   n[        [        R                  " US   R	                  5       5      5      n[        X# Vs/ s H  o@R                  U5      PM     sn5      $ s  snf )z~
Starting with the ``root`` node, build a dependency tree using the NLTK
``Tree`` constructor. Dependency labels are omitted.
r   r   )r#   rQ   r   r{   r.   r   r   )r%   r2   r   r   r4   s        r   treeDependencyGraph.tree  s]    
 yyF|e))$v,*=*=*?@ADd;ds::c?d;<<;s   A,
c              #   *  #    U(       d  U R                   nUS   US   4n[        [        R                  " US   R	                  5       5      5       H<  nU R                  U5      nX$S   US   US   44v   U R                  US9 Sh  vN   M>     g N	7f)z[
Extract dependency triples of the form:
((head word, head tag), rel, (dep word, dep tag))
r   r   r   r   )r2   N)r#   rQ   r   r{   r.   rF   triples)r%   r2   r   r   r4   s        r   r   DependencyGraph.triples  s      99DVd6l+++DL,?,?,ABCA%%a(CUc&k3v;%?@@|||--- D .s   BBB
Bc                 H     U R                   U   S   $ ! [         a     g f = f)Nr   r!   
IndexErrorr%   r   s     r   _hdDependencyGraph._hd  s,    	::a=(( 		    
!!c                 H     U R                   U   S   $ ! [         a     g f = f)Nr   r   r   s     r   _relDependencyGraph._rel  s,    	::a='' 		r   c                    0 nU R                   R                  5        H#  nUS    H  n[        US   U/5      nSX'   M     M%     U R                    H  n0 nU H8  nU H/  nUS   US   :X  d  M  [        US   US   /5      nX   X   -   Xd'   M1     M:     U HB  n	Xi   X'   U	S   U	S   :X  d  M  U R                  U R	                  U	S   5      U	S   5      n
U
s  s  $    M     g)a  Check 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]

r   r   rq   r   F)r!   r.   tupleget_cycle_pathrF   )r%   	distancesr2   r4   rP   r   new_entriespair1pair2pairpaths              r   contains_cycleDependencyGraph.contains_cycle  s   4 	JJ%%'DF|T)_c23!"	 $ (
 AK"&EQx58+#U1XuQx$89+4+;i>N+N( ' # $"-"3	7d1g%..t/B/B47/KTRSWUDK	 $  r   c                     US    H  nX2:X  d  M
  US   /s  $    US    HL  nU R                  U R                  U5      U5      n[        U5      S:  d  M5  UR                  SUS   5        Us  $    / $ )Nr   r   r   )r   rF   rb   insert)r%   	curr_nodegoal_node_indexr4   r   s        r   r   DependencyGraph.get_cycle_path  s}    V$C%!),-- % V$C&&t':':3'?QD4y1}Ay34	 %
 	r   c                    ^ US:X  a  SmO,US:X  a  SmO#US:X  a  SmO[        SR                  U5      5      eSR                  U4S	 j[        U R                  R                  5       5       5       5      $ )
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   c              3   f   >#    U  H&  u  pUS    S:w  d  M  TR                   " SSU0UD6v   M(     g7f)r   r   r   Nr   )rR   )rs   r   r2   templates      r   rv   +DependencyGraph.to_conll.<locals>.<genexpr>  s9      
5E{e# )HOO(a(4(5s   11)r   rR   joinrQ   r!   rS   )r%   styler   s     @r   to_conllDependencyGraph.to_conll  s{     A:0HaZ7Hb[U  228&- 
 ww 
!$**"2"2"45
 
 	
r   c                    SSK n[        [        S[        U R                  5      5      5      nU Vs/ s H<  o0R                  U5      (       d  M  X0R                  U5      U R                  U5      4PM>     nn0 U l        U H"  nU R                  U   S   U R                  U'   M$     UR                  5       nUR                  U5        UR                  U5        U$ s  snf )zJConvert the data in a ``nodelist`` into a networkx labeled directed graph.r   Nrq   r   )networkxr   rangerb   r!   r   r   	nx_labelsMultiDiGraphadd_nodes_fromadd_edges_from)r%   r   nx_nodelistnnx_edgelistgs         r   nx_graphDependencyGraph.nx_graph  s    5C

O454?
4?q88A;*QTYYq\*K 	 
 A $

1f 5DNN1  !!#	%	%
s   C&C)r!   r   r#   r    )NNFNROOT)FNr   )NFNr   )Tr]   )!__name__
__module____qualname____firstlineno____doc__r'   r+   r5   r<   rA   rF   rI   rU   rZ   r_   rc   staticmethodrl   r   r   r   r$   r   r   r   r   r   r   r   r   r   r   __static_attributes__r   r   r   r	   r	      s     !1f $G
E(*+Z# #A LR 4555 !xt	=.0d	
:r   r	   c                 8    [        S5         US;   a  [        R                  " SSU-  /SU SS9nO"[        R                  " SSU-  /[        U SS9S9nUR                  $ !   [        S	R                  U 5      5      e= f! [         a  n[        S
5      UeSnAff = f)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jsonsvgz-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	ExceptionrR   OSError)rY   tprocr   s       r   rX   rX   &  s    SE	66!~~FQJ'#'$	 "~~FQJ'
V< ;;	6*%   SJKQRRSs)   A> AA A;;A> >
BBBc                       \ rS rSrSrSrg)DependencyGraphErroriK  zDependency graph exception.r   N)r   r   r   r   r  r  r   r   r   r  r  K  s    %r   r  c                  T    [        5         [        5         [        5         [        5         g r]   )	malt_demo
conll_democonll_file_democycle_finding_demor   r   r   demor  O  s    KLr   c                    [        S5      nUR                  5       nUR                  5         U (       a  SSKnSSKJn  UR                  5       nUR                  5         UR                  USS9nUR                  XVSS9  UR                  XVUR                  5        UR                  / 5        UR                  / 5        UR                  S	5        UR                  5         gg)
zk
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
r   N)pylabrq   )dim2   )	node_sizeztree.png)r	   r   pprintr   
matplotlibr   r   infospring_layoutdraw_networkx_nodesdraw_networkx_labelsr   xticksytickssavefigshow)nxdgr   r   r   r   poss          r   r  r  V  s    
 
	
B* 779DKKM	$KKM	$$QA$.$$Qr$:%%abll;RRj!

 
r   c                      [        [        5      n U R                  5       nUR                  5         [	        U 5        [	        U R                  S5      5        g)z[
A demonstration of how to read a string representation of
a CoNLL format dependency tree.
r   N)r	   conll_data1r   r$  printr   )r/  r   s     r   r  r    s9    
 
	%B779DKKM	"I	"++a.r   c                      [        S5        [        R                  S5       V s/ s H  o (       d  M  [        U 5      PM     nn U H.  nUR	                  5       n[        S5        UR                  5         M0     g s  sn f )NzMass conll_read demo...rf   r   )r3  conll_data2ri   r	   r   r$  )entrygraphsgraphr   s       r   r  r    sa    	
#$2=2C2CF2KU2Ku$oe$2KFUzz|d  Vs
   
A7A7c                     [        [        5      n [        U R                  5       5        [        5       nUR	                  S S/SSS.5        UR	                  S S/SSS.5        UR	                  S S/SSS.5        UR	                  S S/SSS.5        UR	                  S S/SSS.5        [        UR                  5       5        g )	Nrq   r   r   )r   r   r   r      NTOPr   r   )r	   treebank_datar3  r   r   )r/  	cyclic_dgs     r   r  r    s    		'B	"


!Iqc%ANOqc&QOPqc&QOPqc&QOPqc&QOP	)
"
"
$%r   r  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   _  _
a  1   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   	itertoolsr   r$  r   nltk.internalsr   	nltk.treer   r	   rX   r  r  r  r  r  r  r  r<  r2  r5  r   r   r   r   <module>rC     s      #   & D DN"SJ&9 &*Z		&( Tl zF r   