+
    ÖÇÜha  ã                   óÚ   € R t ^ RIt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt R^R^R	^ R
^!R^"R^#R^$R^%/t ! R R4      tR tR.t]R8X  d
   ]! 4        R# R#   ] d
    ^ RIHt  L[i ; i)a{  
Pretty-printing of discontinuous trees.
Adapted from the disco-dop project, by Andreas van Cranenburgh.
https://github.com/andreasvc/disco-dop

Interesting reference (not used for this code):
T. Eschbach et al., Orth. Hypergraph Drawing, Journal of
Graph Algorithms and Applications, 10(2) 141--157 (2006)149.
https://jgaa.info/accepted/2006/EschbachGuentherBecker2006.10.2.pdf
N)Úescape)Údefaultdict)Ú
itemgetter)ÚTree)ÚOrderedDictÚblackÚredÚgreenÚyellowÚblueÚmagentaÚcyanÚwhitec                   ó^   a € ] tR t^-t o RtR
R ltR tR t]R 4       t	RR lt
RR ltR	tV tR# )ÚTreePrettyPrintera®  
Pretty-print a tree in text format, either as ASCII or Unicode.
The tree can be a normal tree, or discontinuous.

``TreePrettyPrinter(tree, sentence=None, highlight=())``
creates an object from which different visualizations can be created.

:param tree: a Tree object.
:param sentence: a list of words (strings). If `sentence` is given,
    `tree` must contain integers as leaves, which are taken as indices
    in `sentence`. Using this you can display a discontinuous tree.
:param highlight: Optionally, a sequence of Tree objects in `tree` which
    should be highlighted. Has the effect of only applying colors to nodes
    in this sequence (nodes should be given as Tree objects, terminals as
    indices).

>>> from nltk.tree import Tree
>>> tree = Tree.fromstring('(S (NP Mary) (VP walks))')
>>> print(TreePrettyPrinter(tree).text())
... # doctest: +NORMALIZE_WHITESPACE
      S
  ____|____
 NP        VP
 |         |
Mary     walks
Nc                ó*  € VEfÞ   VP                  4       pV'       d­   \        ;QJ d*    R VP                  4        4       F  '       d   K   RM	  RM! R VP                  4        4       4      '       dW   \        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d   V Uu. uF  p\        V4      NK  	  ppEMVP	                  R4      p. pVP                  4        Fò  p\        V4      ^ 8X  d.   VP                  \        V4      4       VP                  R 4       K@  \        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       g   K|  \        V4       Fg  w  rg\        V\        4      '       d   K  \        V4      WV&   \        V4      \        8X  d   RP                  V4      pVP                  RV,          4       Ki  	  Kô  	  V P                  WV4      w  V n        V n        V n        V n        R # u upi )Nc              3   ó>   "  € T F  p\        V4      ^ 8„  x € K  	  R# 5i©é    N©Úlen©Ú.0Úas   & Ú9/usr/lib/python3/dist-packages/nltk/tree/prettyprinter.pyÚ	<genexpr>Ú-TreePrettyPrinter.__init__.<locals>.<genexpr>N   s   é € Ð<©O qœ˜A› ž
«Oùs   ‚FTc              3   óB   "  € T F  p\        V\        4      x € K  	  R # 5i©N©Ú
isinstanceÚintr   s   & r   r   r   O   s   é € Ð;±F¨qœ
 1¤c×*Ð*³Fùó   ‚c              3   óL   "  € T F  p\        V\        4      '       * x € K  	  R # 5ir   )r    r   )r   Úbs   & r   r   r   [   s   é € Ð@¹a¸¤¨A¬tÓ!4×4Ñ4»aùs   ‚"$Ú/z%s)ÚleavesÚallÚsubtreesÚstrÚcopyr   ÚappendÚanyÚ	enumerater    r   ÚtypeÚtupleÚjoinÚ
