§
    �zIf®  ã                   ó”   — d dl Z d dlZi dd“dd“dd“dd“d	d
“dd“dd“dd“dd“dd“dd“dd“dd“dd“dd“dd“Z G d„ d¦  «        ZdS )é    Nzi amzyou arezi waszyou wereÚiÚyouzi'mzi'dz	you wouldzi'vezyou havezi'llzyou willÚmyÚyourzI amzI waszyou'vezI havezyou'llzI willÚyoursÚmineÚmec                   ó8   — e Zd Zi fd„Zd„ Zd„ Zd„ Zd„ Zd	d„ZdS )
ÚChatc                 óh   — d„ |D ¦   «         | _         || _        |                      ¦   «         | _        dS )aÃ  
        Initialize the chatbot.  Pairs is a list of patterns and responses.  Each
        pattern is a regular expression matching the user's statement or question,
        e.g. r'I like (.*)'.  For each such pattern a list of possible responses
        is given, e.g. ['Why do you like %1', 'Did you ever dislike %1'].  Material
        which is matched by parenthesized sections of the patterns (e.g. .*) is mapped to
        the numbered positions in the responses, e.g. %1.

        :type pairs: list of tuple
        :param pairs: The patterns and responses
        :type reflections: dict
        :param reflections: A mapping between first and second person expressions
        :rtype: None
        c                 óV   — g | ]&\  }}t          j        |t           j        ¦  «        |f‘Œ'S © )ÚreÚcompileÚ
IGNORECASE)Ú.0ÚxÚys      úB/var/www/piapp/venv/lib/python3.11/site-packages/nltk/chat/util.pyú
<listcomp>z!Chat.__init__.<locals>.<listcomp>3   s/   € ÐMÐMÐM¹V¸aÀ�œ
 1¥b¤mÑ4Ô4°aÐ8ÐMÐMÐMó    N)Ú_pairsÚ_reflectionsÚ_compile_reflectionsÚ_regex)ÚselfÚpairsÚreflectionss      r   Ú__init__zChat.__init__#   s9   € ð  NÐMÀuÐMÑMÔMˆŒØ'ˆÔØ×/Ò/Ñ1Ô1ˆŒˆˆr   c           
      óô   — t          | j        t          d¬¦  «        }t          j        d                     d                     t          t          j        |¦  «        ¦  «        ¦  «        t          j	        ¦  «        S )NT)ÚkeyÚreversez\b({})\bú|)
Úsortedr   Úlenr   r   ÚformatÚjoinÚmapÚescaper   )r   Úsorted_refls     r   r   zChat._compile_reflections7   sZ   € Ý˜TÔ.µCÀÐFÑFÔFˆÝŒzØ×Ò˜sŸxšx­­B¬I°{Ñ(CÔ(CÑDÔDÑEÔEÅrÄ}ñ
ô 
ð 	
r   c                 ód   ‡ — ‰ j                              ˆ fd„|                     ¦   «         ¦  «        S )zÑ
        Substitute words in the string, according to the specified reflections,
        e.g. "I'm" -> "you are"

        :type str: str
        :param str: The string to be mapped
        :rtype: str
        c                 ó€   •— ‰j         | j        |                      ¦   «         |                      ¦   «         …                  S )N)r   ÚstringÚstartÚend)Úmor   s    €r   ú<lambda>z"Chat._substitute.<locals>.<lambda>H   s+   ø€ �tÔ(¨¬°2·8²8±:´:ÀÇÂÁÄÐ3HÔ)IÔJ€ r   )r   ÚsubÚlower)r   Ústrs   ` r   Ú_substitutezChat._substitute=   s3   ø€ ð Œ{�ŠØJÐJÐJÐJÈCÏIÊIÉKÌKñ
ô 
ð 	
r   c                 ó.  — |                      d¦  «        }|dk    ryt          ||dz   |dz   …         ¦  «        }|d |…         |                      |                     |¦  «        ¦  «        z   ||dz   d …         z   }|                      d¦  «        }|dk    °y|S )Nú%r   é   é   )ÚfindÚintr5   Úgroup)r   ÚresponseÚmatchÚposÚnums        r   Ú
_wildcardszChat._wildcardsK   s§   € Ø�mŠm˜CÑ Ô ˆØ�QŠhˆhÝ�h˜s Q™w¨¨q©Ð0Ô1Ñ2Ô2ˆCà˜˜#˜”Ø×"Ò" 5§;¢;¨sÑ#3Ô#3Ñ4Ô4ñ5à˜3 ™7˜9˜9Ô%ñ&ð ð
 —-’- Ñ$Ô$ˆCð �QŠhˆhð ˆr   c                 ó  — | j         D ]€\  }}|                     |¦  «        }|rdt          j        |¦  «        }|                      ||¦  «        }|dd…         dk    r|dd…         dz   }|dd…         dk    r|dd…         dz   }|c S Œ�dS )z�
        Generate a response to the user input.

        :type str: str
        :param str: The string to be mapped
        :rtype: str
        éþÿÿÿNz?.ú.z??ú?)r   r>   ÚrandomÚchoicerA   )r   r4   Úpatternr=   r>   Úresps         r   ÚrespondzChat.respondW   s¹   € ð $(¤;ð 	ð 	ÑˆW�hØ—M’M #Ñ&Ô&ˆEð ð 	Ý”} XÑ.Ô.�Ø—’ t¨UÑ3Ô3�ð ˜˜˜”9 Ò$Ð$Ø   œ9 s™?�DØ˜˜˜”9 Ò$Ð$Ø   œ9 s™?�DØ���ð	ð		ð 	r   Úquitc                 ó  — d}||k    r||}	 t          d¦  «        }n# t          $ r t          |¦  «         Y nw xY w|r@|d         dv r|d d…         }|d         dv °t          |                      |¦  «        ¦  «         ||k    °zd S d S )NÚ ú>éÿÿÿÿz!.)ÚinputÚEOFErrorÚprintrJ   )r   rK   Ú
user_inputs      r   ÚconversezChat.converseq   sÀ   € Øˆ
Ø˜DÒ Ð ØˆJð"Ý" 3™ZœZ�
�
øÝð "ð "ð "Ý�jÑ!Ô!Ð!Ð!Ð!ð"øøøàð 0Ø  ”n¨Ð,Ð,Ø!+¨C¨R¨C¤�Jð ! ”n¨Ð,Ð,å�d—l’l :Ñ.Ô.Ñ/Ô/Ð/ð ˜DÒ Ð Ð Ð Ð Ð s   Œ œ8·8N)rK   )	Ú__name__Ú
__module__Ú__qualname__r   r   r5   rA   rJ   rT   r   r   r   r   r   "   s{   € € € € € Ø*,ð 2ð 2ð 2ð 2ð(
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ðð ð ð40ð 0ð 0ð 0ð 0ð 0r   r   )rF   r   r   r   r   r   r   ú<module>rX      s  ðð €€€Ø 	€	€	€	ðØ
ˆIðàˆZðð ˆðð 
ˆ9ð	ð
 
ˆ;ðð ˆJðð ˆJðð 	ˆ&ðð ˆvðð �ðð ˆhðð ˆhðð ˆDðð ˆVðð 
ˆ4ðð  	ˆ%ð!€ð(Z0ð Z0ð Z0ð Z0ð Z0ñ Z0ô Z0ð Z0ð Z0ð Z0r   