
    3fi                     F    d dl Z d dlmZ d dlmZ d dlmZ  G d de      Zy)    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                L    t         |           || _        || _        || _        y)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/auto_recruiter/arenv/lib/python3.12/site-packages/langchain_classic/evaluation/exact_match/base.pyr   z"ExactMatchStringEvaluator.__init__   s(     	&"4,    returnc                      y)z&This evaluator does not require input.F r   s    r   requires_inputz(ExactMatchStringEvaluator.requires_input.   s     r   c                      y)z$This evaluator requires a reference.Tr   r   s    r   requires_referencez,ExactMatchStringEvaluator.requires_reference3   s     r   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                      y)zTGet the evaluation name.

        Returns:
            The evaluation name.
        exact_matchr   r   s    r   evaluation_namez)ExactMatchStringEvaluator.evaluation_nameA   s     r   r   r   kwargsc                J   | j                   r |j                         }|j                         }| j                  rh|j                  t        j                  ddt        j                              }|j                  t        j                  ddt        j                              }| j                  rh|j                  t        j                  ddt        j                              }|j                  t        j                  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""#--cmmBFDVDV.WXJ!++CMM"b&BTBT,UVI#--cmmBFMM.RSJ!++CMM"b&--,PQIZ94566r   )__name__
__module____qualname____doc__boolr   r   propertyr   r   listr'   r   r    r   dictr-   __classcell__)r   s   @r   r   r   	   s    & "#($- - !	-
 - -(    D   +DI + +    7 7 	7
 7 
7 7r   r   )r)   typingr   typing_extensionsr   #langchain_classic.evaluation.schemar   r   r   r   r   <module>r:      s      & ?\7 \7r   