
    3j                     T    d Z ddlmZmZ ddlmZ ddlmZ dede	edf   de
e   fd	Zy
)zStage 3: Statistical bigram scoring.

Note: ``from __future__ import annotations`` is intentionally omitted because
this module is compiled with mypyc, which does not support PEP 563 string
annotations.
    )BigramProfilescore_best_language)DetectionResult)EncodingInfodata
candidates.returnc           
      2   | r|sg S t        |       }g }|D ]A  }t        | |j                  |      \  }}|dkD  s$|j                  |j                  ||f       C |j	                  d d       |D cg c]  \  }}}t        |||       c}}}S c c}}}w )zScore all candidates and return results sorted by confidence descending.

    :param data: The raw byte data to score.
    :param candidates: Encoding candidates to evaluate.
    :returns: A list of :class:`DetectionResult` sorted by confidence.
    )profileg        c                     | d   S )N    )xs    I/DATA/.local/lib/python3.12/site-packages/chardet/pipeline/statistical.py<lambda>z"score_candidates.<locals>.<lambda>!   s    ad    T)keyreverse)encoding
confidencelanguage)r   r   nameappendsortr   )r   r   r   scoresencslangr   s           r   score_candidatesr      s     z	D!G24F%dCHHgF4s7MM388Q-. 
 KKNDK1 $#MD!T 	!dC#  s   4BN)__doc__chardet.modelsr   r   chardet.pipeliner   chardet.registryr   bytestuplelistr   r   r   r   <module>r'      sA    > , )
"<#45	/r   