+
    ÖÇÜh7(  ã                   ó  € R t ^ RIHtHt ^ RIHt  ! R R]R7      t ! R R]R7      t ! R R	]4      t ! R
 R]4      t	 ! R R]4      t
R tR t]! ]
! 4       ]4      t]	! ]
! 4       ]4      t ! R R]4      tR tR tR tR t]! ]! 4       ]4      t]	! ]! 4       ]4      t]	! ]! 4       ]RR7      t ! R R]4      tR tR t]! ]! 4       ]4      t]	! ]! 4       ]R4      tR t ! R R]4      tR tR  t]! ]! 4       ]4      t ]	! ]! 4       ]4      t!R!# )"z
CCG Combinators
)ÚABCMetaÚabstractmethod)ÚFunctionalCategoryc                   óD   a € ] tR t^t o Rt]R 4       t]R 4       tRtV t	R# )ÚUndirectedBinaryCombinatora‹  
Abstract class for representing a binary combinator.
Merely defines functions for checking if the function and argument
are able to be combined, and what the resulting category is.

Note that as no assumptions are made as to direction, the unrestricted
combinators can perform all backward, forward and crossed variations
of the combinators; these restrictions must be added in the rule
class.
c                ó   € R # ©N© ©ÚselfÚfunctionÚarguments   &&&Ú5/usr/lib/python3/dist-packages/nltk/ccg/combinator.pyÚcan_combineÚ&UndirectedBinaryCombinator.can_combine   ó   € áó    c                ó   € R # r   r	   r
   s   &&&r   ÚcombineÚ"UndirectedBinaryCombinator.combine    r   r   r	   N©
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      s2   ø‡ € ñ	ð ñó ðð ñó ör   r   )Ú	metaclassc                   óD   a € ] tR t^%t o Rt]R 4       t]R 4       tRtV t	R# )ÚDirectedBinaryCombinatorzÉ
Wrapper for the undirected binary combinator.
It takes left and right categories, and decides which is to be
the function, and which the argument.
It then decides whether or not they can be combined.
c                ó   € R # r   r	   ©r   ÚleftÚrights   &&&r   r   Ú$DirectedBinaryCombinator.can_combine-   r   r   c                ó   € R # r   r	   r$   s   &&&r   r   Ú DirectedBinaryCombinator.combine1   r   r   r	   Nr   r   s   @r   r"   r"   %   s2   ø‡ € ñð ñó ðð ñó ör   r"   c                   ó@   a € ] tR t^6t o RtRR ltR tR tR tRt	V t
R# )	ÚForwardCombinatorz¿
Class representing combinators where the primary functor is on the left.

Takes an undirected combinator, and a predicate which adds constraints
restricting the cases in which it may apply.
c                ó*   € Wn         W n        W0n        R # r   ©Ú_combinatorÚ
_predicateÚ_suffix©r   Ú
combinatorÚ	predicateÚsuffixs   &&&&r   Ú__init__ÚForwardCombinator.__init__>   ó   € Ø%ÔØ#ŒØŽr   c                ój   € V P                   P                  W4      ;'       d    V P                  W4      # r   ©r.   r   r/   r$   s   &&&r   r   ÚForwardCombinator.can_combineC   s3   € Ø×Ñ×+Ñ+¨DÓ8÷ 
ð 
¸T¿_¹_Øó>
ð 	
r   c              #  óX   "  € V P                   P                  W4       R j  x€L
  R #  L5ir   ©r.   r   r$   s   &&&r   r   ÚForwardCombinator.combineH   s   é € Ø×#Ñ#×+Ñ+¨DÓ8×8Ô8ùó   ‚*¡(¢*c                ó8   € R V P                    V P                   2# )Ú>©r.   r0   ©r   s   &r   Ú__str__ÚForwardCombinator.__str__K   ó   € Ø�4×#Ñ#Ð$ T§\¡\ NÐ3Ð3r   r-   N©Ú ©r   r   r   r   r   r5   r   r   rC   r   r   r   s   @r   r+   r+   6   s#   ø‡ € ñôò

