§
    'ê[f˜Z  ã                   ó–   — d dl Z d dlmZmZ d dlmZ d dlmZ  G d„ dee¬¦  «        Z G d„ d	e¦  «        Z	 G d
„ de¦  «        Z
d	dgZdS )é    N)ÚABCMetaÚabstractmethod)ÚTree)Úslice_boundsc                   óÊ   ‡ — e Zd ZdZdˆ fd„	Zedd„¦   «         Zed„ ¦   «         Zˆ fd„Zˆ fd„Z	ˆ fd	„Z
ˆ fd
„Zˆ fd„Zdˆ fd„	Zˆ fd„Z eed¦  «        r	d„ Zd„ Zd„ Zd„ Zˆ xZS )ÚAbstractParentedTreeaÃ  
    An abstract base class for a ``Tree`` that automatically maintains
    pointers to parent nodes.  These parent pointers are updated
    whenever any change is made to a tree's structure.  Two subclasses
    are currently defined:

      - ``ParentedTree`` is used for tree structures where each subtree
        has at most one parent.  This class should be used in cases
        where there is no"sharing" of subtrees.

      - ``MultiParentedTree`` is used for tree structures where a
        subtree may have zero or more parents.  This class should be
        used in cases where subtrees may be shared.

    Subclassing
    ===========
    The ``AbstractParentedTree`` class redefines all operations that
    modify a tree's structure to call two methods, which are used by
    subclasses to update parent information:

      - ``_setparent()`` is called whenever a new child is added.
      - ``_delparent()`` is called whenever a child is removed.
    Nc                 óX  •— t          ¦   «                              ||¦  «         |�‚t          | ¦  «        D ]2\  }}t          |t          ¦  «        r|                      ||d¬¦  «         Œ3t          | ¦  «        D ]2\  }}t          |t          ¦  «        r|                      ||¦  «         Œ1d S d S )NT©Údry_run)ÚsuperÚ__init__Ú	enumerateÚ