nodecoordsÚnodesÚcoordsÚedgesÚ	highlight)ÚselfÚtreeÚsentencer5   r&   r   Únr$   s   &&&&    r   Ú__init__ÚTreePrettyPrinter.__init__I   sg  € ØÓØ—[‘[“]ˆFçß“CÑ<¨D¯M©M¬OÓ<—C—C’CÑ<¨D¯M©M¬OÓ<×<Ò<ß“CÑ;±FÓ;—C—C’CÑ;±FÓ;×;Ò;á,2Ó3©F qœC žF©F�Ð3‘ð —y‘y “�Ø�ØŸ™ž�AÜ˜1“v ”{ØŸ™¤ X£Ô/Ø Ÿ™¨Ö-ß›Ñ@¹aÓ@ŸŸšÑ@¹aÓ@×@Ô@Ü$-¨a¦L™D˜AÜ#-¨a´×#6Ô#6Ü'*¨8£} ¡Ü#'¨£7¬eÔ#3Ø(+¯©°« AØ (§¡°°qµÖ 9ó %1ñ )ð ?C¿o¹oØ˜Ió?
Ñ;ˆŒ
�D”K ¤¨T®^ùò# 4s   Â2Hc                ó"   € V P                  4       # r   )Útext©r6   s   &r   Ú__str__ÚTreePrettyPrinter.__str__f   s   € Ø�y‰y‹{Ðó    c                ó:   € R \        V P                  4      ,          # )z!<TreePrettyPrinter with %d nodes>)r   r2   r>   s   &r   Ú__repr__ÚTreePrettyPrinter.__repr__i   s   € Ø2´S¸¿¹³_ÕDÐDrA   c                óÔ  a aaaaaaaa a!€ VVVV V V!3R lpV3R loS P                  4       p\        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       g   \        R4      h\        V4      \        \	        V4      4      8w  d   \        R4      h\        ;QJ d    V3R lV 4       F  '       d   K   RM	  RM! V3R lV 4       4      '       g-   \        R	\        S4      S P                  4       S3,          4      hRRuo!oS P                  R4      o S P                  4        F  pVP                  R
 R7       K  	  ^o \	        4       oS P                  4       p\        \        \        V4      4      ^,           p\        \        4      pR.\        S4      S ,          ,          .o/ p	\        V4       U
Uu/ uF  w  r¥WZbK	  	  upp
oSP                  4        UU
u0 uF  w  rZV'       d   S V,          V9   g   K  V
kK!  	  ppp
\        V^,
          4       U
u/ uF  qª. bK  	  pp
. pV Fa  pS V,          p\        V\         4      '       d/   WÇVP#                  4       ,
          ,          P%                  V4       KP  VP%                  V4       Kc  	  V F  p
WÊ,          P                  V 3R lR7       K!  	  VP                  4        \	        V4      pV F×  o\'        S S,          4      S ,          pS^ ,          V,          e   Q S^ ,          V,          SV34       hSS,          S^ ,          V&   SS S,          ,          V	SS,          &   V	SS,          ,          f%   RV	SS,          &   VP)                  SS,          4       VP+                  S4       VSRR ,          P-                  ^ V34       KÙ  	  \/        VRR7       EF¼  p
WÊ,          p\        S4      pSP%                  SR,           Uu. uF  qUSR39  d   S!MRNK  	  up4       V EFl  oW§^,
          8  dÈ   VS,          '       d¹   \1        VS,          \3        ^4      R7      w  ppSRR  UUu0 uF,  pVRV  F   p\        V\4        4      '       g   K  VRR kK"  	  K.  	  uppSRR  UUu0 uF,  pVVR  F   p\        V\4        4      '       g   K  VRR kK"  	  K.  	  upp,          '       d   SP-                  S4       V! SSVV4      w  ppVP+                  S4       VS,           F  w  ppSSV,          V&   K  	  SS,          SV,          V&   S S,          V	SS,          &   \        S4      ^ 8”  g   EKO  VSRR ,          P-                  VV34       EKo  	  EK¿  	  \        V4      ^ 8X  g   Q h\        S \        S4      ,          ^,
          RR4       FQ  o\6        ;QJ d    V3R lS 4       F  '       g   K   RM	  RM! V3R lS 4       4      '       d   KE  S F  pVS K  	  KS  	  \9        S4       Uu. uFG  p\        ;QJ d    V!3R lV 4       F  '       d   K   RM	  RM! V!3R lV 4       4      '       d   KE  VNKI  	  upo/ p\        S4       FJ  w  p
p\        SV
,          4       F.  w  op\        V\&        4      '       g   K  V^ 8¼  g   K'  V
S3VV&   K0  	  KL  	  \/        R VP;                  4        4       V3R lR7      p\=        4       p\9        V4       F:  p\        S V,          4       F!  w  ppSV,          VSVV3,           ,          &   K#  	  K<  	  V	VVV3# u upp
i u up
pi u up
i u upi u uppi u uppi u upi )a  
Produce coordinates of nodes on a grid.

Objective:

- Produce coordinates for a non-overlapping placement of nodes and
    horizontal lines.
- Order edges so that crossing edges cross a minimal number of previous
    horizontal lines (never vertical lines).

Approach:

- bottom up level order traversal (start at terminals)
- at each level, identify nodes which cannot be on the same row
- identify nodes which cannot be in the same column
- place nodes into a grid at (row, column)
- order child-parent edges with crossing edges last

Coordinates are (row, column); the origin (0, 0) is at the top left;
the root node is on row 0. Coordinates do not consider the size of a
node (which depends on font, &c), so the width of a column of the grid
should be automatically determined by the element with the greatest
width in that column. Alternatively, the integer coordinates could be
converted to coordinates in which the distances between adjacent nodes
are non-uniform.

Produces tuple (nodes, coords, edges, highlighted) where:

- nodes[id]: Tree object for the node with this integer id
- coords[id]: (n, m) coordinate where to draw node with id in the grid
- edges[id]: parent id of node with this id (ordered dictionary)
- highlighted: set of ids that should be highlighted
c           	     ó¾  <€ W0,           UUu. uF  w  rEVNK	  	  ppp\        V4      \        V4      r‡SV ,          P                  4       p	S\        V	4      ,          \	        V	4      ,          p
Wx8  d,   Yzu;8  d   V8  g   M \        V4      \	        V4      ,          p
\        V4      \        V4      ,
          ^S,          8”  d/   WªS,          ,          p
Wx8  d   Yzu;8  d   V8  g   M V
S,          p
SV ,          ^ 8X  d   \	        V4      p\        V\	        V4      ^,           4       EFˆ  pV\	        V4      8X  d4   TP                  VR,           Uu. uF  pVSR39  d   SMRNK  	  up4       W,          p\	        W0,          4      ^8X  d&   V\        \        W0,          4      4      ^,          3u # \        ;QJ d;    V3R lV\        V4      \        V4      ^,             4       F  '       d   K   RM0	  RM,! V3R lV\        V4      \        V4      ^,             4       4      '       g   EK  \        S4       Ft  pW­,           ;rïW÷8”  g	   Wè8  g   K  Wè8  d   W,          V,          e   Wæ9   d   W¾3u u # W÷8”  d   W,          V,          e   Wö9   d   W¿3u u # VS,          pVS,          pKj  	  EK‹  	  \        RSV ,          WxS! 4       3,          4      hu uppi u upi )z×
Find vacant row, column index for node ``m``.
Iterate over current rows for this level (try lowest first)
and look for cell between first and last child of this node,
add new row to level if no free row available.
Nc              3   óF   <"  € T F  pVR J ;'       g    VS8H  x € K  	  R # 5ir   © ©r   r   Úvertlines   & €r   r   ÚATreePrettyPrinter.nodecoords.<locals>.findcell.<locals>.<genexpr>®   s+   øé € ð áG˜ð ˜�I×.Ð.  h¡Ô.ÛGùs   ƒ!“!FTz3could not find a free cell for:
%s
%smin=%d; max=%déÿÿÿÿ)ÚminÚmaxr&   Úsumr   Úranger+   ÚnextÚiterr'   Ú
ValueError)ÚmÚmatrixÚstartoflevelÚchildrenÚ_r   Ú
candidatesÚminidxÚmaxidxr&   ÚcenterÚrowidxÚrowr9   ÚiÚjÚcornerÚ
dumpmatrixÚidsÚscaler7   rJ   s   &&&&            €€€€€€r   ÚfindcellÚ.TreePrettyPrinter.nodecoords.<locals>.findcell�   sX  ø€ ð )1®Ô4©¡ ›!©ˆJÑ4Ü  ›_¬c°*«o�FØ˜!•W—^‘^Ó%ˆFØœS ›[Õ(¬C°«KÕ7ˆFØŒ vÖ'?¸Ö'?Ü˜Z›¬C°
«OÕ;�Ü�:‹¤ Z£Õ0°1°uµ9Ô<Ø 5�.Õ(�Ø”?¨6Ö+C¸VÖ+CØ˜e•O�FØ�1�v˜Œ{Ü" 6›{�Ü ¬c°&«k¸A­o×>�ØœS ›[Ô(Ø—M‘Mð &,¨B¦Zóá%/ ð )*°&¸$°Ô(?™HÀTÒIÙ%/ñôð •n�Ü�x•{Ó# qÔ(Ø!¤4¬¨X­[Ó(9Ó#:¸1Õ#=Ð=Ò=ß“Sô à ¤ Z£´3°z³?ÀQÕ3FÑGó—S—S’Sô à ¤ Z£´3°z³?ÀQÕ3FÑGó÷ õ ô
 # 5ž\˜Ø &¥
Ð*˜Øœj¨A®JØ œzØ &¥¨qÕ 1Ò 9¸Q¼_à'- yÔ 0Ø!"¤Ø &¥¨qÕ 1Ò 9¸Q¼_à'- yÔ 0Ø �J˜AØ �JšAô *ñ! ?ô: ð!Ø$(¨¥G¨V¹Z»\Ð#JõKóð ùóS 5ùòs   �KÅK
c                 óF   <€ RP                  R \        S 4       4       4      # )z,Dump matrix contents for debugging purposes.Ú
c              3   óh   "  € T F(  w  rR VRP                  R V 4       4      3,          x € K*  	  R# 5i)z%2d: %sÚ c              3   óB   "  € T F  pR V,          R,          x € K  	  R# 5i)z%2r:Né   NNrH   )r   r_   s   & r   r   ÚMTreePrettyPrinter.nodecoords.<locals>.dumpmatrix.<locals>.<genexpr>.<genexpr>È   s   é € Ð(FÁ#¸Q¨%°!­)°R¯ªÃ#ùr"   N©r0   )r   r9   r^   s   &  r   r   ÚCTreePrettyPrinter.nodecoords.<locals>.dumpmatrix.<locals>.<genexpr>Ç   s5   é € ð á/‘F�Að ˜Q §¡Ñ(FÁ#Ó(FÓ FÐG×GÒGÛ/ùs   ‚02)r0   r-   )rU   s   €r   rb   Ú0TreePrettyPrinter.nodecoords.<locals>.dumpmatrixÅ   s&   ø€ à—9‘9ñ ä'¨Ô/óó ð rA   c              3   óB   "  € T F  p\        V\        4      x € K  	  R # 5ir   r   )r   r9   s   & r   r   Ú/TreePrettyPrinter.nodecoords.<locals>.<genexpr>Í   s   é € Ð6©v¨!”:˜a¤×%Ð%«vùr"   FTz#All leaves must be integer indices.z Indices must occur at most once.c              3   ób   <"  € T F$  p^ Tu;8*  ;'       d    \        S4      8  Mu x € K&  	  R# 5ir   r   )r   r9   r8   s   & €r   r   rr   Ñ   s%   øé € Ð:±6¨a�1˜×)Ô)œC ›M×)Ñ)³6ùs   ƒ/–/z`All leaves must be in the interval 0..n with n=len(sentence)
tokens: %d indices: %r
sentence: %sc                 ód   € \        V \        4      '       d   \        V P                  4       4      # T # r   )r    r   rM   r&   )r9   s   &r   Ú<lambda>Ú.TreePrettyPrinter.nodecoords.<locals>.<lambda>Ú   s"   € ´J¸qÄ$×4GÒ4G¤ Q§X¡X£Z£Ð!NÈQÐ!NrA   )ÚkeyNc                 óŽ   <€ \        SV ,          P                  4       4      \        SV ,          P                  4       4      ,
          # r   )rN   r&   rM   )r9   r7   s   &€r   ru   rv   ñ   s*   ø€ ¬¨T°!­W¯^©^Ó-=Ó)>ÄÀTÈ!ÅWÇ^Á^ÓEUÓAVÖ)VrA   z...©Úreversec              3   ó^   <"  € T F"  p\        VS,          \        \        34      x € K$  	  R # 5ir   )r    r   r!   )r   r^   rT   s   & €r   r   rr   +  s#   øé € ÐIÁ&¸3”z # a¥&¬4´¨+×6Ð6Ã&ùs   ƒ*-c              3   óD   <"  € T F  qR J ;'       g    VS8H  x € K  	  R # 5ir   rH   rI   s   & €r   r   rr   3  s"   øé € Ð?¹3°a˜D�y×1Ð1 A¨¡MÔ1»3ùs   ƒ ’ c              3   ó4   "  € T F  q F  q"x € K  	  K  	  R # 5ir   rH   )r   Úlevelr   s   &  r   r   rr   ?  s   é € Ð;™O�5²U°ŒQ±U‰Q›Oùs   ‚c                 ó   <€ V R R S9   # )NrL   rH   )r   Úcrosseds   &€r   ru   rv   @  s   ø€ ˜!˜C˜R˜& GÒ+rA   rL   éþÿÿÿ)r&   r'   rS   r   Úsetr*   r(   ÚsortÚtreepositionsrN   Úmapr   r-   ÚitemsrP   r    r   Úheightr+   r!   ÚdiscardÚremoveÚaddÚsortedrM   r   r/   r,   ÚreversedÚvaluesr   )"r7   r8   r5   re   r&   r   Ú	positionsÚmaxdepthÚ	childcolsr2   r9   Úhighlighted_nodesÚlevelsÚ	terminalsÚnoder_   ÚnodesatdepthrV   rX   Úpivotr^   r]   Úxr3   r4   r`   ra   r€   rb   rc   rT   rU   rd   rJ   s"   ff&                       @@@@@@@@r   r1   ÚTreePrettyPrinter.nodecoordsl   sf  ÿù€ ÷H3	ò 3	õj	ð —‘“ˆß‹sÑ6©vÓ6�s�sŠsÑ6©vÓ6×6Ò6ÜÐBÓCÐCÜˆv‹;œ#œc &›kÓ*Ô*ÜÐ?Ó@Ð@ß‹sÔ:±6Ó:�s�sŠsÔ:±6Ó:×:Ò:Üð#ä&)¨(£m°T·[±[³]ÀHÐ%MõNóð ð
 ˜rÐˆ�&Ø�y‰y˜‹ˆØ—‘–ˆAØ�F‰FÑNˆFÖOñ !àˆÜ“%ˆà×&Ñ&Ó(ˆ	Ü”sœ3 	Ó*Ó+¨aÕ/ˆÜ¤Ó$ˆ	Ø�&œC ›M¨EÕ1Õ2Ð3ˆØˆÜ )¨)Ô 4Ô5Ñ 4™˜ˆqŠtÑ 4Ò5ˆàŸ)™)œ+ô
Ù%‘$�!¯Y¸$¸q½'ÀYÑ:N�AˆA™+ð 	ñ 
ô "' x°!¥|Ô!4Ó5Ñ!4˜A�R’%Ñ!4ˆÐ5Øˆ	ÛˆAØ˜•7ˆDÜ˜$¤×%Ò%Ø $§+¡+£-Õ/Õ0×7Ñ7¸Ö:à× Ñ  Ö#ñ ó ˆAØ�I�N‰NÔVˆNÖWñ à�‰ÔÜ˜	“Nˆ	ãˆAÜ�D˜•G“˜uÕ$ˆAØ˜!•9˜Q•<Ò'Ð=¨&°­)°A­,¸¸1Ð)=Ó=Ð'Ø˜q�6ˆF�1�I�a‰LØ$ T¨!¥WÕ-ˆE�#�a•&‰MØ�S˜•V�}Ò$Ø %��c˜!•f‘Ø!×)Ñ)¨#¨a­&Ô1Ø×Ñ˜QÔØ�a˜˜�fÕ×!Ñ! 1 a &Ö)ñ ô ˜¨×-Ð-ˆAØ!�9ˆLÜ˜v›;ˆLØ�M‰MØHNÈrÎ
ÓSÉ
À1 v¨t nÔ4‘¸$Ò>É
ÑSôô "�Ø !•|Ô#¨	°!¯¬Ü" 9¨Q¥<´ZÀ³]ÔC‘H�A�uð $*¨#¨2¡;ôá#.˜CØ!$ V e£˜AÜ% a¬×/ô ˜˜#˜2›á!,ñ Ù#.òð $*¨#¨2¡;ôá#.˜CØ!$ U V£˜AÜ% a¬×/ô ˜˜#˜2›á!,ñ Ù#.ò÷
ô 
ð  Ÿ™ Aœá$ Q¨°¸iÓH‘	�˜Ø× Ñ  Ô#ð & aŸL˜L‘D�A�qØ(.�F˜6•N 1Ó%ñ )ð
 %(¨¥F��v•˜qÑ!Ø $ Q¥��c˜!•f‘ä�q“6˜A—:Ø˜a  ˜fÕ%×)Ñ)¨6°1¨+×6ô; "ñ .ôH �9‹~ Ô"Ð"Ð"ô �uœs 8›}Õ,¨qÕ0°"°bÖ9ˆAß“3ÔIÁ&ÓI—3—3’3ÔIÁ&ÓI×IÔIÛ!�CØ˜Ašó "ñ :ô   Ô'ó