ò
9÷4ð 4r   r+   c                   ó@   a € ] tR t^Ot o RtRR ltR tR tR tRt	V t
R# )	ÚBackwardCombinatorz9
The backward equivalent of the ForwardCombinator class.
c                ó*   € Wn         W n        W0n        R # r   r-   r1   s   &&&&r   r5   ÚBackwardCombinator.__init__T   r7   r   c                ój   € V P                   P                  W!4      ;'       d    V P                  W4      # r   r9   r$   s   &&&r   r   ÚBackwardCombinator.can_combineY   s3   € Ø×Ñ×+Ñ+¨EÓ8÷ 
ð 
¸T¿_¹_Øó>
ð 	
r   c              #  óX   "  € V P                   P                  W!4       R j  x€L
  R #  L5ir   r<   r$   s   &&&r   r   ÚBackwardCombinator.combine^   s   é € Ø×#Ñ#×+Ñ+¨EÓ8×8Ô8ùr>   c                ó8   € R V P                    V P                   2# )Ú<rA   rB   s   &r   rC   ÚBackwardCombinator.__str__a   rE   r   r-   NrF   rH   r   s   @r   rJ   rJ   O   s#   ø‡ € ñôò

ò
9÷4ð 4r   rJ   c                   ó6   a € ] tR t^et o RtR tR tR tRtV t	R# )ÚUndirectedFunctionApplicationzˆ
Class representing function application.
Implements rules of the form:
X/Y Y -> X (>)
And the corresponding backwards application rule
c                óv   € VP                  4       '       g   R # VP                  4       P                  V4      RJ * # ©FN)Úis_functionÚargÚ	can_unifyr
   s   &&&r   r   Ú)UndirectedFunctionApplication.can_combinem   s3   € Ø×#Ñ#×%Ò%Ùà—<‘<“>×+Ñ+¨HÓ5¸Ð=Ð=Ð=r   c              #  óÊ   "  € VP                  4       '       g   R # VP                  4       P                  V4      pVf   R # VP                  4       P	                  V4      x € R # 5ir   )rX   rY   rZ   ÚresÚ
substitute©r   r   r   Úsubss   &&& r   r   Ú%UndirectedFunctionApplication.combines   sL   é € Ø×#Ñ#×%Ò%Ùà�|‰|‹~×'Ñ'¨Ó1ˆØŠ<Ùà�l‰l‹n×'Ñ'¨Ó-Ô-ùs   ‚A!A#c                ó   € R # rF   r	   rB   s   &r   rC   Ú%UndirectedFunctionApplication.__str__}   s   € Ùr   r	   N©
r   r   r   r   r   r   r   rC   r   r   r   s   @r   rU   rU   e   s   ø‡ € ñò>ò.÷ð r   rU   c                 ó>   € V P                  4       P                  4       # r   ©ÚdirÚ
is_forward©r%   r&   s   &&r   ÚforwardOnlyrj   …   s   € Ø�8‰8‹:× Ñ Ó"Ð"r   c                 ó>   € VP                  4       P                  4       # r   ©rg   Úis_backwardri   s   &&r   ÚbackwardOnlyrn   Š   s   € Ø�9‰9‹;×"Ñ"Ó$Ð$r   c                   ó6   a € ] tR t^“t o RtR tR tR tRtV t	R# )ÚUndirectedCompositionz˜
Functional composition (harmonic) combinator.
Implements rules of the form
X/Y Y/Z -> X/Z (B>)
And the corresponding backwards and crossed variations.
c                óR  € VP                  4       '       d   VP                  4       '       g   R # VP                  4       P                  4       '       dU   VP                  4       P                  4       '       d1   VP                  4       P	                  VP                  4       4      RJ * # R # rW   )rX   rg   Úcan_composerY   rZ   r]   r
   s   &&&r   r   Ú!UndirectedComposition.can_combine›   su   € ð ×$Ñ$×&Ò&¨8×+?Ñ+?×+AÒ+AÙØ�<‰<‹>×%Ñ%×'Ò'¨H¯L©L«N×,FÑ,F×,HÒ,HØ—|‘|“~×/Ñ/°·±³Ó?À4ÐGÐGÐGÙr   c              #  ó  "  € VP                  4       '       d   VP                  4       '       g   R # VP                  4       P                  4       '       d³   VP                  4       P                  4       '       d�   VP                  4       P	                  VP                  4       4      pVeZ   \        VP                  4       P                  V4      VP                  4       P                  V4      VP                  4       4      x € R # R # R # R # 5ir   )rX   rg   rr   rY   rZ   r]   r   r^   r_   s   &&& r   r   ÚUndirectedComposition.combine¤   s¼   é € Ø×$Ñ$×&Ò&¨8×+?Ñ+?×+AÒ+AÙØ�<‰<‹>×%Ñ%×'Ò'¨H¯L©L«N×,FÑ,F×,HÒ,HØ—<‘<“>×+Ñ+¨H¯L©L«NÓ;ˆDØÒÜ(Ø—L‘L“N×-Ñ-¨dÓ3Ø—L‘L“N×-Ñ-¨dÓ3Ø—L‘L“Nóô ñ  ñ -IÑ'ùs   ‚,D	¯%D	Á#D	Á9BD	c                ó   € R # )ÚBr	   rB   s   &r   rC   ÚUndirectedComposition.__str__°   ó   € Ùr   r	   Nrd   r   s   @r   rp   rp   “   s   ø‡ € ñòò
