+
     h  c                  s    ^ RI Ht ^ RIHt ^ RIHtHt R tR tR t	R t
RR	R
R	/R ltRR	R
R	/R ltRR	R
R	/R ltRR	R
R	/R ltR	# )i    )annotations)conv_sequences)is_nonesetupPandasc                s    V^,          pRpWBV ,          ,          pWBV,          ,          pWBV,
          V,          ,          pVR,          # )i           g      @ )pattern_lentext_lencommon_charsZtranspositionssim   &&&& A/usr/lib64/python3.14/site-packages/rapidfuzz/distance/Jaro_py.py_jaro_calculate_similarityr   	   sG    qN
C+%%C(""C>)\99C9    c                sZ    V '       d	   V'       g   R# \        W\        W4      ^ 4      pW28  # )z;
filter matches below score_cutoff based on string lengths
F)r   min)r   r   score_cutoffr	   s   &&& r   _jaro_length_filterr      s)     h
$[C<VXY
ZCr   c                s8    V'       g   R# \        WV^ 4      pWC8  # )zQ
filter matches below score_cutoff based on string lengths and common characters
F)r   )r   r   r   r   r	   r
   r   _jaro_common_char_filterr      s!     
$[L!
LCr   c                s    \        V 4      p\        V4      p^ pW28  d*   V^,          ^,
          pW2V,           8  d   VRW$,            pM(V^,          ^,
          pW#V,           8  d   V RW4,            p WV3# )z:
find bounds and skip out of bound parts of the sequences
N)len)s1s2r   r   bounds   &&   r   _jaro_boundsr   (   s     b'K2wH EA!E)))k)*Bq 1$E))&h&'B5=r   	processorNr   c               s   \        4        \        V 4      '       g   \        V4      '       d   R# Ve   V! V 4      p V! V4      pV '       g   V'       g   R# Vf   ^ p\        W4      w  r\        V 4      p\        V4      p\	        WEV4      '       g   ^ # V^8X  d$   V^8X  d   \        V ^ ,          V^ ,          8H  4      # \        W4      w  rpR.V,          pR.V,          p^ p	\        V 4       Fz  w  r\        ^ W,
          4      p\        W,           V^,
          4      p\        W^,           4       F4  pW,          '       d   K  W,          V8X  g   K"  R;Wz&   W&   V	^,          p	 Kx  	  K|  	  \        WEW4      '       g   ^ # ^ ;pp\        V4       FZ  w  p
pV'       g   K  \        W4       F  pW,          '       g   K  V^,           p M	  W
,          VX,          8w  g   KQ  V^,          pK\  	  \        WEV	V4      # )a  
Calculates the jaro similarity

Parameters
----------
s1 : Sequence[Hashable]
    First string to compare.
s2 : Sequence[Hashable]
    Second string to compare.
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
r         ?FT)r   r   r   r   r   Zfloatr   Z	enumerateZmaxr   Zranger   r   )r   r   r   r   r   r   r   Zs1_flagsZs2_flagsr   ZiZs1_chZlowZhiZjZkZtrans_countZs1_fs   &&$$              r   
similarityr   =   s   : Mr{{gbkkr]r]bB#FBb'K2wH {lCCaHMRUbe^$$ (MBEw$Hw!H LbM!QYHqL)sF#A;;25E>,00hk!	 $ " $K<VV AX&441';;AA ( u1~q  ' &k\;WWr   c                   \        WW#R7      # )a  
Calculates the normalized jaro similarity

Parameters
----------
s1 : Sequence[Hashable]
    First string to compare.
s2 : Sequence[Hashable]
    Second string to compare.
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
r   r   )r   r   r   r   r      &&$$r   normalized_similarityr      s    : b	MMr   c               s    \        4        \        V 4      '       g   \        V4      '       d   R# Ve   V! V 4      p V! V4      pVe   VR8  d   RMRV,
          p\        WVR7      pRV,
          pVe   Wc8:  d   V# R# )a}  
Calculates the jaro distance

Parameters
----------
s1 : Sequence[Hashable]
    First string to compare.
s2 : Sequence[Hashable]
    Second string to compare.
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
r   N)r   )r   r   r   )r   r   r   r   Zcutoff_distancer	   Zdists   &&$$   r   distancer      sy    : Mr{{gbkkr]r]+3|c7IdPSVbPbO
R/
:C9D (D,@4JsJr   c               r   )a  
Calculates the normalized jaro distance

Parameters
----------
s1 : Sequence[Hashable]
    First string to compare.
s2 : Sequence[Hashable]
    Second string to compare.
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
r   )r   r   r   r   normalized_distancer       s    : BiKKr   )Z
__future__r    Zrapidfuzz._common_pyr   Zrapidfuzz._utilsr   r   r   r   r   r   r   r   r   r    r   r   r   <module>r!      s    # / 1*WX 	WX
 WXtN 	N
 N@(K 	(K
 (KVL 	L
 Lr   