isinstancer   Ú
_setparent©ÚselfÚnodeÚchildrenÚiÚchildÚ	__class__s        €úF/var/www/piapp/venv/lib/python3.11/site-packages/nltk/tree/parented.pyr   zAbstractParentedTree.__init__.   s½   ø€ Ý‰Œ×Ò˜˜xÑ(Ô(Ð(ð Ðõ & d™OœOð <ð <‘��5Ý˜e¥TÑ*Ô*ð <Ø—O’O E¨1°d�OÑ;Ô;Ð;øÝ% d™OœOð .ð .‘��5Ý˜e¥TÑ*Ô*ð .Ø—O’O E¨1Ñ-Ô-Ð-øð  Ðð.ð .ó    Fc                 ó   — dS )a¡  
        Update the parent pointer of ``child`` to point to ``self``.  This
        method is only called if the type of ``child`` is ``Tree``;
        i.e., it is not called when adding a leaf to a tree.  This method
        is always called before the child is actually added to the
        child list of ``self``.

        :type child: Tree
        :type index: int
        :param index: The index of ``child`` in ``self``.
        :raise TypeError: If ``child`` is a tree with an impropriate
            type.  Typically, if ``child`` is a tree, then its type needs
            to match the type of ``self``.  This prevents mixing of
            different tree types (single-parented, multi-parented, and
            non-parented).
        :param dry_run: If true, the don't actually set the child's
            parent pointer; just check for any error conditions, and
            raise an exception if one is found.
        N© ©r   r   Úindexr   s       r   r   zAbstractParentedTree._setparent@   ó   € € € r   c                 ó   — dS )a»  
        Update the parent pointer of ``child`` to not point to self.  This
        method is only called if the type of ``child`` is ``Tree``; i.e., it
        is not called when removing a leaf from a tree.  This method
        is always called before the child is actually removed from the
        child list of ``self``.

        :type child: Tree
        :type index: int
        :param index: The index of ``child`` in ``self``.
        Nr   ©r   r   r   s      r   Ú
_delparentzAbstractParentedTree._delparentV   r   r   c                 óÈ  •— t          |t          ¦  «        r„t          | |d¬¦  «        \  }}}t          |||¦  «        D ]9}t          | |         t          ¦  «        r|                      | |         |¦  «         Œ:t          ¦   «                              |¦  «         d S t          |t          ¦  «        r‡|dk     r|t          | ¦  «        z  }|dk     rt          d¦  «        ‚t          | |         t          ¦  «        r|                      | |         |¦  «         t          ¦   «                              |¦  «         d S t          |t          t          f¦  «        rYt          |¦  «        dk    rt          d¦  «        ‚t          |¦  «        dk    r| |d         = d S | |d                  |dd …         = d S t          t          | ¦  «        j        ›dt          |¦  «        j        ›�¦  «        ‚)NT©Ú
allow_stepr   úindex out of rangez(The tree position () may not be deleted.é   ú indices must be integers, not )r   Úslicer   Úranger   r!   r   Ú__delitem__ÚintÚlenÚ
IndexErrorÚlistÚtupleÚ	TypeErrorÚtypeÚ__name__)r   r   ÚstartÚstopÚstepr   r   s         €r   r*   z AbstractParentedTree.__delitem__j   sÔ  ø€ å�e�UÑ#Ô#ð $	Ý ,¨T°5ÀTÐ JÑ JÔ JÑˆE�4˜å˜5 $¨Ñ-Ô-ð 0ð 0�Ý˜d 1œg¥tÑ,Ô,ð 0Ø—O’O D¨¤G¨QÑ/Ô/Ð/øå‰GŒG×Ò Ñ&Ô&Ð&Ð&Ð&õ ˜�sÑ#Ô#ð 	Ø�qŠyˆyØ�˜T™œÑ"�Ø�qŠyˆyÝ Ð!5Ñ6Ô6Ð6å˜$˜uœ+¥tÑ,Ô,ð 4Ø—’  U¤¨UÑ3Ô3Ð3å‰GŒG×Ò Ñ&Ô&Ð&Ð&Ð&å˜¥¥e˜}Ñ-Ô-ð 	å�5‰zŒz˜QŠˆÝ Ð!KÑLÔLÐLå�U‘”˜q’�Ø˜˜qœ�N�N�Nð ˜˜qœ”N 5¨¨¨¤9Ð-Ð-Ð-õ å˜‘:”:Ô&Ð&Ð&­¨U©¬Ô(<Ð(<ð>ñô ð r   c                 ó¶  •— t          |t          ¦  «        �r>t          | |d¬¦  «        \  }}}t          |t          t          f¦  «        st          |¦  «        }t          |¦  «        D ]8\  }}t          |t          ¦  «        r|                      ||||z  z   d¬¦  «         Œ9t          |||¦  «        D ]9}t          | |         t          ¦  «        r|  	                    | |         |¦  «         Œ:t          |¦  «        D ]6\  }}t          |t          ¦  «        r|                      ||||z  z   ¦  «         Œ7t          ¦   «                              ||¦  «         d S t          |t          ¦  «        r¿|dk     r|t          | ¦  «        z  }|dk     rt          d¦  «        ‚|| |         u rd S t          |t          ¦  «        r|                      ||¦  «         t          | |         t          ¦  «        r|  	                    | |         |¦  «         t          ¦   «                              ||¦  «         d S t          |t          t          f¦  «        r]t          |¦  «        dk    rt          d¦  «        ‚t          |¦  «        dk    r|| |d         <   d S || |d                  |dd …         <   d S t          t!          | ¦  «        j        ›dt!          |¦  «        j        ›�¦  «        ‚)	NTr#   r
   r   r%   z,The tree position () may not be assigned to.r&   r'   )r   r(   r   r.   r/   r   r   r   r)   r!   r   Ú__setitem__r+   r,   r-   r0   r1   r2   )	r   r   Úvaluer3   r4   r5   r   r   r   s	           €r   r7   z AbstractParentedTree.__setitem__’   sØ  ø€ å�e�UÑ#Ô#ñ 8	Ý ,¨T°5ÀTÐ JÑ JÔ JÑˆE�4˜å˜e¥d­E ]Ñ3Ô3ð $Ý˜U™œ�õ & eÑ,Ô,ð Kð K‘��5Ý˜e¥TÑ*Ô*ð KØ—O’O E¨5°1°t±8Ñ+;ÀT�OÑJÔJÐJøå˜5 $¨Ñ-Ô-ð 0ð 0�Ý˜d 1œg¥tÑ,Ô,ð 0Ø—O’O D¨¤G¨QÑ/Ô/Ð/øõ & eÑ,Ô,ð =ð =‘��5Ý˜e¥TÑ*Ô*ð =Ø—O’O E¨5°1°t±8Ñ+;Ñ<Ô<Ð<øå‰GŒG×Ò  uÑ-Ô-Ð-Ð-Ð-õ ˜�sÑ#Ô#ð  	Ø�qŠyˆyØ�˜T™œÑ"�Ø�qŠyˆyÝ Ð!5Ñ6Ô6Ð6à˜˜UœÐ#Ð#Ø�å˜%¥Ñ&Ô&ð .Ø—’  uÑ-Ô-Ð-å˜$˜uœ+¥tÑ,Ô,ð 4Ø—’  U¤¨UÑ3Ô3Ð3å‰GŒG×Ò  uÑ-Ô-Ð-Ð-Ð-å˜¥¥e˜}Ñ-Ô-ð 	å�5‰zŒz˜QŠˆÝ Ð!OÑPÔPÐPå�U‘”˜q’�Ø!&��U˜1”X‘��ð -2��U˜1”X”˜u Q R RœyÑ)Ð)Ð)õ å˜‘:”:Ô&Ð&Ð&­¨U©¬Ô(<Ð(<ð>ñô ð r   c                 óº   •— t          |t          ¦  «        r#|                      |t          | ¦  «        ¦  «         t	          ¦   «                              |¦  «         d S ©N©r   r   r   r,   r   Úappend)r   r   r   s     €r   r<   zAbstractParentedTree.appendÎ   sK   ø€ Ý�e�TÑ"Ô"ð 	.Ø�OŠO˜E¥3 t¡9¤9Ñ-Ô-Ð-Ý‰Œ�Š�uÑÔÐÐÐr   c                 óÄ   •— |D ][}t          |t          ¦  «        r#|                      |t          | ¦  «        ¦  «         t	          ¦   «                              |¦  «         Œ\d S r:   r;   )r   r   r   r   s      €r   ÚextendzAbstractParentedTree.extendÓ   sa   ø€ Øð 	"ð 	"ˆEÝ˜%¥Ñ&Ô&ð 2Ø—’ ¥s¨4¡y¤yÑ1Ô1Ð1Ý‰GŒG�NŠN˜5Ñ!Ô!Ð!Ð!ð	"ð 	"r   c                 óâ   •— |dk     r|t          | ¦  «        z  }|dk     rd}t          |t          ¦  «        r|                      ||¦  «         t	          ¦   «                              ||¦  «         d S ©Nr   )r,   r   r   r   r   Úinsert)r   r   r   r   s      €r   rA   zAbstractParentedTree.insertÙ   sp   ø€ ð �1Š9ˆ9Ø•S˜‘Y”YÑˆEØ�1Š9ˆ9ØˆEå�e�TÑ"Ô"ð 	*Ø�OŠO˜E 5Ñ)Ô)Ð)Ý‰Œ�Š�u˜eÑ$Ô$Ð$Ð$Ð$r   éÿÿÿÿc                 ó  •— |dk     r|t          | ¦  «        z  }|dk     rt          d¦  «        ‚t          | |         t          ¦  «        r|                      | |         |¦  «         t          ¦   «                              |¦  «        S )Nr   r%   )r,   r-   r   r   r!   r   Úpop)r   r   r   s     €r   rD   zAbstractParentedTree.popæ   sx   ø€ Ø�1Š9ˆ9Ø•S˜‘Y”YÑˆEØ�1Š9ˆ9ÝÐ1Ñ2Ô2Ð2Ý�d˜5”k¥4Ñ(Ô(ð 	0Ø�OŠO˜D œK¨Ñ/Ô/Ð/Ý‰wŒw�{Š{˜5Ñ!Ô!Ð!r   c                 óâ   •— |                       |¦  «        }t          | |         t          ¦  «        r|                      | |         |¦  «         t	          ¦   «                              |¦  «         d S r:   )r   r   r   r!   r   Úremove)r   r   r   r   s      €r   rF   zAbstractParentedTree.removeñ   s^   ø€ Ø—