á'�ß“3Ô?¹3Ó?—3—3’3Ô?¹3Ó?×?÷ ˆCÙ'ñ
ˆð ˆÜ˜fÖ%‰DˆAˆqÜ! &¨¥)Ö,‘��1Ü˜a¤×%Ô%¨!¨q®&Ø ! 1 �F˜1“Ió -ñ &ô Ù;˜FŸM™MœOÓ;Ü+ô
ˆ	ô “ˆÜ˜)Ö$ˆAÜ! $ q¥'Ö*‘��1Ø'*¨1¥v��c˜!˜q˜d�(•mÓ$ó +ñ %ð �f˜eÐ%6Ð6Ð6ùóM 6ùó
ùò 6ùò@ Tùó
ùó
ùò>
sN   Ç ]Ç$]	È]	È ]Ï-]
Ñ ]
Ñ8]
Ò ]Ò5]Ø]%Ø)]%Ù ]%Ù ]%c
                óø  aa0€ VR8X  d   ^pV'       d<   Rp
RpRpRpV
R,           V
,           pV
R,           V
,           pV
R,           V
,           pR	pMR
p
R;r¼Rp^V
,          pR;ppRpV3R lp. p\        \        4      p\        R 4      p\        R 4      p^ p/ p/ p\        \        4      p/ p\        P                  ! RV	^,
          W™3,          4      pV P
                   EFÊ  pV P                  V,          w  ppVVV,          V&   \        VV4      p\        V P
                  V,          \        4      '       d"   V P
                  V,          P                  4       MV P
                  V,          p V'       d   \        V 4      V8”  d   V RV V,           p V	'       d1   \        V 4      V	8”  d!   VP                  RV 4      P                  4       p V P                  R4      p \        VV,          \        V 4      4      VV&   \        VV,          \        \        \        V 4      4      4      VV&   V VV&   VV P                   9  d   EK_  V P                   V,          p!VV!,          P#                  VV34       \%        VP'                  V!V4      V4      VV!&   \        VP'                  V!V4      V4      VV!&   EKÍ  	  \)        VRR7       EFs  p\+        VV,          4       U"U#u. uF;  p"\+        V^,           4       U#u. uF  p#RP-                  VV#,          4      NK  	  up#NK=  	  p$p"p#\+        V^,           4       U#u. uF  p#RP-                  VV#,          4      NK  	  p%p#VV,           EFv  p#VV,          V#,          p&V P
                  V&,          p'VV&,          p(\        V'\        4      '       EdÀ   V&V9   Ed¦   VV&,          VV&,          8  Ed�   VV&,          VV&,          uo0p)VS0,          ^,           ^,          ^,
          VV),          ^,          p*pRV,          V,           P/                  VS0,          V