÷ð r   rp   c                 óŠ   € V P                  4       P                  4       ;'       d    VP                  4       P                  4       # r   rf   ri   s   &&r   ÚbothForwardr{   µ   s.   € Ø�8‰8‹:× Ñ Ó"×?Ð? u§y¡y£{×'=Ñ'=Ó'?Ð?r   c                 óŠ   € V P                  4       P                  4       ;'       d    VP                  4       P                  4       # r   rl   ri   s   &&r   ÚbothBackwardr}   ¹   s.   € Ø�8‰8‹:×!Ñ!Ó#×AÐA¨¯	©	«×(?Ñ(?Ó(AÐAr   c                 óŠ   € V P                  4       P                  4       ;'       d    VP                  4       P                  4       # r   )rg   rh   rm   ri   s   &&r   ÚcrossedDirsr   ¾   s.   € Ø�8‰8‹:× Ñ Ó"×@Ð@ u§y¡y£{×'>Ñ'>Ó'@Ð@r   c                 óø   € \        W4      '       g   R # V P                  4       P                  4       '       g'   VP                  4       P                  4       '       d   R # V P                  4       P	                  4       # ©F)r   rg   Ú	can_crossrY   Úis_primitiveri   s   &&r   ÚbackwardBxConstraintr„   Â   sQ   € ä�t×#Ò#Ùà�8‰8‹:×Ñ×!Ò! e§i¡i£k×&;Ñ&;×&=Ò&=Ùà�8‰8‹:×"Ñ"Ó$Ð$r   Úx)r4   c                   ó6   a € ] tR t^×t o RtR tR tR tRtV t	R# )ÚUndirectedSubstitutionzt
Substitution (permutation) combinator.
Implements rules of the form
Y/Z (X\Y)/Z -> X/Z (<Sx)
And other variations.
c                ó:  € VP                  4       '       g   VP                  4       '       d   R # VP                  4       P                  4       '       d   R # VP                  4       P                  4       '       g   R # VP                  4       P	                  4       '       d%   VP                  4       P	                  4       '       g   R # VP                  4       P                  4       VP                  4       8H  ;'       d"    VP                  4       VP                  4       8H  # r�   )rƒ   r]   rY   rg   rr   r
   s   &&&r   r   Ú"UndirectedSubstitution.can_combineß   sÀ   € Ø× Ñ ×"Ò" h×&;Ñ&;×&=Ò&=Ùð �<‰<‹>×&Ñ&×(Ò(ÙØ�|‰|‹~×*Ñ*×,Ò,Ùà—‘“×*Ñ*×,Ò,°·±³×1KÑ1K×1MÒ1MÙØ—‘“×"Ñ"Ó$¨¯©«Ñ6÷ 
ð 
Ø�L‰L‹N˜hŸl™l›nÑ,ð	
r   c              #  óÎ   "  € V P                  W4      '       dJ   \        VP                  4       P                  4       VP                  4       VP	                  4       4      x € R # R # 5ir   )r   r   r]   rY   rg   r
   s   &&&r   r   ÚUndirectedSubstitution.combineð   sJ   é € Ø×Ñ˜H×/Ò/Ü$Ø—‘“×"Ñ"Ó$ h§l¡l£n°h·l±l³nóô ñ 0ùs   ‚A#A%c                ó   € R # )ÚSr	   rB   s   &r   rC   ÚUndirectedSubstitution.__str__ö   ry   r   r	   Nrd   r   s   @r   r‡   r‡   ×   s   ø‡ € ñò
