Ë
    ¡[;jQ  ã                  óx   — d dl mZ d dlmZ d dlmZmZ d dlmZ	 ddddœd„Z
ddddœd	„Zddddœd
„Zddddœd„Zy)é    )Úannotations)Úconv_sequences)Úis_noneÚsetupPandas)ÚJaro_pygš™™™™™¹?N©Úprefix_weightÚ	processorÚscore_cutoffc               ó2  — t        «        t        | «      st        |«      ry|� || «      }  ||«      }|€d}|dkD  s|dk  rd}t        |«      ‚t        | |«      \  } }t	        | «      }t	        |«      }t        ||«      }d}	t        |d«      }
t        |
«      D ]  }| |	   ||	   k7  r n|	dz  }	Œ |}|dkD  r"|	|z  }|dk\  rd}nt        d||z
  |dz
  z  «      }t        j                  | ||¬«      }|dkD  r||	|z  d|z
  z  z  }t        |d«      }||k\  r|S dS )	a·  
    Calculates the jaro winkler similarity

    Parameters
    ----------
    s1 : Sequence[Hashable]
        First string to compare.
    s2 : Sequence[Hashable]
        Second string to compare.
    prefix_weight : float, optional
        Weight used for the common prefix of the two strings.
        Has to be between 0 and 0.25. Default is 0.1.
    processor: callable, optional
        Optional callable that is used to preprocess the strings before
        comparing them. Default is None, which deactivates this behaviour.
    score_cutoff : float, optional
        Optional argument for a score threshold as a float between 0 and 1.0.
        For ratio < score_cutoff 0 is returned instead. Default is None,
        which deactivates this behaviour.

    Returns
    -------
    similarity : float
        similarity between s1 and s2 as a float between 0 and 1.0

    Raises
    ------
    ValueError
        If prefix_weight is invalid
    g        r   ç      ð?z.prefix_weight has to be in the range 0.0 - 1.0é   é   gffffffæ?)r   )
r   r   Ú
ValueErrorr   ÚlenÚminÚrangeÚmaxÚJaroÚ
similarity)Ús1Ús2r	   r
   r   ÚmsgÚP_lenÚT_lenÚmin_lenÚprefixÚ
max_prefixÚ_Újaro_score_cutoffÚ
prefix_simÚSims                  újG:\00. PROJECTS\API\Inventory\templateJSON\kerjaOCR\Lib\site-packages\rapidfuzz/distance/JaroWinkler_py.pyr   r   
   sY  € ôL „MÜˆr„{”g˜b”kØàÐÙ�r‹]ˆÙ�r‹]ˆàÐØˆà�sÒ˜m¨cÒ1Ø>ˆÜ˜‹oÐä˜B Ó#�F€BˆÜ�‹G€EÜ�‹G€EÜ�%˜Ó€GØ€FÜ�W˜a“€Jä�:ÖˆØˆf‰:˜˜F™Ò#ÙØ�!‰‰ð ð
 %ÐØ˜3ÒØ˜mÑ+ˆ
à˜ÒØ #Ñä # C¨*Ð7HÑ*HÈZÐZ]ÑM]Ñ)^Ó _Ðä
�/‰/˜"˜bÐ/@Ô
A€CØ
ˆS‚yØˆv˜Ñ%¨¨s©Ñ3Ñ3ˆÜ�#�s‹mˆà˜Ò%ˆ3Ð,¨1Ð,ó    c               ó"   — t        | ||||¬«      S )aØ  
    Calculates the normalized jaro winkler similarity

    Parameters
    ----------
    s1 : Sequence[Hashable]
        First string to compare.
    s2 : Sequence[Hashable]
        Second string to compare.
    prefix_weight : float, optional
        Weight used for the common prefix of the two strings.
        Has to be between 0 and 0.25. Default is 0.1.
    processor: callable, optional
        Optional callable that is used to preprocess the strings before
        comparing them. Default is None, which deactivates this behaviour.
    score_cutoff : float, optional
        Optional argument for a score threshold as a float between 0 and 1.0.
        For ratio < score_cutoff 0 is returned instead. Default is None,
        which deactivates this behaviour.

    Returns
    -------
    normalized similarity : float
        normalized similarity between s1 and s2 as a float between 0 and 1.0

    Raises
    ------
    ValueError
        If prefix_weight is invalid
    r   )r   ©r   r   r	   r
   r   s        r#   Únormalized_similarityr'   \   s!   € ôL Ø
Ø
Ø#ØØ!ôð r$   c               óÂ   — t        «        t        | «      st        |«      ry|� || «      }  ||«      }|�|dkD  rdnd|z
  }t        | |||¬«      }d|z
  }|�||k  r|S dS )a³  
    Calculates the jaro winkler distance

    Parameters
    ----------
    s1 : Sequence[Hashable]
        First string to compare.
    s2 : Sequence[Hashable]
        Second string to compare.
    prefix_weight : float, optional
        Weight used for the common prefix of the two strings.
        Has to be between 0 and 0.25. Default is 0.1.
    processor: callable, optional
        Optional callable that is used to preprocess the strings before
        comparing them. Default is None, which deactivates this behaviour.
    score_cutoff : float, optional
        Optional argument for a score threshold as a float between 0 and 1.0.
        For ratio < score_cutoff 0 is returned instead. Default is None,
        which deactivates this behaviour.

    Returns
    -------
    distance : float
        distance between s1 and s2 as a float between 1.0 and 0.0

    Raises
    ------
    ValueError
        If prefix_weight is invalid
    r   N)r	   r   )r   r   r   )r   r   r	   r
   r   Úcutoff_distanceÚsimÚdists           r#   Údistancer,   ‹   s|   € ôL „MÜˆr„{”g˜b”kØàÐÙ�r‹]ˆÙ�r‹]ˆà+Ð3°|ÀcÒ7I‘dÐPSÐVbÑPb€OÜ
�R˜¨=ÀÔ
W€CØ�‰9€DØ Ð(¨D°LÒ,@ˆ4ÐJÀsÐJr$   c               ó"   — t        | ||||¬«      S )aÔ  
    Calculates the normalized jaro winkler distance

    Parameters
    ----------
    s1 : Sequence[Hashable]
        First string to compare.
    s2 : Sequence[Hashable]
        Second string to compare.
    prefix_weight : float, optional
        Weight used for the common prefix of the two strings.
        Has to be between 0 and 0.25. Default is 0.1.
    processor: callable, optional
        Optional callable that is used to preprocess the strings before
        comparing them. Default is None, which deactivates this behaviour.
    score_cutoff : float, optional
        Optional argument for a score threshold as a float between 0 and 1.0.
        For ratio < score_cutoff 0 is returned instead. Default is None,
        which deactivates this behaviour.

    Returns
    -------
    normalized distance : float
        normalized distance between s1 and s2 as a float between 1.0 and 0.0

    Raises
    ------
    ValueError
        If prefix_weight is invalid
    r   )r,   r&   s        r#   Únormalized_distancer.   ¿   s!   € ôL Ø
Ø
Ø#ØØ!ôð r$   )Ú
__future__r   Úrapidfuzz._common_pyr   Úrapidfuzz._utilsr   r   Úrapidfuzz.distancer   r   r   r'   r,   r.   © r$   r#   Ú<module>r4      sX   ðõ #å /ß 1Ý .ð ØØôO-ðl ØØô,ðf ØØô1Kðp ØØõ,r$   