4      V%S0&   VRV*,          ,           P1                  VV),          V
4      V%V)&   \+        VV&,          ^,           VV&,          4       FÔ  o0S0V#8X  dR   \2        ;QJ d&    V03R lVV&,           4       F  '       g   K   RM	  RM! V03R lVV&,           4       4      '       d   Tp+M]S0V#8X  d   Tp+MS\2        ;QJ d&    V03R lVV&,           4       F  '       g   K   RM	  RM! V03R lVV&,           4       4      '       d   Tp+MT
p+V+P-                  VS0,          V
4      V%S0&   KÖ  	  MV! V%V#,          4      V%V#&   V( Uu. uF  pVP-                  VV#,          4      NK  	  p(p\        V'\        4      '       d   TMTp,\        V'\        4      '       d(   V'P                  4       P5                  R4      '       d   Tp,V'       dG   V( Uu. uF  p\7        VRR7      NK  	  p(pV&V P8                  9   d   V( Uu. uF  pRV, RV R2NK  	  p(pM>V'       d7   V&V P8                  9   d&   V( Uu. uF  pR \:        V,,          V3,          NK  	  p(p\+        VV,          4       FP  p-V-\        V(4      8  d
   V(V-,          M)VV&,          '       d   TMRP-                  VV#,          R4      V$V-,          V#&   KR  	  EKy  	  V\        V4      8w  Ed'   V P                  P=                  4        F�  w  p&w  p.p#V&^ 8”  g   K  V P                  V P                   V&,          ,          ^ ,          Tu;8  d
   V.8  g   KL  M KP  V! V%V#,          4      V%V#&   V#VV,          9  g   Kr  V$ F  p/V! V/V#,          4      V/V#&   K  	  K�  	  \?        V%V%R!,          R.,           4       UU*u. uF4  w  pp*TVR#,          R8w  d
   VR#,          MV*^ ,          S,          ,           NK6  	  p%pp*VPA                  RPC                  V%4      4       VPE                  V3R" l\G        V$4       4       4       EKv  	  RPC                  \G        V4      4      R,           # u up#i u up#p"i u up#i u upi u upi u upi u upi u up*pi )$a°  