’
˜5Ñ!Ô!ˆÝ�d˜5”k¥4Ñ(Ô(ð 	0Ø�OŠO˜D œK¨Ñ/Ô/Ð/Ý‰Œ�Š�uÑÔÐÐÐr   Ú__getslice__c           	      ó€   — |                       t          t          d|¦  «        t          d|¦  «        ¦  «        ¦  «        S r@   )Ú__getitem__r(   Úmax©r   r3   r4   s      r   rG   z!AbstractParentedTree.__getslice__ÿ   ó0   € Ø×#Ò#¥E­#¨a°©-¬-½¸QÀ¹¼Ñ$FÔ$FÑGÔGÐGr   c           	      ó€   — |                       t          t          d|¦  «        t          d|¦  «        ¦  «        ¦  «        S r@   )r*   r(   rJ   rK   s      r   Ú__delslice__z!AbstractParentedTree.__delslice__  rL   r   c           	      ó‚   — |                       t          t          d|¦  «        t          d|¦  «        ¦  «        |¦  «        S r@   )r7   r(   rJ   )r   r3   r4   r8   s       r   Ú__setslice__z!AbstractParentedTree.__setslice__  s2   € Ø×#Ò#¥E­#¨a°©-¬-½¸QÀ¹¼Ñ$FÔ$FÈÑNÔNÐNr   c                 ó.   — | j         t          | ¦  «        fS )a©  Method used by the pickle module when un-pickling.
        This method provides the arguments passed to ``__new__``
        upon un-pickling. Without this method, ParentedTree instances
        cannot be pickled and unpickled in Python 3.7+ onwards.

        :return: Tuple of arguments for ``__new__``, i.e. the label
            and the children of this node.
        :rtype: Tuple[Any, List[AbstractParentedTree]]
        )Ú_labelr.   ©r   s    r   Ú__getnewargs__z#AbstractParentedTree.__getnewargs__  s   € ð ”�T $™ZœZÐ(Ð(r   r:   ©F)rB   )r2   Ú
__module__Ú__qualname__Ú__doc__r   r   r   r!   r*   r7   r<   r>   rA   rD   rF   Úhasattrr.   rG   rN   rP   rT   Ú__classcell__©r   s   @r   r   r      s”  ø€ € € € € ðð ð0.ð .ð .ð .ð .ð .ð$ ðð ð ñ „^ðð* ðð ñ „^ðð&&ð &ð &ð &ð &ðP:ð :ð :ð :ð :ðxð ð ð ð ð
"ð "ð "ð "ð "ð%ð %ð %ð %ð %ð"ð "ð "ð "ð "ð "ðð ð ð ð ð €wˆt�^Ñ$Ô$ð 	Oð	Hð 	Hð 	Hð	Hð 	Hð 	Hð	Oð 	Oð 	Oð
)ð 
)ð 
)ð 
)ð 
)ð 
)ð 
)r   r   )Ú	metaclassc                   óh   ‡ — e Zd ZdZdˆ fd„	Zd„ Zdˆ fd„	Zd„ Zd„ Zd	„ Z	d
„ Z
d„ Zd„ Zd„ Zdd„Zˆ xZS )ÚParentedTreea  
    A ``Tree`` that automatically maintains parent pointers for
    single-parented trees.  The following are methods for querying
    the structure of a parented tree: ``parent``, ``parent_index``,
    ``left_sibling``, ``right_sibling``, ``root``, ``treeposition``.

    Each ``ParentedTree`` may have at most one parent.  In
    particular, subtrees may not be shared.  Any attempt to reuse a
    single ``ParentedTree`` as a child of more than one parent (or
    as multiple children of the same parent) will cause a
    ``ValueError`` exception to be raised.

    ``ParentedTrees`` should never be used in the same tree as ``Trees``
    or ``MultiParentedTrees``.  Mixing tree implementations may result
    in incorrect parent pointers and in ``TypeError`` exceptions.
    Nc                 óò   •— d | _         	 t          ¦   «                              ||¦  «         |€Gt          | ¦  «        D ]9\  }}t	          |t
          ¦  «        rd |_         |                      ||¦  «         Œ8d S d S r:   )Ú_parentr   r   r   r   r   r   r   s        €r   r   zParentedTree.__init__'  sˆ   ø€ ØˆŒØCÝ‰Œ×Ò˜˜xÑ(Ô(Ð(ØÐõ
 & d™OœOð .ð .‘��5Ý˜e¥TÑ*Ô*ð .Ø$(�E”MØ—O’O E¨1Ñ-Ô-Ð-øð Ðð
.ð .r   c                 ó   — ddl m} |S )Nr   )ÚImmutableParentedTree)Únltk.tree.immutablerb   )r   rb   s     r   Ú_frozen_classzParentedTree._frozen_class5  s   € Ø=Ð=Ð=Ð=Ð=Ð=à$Ð$r   Fc                 óŽ   •— |s!t          j        | j        j        › d�¦  «         t	          ¦   «                              d¬¦  «        S )NzB objects do not support shallow copies. Defaulting to a deep copy.T)Údeep)ÚwarningsÚwarnr   r2   r   Úcopy)r   rf   r   s     €r   ri   zParentedTree.copy:  sJ   ø€ Øð 	ÝŒMØ”>Ô*ÐnÐnÐnñô ð õ ‰wŒw�|Š| ˆ|Ñ&Ô&Ð&r   c                 ó   — | j         S )z5The parent of this tree, or None if it has no parent.)r`   rS   s    r   ÚparentzParentedTree.parentE  s
   € àŒ|Ðr   c                 ól   — | j         €dS t          | j         ¦  «        D ]\  }}|| u r|c S ŒJ d¦   «         ‚)aD  
        The index of this tree in its parent.  I.e.,
        ``ptree.parent()[ptree.parent_index()] is ptree``.  Note that
        ``ptree.parent_index()`` is not necessarily equal to
        ``ptree.parent.index(ptree)``, since the ``index()`` method
        returns the first child that is equal to its argument.
        NFz&expected to find self in self._parent!)r`   r   )r   r   r   s      r   Úparent_indexzParentedTree.parent_indexI  sT   € ð Œ<ÐØ�4Ý! $¤,Ñ/Ô/ð 	ð 	‰HˆAˆuØ˜ˆ}ˆ}Ø���ð à>Ð>Ñ>Ô>Ð>r   c                 óh   — |                       ¦   «         }| j        r|dk    r| j        |dz
           S dS )z6The left sibling of this tree, or None if it has none.r   r&   N)rm   r`   ©r   rm   s     r   Úleft_siblingzParentedTree.left_siblingX  s>   € à×(Ò(Ñ*Ô*ˆØŒ<ð 	2˜L¨1Ò,Ð,Ø”< ¨qÑ 0Ô1Ð1Øˆtr   c                 ó’   — |                       ¦   «         }| j        r+|t          | j        ¦  «        dz
  k     r| j        |dz            S dS )z7The right sibling of this tree, or None if it has none.r&   N)rm   r`   r,   ro   s     r   Úright_siblingzParentedTree.right_sibling_  sM   € à×(Ò(Ñ*Ô*ˆØŒ<ð 	2˜L­C°´Ñ,=Ô,=ÀÑ,AÒBÐBØ”< ¨qÑ 0Ô1Ð1Øˆtr   c                 ó‚   — | }|                      ¦   «         �(|                      ¦   «         }|                      ¦   «         ­(|S )z¶
        The root of this tree.  I.e., the unique ancestor of this tree
        whose parent is None.  If ``ptree.parent()`` is None, then
        ``ptree`` is its own root.
        )rk   ©r   Úroots     r   ru   zParentedTree.rootf  s9   € ð ˆØ�kŠk‰mŒmÐ'Ø—;’;‘=”=ˆDð �kŠk‰mŒmÐ'àˆr   c                 ó¦   — |                       ¦   «         €dS |                       ¦   «                              ¦   «         |                      ¦   «         fz   S )z�
        The tree position of this tree, relative to the root of the
        tree.  I.e., ``ptree.root[ptree.treeposition] is ptree``.
        Nr   )rk   Útreepositionrm   rS   s    r   rw   zParentedTree.treepositionq  sE   € ð
 �;Š;‰=Œ=Ð Ø�2à—;’;‘=”=×-Ò-Ñ/Ô/°4×3DÒ3DÑ3FÔ3FÐ2HÑHÐHr   c                 óp   — t          |t          ¦  «        sJ ‚| |         |u sJ ‚|j        | u sJ ‚d |_        d S r:   )r   r^   r`   r    s      r   r!   zParentedTree._delparent  sM   € å˜%¥Ñ.Ô.Ð.Ð.Ð.Ø�EŒ{˜eÐ#Ð#Ð#Ð#ØŒ} Ð$Ð$Ð$Ð$ð ˆŒˆˆr   c                 ó°   — t          |t          ¦  «        st          d¦  «        ‚t          |d¦  «        r|j        �t          d¦  «        ‚|s	| |_        d S d S )Nz5Can not insert a non-ParentedTree into a ParentedTreer`   z3Can not insert a subtree that already has a parent.)r   r^   r0   rY   r`   Ú
ValueErrorr   s       r   r   zParentedTree._setparentˆ  sn   € å˜%¥Ñ.Ô.ð 	UÝÐSÑTÔTÐTõ �5˜)Ñ$Ô$ð 	T¨¬Ð)BÝÐRÑSÔSÐSð ð 	!Ø ˆEŒMˆMˆMð	!ð 	!r   r:   rU   )r2   rV   rW   rX   r   rd   ri   rk   rm   rp   rr   ru   rw   r!   r   rZ   r[   s   @r   r^   r^     sô   ø€ € € € € ðð ð".ð .ð .ð .ð .ð .ð%ð %ð %ð
'ð 'ð 'ð 'ð 'ð 'ðð ð ð?ð ?ð ?ðð ð ðð ð ð	ð 	ð 	ðIð Ið Iðð ð ð!ð !ð !ð !ð !ð !ð !ð !r   r^   c                   óh   ‡ — e Zd ZdZdˆ fd„	Zd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zd„ Zd„ Zd„ Zdd„Zˆ xZS )ÚMultiParentedTreea  
    A ``Tree`` that automatically maintains parent pointers for
    multi-parented trees.  The following are methods for querying the
    structure of a multi-parented tree: ``parents()``, ``parent_indices()``,
    ``left_siblings()``, ``right_siblings()``, ``roots``, ``treepositions``.

    Each ``MultiParentedTree`` may have zero or more parents.  In
    particular, subtrees may be shared.  If a single
    ``MultiParentedTree`` is used as multiple children of the same
    parent, then that parent will appear multiple times in its
    ``parents()`` method.

    ``MultiParentedTrees`` should never be used in the same tree as
    ``Trees`` or ``ParentedTrees``.  Mixing tree implementations may
    result in incorrect parent pointers and in ``TypeError`` exceptions.
    Nc                 óò   •— g | _         	 t          ¦   «                              ||¦  «         |€Gt          | ¦  «        D ]9\  }}t	          |t
          ¦  «        rg |_         |                      ||¦  «         Œ8d S d S r:   )Ú_parentsr   r   r   r   r   r   r   s        €r   r   zMultiParentedTree.__init__¨  sŒ   ø€ ØˆŒð	õ 	‰Œ×Ò˜˜xÑ(Ô(Ð(ØÐõ
 & d™OœOð .ð .‘��5Ý˜e¥TÑ*Ô*ð .Ø%'�E”NØ—O’O E¨1Ñ-Ô-Ð-øð Ðð
.ð .r   c                 ó   — ddl m} |S )Nr   )ÚImmutableMultiParentedTree)rc   r€   )r   r€   s     r   rd   zMultiParentedTree._frozen_class¸  s   € ØBÐBÐBÐBÐBÐBà)Ð)r   c                 ó*   — t          | j        ¦  «        S )a  
        The set of parents of this tree.  If this tree has no parents,
        then ``parents`` is the empty set.  To check if a tree is used
        as multiple children of the same parent, use the
        ``parent_indices()`` method.

        :type: list(MultiParentedTree)
        )r.   r~   rS   s    r   ÚparentszMultiParentedTree.parentsÁ  s   € õ �D”MÑ"Ô"Ð"r   c                 ó>   — d„ |                       ¦   «         D ¦   «         S )a}  
        A list of all left siblings of this tree, in any of its parent
        trees.  A tree may be its own left sibling if it is used as
        multiple contiguous children of the same parent.  A tree may
        appear multiple times in this list if it is the left sibling
        of this tree with respect to multiple parents.

        :type: list(MultiParentedTree)
        c                 ó6   — g | ]\  }}|d k    ¯||dz
           ‘ŒS )r   r&   r   ©Ú.0rk   r   s      r   ú
<listcomp>z3MultiParentedTree.left_siblings.<locals>.<listcomp>Ö  s6   € ð 
ð 
ð 
á�˜Ø�qŠyˆyð �5˜1‘9Ôàˆyˆyr   ©Ú_get_parent_indicesrS   s    r   Úleft_siblingszMultiParentedTree.left_siblingsÌ  ó/   € ð
ð 
à#'×#;Ò#;Ñ#=Ô#=ð
ñ 
ô 
ð 	
r   c                 ó>   — d„ |                       ¦   «         D ¦   «         S )a€  
        A list of all right siblings of this tree, in any of its parent
        trees.  A tree may be its own right sibling if it is used as
        multiple contiguous children of the same parent.  A tree may
        appear multiple times in this list if it is the right sibling
        of this tree with respect to multiple parents.

        :type: list(MultiParentedTree)
        c                 óV   — g | ]&\  }}|t          |¦  «        d z
  k     ¯||d z            ‘Œ'S )r&   )r,   r…   s      r   r‡   z4MultiParentedTree.right_siblings.<locals>.<listcomp>æ  sD   € ð 
ð 
ð 
á�˜Ø�˜F™œ a™Ò(Ð(ð �5˜1‘9Ôà(Ð(Ð(r   rˆ   rS   s    r   Úright_siblingsz MultiParentedTree.right_siblingsÜ  r‹   r   c                 ó*   ‡ — ˆ fd„‰ j         D ¦   «         S )Nc                 óJ   •— g | ]}t          |¦  «        D ]\  }}|‰u ¯	||f‘ŒŒ S r   )r   )r†   rk   r   r   r   s       €r   r‡   z9MultiParentedTree._get_parent_indices.<locals>.<listcomp>í  sP   ø€ ð 
ð 
ð 
àÝ )¨&Ñ 1Ô 1ð
ð 
ñ ��uØ˜ˆ}ˆ}ð �UˆOð ˆ}ˆ}ˆ}r   ©r~   rS   s   `r   r‰   z%MultiParentedTree._get_parent_indicesì  s0   ø€ ð
ð 
ð 
ð 
àœ-ð
ñ 
ô 
ð 	
r   c                 ój   — t          |                      i ¦  «                             ¦   «         ¦  «        S )zÌ
        The set of all roots of this tree.  This set is formed by
        tracing all possible parent paths until trees with no parents
        are found.

        :type: list(MultiParentedTree)
        )r.   Ú_get_roots_helperÚvaluesrS   s    r   ÚrootszMultiParentedTree.rootsô  s,   € õ �D×*Ò*¨2Ñ.Ô.×5Ò5Ñ7Ô7Ñ8Ô8Ð8r   c                 óx   — | j         r | j         D ]}|                     |¦  «         Œn| |t          | ¦  «        <   |S r:   )r~   r“   Úid)r   Úresultrk   s      r   r“   z#MultiParentedTree._get_roots_helperþ  sP   € ØŒ=ð 	$Øœ-ð 1ð 1�Ø×(Ò(¨Ñ0Ô0Ð0Ð0ð1ð  $ˆF•2�d‘8”8ÑØˆr   c                 óP   ‡ — |‰ j         vrg S ˆ fd„t          |¦  «        D ¦   «         S )aY  
        Return a list of the indices where this tree occurs as a child
        of ``parent``.  If this child does not occur as a child of
        ``parent``, then the empty list is returned.  The following is
        always true::

          for parent_index in ptree.parent_indices(parent):
              parent[parent_index] is ptree
        c                 ó"   •— g | ]\  }}|‰u ¯	|‘ŒS r   r   )r†   r   r   r   s      €r   r‡   z4MultiParentedTree.parent_indices.<locals>.<listcomp>  s"   ø€ ÐSÐSÐS™n˜u eÀUÈdÀ]À]�EÀ]À]À]r   )r~   r   )r   rk   s   ` r   Úparent_indicesz MultiParentedTree.parent_indices  s9   ø€ ð ˜œÐ&Ð&ØˆIàSÐSÐSÐSµ	¸&Ñ0AÔ0AÐSÑSÔSÐSr   c                 ó<   ‡ ‡— ‰ ‰u rdgS ˆˆ fd„‰ j         D ¦   «         S )a  
        Return a list of all tree positions that can be used to reach
        this multi-parented tree starting from ``root``.  I.e., the
        following is always true::

          for treepos in ptree.treepositions(root):
              root[treepos] is ptree
        r   c                 ó~   •— g | ]9}|                      ‰¦  «        D ]!}t          |¦  «        D ]\  }}|‰u ¯	||fz   ‘ŒŒ"Œ:S r   )Útreepositionsr   )r†   rk   Útreeposr   r   ru   r   s        €€r   r‡   z3MultiParentedTree.treepositions.<locals>.<listcomp>!  su   ø€ ð ð ð àØ%×3Ò3°DÑ9Ô9ðð ð Ý&/°Ñ&7Ô&7ð	ð ñ #�U˜EØ˜D�=�=ð	 ˜5˜(Ñ"ð !�=�=�=�=r   r‘   rt   s   ``r   rž   zMultiParentedTree.treepositions  sH   øø€ ð �4ˆ<ˆ<Ø�4ˆKðð ð ð ð à"œmðñ ô ð r   c                 ó  ‡ — t          |t          ¦  «        sJ ‚‰ |         |u sJ ‚t          ˆ fd„|j        D ¦   «         ¦  «        dk    sJ ‚t	          ‰ ¦  «        D ]\  }}||u r	||k    r d S Œ|j                             ‰ ¦  «         d S )Nc                 ó   •— g | ]}|‰u ¯|‘Œ	S r   r   )r†   Úpr   s     €r   r‡   z0MultiParentedTree._delparent.<locals>.<listcomp>1  s   ø€ Ð;Ð;Ð;˜!°°d°°�A°°°r   r&   )r   r|   r,   r~   r   rF   )r   r   r   r   Úcs   `    r   r!   zMultiParentedTree._delparent-  s¯   ø€ å˜%Õ!2Ñ3Ô3Ð3Ð3Ð3Ø�EŒ{˜eÐ#Ð#Ð#Ð#ÝÐ;Ð;Ð;Ð;˜uœ~Ð;Ñ;Ô;Ñ<Ô<ÀÒAÐAÐAÐAõ ˜d‘O”Oð 	(ð 	(‰DˆAˆqØ�Eˆzˆz˜a 5šj˜jØ��øàŒN×!Ò! $Ñ'Ô'Ð'Ð'Ð'r   Fc                 ó¬   — t          |t          ¦  «        st          d¦  «        ‚|s-|j        D ]	}|| u r d S Œ
|j                             | ¦  «         d S d S )Nz?Can not insert a non-MultiParentedTree into a MultiParentedTree)r   r|   r0   r~   r<   )r   r   r   r   rk   s        r   r   zMultiParentedTree._setparent;  s‚   € å˜%Õ!2Ñ3Ô3ð 	ÝØQñô ð ð
 ð 	,Øœ.ð ,ð ,�Ø˜T�>�>Ø�E�Eð "ð ”×%Ò% dÑ+Ô+Ð+Ð+Ð+ð	,ð 	,r   r:   rU   )r2   rV   rW   rX   r   rd   r‚   rŠ   rŽ   r‰   r•   r“   r›   rž   r!   r   rZ   r[   s   @r   r|   r|   –  sô   ø€ € € € € ðð ð".ð .ð .ð .ð .ð .ð *ð *ð *ð	#ð 	#ð 	#ð
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð9ð 9ð 9ðð ð ðTð Tð Tðð ð ð0(ð (ð (ð,ð ,ð ,ð ,ð ,ð ,ð ,ð ,r   r|   )rg   Úabcr   r   Únltk.tree.treer   Ú	nltk.utilr   r   r^   r|   Ú__all__r   r   r   ú<module>r©      s  ðð €€€Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'à Ð Ð Ð Ð Ð Ø "Ð "Ð "Ð "Ð "Ð "ð})ð })ð })ð })ð })˜4¨7ð })ñ })ô })ð })ð@~!ð ~!ð ~!ð ~!ð ~!Ð'ñ ~!ô ~!ð ~!ðBr,ð r,ð r,ð r,ð r,Ð,ñ r,ô r,ð r,ðl Øð€€€r   