o
    °#¨eã  ã                   @   s&   d dl T d dlmZ G dd„ dƒZdS )é    )Ú*)Úwarnc                   @   sr   e Zd ZdZdd„ Zddd„Zd	d
„ Zdd„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )ÚStringMatcherz<A SequenceMatcher-like class built on the top of Levenshteinc                 C   s"   d  | _ | _d  | _ | _| _d S ©N)Ú_ratioÚ	_distanceÚ_opcodesÚ_editopsÚ_matching_blocks©Úself© r   úH/var/www/myenv/lib/python3.10/site-packages/Levenshtein/StringMatcher.pyÚ_reset_cache   s   zStringMatcher._reset_cacheNÚ Fc                 C   s2   |rt dƒ |rt dƒ ||| _| _|  ¡  d S )Nz*isjunk NOT implemented, it will be ignoredz,autojunk NOT implemented, it will be ignored)r   Ú_str1Ú_str2r   )r   ÚisjunkÚseq1Úseq2Úautojunkr   r   r   Ú__init__   s   zStringMatcher.__init__c                 C   s   ||| _ | _|  ¡  d S r   )r   r   r   )r   r   r   r   r   r   Úset_seqs   s   zStringMatcher.set_seqsc                 C   ó   || _ |  ¡  d S r   )r   r   )r   r   r   r   r   Úset_seq1   ó   zStringMatcher.set_seq1c                 C   r   r   )r   r   )r   r   r   r   r   Úset_seq2   r   zStringMatcher.set_seq2c                 C   ó<   | j s| jrt| j| j| jƒ| _ | j S t| j| jƒ| _ | j S r   )r   r	   Úopcodesr   r   r   r   r   r   Úget_opcodes    ó   ÿzStringMatcher.get_opcodesc                 C   r   r   )r	   r   Úeditopsr   r   r   r   r   r   Úget_editops(   r    zStringMatcher.get_editopsc                 C   s"   | j st|  ¡ | j| jƒ| _ | j S r   )r
   Úmatching_blocksr   r   r   r   r   r   r   Úget_matching_blocks0   s
   ÿz!StringMatcher.get_matching_blocksc                 C   ó   | j st| j| jƒ| _ | j S r   ©r   Úratior   r   r   r   r   r   r'   7   ó   zStringMatcher.ratioc                 C   r%   r   r&   r   r   r   r   Úquick_ratio<   s   zStringMatcher.quick_ratioc                 C   s,   t | jƒt | jƒ}}dt||ƒ ||  S )Ng       @)Úlenr   r   Úmin)r   Úlen1Úlen2r   r   r   Úreal_quick_ratioB   s   zStringMatcher.real_quick_ratioc                 C   r%   r   )r   Údistancer   r   r   r   r   r   r/   F   r(   zStringMatcher.distance)Nr   r   F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r"   r$   r'   r)   r.   r/   r   r   r   r   r      s    
r   N)ÚLevenshteinÚwarningsr   r   r   r   r   r   Ú<module>   s    