§
    ’©ºj%   ã                   ó  — d dl mZ d dlmZmZmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ  G d„ de¦  «        Z  G d„ de	¦  «        Z! G d„ de¦  «        Z" G d„ de¦  «        Z# G d„ de¦  «        Z$ G d„ de¦  «        Z% G d„ de¦  «        Z& G d„ de¦  «        Z' G d „ d!e¦  «        Z( G d"„ d#e¦  «        Z) G d$„ d%e¦  «        Z* G d&„ d'e¦  «        Z+d(S ))é    )ÚSequence)ÚAnyÚLiteralÚOptional)Ú	BLEUScore)ÚCharErrorRate)Ú	CHRFScore)ÚExtendedEditDistance)ÚMatchErrorRate)Ú
Perplexity)ÚSacreBLEUScore)ÚSQuAD)ÚTranslationEditRate)ÚWordErrorRate)ÚWordInfoLost)ÚWordInfoPreserved)Ú_deprecated_root_import_classc                   óX   ‡ — e Zd ZdZ	 	 	 ddededeee                  de	d	df
ˆ fd
„Z
ˆ xZS )Ú
_BLEUScorezâWrapper for deprecated import.

    >>> preds = ['the cat is on the mat']
    >>> target = [['there is a cat on the mat', 'a cat is on the mat']]
    >>> bleu = _BLEUScore()
    >>> bleu(preds, target)
    tensor(0.7598)

    é   FNÚn_gramÚsmoothÚweightsÚkwargsÚreturnc                 ób   •— t          dd¦  «          t          ¦   «         j        d|||dœ|¤Ž d S )Nr   Útext)r   r   r   © ©r   ÚsuperÚ__init__)Úselfr   r   r   r   Ú	__class__s        €úm/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/torchmetrics/text/_deprecated.pyr!   z_BLEUScore.__init__   sA   ø€ õ 	& k°6Ñ:Ô:Ð:Ø�‰ŒÔÐQ ¨v¸wÐQÐQÈ&ÐQÐQÐQÐQÐQó    )r   FN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚintÚboolr   r   Úfloatr   r!   Ú__classcell__©r#   s   @r$   r   r      s    ø€ € € € € ðð ð ØØ-1ð	Rð RàðRð ðRð ˜( 5œ/Ô*ð	Rð
 ðRð 
ðRð Rð Rð Rð Rð Rð Rð Rð Rð Rr%   r   c                   ó,   ‡ — e Zd ZdZdeddfˆ fd„Zˆ xZS )Ú_CharErrorRatezüWrapper for deprecated import.

    >>> preds = ["this is the prediction", "there is an other sample"]
    >>> target = ["this is the reference", "there is another one"]
    >>> cer = _CharErrorRate()
    >>> cer(preds, target)
    tensor(0.3415)

    r   r   Nc                 óZ   •— t          dd¦  «          t          ¦   «         j        di |¤Ž d S )Nr   r   r   r   ©r"   r   r#   s     €r$   r!   z_CharErrorRate.__init__4   s8   ø€ õ 	& o°vÑ>Ô>Ð>Ø�‰ŒÔÐ"Ð"˜6Ð"Ð"Ð"Ð"Ð"r%   ©r&   r'   r(   r)   r   r!   r-   r.   s   @r$   r0   r0   )   óY   ø€ € € € € ðð ð#àð#ð 
ð#ð #ð #ð #ð #ð #ð #ð #ð #ð #r%   r0   c                   óR   ‡ — e Zd ZdZ	 	 	 	 	 	 ddededed	ed
edededdfˆ fd„Zˆ xZ	S )Ú
_CHRFScorezâWrapper for deprecated import.

    >>> preds = ['the cat is on the mat']
    >>> target = [['there is a cat on the mat', 'a cat is on the mat']]
    >>> chrf = _CHRFScore()
    >>> chrf(preds, target)
    tensor(0.8640)

    é   é   ç       @FÚn_char_orderÚn_word_orderÚbetaÚ	lowercaseÚ
whitespaceÚreturn_sentence_level_scorer   r   Nc           
      óh   •— t          dd¦  «          t          ¦   «         j        d||||||dœ|¤Ž d S )Nr	   r   )r:   r;   r<   r=   r>   r?   r   r   )	r"   r:   r;   r<   r=   r>   r?   r   r#   s	           €r$   r!   z_CHRFScore.__init__G   s`   ø€ õ 	& k°6Ñ:Ô:Ð:Ø�‰ŒÔð 	
