ó ©i:Ec@sEddlZddlmZmZmZddlmZmZmZddl m Z m Z m Z ddl mZmZmZddlmZmZmZdZdZd Zd dd „ƒYZd efd „ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdS(i’’’’N(tEUCTWCharToFreqOrdertEUCTW_TABLE_SIZEt EUCTW_TYPICAL_DISTRIBUTION_RATIO(tEUCKRCharToFreqOrdertEUCKR_TABLE_SIZEt EUCKR_TYPICAL_DISTRIBUTION_RATIO(tGB2312CharToFreqOrdertGB2312_TABLE_SIZEt!GB2312_TYPICAL_DISTRIBUTION_RATIO(tBig5CharToFreqOrdertBIG5_TABLE_SIZEtBIG5_TYPICAL_DISTRIBUTION_RATIO(tJISCharToFreqOrdertJIS_TABLE_SIZEtJIS_TYPICAL_DISTRIBUTION_RATIOig®Gįz®ļ?g{®Gįz„?tCharDistributionAnalysiscBs>eZd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs)d|_d|_d|_|jƒdS(N(tNonet_mCharToFreqOrdert _mTableSizet_mTypicalDistributionRatiotreset(tself((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyt__init__(s   cCs"tj|_d|_d|_dS(sreset analyser, clear any stateiN(t constantstFalset_mDonet _mTotalCharst _mFreqChars(R((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR.s  cCs}|dkr|j|ƒ}nd}|dkry|jd7_||jkryd|j|krv|jd7_qvqyndS(s"feed a character with known lengthii’’’’iiiN(t get_orderRRRR(RtaStrtaCharLentorder((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pytfeed4s  cCsZ|jdkrtS|j|jkrV|j|j|j|j}|tkrV|SntS(s(return confidence based on existing datai(RtSURE_NORRtSURE_YES(Rtr((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pytget_confidenceBs cCs |jtkS(N(RtENOUGH_DATA_THRESHOLD(R((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pytgot_enough_dataPscCsdS(Ni’’’’((RR((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyRUs(t__name__t __module__RRR R$R&R(((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR's      tEUCTWDistributionAnalysiscBseZd„Zd„ZRS(cCs,tj|ƒt|_t|_t|_dS(N(RRRRRRRR(R((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR\s   cCs@|ddkr8dt|dƒdt|dƒdSdSdS(NisÄi^iÄii”i’’’’(tord(RR((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyRbs((R'R(RR(((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR)[s tEUCKRDistributionAnalysiscBseZd„Zd„ZRS(cCs,tj|ƒt|_t|_t|_dS(N(RRRRRRRR(R((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyRms   cCs@|ddkr8dt|dƒdt|dƒdSdSdS(Nis°i^i°ii”i’’’’(R*(RR((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyRss((R'R(RR(((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR+ls tGB2312DistributionAnalysiscBseZd„Zd„ZRS(cCs,tj|ƒt|_t|_t|_dS(N(RRRRRRRR(R((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR~s   cCsP|ddkrH|ddkrHdt|dƒdt|dƒdSdSdS( Nis°is”i^i°i”i’’’’(R*(RR((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR„s ((R'R(RR(((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR,}s tBig5DistributionAnalysiscBseZd„Zd„ZRS(cCs,tj|ƒt|_t|_t|_dS(N(RRR RR RR R(R((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyRs   cCs|ddkrw|ddkrLdt|dƒdt|dƒddSdt|dƒdt|dƒd Snd SdS( Nis¤is”ii¤i”i?i@i’’’’(R*(RR((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR•s ,+(R'R(RR(((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR-Žs tSJISDistributionAnalysiscBseZd„Zd„ZRS(cCs,tj|ƒt|_t|_t|_dS(N(RRR RR RRR(R((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR£s   cCs³|ddkr;|ddkr;dt|dƒd}nC|ddkrz|ddkrzdt|dƒdd }nd S|t|d ƒd }|d d krÆd }n|S(NissŸi¼isąsļiąii’’’’ii@s(R*(RRR((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR©s   (R'R(RR(((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR.¢s tEUCJPDistributionAnalysiscBseZd„Zd„ZRS(cCs,tj|ƒt|_t|_t|_dS(N(RRR RR RRR(R((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyRŗs   cCs@|ddkr8dt|dƒdt|dƒdSdSdS(Nis i^i”ii’’’’(R*(RR((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyRĄs((R'R(RR(((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyR/¹s ((Rt euctwfreqRRRt euckrfreqRRRt gb2312freqRRRtbig5freqR R R tjisfreqR R RR%R"R!RR)R+R,R-R.R/(((s</usr/lib/python2.7/dist-packages/chardet/chardistribution.pyts 4