ò"÷ð r   r‡   c                 óÌ   € \        W4      '       g   R # V P                  4       P                  4       P                  4       ;'       d    V P	                  4       P                  4       # r�   )r{   r]   rg   rh   rY   rƒ   ri   s   &&r   ÚforwardSConstraintr�   û   sC   € Ü�t×#Ò#ÙØ�8‰8‹:�>‰>Ó×&Ñ&Ó(×FÐF¨T¯X©X«Z×-DÑ-DÓ-FÐFr   c                 ó`  € V P                  4       P                  4       '       g'   VP                  4       P                  4       '       d   R # \        W4      '       g   R # VP                  4       P                  4       P	                  4       ;'       d    VP                  4       P                  4       # r�   )rg   r‚   r{   r]   rm   rY   rƒ   ri   s   &&r   ÚbackwardSxConstraintr’     so   € Ø�8‰8‹:×Ñ×!Ò! e§i¡i£k×&;Ñ&;×&=Ò&=ÙÜ�t×#Ò#ÙØ�9‰9‹;�?‰?Ó×(Ñ(Ó*×IÐI¨u¯y©y«{×/GÑ/GÓ/IÐIr   c                 ór   € V P                  4       P                  4       '       d   V P                  4       p K6  V # r   )r]   rX   )Úcategs   &r   ÚinnermostFunctionr•     s'   € Ø
�)‰)‹+×
!Ñ
!×
#Ò
#Ø—	‘	“ŠØ€Lr   c                   ó6   a € ] tR tRt o RtR tR tR tRtV t	R# )ÚUndirectedTypeRaisei  z)
Undirected combinator for type raising.
c                óî   € VP                  4       '       d%   VP                  4       P                  4       '       g   R # \        V4      p\        P	                  \
        P                  4       4      pVe   R# R # )FT)rX   r]   r•   r%   rZ   Ú	arg_categrY   )r   r   rY   r`   s   &&& r   r   ÚUndirectedTypeRaise.can_combine  sT   € ð —‘×!Ò! c§g¡g£i×&;Ñ&;×&=Ò&=Ùä Ó$ˆô �~‰~œiŸm™m›oÓ.ˆØÒÙÙr   c           	   #  ó¼  "  € VP                  4       '       d;   VP                  4       '       d%   VP                  4       P                  4       '       g   R # \        V4      pVP	                  VP                  4       4      pVeX   VP                  4       P                  V4      p\        V\        WAVP                  4       4      VP                  4       ) 4      x € R # R # 5ir   )	rƒ   rX   r]   r•   rZ   rY   r^   r   rg   )r   r   rY   r`   Úxcats   &&&  r   r   ÚUndirectedTypeRaise.combine/  s¤   é € à×!Ñ!×#Ò#¨¯©×(9Ò(9¸c¿g¹g»i×>SÑ>S×>UÒ>Uáô   Ó$ˆà×!Ñ! #§'¡'£)Ó,ˆØÒØ—7‘7“9×'Ñ'¨Ó-ˆDÜ$ØÔ(¨¸¿¹»ÓCÀsÇwÁwÃyÀ\óô ñ ùs   ‚,C¯#CÁB	Cc                ó   € R # )ÚTr	   rB   s   &r   rC   ÚUndirectedTypeRaise.__str__?  ry   r   r	   Nrd   r   s   @r   r—   r—     s   ø‡ € ñòò&÷ ð r   r—   c                 ó    € \        V4      pVP                  4       P                  4       ;'       d    VP                  4       P	                  4       # r   )r•   rg   rm   r]   rƒ   ©r%   r&   rY   s   && r   ÚforwardTConstraintr£   H  s8   € Ü
˜EÓ
"€CØ�7‰7‹9× Ñ Ó"×?Ð? s§w¡w£y×'=Ñ'=Ó'?Ð?r   c                 ó    € \        V 4      pVP                  4       P                  4       ;'       d    VP                  4       P	                  4       # r   )r•   rg   rh   r]   rƒ   r¢   s   && r   ÚbackwardTConstraintr¥   M  s8   € Ü
˜DÓ
!€CØ�7‰7‹9×ÑÓ!×>Ð> c§g¡g£i×&<Ñ&<Ó&>Ð>r   N)"r   Úabcr   r   Únltk.ccg.apir   r   r"   r+   rJ   rU   rj   rn   ÚForwardApplicationÚBackwardApplicationrp   r{   r}   r   r„   ÚForwardCompositionÚBackwardCompositionÚ
BackwardBxr‡   r�   r’   ÚForwardSubstitutionÚ
BackwardSxr•   r—   r£   r¥   ÚForwardTÚ	BackwardTr	   r   r   Ú<module>r±      sd  ðñ÷ (å +ô¨7õ ô*¨õ ô"4Ð0ô 4ô24Ð1ô 4ô,Ð$>ô ò@#ò
%ñ
 'Ñ'DÓ'FÈÓTÐ Ù(Ñ)FÓ)HÈ,ÓWÐ ôÐ6ô òD@òBò
Aò%ñ 'Ñ'<Ó'>ÀÓLÐ Ù(Ñ)>Ó)@À,ÓOÐ ñ  ÙÓÐ1¸#ô€
ô
 Ð7ô  òHGòJñ (Ñ(>Ó(@ÐBTÓUÐ ÙÑ 6Ó 8Ð:NÐPSÓT€
ò
ô)Ð4ô )òb@ò
?ñ Ñ0Ó2Ð4FÓG€ÙÑ2Ó4Ð6IÓJ‚	r   