Ø%Ø%ØØØ!Ø(Cð	
ð 	
ð ð	
ð 	
ð 	
ð 	
ð 	
r%   )r7   r8   r9   FFF)
r&   r'   r(   r)   r*   r,   r+   r   r!   r-   r.   s   @r$   r6   r6   <   s®   ø€ € € € € ðð ð ØØØØ Ø,1ð
ð 
àð
ð ð
ð ð	
ð
 ð
ð ð
ð &*ð
ð ð
ð 
ð
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
r%   r6   c                   ó^   ‡ — e Zd ZdZ	 	 	 	 	 	 dded	         d
ededededededdfˆ fd„Zˆ xZ	S )Ú_ExtendedEditDistancea  Wrapper for deprecated import.

    >>> preds = ["this is the prediction", "here is an other sample"]
    >>> target = ["this is the reference", "here is another one"]
    >>> eed = _ExtendedEditDistance()
    >>> eed(preds=preds, target=target)
    tensor(0.3078)

    ÚenFr9   ç333333Ó?çš™™™™™É?ç      ð?Úlanguage)rC   Újar?   ÚalphaÚrhoÚdeletionÚ	insertionr   r   Nc           
      óh   •— t          dd¦  «          t          ¦   «         j        d||||||dœ|¤Ž d S )Nr
   r   )rG   r?   rI   rJ   rK   rL   r   r   )	r"   rG   r?   rI   rJ   rK   rL   r   r#   s	           €r$   r!   z_ExtendedEditDistance.__init__h   sa   ø€ õ 	&Ð&<¸fÑEÔEÐEØ�‰ŒÔð 	
ØØ(CØØØØð	
ð 	
ð ð	
ð 	
ð 	
ð 	
ð 	
r%   )rC   Fr9   rD   rE   rF   )
r&   r'   r(   r)   r   r+   r,   r   r!   r-   r.   s   @r$   rB   rB   ]   s³   ø€ € € € € ðð ð )-Ø,1ØØØØð
ð 
à˜*Ô%ð
ð &*ð
ð ð	
ð
 ð
ð ð
ð ð
ð ð
ð 
ð
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
r%   rB   c                   ó,   ‡ — e Zd ZdZdeddfˆ fd„Zˆ xZS )Ú_MatchErrorRatezýWrapper for deprecated import.

    >>> preds = ["this is the prediction", "there is an other sample"]
    >>> target = ["this is the reference", "there is another one"]
    >>> mer = _MatchErrorRate()
    >>> mer(preds, target)
    tensor(0.4444)

    r   r   Nc                 óZ   •— t          dd¦  «          t          ¦   «         j        di |¤Ž d S )Nr   r   r   r   r2   s     €r$   r!   z_MatchErrorRate.__init__‰   s9   ø€ õ 	&Ð&6¸Ñ?Ô?Ð?Ø�‰ŒÔÐ"Ð"˜6Ð"Ð"Ð"Ð"Ð"r%   r3   r.   s   @r$   rO   rO   ~   r4   r%   rO   c                   ó@   ‡ — e Zd ZdZ	 ddee         deddfˆ fd„Zˆ xZS )Ú_Perplexitya	  Wrapper for deprecated import.

    >>> from torch import rand, randint
    >>> preds = rand(2, 8, 5)
    >>> target = randint(5, (2, 8))
    >>> target[0, 6:] = -100
    >>> perp = _Perplexity(ignore_index=-100)
    >>> perp(preds, target)
    tensor(5.8540)

    NÚignore_indexr   r   c                 ó^   •— t          dd¦  «          t          ¦   «         j        dd|i|¤Ž d S )Nr   r   rS   r   r   )r"   rS   r   r#   s      €r$   r!   z_Perplexity.__init__ž   s=   ø€ õ
 	& l°FÑ;Ô;Ð;Ø�‰ŒÔÐ=Ð= lÐ=°fÐ=Ð=Ð=Ð=Ð=r%   )N)	r&   r'   r(   r)   r   r*   r   r!   r-   r.   s   @r$   rR   rR   ‘   sq   ø€ € € € € ð
