Your IP : 3.135.249.119


Current Path : /opt/alt/python37/lib/python3.7/site-packages/chardet/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/chardet/__pycache__/sbcharsetprober.cpython-37.pyc

B

<_9Y�@s4ddlmZddlmZmZmZGdd�de�ZdS)�)�
CharSetProber)�CharacterCategory�ProbingState�SequenceLikelihoodcsbeZdZdZdZdZdZd�fdd�	Z�fd	d
�Ze	dd��Z
e	d
d��Zdd�Zdd�Z
�ZS)�SingleByteCharSetProber�@igffffff�?g�������?FNcsJtt|���||_||_||_d|_d|_d|_d|_	d|_
|��dS)N)�superr�__init__�_model�	_reversed�_name_prober�_last_order�
_seq_counters�_total_seqs�_total_char�
_freq_char�reset)�self�model�reversedZname_prober)�	__class__��H/opt/alt/python37/lib/python3.7/site-packages/chardet/sbcharsetprober.pyr	'sz SingleByteCharSetProber.__init__cs:tt|���d|_dgt��|_d|_d|_d|_	dS)N��)
rrrr
rZget_num_categoriesrrrr)r)rrrr5szSingleByteCharSetProber.resetcCs|jr|jjS|jdSdS)N�charset_name)rrr
)rrrrr?sz$SingleByteCharSetProber.charset_namecCs|jr|jjS|j�d�SdS)N�language)rrr
�get)rrrrrFsz SingleByteCharSetProber.languagec	Csn|jds|�|�}|s|jS|jd}x�t|�D]�\}}||}|tjkrZ|jd7_||jkr�|jd7_|j	|jkr�|j
d7_
|js�|j	|j|}|jd|}n||j|j	}|jd|}|j|d7<||_	q2W|jd}|jt
jk�rh|j
|jk�rh|��}||jk�r@|j�d||�t
j|_n(||jk�rh|j�d|||j�t
j|_|jS)NZkeep_english_letter�char_to_order_maprZprecedence_matrixrz$%s confidence = %s, we have a winnerz9%s confidence = %s, below negative shortcut threshhold %s)r
Zfilter_international_words�state�	enumeraterZCONTROLr�SAMPLE_SIZErr
rrrrZ	DETECTING�SB_ENOUGH_REL_THRESHOLD�get_confidence�POSITIVE_SHORTCUT_THRESHOLD�logger�debugZFOUND_IT�_state�NEGATIVE_SHORTCUT_THRESHOLDZNOT_ME)	rZbyte_strr�i�c�orderrrZ
confidencerrr�feedMsF







zSingleByteCharSetProber.feedcCsNd}|jdkrJd|jtj|j|jd}||j|j}|dkrJd}|S)Ng{�G�z�?rg�?Ztypical_positive_ratiog�G�z��?)rrrZPOSITIVEr
rr)r�rrrrr#|s
 z&SingleByteCharSetProber.get_confidence)FN)�__name__�
__module__�__qualname__r!r"r$r(r	r�propertyrrr,r#�
__classcell__rr)rrr!s
/rN)Z
charsetproberrZenumsrrrrrrrr�<module>s

?>