+
    ÖÇÜhö  ã                   óv   € ^ RI Ht ^ RIHt ^ RIHtHtHt  ! R R4      tR
R lt	R t
]R	8X  d
   ]
! 4        R# R# )é    )Úload_parser)ÚInstantiateVarsChart)ÚApplicationExpressionÚLambdaExpressionÚVariablec                   ó:   a € ] tR t^t o RtR tR tRR ltRtV t	R# )ÚCooperStorezC
A container for handling quantifier ambiguity via Cooper storage.
c                ó¢   € Wn         . V n         VR,          V n        VR,          V n        R#   \         d    \        RT,          4        R# i ; i)z£
:param featstruct: The value of the ``sem`` node in a tree from
    ``parse_with_bindops()``
:type featstruct: FeatStruct (with features ``core`` and ``store``)

ÚCOREÚSTOREz$%s is not a Cooper storage structureN)Ú
featstructÚreadingsÚcoreÚstoreÚKeyErrorÚprint)Úselfr   s   &&Ú9/usr/lib/python3/dist-packages/nltk/sem/cooper_storage.pyÚ__init__ÚCooperStore.__init__   sM   € ð %ŒØˆŒð	GØ" 6Õ*ˆDŒIØ# GÕ,ˆDŽJøÜô 	GÜÐ8¸:ÕE×Fð	Gús   �- ­AÁAc              #  ó¬   "  € R pV'       dA   \        V4       F/  w  r4V P                  V! W4      4       F  pV3V,           x € K  	  K1  	  R# Rx € R# 5i)z[
:return: An iterator over the permutations of the input list
:type lst: list
:rtype: iter
c                 ó,   € V R V W^,           R  ,           # )N© )Úlst0Úindexs   &&r   Ú<lambda>Ú&CooperStore._permute.<locals>.<lambda>'   s   €  T¨&¨5 \°DÀ½¸Ð4EÖ%Eó    Nr   )Ú	enumerateÚ_permute)r   ÚlstÚremover   ÚxÚys   &&    r   r    ÚCooperStore._permute!   sJ   é € ñ FˆßÜ% cžN‘�ØŸ™¡v¨cÓ'9Ö:�AØ˜$ �(”Nó ;ó +ð ŒHùs   ‚AAc           	     ó¸  € \        V P                  V P                  4      4       F±  w  r#V'       d   \        RV^,           ,          4       V P                  pV F^  p\        VP                  4      w  rg\        V\        VP                  V4      4      pV'       d   \        RV4       VP                  4       pK`  	  V P                  P                  V4       K³  	  R# )aù  
Carry out S-Retrieval of binding operators in store. If hack=True,
serialize the bindop and core as strings and reparse. Ugh.

Each permutation of the store (i.e. list of binding operators) is
taken to be a possible scoping of quantifiers. We iterate through the
binding operators in each permutation, and successively apply them to
the current term, starting with the core semantic representation,
working from the inside out.

Binding operators are of the form::

     bo(\P.all x.(man(x) -> P(x)),z1)
zPermutation %sz  N)r   r    r   r   r   ÚtupleÚargsr   r   ÚvariableÚsimplifyr   Úappend)r   ÚtraceÚpermÚ
store_permÚtermÚbindopÚquantÚvarexs   &&      r   Ú
s_retrieveÚCooperStore.s_retrieve/   s§   € ô !*¨$¯-©-¸¿
¹
Ó*CÖ DÑˆDßÜÐ&¨$°­(Õ3Ô4Ø—9‘9ˆDÛ$�ä$ V§[¡[Ó1‘�ô -ØÔ+¨E¯N©N¸DÓAó�÷ Ü˜$ Ô%Ø—}‘}“’ñ %ð �M‰M× Ñ  Ö&ó !Er   )r   r   r   r   N)F)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r    r3   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r	   r	      s   ø‡ € ñòGò÷'ò 'r   r	   Nc                óŒ   € V'       g   Rp\        W\        R7      pV P                  4       p\        VP	                  V4      4      # )z;
Use a grammar with Binding Operators to parse a sentence.
z#grammars/book_grammars/storage.fcfg)r,   Úchart_class)r   r   ÚsplitÚlistÚparse)ÚsentenceÚgrammarr,   ÚparserÚtokenss   &&&  r   Úparse_with_bindopsrF   P   s9   € ÷ Ø7ˆÜ˜Ô;OÔP€Fà�^‰^Ó€FÜ�—‘˜VÓ$Ó%Ð%r   c                  óÌ  € ^ RI Hp  Rp\        4        \        RV,          4       \        R4       V P                  V^ R7      pV EF  pV P	                  VP                  4       R,          4      p\        4        \        R4       \        R4       VP                   F  p\        V4       K  	  \        4        \        R4       \        R4       \        VP                  4       \        4        \        R4       \        R4       VP                  R	R7       \        R
4       \        R4       \        VP                  4       F  w  rg\        V^,            RV 24       K  	  EK  	  R# )r   )Úcooper_storagezevery girl chases a dogzAnalysis of sentence '%s')r,   ÚSEMzBinding operators:zCore:zS-Retrieval:Tz	Readings:z: Nz2==================================================z---------------)Únltk.semrH   r   rF   r	   Úlabelr   r   r3   r   r   )ÚcsrB   ÚtreesÚtreeÚsemrepÚsÚiÚreadings           r   ÚdemorS   \   s  € Ý-à(€Hä	„GÜ	Ð
%¨Õ
0Ô1Ü	ˆ(„OØ×!Ñ! (°!Ð!Ó4€EÜˆØ—‘ §
¡
£¨UÕ 3Ó4ˆÜŒÜÐ"Ô#ÜˆhŒØ—”ˆAÜ�!ŽHñ äŒÜˆgŒÜˆhŒÜˆf�k‰kÔÜŒÜˆnÔÜˆhŒØ×Ñ ÐÔ%ÜˆkÔÜˆhŒä# F§O¡OÖ4‰JˆAÜ�Q˜•U�G˜2˜g˜YÐ'Ö(ô 5ó% r   Ú__main__)Nr   )Ú
nltk.parser   Únltk.parse.featurechartr   Únltk.sem.logicr   r   r   r	   rF   rS   r5   r   r   r   Ú<module>rX      s>   ðõ #Ý 8ß LÑ L÷@'ñ @'ôF	&ò)ð> ˆzÔÙ†Fñ r   