o
    wi                     @   s(   d dl mZmZ d	ddZd
ddZdS )   )levenshtein	fast_compc                 c   s0    |D ]}t | ||d}|dkr||fV  qdS )a2  Compute the Levenshtein distance between the sequence `seq1` and the series
	of	sequences `seqs`.
	
		`seq1`: the reference sequence
		`seqs`: a series of sequences (can be a generator)
		`max_dist`: if provided and > 0, only the sequences which distance from
		the reference sequence is lower or equal to this value will be returned.
	
	The return value is a series of pairs (distance, sequence).
	
	The sequence objects in `seqs` are expected to be of the same kind than
	the reference sequence in the C implementation; the same holds true for
	`ifast_comp`.
	)max_distr   N)r   )seq1seqsr   seq2dist r
   P/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/distance/_iterators.pyilevenshtein   s   
r   Fc                 c   s.    |D ]}t | ||}|dkr||fV  qdS )au  Return an iterator over all the sequences in `seqs` which distance from
	`seq1` is lower or equal to 2. The sequences which distance from the
	reference sequence is higher than that are dropped.
	
		`seq1`: the reference sequence.
		`seqs`: a series of sequences (can be a generator)
		`transpositions` has the same sense than in `fast_comp`.
	
	The return value is a series of pairs (distance, sequence).
	
	You might want to call `sorted()` on the iterator to get the results in a
	significant order:
	
		>>> g = ifast_comp("foo", ["fo", "bar", "foob", "foo", "foobaz"])
		>>> sorted(g)
		[(0, 'foo'), (1, 'fo'), (1, 'foob')]
	r   N)r   )r   r   transpositionsr   r	   r
   r
   r   
ifast_comp   s   
r   N)r   )F)
_pyimportsr   r   r   r   r
   r
   r
   r   <module>   s    
