ó
    ´OÂf0  ã                   óŒ   • S SK r S SKr0 SS_SS_SS_SS_S	S
_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_r " S S5      rg)é    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                   óB   • \ rS rSr0 4S jrS rS rS rS rS
S jr	Sr
g	)ÚChaté"   c                 óÈ   • U VVs/ s H,  u  p4[         R                  " U[         R                  5      U4PM.     snnU l        X l        U R                  5       U l        gs  snnf )ac  
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
N)ÚreÚcompileÚ
IGNORECASEÚ_pairsÚ_reflectionsÚ_compile_reflectionsÚ_regex)ÚselfÚpairsÚreflectionsÚxÚys        Ú0/usr/lib/python3/dist-packages/nltk/chat/util.pyÚ__init__ÚChat.__init__#   sN   € ñ  HMÔMÂu¹V¸aœŸ
š
 1¤b§m¡mÓ4°aÓ8ÁuÒMˆŒØ'ÔØ×/Ñ/Ó1ˆ�ùó Ns   †3Ac           
      óê   • [        U R                  [        SS9n[        R                  " SR                  SR                  [        [        R                  U5      5      5      [        R                  5      $ )NT)ÚkeyÚreversez\b({})\bÚ|)
Úsortedr   Úlenr   r   ÚformatÚjoinÚmapÚescaper   )r   Úsorted_refls     r   r   ÚChat._compile_reflections7   sO   € Ü˜T×.Ñ.´CÀÑFˆÜ�zŠzØ×Ñ˜sŸx™x¬¬B¯I©I°{Ó(CÓDÓEÄrÇ}Á}ó
ð 	
ó    c                 ó`   ^ • T R                   R                  U 4S jUR                  5       5      $ )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                 ót   >• TR                   U R                  U R                  5       U R                  5           $ )N)r   ÚstringÚstartÚend)Úmor   s    €r   Ú<lambda>Ú"Chat._substitute.<locals>.<lambda>H   s'   ø€ �t×(Ñ(¨¯©°2·8±8³:ÀÇÁÃÐ)IÒJr)   )r   ÚsubÚlower)r   Ústrs   ` r   Ú_substituteÚChat._substitute=   s%   ø€ ð �{‰{�‰ÜJÈCÏIÉIËKó
ð 	
r)   c                 óè   • UR                  S5      nUS:¼  aZ  [        XS-   US-    5      nUS U U R                  UR                  U5      5      -   XS-   S  -   nUR                  S5      nUS:¼  a  MZ  U$ )NÚ%r   é   é   )ÚfindÚintr5   Úgroup)r   ÚresponseÚmatchÚposÚnums        r   Ú
_wildcardsÚChat._wildcardsK   s‰   € Ø�m‰m˜CÓ ˆØ�Q‹hÜ�h Q™w¨¨q©Ð1Ó2ˆCà˜˜#�Ø×"Ñ" 5§;¡;¨sÓ#3Ó4ñ5à ™7˜9Ð%ñ&ð ð
 —-‘- Ó$ˆCð �Q�hð ˆr)   c                 óø   • U R                    Hj  u  p#UR                  U5      nU(       d  M  [        R                  " U5      nU R	                  XT5      nUSS S:X  a  USS S-   nUSS S:X  a  USS S-   nUs  $    g)zh
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   r4   Úpatternr>   r?   Úresps         r   ÚrespondÚChat.respondW   s‡   € ð "&§¤ÑˆGØ—M‘M #Ó&ˆE÷ ˆuÜ—}’} XÓ.�Ø—‘ tÓ3�ð ˜˜�9 Ó$Ø  ˜9 s™?�DØ˜˜�9 Ó$Ø  ˜9 s™?�DØ’ò "-r)   c                 óè   • SnX!:w  aP  Un [        S5      nU(       a3  US   S;   a  US S nUS   S;   a  M  [        U R                  U5      5        X!:w  a  MO  g g ! [         a    [        U5         NZf = f)NÚ Ú>éÿÿÿÿz!.)ÚinputÚEOFErrorÚprintrL   )r   ÚquitÚ
user_inputs      r   ÚconverseÚChat.converseq   s|   € Øˆ
ØÓ ØˆJð"Ü" 3›Z�
ö Ø  ‘n¨Ó,Ø!+¨C¨R �Jð ! ‘n¨Õ,ä�d—l‘l :Ó.Ô/ð × øô ó "Ü�jÖ!ð"ús   ‹A ÁA1Á0A1)r   r   r   N)rU   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   r5   rB   rL   rW   Ú__static_attributes__© r)   r   r   r   "   s#   † Ø*,ô 2ò(
ò
ò
ò÷40r)   r   )rH   r   r   r   r^   r)   r   Ú<module>r_      sÜ   ðó Û 	ðØ
ˆIðàˆZðð ˆðð 
ˆ9ð	ð
 
ˆ;ðð ˆJðð ˆJðð 	ˆ&ðð ˆvðð �ðð ˆhðð ˆhðð ˆDðð ˆVðð 
ˆ4ðð  	ˆ%ð!€÷(Z0ò Z0r)   