Viewing File: /opt/alt/python38/lib/python3.8/site-packages/chardet/__pycache__/chardistribution.cpython-38.pyc

U

<_9Y$@sddlmZmZmZddlmZmZmZddlm	Z	m
Z
mZddlm
Z
mZmZddlmZmZmZGdddeZGdd	d	eZGd
ddeZGdd
d
eZGdddeZGdddeZGdddeZdS))EUCTW_CHAR_TO_FREQ_ORDEREUCTW_TABLE_SIZE EUCTW_TYPICAL_DISTRIBUTION_RATIO)EUCKR_CHAR_TO_FREQ_ORDEREUCKR_TABLE_SIZE EUCKR_TYPICAL_DISTRIBUTION_RATIO)GB2312_CHAR_TO_FREQ_ORDERGB2312_TABLE_SIZE!GB2312_TYPICAL_DISTRIBUTION_RATIO)BIG5_CHAR_TO_FREQ_ORDERBIG5_TABLE_SIZEBIG5_TYPICAL_DISTRIBUTION_RATIO)JIS_CHAR_TO_FREQ_ORDERJIS_TABLE_SIZEJIS_TYPICAL_DISTRIBUTION_RATIOc@sLeZdZdZdZdZdZddZddZd	d
Z	ddZ
d
dZddZdS)CharDistributionAnalysisigGz?g{Gz?cCs0d|_d|_d|_d|_d|_d|_|dSN)_char_to_freq_order_table_sizetypical_distribution_ratio_done_total_chars_freq_charsresetselfrI/opt/alt/python38/lib/python3.8/site-packages/chardet/chardistribution.py__init__.sz!CharDistributionAnalysis.__init__cCsd|_d|_d|_dS)zreset analyser, clear any stateFN)rrrrrrrr=szCharDistributionAnalysis.resetcCsX|dkr||}nd}|dkrT|jd7_||jkrTd|j|krT|jd7_dS)z"feed a character with known lengthr riN)	get_orderrrrr)rcharZchar_lenorderrrrfeedFs
zCharDistributionAnalysis.feedcCsT|jdks|j|jkr|jS|j|jkrN|j|j|j|j}||jkrN|S|jS)z(return confidence based on existing datar )rrMINIMUM_DATA_THRESHOLDSURE_NOrSURE_YES)rrrrrget_confidenceTs
z'CharDistributionAnalysis.get_confidencecCs|j|jkSr)rENOUGH_DATA_THRESHOLDrrrrgot_enough_datadsz(CharDistributionAnalysis.got_enough_datacCsdS)Nr"r)rbyte_strrrrr#isz"CharDistributionAnalysis.get_orderN)
__name__
__module____qualname__r,r)r(r'rrr&r+r-r#rrrrr(s	rcs$eZdZfddZddZZS)EUCTWDistributionAnalysiscs$tt|t|_t|_t|_dSr)	superr2rrrrrrrr	__class__rrrrsz"EUCTWDistributionAnalysis.__init__cCs0|d}|dkr(d|d|ddSdSdS)Nr ^rr"rrr.
first_charrrrr#xsz#EUCTWDistributionAnalysis.get_orderr/r0r1rr#
__classcell__rrr4rr2qsr2cs$eZdZfddZddZZS)EUCKRDistributionAnalysiscs$tt|t|_t|_t|_dSr)	r3r=rrrrrrrrr4rrrsz"EUCKRDistributionAnalysis.__init__cCs0|d}|dkr(d|d|ddSdSdS)Nr r7rr8r"rr9rrrr#sz#EUCKRDistributionAnalysis.get_orderr;rrr4rr=sr=cs$eZdZfddZddZZS)GB2312DistributionAnalysiscs$tt|t|_t|_t|_dSr)	r3r?rrrr	rr
rrr4rrrsz#GB2312DistributionAnalysis.__init__cCs>|d|d}}|dkr6|dkr6d|d|dSdSdS)Nr rr>r8r7r"rrr.r:second_charrrrr#sz$GB2312DistributionAnalysis.get_orderr;rrr4rr?sr?cs$eZdZfddZddZZS)Big5DistributionAnalysiscs$tt|t|_t|_t|_dSr)	r3rBrrrrrr
rrr4rrrsz!Big5DistributionAnalysis.__init__cCsX|d|d}}|dkrP|dkr:d|d|ddSd|d|dSndSdS)	Nr rr8?@r"rr@rrrr#sz"Big5DistributionAnalysis.get_orderr;rrr4rrBsrBcs$eZdZfddZddZZS)SJISDistributionAnalysiscs$tt|t|_t|_t|_dSr)	r3rGrrrrrrrrr4rrrsz!SJISDistributionAnalysis.__init__cCsr|d|d}}|dkr0|dkr0d|d}n&|dkrR|dkrRd|dd}nd	S||d
}|dkrnd	}|S)Nr rr"rFr)rr.r:rAr%rrrr#sz"SJISDistributionAnalysis.get_orderr;rrr4rrGsrGcs$eZdZfddZddZZS)EUCJPDistributionAnalysiscs$tt|t|_t|_t|_dSr)	r3rOrrrrrrrrr4rrrsz"EUCJPDistributionAnalysis.__init__cCs0|d}|dkr(d|d|ddSdSdS)Nr r7r8rr"r)rr.r$rrrr#sz#EUCJPDistributionAnalysis.get_orderr;rrr4rrOsrON)Z	euctwfreqrrrZ	euckrfreqrrrZ
gb2312freqrr	r
Zbig5freqrrr
Zjisfreqrrrobjectrr2r=r?rBrGrOrrrr<module>sI
Back to Directory File Manager