Ë
    ´ŒjX	  ã                   ó:   — d dl Z d dlmZ d dlmZ  G d„ de«      Zy)é    N)ÚAny)ÚStringEvaluatorc                   ó¨   ‡ — e Zd ZdZddœ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dedededefd„Zˆ xZS )ÚRegexMatchStringEvaluatora  Compute a regex match between the prediction and the reference.

    Examples
    ----------
    >>> evaluator = RegexMatchStringEvaluator(flags=re.IGNORECASE)
    >>> evaluator.evaluate_strings(
            prediction="Mindy is the CTO",
            reference="^mindy.*cto$",
        )  # This will return {'score': 1.0} due to the IGNORECASE flag

    >>> evaluator = RegexMatchStringEvaluator()
    >>> evaluator.evaluate_strings(
            prediction="Mindy is the CTO",
            reference="^Mike.*CEO$",
        )  # This will return {'score': 0.0}

    >>> evaluator.evaluate_strings(
            prediction="Mindy is the CTO",
            reference="^Mike.*CEO$|^Mindy.*CTO$",
        )  # This will return {'score': 1.0} as the prediction matches the second pattern in the union
    r   ©Úflagsr   Úkwargsc                ó0   •— t         ‰| �  «        || _        y )N)ÚsuperÚ__init__r   )Úselfr   r	   Ú	__class__s      €úo/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/langchain/evaluation/regex_match/base.pyr   z"RegexMatchStringEvaluator.__init__   s   ø€ Ü‰ÑÔØˆ�
ó    Úreturnc                  ó   — y)z8
        This evaluator does not require input.
        F© ©r   s    r   Úrequires_inputz(RegexMatchStringEvaluator.requires_input"   s   € ð
 r   c                  ó   — y)z6
        This evaluator requires a reference.
        Tr   r   s    r   Úrequires_referencez,RegexMatchStringEvaluator.requires_reference)   s   € ð
 r   c                 ó
   — ddgS )z^
        Get the input keys.

        Returns:
            List[str]: The input keys.
        Ú	referenceÚ
predictionr   r   s    r   Ú
input_keysz$RegexMatchStringEvaluator.input_keys0   s   € ð ˜\Ð*Ð*r   c                  ó   — y)zb
        Get the evaluation name.

        Returns:
            str: The evaluation name.
        Úregex_matchr   r   s    r   Úevaluation_namez)RegexMatchStringEvaluator.evaluation_name:   s   € ð r   r   r   c                ór   — t        j                  ||| j                  ¬«      }dt        t	        |«      «      iS )a7  
        Evaluate the regex match between the prediction and the reference.

        Args:
            prediction (str): The prediction string.
            reference (Optional[str], optional): The reference regex pattern.

        Returns:
            dict: The evaluation results containing the score.
        r   Úscore)ÚreÚmatchr   ÚintÚbool)r   r   r   r	   r"   s        r   Ú_evaluate_stringsz+RegexMatchStringEvaluator._evaluate_stringsD   s.   € ô" —‘˜ J°d·j±jÔAˆØœœT %›[Ó)Ð*Ð*r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r#   r   r   Úpropertyr$   r   r   ÚlistÚstrr   r   Údictr%   Ú__classcell__)r   s   @r   r   r      s½   ø„ ñð, ()ò  ð °Cõ ð ð ò ó ðð ð Dò ó ðð ð+˜D ™Iò +ó ð+ð ð ò ó ðð+ð ð+ð ð	+ð
 ð+ð 
÷+r   r   )r!   Útypingr   Úlangchain.evaluation.schemar   r   r   r   r   Ú<module>r1      s   ðÛ 	Ý å 7ôO+ õ O+r   