+
    ʇi                        ^ 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	# )    )annotations)conv_sequences)is_nonesetupPandasc                    V^,          pRpWBV ,          ,          pWBV,          ,          pWBV,
          V,          ,          pVR,          # )           g      @ )pattern_lentext_lencommon_charstranspositionssims   &&&& o/Users/max/.openclaw/workspace/postharvest/merge_env/lib/python3.14/site-packages/rapidfuzz/distance/Jaro_py.py_jaro_calculate_similarityr   	   sG    qN
C+%%C(""C>)\99C9    c                Z    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                8    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   s   &&&& r   _jaro_common_char_filterr      s!     
$[L!
LCr   c                    \        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                  \        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   floatr   	enumeratemaxr   ranger   r   )r   r   r   r   r   r   r   s1_flagss2_flagsr   is1_chlowhijktrans_counts1_fs   &&$$              r   
similarityr0   =   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   )r0   r   r   r   r   s   &&$$r   normalized_similarityr4      s    : b	MMr   c                   \        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   r0   )r   r   r   r   cutoff_distancer   dists   &&$$   r   distancer8      sy    : Mr{{gbkkr]r]+3|c7IdPSVbPbO
R/
:C9D (D,@4JsJr   c                   \        WW#R7      # )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
r2   )r8   r3   s   &&$$r   normalized_distancer:      s    : BiKKr   )
__future__r   rapidfuzz._common_pyr   rapidfuzz._utilsr   r   r   r   r   r   r0   r4   r8   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   