
    k*iQ                        S SK Jr  S SKJr  S SKJrJr  S SKJr	  SSSS.S jr
SSSS.S	 jrSSSS.S
 jrSSSS.S jrg)    )annotations)conv_sequences)is_nonesetupPandas)Jaro_pyg?Nprefix_weight	processorscore_cutoffc               D   [        5         [        U 5      (       d  [        U5      (       a  gUb  U" U 5      n U" U5      nUc  SnUS:  d  US:  a  Sn[        U5      e[        X5      u  p[	        U 5      n[	        U5      n[        Xg5      nSn	[        US5      n
[        U
5       H  nX	   X   :w  a    O	U	S-  n	M     UnUS:  a!  X-  nUS:  a  SnO[        SX-
  US-
  -  5      n[        R                  " XUS9nUS:  a  XU-  SU-
  -  -  n[        US5      nX:  a  U$ S$ )	aO  
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                  a/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/rapidfuzz/distance/JaroWinkler_py.pyr   r   
   sH   L Mr{{gbkkr]r]smc1>oB#FBGEGE%GFWaJ::#! 
 %3+
 # #C**HZZ]M])^ _
//"/@
AC
Sy%s33#sm%3,1,    c                   [        U UUUUS9$ )ap  
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                   [        5         [        U 5      (       d  [        U5      (       a  gUb  U" U 5      n U" U5      nUb  US:  a  SOSU-
  n[        XX%S9nSU-
  nUb  Xt::  a  U$ S$ )aK  
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,      sz    L Mr{{gbkkr]r]+3|c7IdPSVbPbO
R=
WC9D (D,@4JsJr$   c                   [        U UUUUS9$ )al  
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$   