§
    íóÉj¤  ã                   ó    — d dl Z d dlZd dlm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 )é    N)Úredosz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 © )r   ÚcompileÚreÚ
IGNORECASE)Ú.0ÚxÚys      úq/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib/python3.11/site-packages/nltk/chat/util.pyú
<listcomp>z!Chat.__init__.<locals>.<listcomp>:   s/   € ÐPÐPÐPÁÀÀA�œ a­¬Ñ7Ô7¸Ð;ÐPÐPÐPó    N)Ú_pairsÚ_reflectionsÚ_compile_reflectionsÚ_regex)ÚselfÚpairsÚreflectionss      r   Ú__init__zChat.__init__%   s9   € ð* QÐPÈ%ÐPÑPÔPˆŒØ'ˆÔØ×/Ò/Ñ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_reflections>   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>O   s+   ø€ �tÔ(¨¬°2·8²8±:´:ÀÇÂÁÄÐ3HÔ)IÔJ€ r   )r   ÚsubÚlower)r   Ústrs   ` r   Ú_substitutezChat._substituteD   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Úintr6   Úgroup)r   ÚresponseÚmatchÚposÚnums        r   Ú
_wildcardszChat._wildcardsR   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ÚchoicerB   )r   r5   Úpatternr>   r?   Úresps         r   ÚrespondzChat.respond^   s¹   € ð "&¤ð 	ð 	ÑˆG�XØ—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ÚprintrK   )r   rL   Ú
user_inputs      r   ÚconversezChat.conversex   sÀ   € Øˆ
Ø˜DÒ Ð ØˆJð"Ý" 3™ZœZ�
�
øÝð "ð "ð "Ý�jÑ!Ô!Ð!Ð!Ð!ð"øøøàð 0Ø  ”n¨Ð,Ð,Ø!+¨C¨R¨C¤�Jð ! ”n¨Ð,Ð,å�d—l’l :Ñ.Ô.Ñ/Ô/Ð/ð ˜DÒ Ð Ð Ð Ð Ð s   Œ œ8·8N)rL   )	Ú__name__Ú
__module__Ú__qualname__r    r   r6   rB   rK   rU   r   r   r   r   r   $   s{   € € € € € Ø*,ð 2ð 2ð 2ð 2ð2
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ðð ð ð40ð 0ð 0ð 0ð 0ð 0r   r   )rG   r   Únltkr   r   r   r   r   r   ú<module>rZ      s*  ðð €€€Ø 	€	€	€	à Ð Ð Ð Ð Ð ðØ
ˆIðàˆZðð ˆðð 
ˆ9ð	ð
 
ˆ;ðð ˆJðð ˆJðð 	ˆ&ðð ˆvðð �ðð ˆhðð ˆhðð ˆDðð ˆVðð 
ˆ4ðð  	ˆ%ð!€ð(_0ð _0ð _0ð _0ð _0ñ _0ô _0ð _0ð _0ð _0r   