:return: ASCII art for a discontinuous tree.

:param unicodelines: whether to use Unicode line drawing characters
    instead of plain (7-bit) ASCII.
:param html: whether to wrap output in html code (default plain text).
:param ansi: whether to produce colors with ANSI escape sequences
    (only effective when html==False).
:param leafcolor, nodecolor: specify colors of leaves and phrasal
    nodes; effective when either html or ansi is True.
:param abbreviate: if True, abbreviate labels longer than 5 characters.
    If integer, abbreviate labels longer than `abbr` characters.
:param maxwidth: maximum number of characters before a label starts to
    wrap; pass None to disable.
Tu   â”€u   â”Œu   â”�u    â”‚ u   â”¬u   â”´u   â”¼u   â€¦rX   rj   z | z_|_Ú.c                óô   € \        V 4      \        V 4      ^,          ,
          \        V4      ^,          ,
          ^,
          p\        V 4      p\        V4      W2V\        V4      ,           % RP                  V4      # )z5Overwrite center of this cell with a vertical branch.Ú )r   Úlistr0   )Úcurr—   ÚsplitlÚlsts   &&  r   Ú	crosscellÚ)TreePrettyPrinter.text.<locals>.crosscelly  sW   € ä˜“X¤ C£¨A¥Õ-´°A³¸!µÕ;¸aÕ?ˆFÜ�s“)ˆCÜ,0°«GˆC˜¤# a£&�Ð)Ø—7‘7˜3“<ÐrA   c                  ó   € ^# )é   rH   rH   rA   r   ru   Ú(TreePrettyPrinter.text.<locals>.<lambda>‚  s   € ©!rA   c                  ó   € ^# )é   rH   rH   rA   r   ru   r¥   ƒ  s   € ©ArA   z(.{%d,%d}\b\W*|.{%d})Nz\1\nrh   ry   rœ   c              3   ó2   <"  € T F  w  rVS8H  x € K  	  R # 5ir   rH   ©r   rX   r   r_   s   &  €r   r   Ú)TreePrettyPrinter.text.<locals>.<genexpr>»  s   øé € Ð/PÁ<¹4¸1°°Q¶Ã<ùó   ƒFc              3   ó2   <"  € T F  w  rVS8H  x € K  	  R # 5ir   rH   r©   s   &  €r   r   rª   ¿  s   øé € Ð$E¹±° Q¨!¦V»ùr«   Ú-©Úquotez<font color=Ú>z</font>z[%d;1m%s[0m:r§   NNc              3   óT   <"  € T F  pR S,          P                  V4      x € K  	  R# 5i)rj   Nrn   )r   ÚnoderowÚnodedists   & €r   r   rª   è  s'   øé € ð Ù>P°7��x•×%Ñ% g×.Ð.Ó>Pùs   ƒ%(rL   )$r   Údictr‚   ÚreÚcompiler2   r3   rN   r    r   Úlabelr   ÚsubÚstripÚsplitr…   r4   rŠ   rM   Úgetr‹   rP   r\   ÚljustÚrjustr,   Ú
