1616
1717__author__ : str  =  "Max Bachmann" 
1818__license__ : str  =  "GPL" 
19- __version__ : str  =  "0.22 .0" 
19+ __version__ : str  =  "0.23 .0" 
2020
2121import  rapidfuzz .distance .Levenshtein  as  _Levenshtein 
2222import  rapidfuzz .distance .Indel  as  _Indel 
@@ -166,7 +166,7 @@ def ratio(s1, s2, *, processor=None, score_cutoff=None):
166166    )
167167
168168
169- def  hamming (s1 , s2 , * , processor = None , score_cutoff = None ):
169+ def  hamming (s1 , s2 , * , pad = True ,  processor = None , score_cutoff = None ):
170170    """ 
171171    Calculates the Hamming distance between two strings. 
172172    The hamming distance is defined as the number of positions 
@@ -179,6 +179,10 @@ def hamming(s1, s2, *, processor=None, score_cutoff=None):
179179        First string to compare. 
180180    s2 : Sequence[Hashable] 
181181        Second string to compare. 
182+     pad : bool, optional 
183+        should strings be padded if there is a length difference. 
184+        If pad is False and strings have a different length 
185+        a ValueError is thrown instead. Default is True. 
182186    processor: callable, optional 
183187        Optional callable that is used to preprocess the strings before 
184188        comparing them. Default is None, which deactivates this behaviour. 
@@ -198,7 +202,7 @@ def hamming(s1, s2, *, processor=None, score_cutoff=None):
198202    ValueError 
199203        If s1 and s2 have a different length 
200204    """ 
201-     return  _Hamming .distance (s1 , s2 , processor = processor , score_cutoff = score_cutoff )
205+     return  _Hamming .distance (s1 , s2 , pad = pad ,  processor = processor , score_cutoff = score_cutoff )
202206
203207
204208def  jaro (s1 , s2 , * , processor = None , score_cutoff = None ) ->  float :
0 commit comments