§
    ™Štjò  ã                   óN   — d dl Z d dlmZ d dlmZ d dlmZ  G d„ de¦  «        ZdS )é    N)ÚAny)Úoverride)ÚStringEvaluatorc            	       óâ   ‡ — e Zd ZdZddddœdedededefˆ fd„Zed	efd
„¦   «         Zed	efd„¦   «         Z	ed	e
e         fd„¦   «         Zed	efd„¦   «         Zedededed	efd„¦   «         Zˆ xZS )ÚExactMatchStringEvaluatoraÖ  Compute an exact match between the prediction and the reference.

    Examples:
    ----------
    >>> evaluator = ExactMatchChain()
    >>> evaluator.evaluate_strings(
            prediction="Mindy is the CTO",
            reference="Mindy is the CTO",
        )  # This will return {'score': 1.0}

    >>> evaluator.evaluate_strings(
            prediction="Mindy is the CTO",
            reference="Mindy is the CEO",
        )  # This will return {'score': 0.0}
    F)Úignore_caseÚignore_punctuationÚignore_numbersr   r	   r
   Ú_c                ór   •— t          ¦   «                              ¦   «          || _        || _        || _        dS )a/  Initialize the `ExactMatchStringEvaluator`.

        Args:
            ignore_case: Whether to ignore case when comparing strings.
            ignore_punctuation: Whether to ignore punctuation when comparing strings.
            ignore_numbers: Whether to ignore numbers when comparing strings.
        N)ÚsuperÚ__init__r   r	   r
   )Úselfr   r	   r
   r   Ú	__class__s        €úk/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langchain_classic/evaluation/exact_match/base.pyr   z"ExactMatchStringEvaluator.__init__   s9   ø€ õ 	‰Œ×ÒÑÔÐØ&ˆÔØ"4ˆÔØ,ˆÔÐÐó    Úreturnc                 ó   — dS )z&This evaluator does not require input.F© ©r   s    r   Úrequires_inputz(ExactMatchStringEvaluator.requires_input.   s	   € ð ˆur   c                 ó   — dS )z$This evaluator requires a reference.Tr   r   s    r   Úrequires_referencez,ExactMatchStringEvaluator.requires_reference3   s	   € ð ˆtr   c                 ó
   — ddgS )zJGet the input keys.

        Returns:
            The input keys.
        Ú	referenceÚ
predictionr   r   s    r   Ú
input_keysz$ExactMatchStringEvaluator.input_keys8   s   € ð ˜\Ð*Ð*r   c                 ó   — dS )zTGet the evaluation name.

        Returns:
            The evaluation name.
        Úexact_matchr   r   s    r   Úevaluation_namez)ExactMatchStringEvaluator.evaluation_nameA   s	   € ð ˆ}r   r   r   Úkwargsc                ón  — | j         r(|                     ¦   «         }|                     ¦   «         }| j        rr|                     t                               ddt          j        ¦  «        ¦  «        }|                     t                               ddt          j        ¦  «        ¦  «        }| j        rr|                     t                               ddt          j	        ¦  «        ¦  «        }|                     t                               ddt          j	        ¦  «        ¦  «        }dt          ||k    ¦  «        iS )a@  Evaluate the exact match between the prediction and the reference.

        Args:
            prediction: The prediction string.
            reference: The reference string.
            **kwargs: Additional keyword arguments (not used).

        Returns:
            The evaluation results containing the score.
        Ú Úscore)r   Úlowerr	   Ú	translateÚstrÚ	maketransÚstringÚpunctuationr
   ÚdigitsÚint)r   r   r   r!   s       r   Ú_evaluate_stringsz+ExactMatchStringEvaluator._evaluate_stringsJ   sõ   € ð$ Ôð 	*Ø#×)Ò)Ñ+Ô+ˆJØ!ŸšÑ)Ô)ˆIØÔ"ð 	WØ#×-Ò-­c¯mªm¸BÀÅFÔDVÑ.WÔ.WÑXÔXˆJØ!×+Ò+­C¯MªM¸"¸bÅ&ÔBTÑ,UÔ,UÑVÔVˆIØÔð 	RØ#×-Ò-­c¯mªm¸BÀÅFÄMÑ.RÔ.RÑSÔSˆJØ!×+Ò+­C¯MªM¸"¸bÅ&Ä-Ñ,PÔ,PÑQÔQˆIØ�˜Z¨9Ò4Ñ5Ô5Ð6Ð6r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úboolr   r   Úpropertyr   r   Úlistr'   r   r    r   Údictr-   Ú__classcell__)r   s   @r   r   r   	   sl  ø€ € € € € ðð ð& "Ø#(Ø$ð-ð -ð -ð ð-ð !ð	-ð
 ð-ð ð-ð -ð -ð -ð -ð -ð( ð ð ð ð ñ „Xðð ð Dð ð ð ñ „Xðð ð+˜D œIð +ð +ð +ñ „Xð+ð ð ð ð ð ñ „Xðð ð7ð ð7ð ð	7ð
 ð7ð 
ð7ð 7ð 7ñ „Xð7ð 7ð 7ð 7ð 7r   r   )r)   Útypingr   Útyping_extensionsr   Ú#langchain_classic.evaluation.schemar   r   r   r   r   ú<module>r:      s‚   ðØ €€€Ø Ð Ð Ð Ð Ð à &Ð &Ð &Ð &Ð &Ð &à ?Ð ?Ð ?Ð ?Ð ?Ð ?ð\7ð \7ð \7ð \7ð \7 ñ \7ô \7ð \7ð \7ð \7r   