startswithr   r5   Ú	ANSICOLORr†   Úzipr+   r0   ÚextendrŒ   )1r6   r³   ÚunicodelinesÚhtmlÚansiÚ	nodecolorÚ	leafcolorÚ	funccolorÚ
abbreviateÚmaxwidthÚhorzlineÚ
leftcornerÚrightcornerrJ   ÚteeÚbottomÚcrossÚellipsisr¡   ÚresultrU   ÚmaxnodewithÚmaxnodeheightÚmaxcolÚminchildcolÚmaxchildcolr�   ÚlabelsÚwraprer   r^   Úcolumnr·   ÚparentrX   ÚcolÚnoderowsÚ	branchrowr9   r”   r=   r`   r$   ÚlineÚcolorr—   Úchildrowr²   r_   s1   &f&&&&&&&&                                      @r   r=   ÚTreePrettyPrinter.textK  sL  ù€ ð6 ˜ÔØˆJßØˆHØ!ˆJØ"ˆKØ!ˆHØ˜XÕ%¨Õ0ˆCØ Õ(¨8Õ3ˆFØ˜xÕ'¨(Õ2ˆEØ‰HàˆHØ'*Ð*ˆJØˆHØ�h•,ˆCØ"Ð"ˆE�FØˆHà%ô 	 ð ˆÜœTÓ"ˆÜ!¡)Ó,ˆÜ#¡IÓ.ˆØˆØˆØˆÜ¤Ó$ˆ	ØˆÜ—’Ø%¨°A­°xÐ(JÕJó
ˆð —•ˆAØŸ+™+ a�.‰KˆC�Ø"#ˆF�3�K˜ÑÜ˜ Ó(ˆFô ˜dŸj™j¨�m¬T×2Ò2ð —
‘
˜1•×#Ñ#Ô%à—Z‘Z •]ð ÷
 œc %›j¨:Ô5Ø˜k˜zÐ*¨XÕ5�ßœC ›J¨Ô1ØŸ
™
 7¨EÓ2×8Ñ8Ó:�Ø—K‘K Ó%ˆEÜ!$ ]°3Õ%7¼¸U»Ó!DˆM˜#ÑÜ"% k°&Õ&9¼3¼sÄ3È»Ó;OÓ"PˆK˜ÑØˆF�1‰IØ˜Ÿ
™
Ô"ÚØ—Z‘Z •]ˆFØ�fÕ×!Ñ! 3¨ -Ô0Ü"% k§o¡o°f¸fÓ&EÀvÓ"NˆK˜ÑÜ"% k§o¡o°f¸fÓ&EÀvÓ"NˆK˜Ôñ- ô0 ˜&¨$×/Ð/ˆCô ˜}¨SÕ1Ô2ôá2�Aô 9>¸fÀq½jÔ8IÓJÑ8I°�—‘˜; sÕ+Ö,Ñ8IÔJÙ2ð ñ ô AFÀfÈqÅjÔ@QÓRÑ@Q¸˜Ÿ™ ;¨sÕ#3Ö4Ñ@QˆIÐRØ˜c—{‘{�Ø˜3•K Õ$�Ø—z‘z !•}�Ø˜a•y�Ü˜d¤D×)Ó)à˜KÕ'¨K¸­N¸[È½^Õ,KØ*¨1�~¨{¸1­~˜˜˜1Ø +¨A¥°Õ 2°qÕ8¸1Õ<¸kÈ!½nÐPQÕ>Q˜1˜Ø),¨q­°JÕ(>×'EÑ'EØ'¨�N¨Hó(˜	 !™ð )4°s¸QµwÕ(?×'FÑ'FØ'¨�N¨Hó(˜	 !™ô "' {°1¥~¸Õ'9¸;Àq½>Ö!J˜AØ  Cœx¯C«CÔ/PÀ9ÈQÆ<Ó/P¯C¯CªCÔ/PÀ9ÈQÆ<Ó/P×,PÒ,PØ',¡Ø!" c¤Ø'-¡ß!$£Ô$E¸	À!¾Ó$E§§¢Ô$E¸	À!¾Ó$E×!EÒ!EØ'*¡à'/ Ø+/¯;©;°{À1µ~ÀxÓ+P˜I a›Lò "Kñ *3°9¸Sµ>Ó)B˜	 #™Ù<@ÓA¹D°q˜Ÿ™ ¨SÕ!1Ö2¹D�ÐAÜ%/°´d×%;Ò%;™	À�Ü˜d¤D×)Ò)¨d¯j©j«l×.EÑ.EÀc×.JÒ.JØ%�EßÙ<@ÓA¹D°qœF 1¨E×2¹D�DÐAØ˜DŸN™NÔ*ÙKOÓPÉ4Àa ,¨u¨g°Q°q°c¸Ó AÉ4˜ÐPøß˜a 4§>¡>Ô1ÙSWÓXÑSWÈaÐ1´Y¸uÕ5EÀqÐ4I×IÐIÑSW�DÐXÜ˜}¨SÕ1Ö2�Að
 œs 4›yœ=ð ˜Qžà*3°A¯,¬,™h¸C×GÑGØ'¨Õ,¨cóð ˜Q•K Ó$ô 3ñK #ðb ”c˜&“kÕ!Ø*.¯+©+×*;Ñ*;Ö*=Ñ&�A‘˜ #Ø˜1–u §¡¨T¯Z©Z¸­]Õ!;¸AÕ!>ÀÖ!OÀx×!OÒ!OÙ)2°9¸Sµ>Ó)B˜	 #™Ø f¨S¥kÖ1Û+3 Ù/8¸À½Ó/F ¨£ó ,4ñ	 +>ô !$ I¨y¸­}À¸uÕ/DÔ Eôá E™˜˜1ð  1 R¥5¨C¤<˜!˜Bž%°Q°qµT¸XÕE×FÐFÙ Eð ñ ð —‘˜bŸg™g iÓ0Ô1Ø�M‰Mô Ü>FÀxÔ>Pó÷ ñG 0ðL �y‰yœ &Ó)Ó*¨TÕ1Ð1ùòI Kùóùò Sùò8 Bùò
 BùâPùâXùó(s<   ËaË+!aÌaÌ*!aÕ !a"×&a'Øa,Ùa1Þ+:a6áac                óä  € ^p^(p^p^;rx\        R V P                  P                  4        4       4      p	\        R V P                  P                  4        4       4      p
RV	^,          V
R,          V) V) W•,          ^V,          ,           W¦,          ^V,          ,           3,          .p\        \        4      pV P
                   F5  pV'       g   K  WÀP                  V,          ,          P                  V4       K7  	  V P
                   Fý  pWÎ,          '       g   K  V P                  V,          w  ppVV,          pWö,          pVV,          pWøV^,          ,           ,          pWÎ,           Uu. uF  pV P                  V,          ^,          NK  	  ppWu\        V4      ,          ,           pWu\        V4      ,          ,           pVP                  RVVVV3,          4       VP                  RVVVWô^,          ,
          3,          4       Kÿ  	  V P                  P                  4        F¢  w  ppV P                  V,          w  ppWö,          pWøV^,          ,           ,          pV P                  V,          w  ppVV,          pVV,          pVV,          pVW„,
          ,          pVRVVVV^,           3,          RVVVV3,          .,          pK¤  	  V P                  P                  4        Fí  w  pw  ppV P
                  V,          pVV,          V,           pVV,          V,           pWÐP                  9   dY   \        V\        4      '       d   TMTp\        V\        4      '       d(   VP                  4       P                  R4      '       d   TpMRpTR	TTTT\!        \        V\        4      '       d   VP                  4       MTR
R7      3,          .,          pKï  	  VR.,          pRP#                  V4      # u upi )z(
:return: SVG representation of a tree.
c              3   ó*   "  € T F	  w  rVx € K  	  R # 5ir   rH   )r   rX   rÛ   s   &  r   r   Ú(TreePrettyPrinter.svg.<locals>.<genexpr>õ  s   é € Ð;Ñ&:™F˜A•CÓ&:ùó   ‚c              3   ó*   "  € T F	  w  rVx € K  	  R # 5ir   rH   )r   r^   rX   s   &  r   r   rä   ö  s   é € Ð<Ñ';™V˜S•SÓ';ùrå   zg<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="%dem" height="%dem" viewBox="%d %d %d %d">g      @zS	<polyline style="stroke:black; stroke-width:1; fill:none;" points="%g,%g %g,%g" />zT	<polyline style="stroke:white; stroke-width:10; fill:none;" points="%g,%g %g,%g" />r­   r   zV	<text style="text-anchor: middle; fill: %s; font-size: %dpx;" x="%g" y="%g">%s</text>Fr®   z</svg>rh   )rN   r3   r�   r   r‚   r2   r4   rŠ   rM   r+   r†   r5   r    r   r·   r¾   r   r0   )r6   rÅ   rÆ   rÇ   ÚfontsizeÚhscaleÚvscaleÚhstartÚvstartÚwidthr‡   rÑ   rW   r9   r”   Úyr—   ÚcÚchildxÚxminÚxmaxÚchildrÚ   rX   Úchildyr^   rÙ   rß   s   &&&&                        r   ÚsvgÚTreePrettyPrinter.svgí  s“  € ð ˆØˆØˆØÐˆÜÑ; d§k¡k×&8Ñ&8Ô&:Ó;Ó;ˆÜÑ< t§{¡{×'9Ñ'9Ô';Ó<Ó<ˆð@ð ˜•	Ø˜•Ø�Ø�Ø•  V¥Õ+Ø• ! f¥*Õ,ðõ	ð
ˆô œsÓ#ˆØ—”ˆAß‰qØŸ™ A�Õ'×+Ñ+¨AÖ.ñ ð
 —J”JˆDØ—>”>ÙØ—;‘;˜tÕ$‰DˆAˆqØ��KˆAØ�KˆAØ��KˆAØ˜( a�-Õ'Õ'ˆAØ19¶Ó@±¨A�d—k‘k !•n Q×'Ð'±ˆFÐ@Ø¤S¨£[Õ0Õ0ˆDØ¤S¨£[Õ0Õ0ˆDØ�M‰Mð*Ø-1°1°d¸AÐ,>õ?ôð �M‰Mð*Ø-.°°1°aÀa½-Õ6GÐ,HõIöñ ð* "ŸZ™Z×-Ñ-Ö/‰MˆE�6Ø—;‘;˜vÕ&‰DˆAˆqØ�KˆAØ˜( a�-Õ'Õ'ˆAØ!Ÿ[™[¨Õ/‰NˆF�FØ�fÕˆFØ�fÕˆFØ�fÕˆFØ�fÕ'Õ'ˆFØð+Ø.4°f¸fÀaÈ!ÅeÐ-LõMð+Ø.4°f¸fÀaÐ-HõIðõ ŠFñ 0ð" !%§¡× 1Ñ 1Ö 3ÑˆA‰}��VØ—:‘:˜a•=ˆDØ˜• &Õ(ˆAØ�f•˜vÕ%ˆAØ—N‘NÔ"Ü%/°´d×%;Ò%;™	À�Ü˜d¤D×)Ò)¨d¯j©j«l×.EÑ.EÀc×.JÒ.JØ%�Eøà�Øð<ð ØØØÜÜ(2°4¼×(>Ò(>˜Ÿ
™
œÀDÐPUôðõ
ðõ ŠFñ !4ð0 	�8�*ÕˆØ�y‰y˜Ó Ð ùòo As   Å)#O-)r3   r4   r5   r2   )NrH   )	r§   FFFr   r   r	   Né   )r   r   r	   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r:   r?   rC   Ústaticmethodr1   r=   rô   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r   -   sD   ø‡ € ñô6
ò:òEð ñ\7ó ð\7ô|`2÷D\!ò \!rA   r   c                 óR  € RR lp ^ RI Hp R F%  pVP                  4       V,          pV ! W#^^R7       K'  	  \        4        \        R4       \        \	        X4      P                  ^R7      4       \        P                  ! R\        R7      pR	P                  4       pV ! R
W4^R7       R# )zDo some tree drawing tests.Nc           
      óŒ  € \        4        \        R P                  T RP                  T;'       g    VP                  4       4      4      4       \        V4       \        4        \	        W4      p \        VP
                  ! RRVRV/VB 4       R#   \        \        3 d$    \        TP
                  ! RRRRR/TB 4        R# i ; i)z{}: "{}"rj   rÂ   rÄ   FNrH   )ÚprintÚformatr0   r&   r   r=   ÚUnicodeDecodeErrorÚUnicodeEncodeError)r9   r7   r8   rÄ   ÚxargsÚdrawtrees   &&&&, r   Ú
