3 ]9Y6@s,ddlmZddlmZGdddeZdS)) CharSetProber) ProbingStatecseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZfddZddZddZddZddZddZeddZeddZedd ZZS)! HebrewProberg{Gz?z ISO-8859-8z windows-1255cs>tt|jd|_d|_d|_d|_d|_d|_|j dS)N) superr__init___final_char_logical_score_final_char_visual_score_prev _before_prev_logical_prober_visual_proberreset)self) __class__"/usr/lib/python3.6/hebrewprober.pyrszHebrewProber.__init__cCsd|_d|_d|_d|_dS)N )rrrr)rrrrrszHebrewProber.resetcCs||_||_dS)N)rr)rZ logicalProberZ visualProberrrrset_model_probersszHebrewProber.set_model_proberscCs||j|j|j|j|jgkS)N) FINAL_KAF FINAL_MEM FINAL_NUNFINAL_PE FINAL_TSADI)rcrrris_finalszHebrewProber.is_finalcCs||j|j|j|jgkS)N) NORMAL_KAF NORMAL_MEM NORMAL_NUN NORMAL_PE)rr%rrr is_non_finals zHebrewProber.is_non_finalcCs|jtjkrtjS|j|}x|D]}|dkrp|jdkr|j|jrT|jd7_q|j|jr|j d7_ n,|jdkr|j|jr|dkr|j d7_ |j|_||_q"Wtj S)Nrr) staterNOT_MEZfilter_high_byte_onlyrr&rrr+r DETECTING)rZbyte_strZcurrrrfeeds         zHebrewProber.feedcCsx|j|j}||jkr|jS||j kr.|jS|jj|jj}||jkrR|jS||j krd|jS|dkrr|jS|jS)Ng) rrMIN_FINAL_CHAR_DISTANCELOGICAL_HEBREW_NAMEVISUAL_HEBREW_NAMErZget_confidencerMIN_MODEL_DISTANCE)rZfinalsubZmodelsubrrr charset_names      zHebrewProber.charset_namecCsdS)NZHebrewr)rrrrlanguageszHebrewProber.languagecCs(|jjtjkr"|jjtjkr"tjStjS)N)rr,rr-rr.)rrrrr,szHebrewProber.state)__name__ __module__ __qualname__r r'r!r(r"r)r#r*r$Z NORMAL_TSADIr0r3r2r1rrrr&r+r/propertyr4r5r, __classcell__rr)rrrs.  ;  rN)Z charsetproberrZenumsrrrrrrs  c