3 XL@s8d`ZGdddeZGdd d eZGd d d eZd S)ac@sPeZdZdZdZdZdZdZddZdd Z d d Z d d Z ddZ ddZ dS)JapaneseContextAnalysisrdircCs*d|_d|_d|_d|_d|_|jdS)N) _total_rel _rel_sample_need_to_skip_char_num_last_char_order_donereset)selfr/usr/lib/python3.6/jpcntx.py__init__{s z JapaneseContextAnalysis.__init__cCs*d|_dg|j|_d|_d|_d|_dS)NrrF)r NUM_OF_CATEGORYr r r r)rrrrrs zJapaneseContextAnalysis.resetcCs|jr dS|j}x||kr|j|||d\}}||7}||krV|||_d|_q|dkr|jdkr|jd7_|j|jkrd|_P|jt|j|d7<||_qWdS)NrrTrrr)rr get_orderr r MAX_REL_THRESHOLDr jp2CharContext)rbyte_strZ num_bytesiorderchar_lenrrrfeeds     zJapaneseContextAnalysis.feedcCs |j|jkS)N)r ENOUGH_REL_THRESHOLD)rrrrgot_enough_datasz'JapaneseContextAnalysis.got_enough_datacCs,|j|jkr"|j|jd|jS|jSdS)Nr)r MINIMUM_DATA_THRESHOLDr DONT_KNOW)rrrrget_confidences z&JapaneseContextAnalysis.get_confidencecCsdS)Nrr)rrr)rrrrrrsz!JapaneseContextAnalysis.get_orderNr)__name__ __module__ __qualname__rr!rrr rrrrr"rrrrrrts rcs0eZdZfddZeddZddZZS)SJISContextAnalysiscstt|jd|_dS)NZ SHIFT_JIS)superr&r _charset_name)r) __class__rrrszSJISContextAnalysis.__init__cCs|jS)N)r()rrrr charset_namesz SJISContextAnalysis.charset_namecCs|sdS|d}d|ko"dkns@d|ko:dknrld}|dksdd |ko^dknrpd |_nd}t|dkr|d}|d krd|kod knr|d|fSd|fS)NrrrZCP932r)rrr)r(len)rr first_charr second_charrrrrs0    zSJISContextAnalysis.get_order)r#r$r%rpropertyr*r __classcell__rr)r)rr&s  r&c@seZdZddZdS)EUCJPContextAnalysiscCs|sd S|d}|dks0d|ko*dknr6d}n|dkrDd}nd}t|dkr|d}|d krd|kovd knr|d|fSd |fS)Nrrrrr)r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