print_treeÚtest.<locals>.print_treeO  s¢   € ÜŒÜˆj×Ñ  3§8¡8¨H×,EÐ,E¸¿¹»Ó#FÓGÔHÜˆdŒÜŒÜ$ TÓ4ˆð	JÜ�(—-’-ÑF¨TÐF¸ÐFÀÑFÖGøÜ"Ô$6Ð7ô 	JÜ�(—-’-ÑH¨UÐH¸ÐHÀ%ÑH×Ið	Jús   Á.B Â0CÃC)Útreebank)r³   rÉ   zASCII version:)r³   z³(top (punct 8) (smain (noun 0) (verb 1) (inf (verb 5) (inf (verb 6) (conj (inf (pp (prep 2) (np (det 3) (noun 4))) (verb 7)) (inf (verb 9)) (vg 10) (inf (verb 11)))))) (punct 12)))Ú	read_leafzDZe had met haar moeder kunnen gaan winkelen , zwemmen of terrassen .zDiscontinuous tree)NT)r   i   i7  iÓ
  iz  )
Únltk.corpusr
  Úparsed_sentsr  r   r=   r   Ú
fromstringr!   rº   )r  r
  r9   r7   r8   s        r   Útestr  L  sš   € ô	Jõ %ã(ˆØ×$Ñ$Ó& qÕ)ˆÙ�1 Q°×3ñ )ô 
„GÜ	Ð
ÔÜ	Ô
˜DÓ
!×
&Ñ
&°Ð
&Ó
2Ô3ä�?Š?ð	2ô ô	€Dð	"ß"'¡%£'ð ñ Ð# T¸a×@rA   Ú__main__)rû   rµ   rÃ   r   ÚImportErrorÚcgiÚcollectionsr   Úoperatorr   Únltk.tree.treer   Ú	nltk.utilr   r¿   r   r  Ú__all__r÷   rH   rA   r   Ú<module>r     s›   ðñ	ó 
ðÝõ $Ý å Ý !ð ˆRØ	ˆ2ØˆRØˆbØ
ˆBØˆrØ
ˆBØˆRð	€	÷\!ñ \!ò~!AðH Ð
€àˆzÔÙ†Fñ øðu ô ßðús   ˆA ÁA*Á)A*