ð 
ð '+ð>ð >à˜s”mð>ð ð>ð 
ð	>ð >ð >ð >ð >ð >ð >ð >ð >ð >r%   rR   c                   óp   ‡ — e Zd ZdZ	 	 	 	 	 ddededed	         d
edeee	                  de
ddfˆ fd„Zˆ xZS )Ú_SacreBLEUScorezóWrapper for deprecated import.

    >>> preds = ['the cat is on the mat']
    >>> target = [['there is a cat on the mat', 'a cat is on the mat']]
    >>> sacre_bleu = _SacreBLEUScore()
    >>> sacre_bleu(preds, target)
    tensor(0.7598)

    r   FÚ13aNr   r   Útokenize)ÚnonerW   ÚzhÚintlÚcharr=   r   r   r   c           	      óf   •— t          dd¦  «          t          ¦   «         j        d|||||dœ|¤Ž d S )Nr   r   )r   r   rX   r=   r   r   r   )r"   r   r   rX   r=   r   r   r#   s          €r$   r!   z_SacreBLEUScore.__init__²   sY   ø€ õ 	&Ð&6¸Ñ?Ô?Ð?Ø�‰ŒÔð 	
Ø &°8ÀyÐZað	
ð 	
Øekð	
ð 	
ð 	
ð 	
ð 	
r%   )r   FrW   FN)r&   r'   r(   r)   r*   r+   r   r   r   r,   r   r!   r-   r.   s   @r$   rV   rV   §   s°   ø€ € € € € ðð ð ØØAFØØ-1ð
ð 
àð
ð ð
ð Ð=Ô>ð	
ð
 ð
ð ˜( 5œ/Ô*ð
ð ð
ð 
ð
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
r%   rV   c                   ó,   ‡ — e Zd ZdZdeddfˆ fd„Zˆ xZS )Ú_SQuADaL  Wrapper for deprecated import.

    >>> preds = [{"prediction_text": "1976", "id": "56e10a3be3433e1400422b22"}]
    >>> target = [{"answers": {"answer_start": [97], "text": ["1976"]}, "id": "56e10a3be3433e1400422b22"}]
    >>> squad = _SQuAD()
    >>> squad(preds, target)
    {'exact_match': tensor(100.), 'f1': tensor(100.)}

    r   r   Nc                 óZ   •— t          dd¦  «          t          ¦   «         j        di |¤Ž d S )Nr   r   r   r   r2   s     €r$   r!   z_SQuAD.__init__Ì   s6   ø€ Ý% g¨vÑ6Ô6Ð6Ø�‰ŒÔÐ"Ð"˜6Ð"Ð"Ð"Ð"Ð"r%   r3   r.   s   @r$   r_   r_   Á   óU   ø€ € € € € ðð ð# ð #¨ð #ð #ð #ð #ð #ð #ð #ð #ð #ð #r%   r_   c                   óL   ‡ — e Zd ZdZ	 	 	 	 	 ddededededed	ed
dfˆ fd„Zˆ xZS )Ú_TranslationEditRatezêWrapper for deprecated import.

    >>> preds = ['the cat is on the mat']
    >>> target = [['there is a cat on the mat', 'a cat is on the mat']]
    >>> ter = _TranslationEditRate()
    >>> ter(preds, target)
    tensor(0.1538)

    FTÚ	normalizeÚno_punctuationr=   Úasian_supportr?   r   r   Nc           	      óf   •— t          dd¦  «          t          ¦   «         j        d|||||dœ|¤Ž d S )Nr   r   )rd   re   r=   rf   r?   r   r   )r"   rd   re   r=   rf   r?   r   r#   s          €r$   r!   z_TranslationEditRate.__init__Ü   s^   ø€ õ 	&Ð&;¸VÑDÔDÐDØ�‰ŒÔð 	
ØØ)ØØ'Ø(Cð	
ð 	
ð ð	
ð 	
ð 	
ð 	
ð 	
r%   )FFTFF)r&   r'   r(   r)   r+   r   r!   r-   r.   s   @r$   rc   rc   Ñ   s¡   ø€ € € € € ðð ð  Ø$ØØ#Ø,1ð
ð 
àð
ð ð
ð ð	
ð
 ð
