+
    ʇik                    |    ^ RI Ht ^ RIHt ^ RIHtH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 '       g   \        V4      # ^\        V 4      ,          ^,
          p^ p^ p^ p\        V 4      p^\        V 4      ^,
          ,          p/ pVP                  p	^p
V  F  pV	! V^ 4      V
,          W&   V
^,          p
K   	  V F  pV	! V^ 4      pV( V,          ^,          V,          pW,          V,           V,          V,          V,          pWN,          pW4V,          ( ,          pWB,          pWoV,          ^ 8g  ,          pVVV,          ^ 8g  ,          pV^,          ^,          pV^,          pVWO,          ( ,          pW,          pTpK  	  V# )   )lenget)s1s2VPVND0PM_j_oldcurrDistmaskblock	block_getxch1ch2PM_jTRHPHNs   &&               n/Users/max/.openclaw/workspace/postharvest/merge_env/lib/python3.14/site-packages/rapidfuzz/distance/OSA_py.py_osa_distance_hyrroe2003r   	   sF   2w
s2w,!	B	
B	
BH2wHR1DE		I	AsA&*
	a  a t|!X-	R2%-2W G*_W 	$Y1$$R$Y1$$ Ag]1WBG*_W) , O    	processorNscore_cutoffc                   Ve   V! V 4      p V! V4      p\        W4      w  r\        W4      pVe   WC8:  d   V# V^,           # )a?  
Calculates the optimal string alignment (OSA) 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 : int, optional
    Maximum distance between s1 and s2, that is
    considered as a result. If the distance is bigger than score_cutoff,
    score_cutoff + 1 is returned instead. Default is None, which deactivates
    this behaviour.

Returns
-------
distance : int
    distance between s1 and s2

Examples
--------
Find the OSA distance between two strings:

>>> from rapidfuzz.distance import OSA
>>> OSA.distance("CA", "AC")
2
>>> OSA.distance("CA", "ABC")
3
)r   r   )r   r   r   r    dists   &&$$ r   distancer#   4   sN    P r]r]B#FB#B+D (D,@4W|VWGWWr   c                   Ve   V! V 4      p V! V4      p\        W4      w  r\        \        V 4      \        V4      4      p\        W4      pWE,
          pVe   Wc8  d   V# ^ # )a  
Calculates the optimal string alignment (OSA) similarity in the range [max, 0].

This is calculated as ``max(len1, len2) - 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 : int, optional
    Maximum distance between s1 and s2, that is
    considered as a result. If the similarity is smaller than score_cutoff,
    0 is returned instead. Default is None, which deactivates
    this behaviour.

Returns
-------
similarity : int
    similarity between s1 and s2
)r   maxr	   r#   )r   r   r   r    maximumr"   sims   &&$$   r   
similarityr(   e   sc    @ r]r]B#FB#b'3r7#GBD
.C'3+>3FQFr   c               2   \        4        \        V 4      '       g   \        V4      '       d   R# Ve   V! V 4      p V! V4      p\        W4      w  r\        \	        V 4      \	        V4      4      p\        W4      pV'       d	   WT,          M^ pVe   Wc8:  d   V# ^# )a  
Calculates a normalized optimal string alignment (OSA) similarity in the range [1, 0].

This is calculated as ``distance / max(len1, len2)``.

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 norm_dist > score_cutoff 1.0 is returned instead. Default is 1.0,
    which deactivates this behaviour.

Returns
-------
norm_dist : float
    normalized distance between s1 and s2 as a float between 0 and 1.0
      ?)r   r   r   r%   r	   r#   )r   r   r   r    r&   r"   	norm_dists   &&$$   r   normalized_distancer,      s    > Mr{{gbkkr]r]B#FB#b'3r7#GBD")qI%-1J9RQRRr   c                   \        4        \        V 4      '       g   \        V4      '       d   R# Ve   V! V 4      p V! V4      p\        W4      w  r\        W4      pRV,
          pVe   WS8  d   V# ^ # )a  
Calculates a normalized optimal string alignment (OSA) similarity in the range [0, 1].

This is calculated as ``1 - normalized_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 norm_sim < score_cutoff 0 is returned instead. Default is 0,
    which deactivates this behaviour.

Returns
-------
norm_sim : float
    normalized similarity between s1 and s2 as a float between 0 and 1.0
g        r*   )r   r   r   r,   )r   r   r   r    r+   norm_sims   &&$$  r   normalized_similarityr/      si    > Mr{{gbkkr]r]B#FB#B+IYH$,0H8PqPr   )
__future__r   rapidfuzz._common_pyr   rapidfuzz._utilsr   r   r   r#   r(   r,   r/    r   r   <module>r4      s    # / 1(V.X 	.X
 .Xb(G 	(G
 (GV+S 	+S
 +S\*Q 	*Q
 *Qr   