ð &*ð
ð ð
ð 
ð
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
r%   rc   c                   ó,   ‡ — e Zd ZdZdeddfˆ fd„Zˆ xZS )Ú_WordErrorRatezüWrapper for deprecated import.

    >>> preds = ["this is the prediction", "there is an other sample"]
    >>> target = ["this is the reference", "there is another one"]
    >>> wer = _WordErrorRate()
    >>> wer(preds, target)
    tensor(0.5000)

    r   r   Nc                 óZ   •— t          dd¦  «          t          ¦   «         j        di |¤Ž d S )Nr   r   r   r   r2   s     €r$   r!   z_WordErrorRate.__init__û   s6   ø€ Ý% o°vÑ>Ô>Ð>Ø�‰ŒÔÐ"Ð"˜6Ð"Ð"Ð"Ð"Ð"r%   r3   r.   s   @r$   ri   ri   ð   ra   r%   ri   c                   ó,   ‡ — e Zd ZdZdeddfˆ fd„Zˆ xZS )Ú_WordInfoLostzûWrapper for deprecated import.

    >>> preds = ["this is the prediction", "there is an other sample"]
    >>> target = ["this is the reference", "there is another one"]
    >>> wil = _WordInfoLost()
    >>> wil(preds, target)
    tensor(0.6528)

    r   r   Nc                 óZ   •— t          dd¦  «          t          ¦   «         j        di |¤Ž d S )Nr   r   r   r   r2   s     €r$   r!   z_WordInfoLost.__init__  s6   ø€ Ý% n°fÑ=Ô=Ð=Ø�‰ŒÔÐ"Ð"˜6Ð"Ð"Ð"Ð"Ð"r%   r3   r.   s   @r$   rl   rl      ra   r%   rl   c                   ó,   ‡ — e Zd ZdZdeddfˆ fd„Zˆ xZS )Ú_WordInfoPreservedzÿWrapper for deprecated import.

    >>> preds = ["this is the prediction", "there is an other sample"]
    >>> target = ["this is the reference", "there is another one"]
    >>> wip = WordInfoPreserved()
    >>> wip(preds, target)
    tensor(0.3472)

    r   r   Nc                 óZ   •— t          dd¦  «          t          ¦   «         j        di |¤Ž d S )Nr   r   r   r   r2   s     €r$   r!   z_WordInfoPreserved.__init__  s7   ø€ Ý%Ð&9¸6ÑBÔBÐBØ�‰ŒÔÐ"Ð"˜6Ð"Ð"Ð"Ð"Ð"r%   r3   r.   s   @r$   ro   ro     ra   r%   ro   N),Úcollections.abcr   Útypingr   r   r   Útorchmetrics.text.bleur   Útorchmetrics.text.cerr   Útorchmetrics.text.chrfr	   Útorchmetrics.text.eedr
   Útorchmetrics.text.merr   Útorchmetrics.text.perplexityr   Útorchmetrics.text.sacre_bleur   Útorchmetrics.text.squadr   Útorchmetrics.text.terr   Útorchmetrics.text.werr   Útorchmetrics.text.wilr   Útorchmetrics.text.wipr   Útorchmetrics.utilities.printsr   r   r0   r6   rB   rO   rR   rV   r_   rc   ri   rl   ro   r   r%   r$   ú<module>r€      s.  ðØ $Ð $Ð $Ð $Ð $Ð $Ø )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )à ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø /Ð /Ð /Ð /Ð /Ð /Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø )Ð )Ð )Ð )Ð )Ð )Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø /Ð /Ð /Ð /Ð /Ð /Ø .Ð .Ð .Ð .Ð .Ð .Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø GÐ GÐ GÐ GÐ GÐ GðRð Rð Rð Rð R�ñ Rô Rð Rð,#ð #ð #ð #ð #�]ñ #ô #ð #ð&
ð 
ð 
ð 
ð 
�ñ 
ô 
ð 
ðB
ð 
ð 
ð 
ð 
Ð0ñ 
ô 
ð 
ðB#ð #ð #ð #ð #�nñ #ô #ð #ð&>ð >ð >ð >ð >�*ñ >ô >ð >ð,
ð 
ð 
ð 
ð 
�nñ 
ô 
ð 
ð4#ð #ð #ð #ð #ˆUñ #ô #ð #ð 
ð 
ð 
ð 
ð 
Ð.ñ 
ô 
ð 
ð>#ð #ð #ð #ð #�]ñ #ô #ð #ð #ð #ð #ð #ð #�Lñ #ô #ð #ð #ð #ð #ð #ð #Ð*ñ #ô #ð #ð #ð #r%   